1 16 package javax.faces.component; 17 18 import javax.faces.context.FacesContext; 19 import javax.faces.el.ValueBinding; 20 21 27 public class UISelectItem 28 extends UIComponentBase 29 { 30 32 public static final String COMPONENT_TYPE = "javax.faces.SelectItem"; 33 public static final String COMPONENT_FAMILY = "javax.faces.SelectItem"; 34 private static final boolean DEFAULT_ITEMDISABLED = false; 35 36 private String _itemDescription = null; 37 private Boolean _itemDisabled = null; 38 private String _itemLabel = null; 39 private Object _itemValue = null; 40 private Object _value = null; 41 42 public UISelectItem() 43 { 44 } 45 46 public String getFamily() 47 { 48 return COMPONENT_FAMILY; 49 } 50 51 public void setItemDescription(String itemDescription) 52 { 53 _itemDescription = itemDescription; 54 } 55 56 public String getItemDescription() 57 { 58 if (_itemDescription != null) return _itemDescription; 59 ValueBinding vb = getValueBinding("itemDescription"); 60 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 61 } 62 63 public void setItemDisabled(boolean itemDisabled) 64 { 65 _itemDisabled = Boolean.valueOf(itemDisabled); 66 } 67 68 public boolean isItemDisabled() 69 { 70 if (_itemDisabled != null) return _itemDisabled.booleanValue(); 71 ValueBinding vb = getValueBinding("itemDisabled"); 72 Boolean v = vb != null ? (Boolean )vb.getValue(getFacesContext()) : null; 73 return v != null ? v.booleanValue() : DEFAULT_ITEMDISABLED; 74 } 75 76 public void setItemLabel(String itemLabel) 77 { 78 _itemLabel = itemLabel; 79 } 80 81 public String getItemLabel() 82 { 83 if (_itemLabel != null) return _itemLabel; 84 ValueBinding vb = getValueBinding("itemLabel"); 85 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 86 } 87 88 public void setItemValue(Object itemValue) 89 { 90 _itemValue = itemValue; 91 } 92 93 public Object getItemValue() 94 { 95 if (_itemValue != null) return _itemValue; 96 ValueBinding vb = getValueBinding("itemValue"); 97 return vb != null ? (Object )vb.getValue(getFacesContext()) : null; 98 } 99 100 public void setValue(Object value) 101 { 102 _value = value; 103 } 104 105 public Object getValue() 106 { 107 if (_value != null) return _value; 108 ValueBinding vb = getValueBinding("value"); 109 return vb != null ? (Object )vb.getValue(getFacesContext()) : null; 110 } 111 112 113 public Object saveState(FacesContext context) 114 { 115 Object values[] = new Object [6]; 116 values[0] = super.saveState(context); 117 values[1] = _itemDescription; 118 values[2] = _itemDisabled; 119 values[3] = _itemLabel; 120 values[4] = _itemValue; 121 values[5] = _value; 122 return ((Object ) (values)); 123 } 124 125 public void restoreState(FacesContext context, Object state) 126 { 127 Object values[] = (Object [])state; 128 super.restoreState(context, values[0]); 129 _itemDescription = (String )values[1]; 130 _itemDisabled = (Boolean )values[2]; 131 _itemLabel = (String )values[3]; 132 _itemValue = (Object )values[4]; 133 _value = (Object )values[5]; 134 } 135 } 137 | Popular Tags |