001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *   http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    
020    package org.apache.myfaces.tobago.taglib.component;
021    
022    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ALT;
023    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_BORDER;
024    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
025    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
026    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VALUE;
027    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
028    import org.apache.myfaces.tobago.component.ComponentUtil;
029    
030    import javax.faces.component.UIComponent;
031    import javax.faces.component.UIGraphic;
032    
033    public class ImageTag extends TobagoTag implements ImageTagDeclaration {
034    
035      private String value;
036      private String alt;
037      private String border;
038      private String tip;
039      private String width;
040      private String height;
041    
042      @Override
043      public String getComponentType() {
044        return UIGraphic.COMPONENT_TYPE;
045      }
046    
047      @Override
048      protected void setProperties(UIComponent component) {
049        super.setProperties(component);
050        ComponentUtil.setStringProperty(component, ATTR_ALT, alt);
051        ComponentUtil.setStringProperty(component, ATTR_BORDER, border);
052        ComponentUtil.setStringProperty(component, ATTR_VALUE, value);
053        ComponentUtil.setStringProperty(component, ATTR_TIP, tip);
054        ComponentUtil.setStringProperty(component, ATTR_WIDTH, width);
055        ComponentUtil.setStringProperty(component, ATTR_HEIGHT, height);
056      }
057    
058      @Override
059      public void release() {
060        super.release();
061        this.alt = null;
062        this.border = null;
063        this.value = null;
064        this.tip = null;
065        width = null;
066        height = null;
067      }
068    
069      public String getValue() {
070        return value;
071      }
072    
073      public void setValue(String value) {
074        this.value = value;
075      }
076    
077      public String getAlt() {
078        return alt;
079      }
080    
081      public void setAlt(String alt) {
082        this.alt = alt;
083      }
084    
085      public String getBorder() {
086        return border;
087      }
088    
089      public void setBorder(String border) {
090        this.border = border;
091      }
092    
093      public String getTip() {
094        return tip;
095      }
096    
097      public void setTip(String tip) {
098        this.tip = tip;
099      }
100    
101      public String getWidth() {
102        return width;
103      }
104    
105      public void setWidth(String width) {
106        this.width = width;
107      }
108    
109      public String getHeight() {
110        return height;
111      }
112    
113      public void setHeight(String height) {
114        this.height = height;
115      }
116    }