1 17 package org.alfresco.web.ui.common.tag; 18 19 import javax.faces.FacesException; 20 import javax.faces.component.UICommand; 21 import javax.faces.component.UIComponent; 22 import javax.faces.el.MethodBinding; 23 import javax.faces.el.ValueBinding; 24 25 import org.alfresco.web.ui.common.component.UIGenericPicker; 26 27 30 public class GenericPickerTag extends BaseComponentTag 31 { 32 private final static Class QUERYCALLBACK_CLASS_ARGS[] = {int.class, String .class}; 33 34 37 public String getComponentType() 38 { 39 return "org.alfresco.faces.GenericPicker"; 40 } 41 42 45 public String getRendererType() 46 { 47 return null; 48 } 49 50 53 protected void setProperties(UIComponent component) 54 { 55 super.setProperties(component); 56 setBooleanProperty(component, "showFilter", this.showFilter); 57 setBooleanProperty(component, "showContains", this.showContains); 58 setBooleanProperty(component, "showAddButton", this.showAddButton); 59 setBooleanProperty(component, "filterRefresh", this.filterRefresh); 60 setStringProperty(component, "addButtonLabel", this.addButtonLabel); 61 setActionProperty((UICommand)component, this.action); 62 setActionListenerProperty((UICommand)component, this.actionListener); 63 setIntProperty(component, "width", this.width); 64 setIntProperty(component, "height", this.height); 65 setStringBindingProperty(component, "filters", this.filters); 66 if (queryCallback != null) 67 { 68 if (isValueReference(queryCallback)) 69 { 70 MethodBinding b = getFacesContext().getApplication().createMethodBinding(queryCallback, QUERYCALLBACK_CLASS_ARGS); 71 ((UIGenericPicker)component).setQueryCallback(b); 72 } 73 else 74 { 75 throw new FacesException("Query Callback method binding incorrectly specified: " + queryCallback); 76 } 77 } 78 } 79 80 83 public void release() 84 { 85 super.release(); 86 this.showFilter = null; 87 this.showContains = null; 88 this.showAddButton = null; 89 this.addButtonLabel = null; 90 this.action = null; 91 this.actionListener = null; 92 this.width = null; 93 this.height = null; 94 this.queryCallback = null; 95 this.filters = null; 96 this.filterRefresh = null; 97 } 98 99 104 public void setShowFilter(String showFilter) 105 { 106 this.showFilter = showFilter; 107 } 108 109 114 public void setShowContains(String showContains) 115 { 116 this.showContains = showContains; 117 } 118 119 124 public void setShowAddButton(String showAddButton) 125 { 126 this.showAddButton = showAddButton; 127 } 128 129 134 public void setAddButtonLabel(String addButtonLabel) 135 { 136 this.addButtonLabel = addButtonLabel; 137 } 138 139 144 public void setAction(String action) 145 { 146 this.action = action; 147 } 148 149 154 public void setActionListener(String actionListener) 155 { 156 this.actionListener = actionListener; 157 } 158 159 164 public void setWidth(String width) 165 { 166 this.width = width; 167 } 168 169 174 public void setHeight(String height) 175 { 176 this.height = height; 177 } 178 179 184 public void setQueryCallback(String queryCallback) 185 { 186 this.queryCallback = queryCallback; 187 } 188 189 194 public void setFilters(String filters) 195 { 196 this.filters = filters; 197 } 198 199 204 public void setFilterRefresh(String filterRefresh) 205 { 206 this.filterRefresh = filterRefresh; 207 } 208 209 210 211 private String filterRefresh; 212 213 214 private String filters; 215 216 217 private String queryCallback; 218 219 220 private String showFilter; 221 222 223 private String showContains; 224 225 226 private String showAddButton; 227 228 229 private String addButtonLabel; 230 231 232 private String action; 233 234 235 private String actionListener; 236 237 238 private String width; 239 240 241 private String height; 242 } 243 | Popular Tags |