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