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_ITEM_DESCRIPTION; 023 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ITEM_DISABLED; 024 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ITEM_LABEL; 025 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ITEM_IMAGE; 026 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ITEM_VALUE; 027 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_IMAGE; 028 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VALUE; 029 import org.apache.myfaces.tobago.component.ComponentUtil; 030 import org.apache.myfaces.tobago.component.UISelectItem; 031 032 import javax.faces.component.UIComponent; 033 034 public class SelectItemTag extends TobagoTag implements SelectItemTagDeclaration { 035 036 private String itemDescription; 037 private String itemDisabled; 038 private String itemLabel; 039 private String itemValue; 040 private String value; 041 private String itemImage; 042 private String markup; 043 044 045 public String getComponentType() { 046 return UISelectItem.COMPONENT_TYPE; 047 } 048 049 public String getRendererType() { 050 return null; 051 } 052 053 protected void setProperties(UIComponent component) { 054 super.setProperties(component); 055 ComponentUtil.setStringProperty(component, ATTR_ITEM_DESCRIPTION, itemDescription); 056 ComponentUtil.setBooleanProperty(component, ATTR_ITEM_DISABLED, itemDisabled); 057 ComponentUtil.setStringProperty(component, ATTR_ITEM_LABEL, itemLabel); 058 ComponentUtil.setStringProperty(component, ATTR_ITEM_VALUE, itemValue); 059 ComponentUtil.setStringProperty(component, ATTR_VALUE, value); 060 ComponentUtil.setStringProperty(component, ATTR_ITEM_IMAGE, itemImage); 061 ComponentUtil.setStringProperty(component, ATTR_IMAGE, itemImage); 062 ComponentUtil.setMarkup(component, markup); 063 } 064 065 public void release() { 066 super.release(); 067 itemDescription = null; 068 itemDisabled = null; 069 itemLabel = null; 070 itemValue = null; 071 value = null; 072 itemImage = null; 073 markup = null; 074 } 075 076 public String getItemDescription() { 077 return itemDescription; 078 } 079 080 public void setItemDescription(String itemDescription) { 081 this.itemDescription = itemDescription; 082 } 083 084 public String getItemDisabled() { 085 return itemDisabled; 086 } 087 088 public void setItemDisabled(String itemDisabled) { 089 this.itemDisabled = itemDisabled; 090 } 091 092 public String getItemLabel() { 093 return itemLabel; 094 } 095 096 public void setItemLabel(String itemLabel) { 097 this.itemLabel = itemLabel; 098 } 099 100 public String getItemValue() { 101 return itemValue; 102 } 103 104 public void setItemValue(String itemValue) { 105 this.itemValue = itemValue; 106 } 107 108 public String getValue() { 109 return value; 110 } 111 112 public void setValue(String value) { 113 this.value = value; 114 } 115 116 public String getItemImage() { 117 return itemImage; 118 } 119 120 public void setItemImage(String itemImage) { 121 this.itemImage = itemImage; 122 } 123 124 public String getMarkup() { 125 return markup; 126 } 127 128 public void setMarkup(String markup) { 129 this.markup = markup; 130 } 131 }