public void setConverter( String value ) { putAttribute( "converter", value ); } }
public String getValue() { return getAttribute( "value" ); }
HtmlSelectOneMenu select = new HtmlSelectOneMenu(); String selectId = dataTable.getAttribute("id") + "Select"; select.putAttribute("id", selectId); String requestScopedValue = "requestScope['" + selectId + "']"; select.setValue(StaticFacesUtils.wrapExpression(requestScopedValue)); String simpleComponentType = ClassUtils.getSimpleName(componentType); String controllerName = StringUtils.decapitalize(simpleComponentType); select.setConverter(StaticFacesUtils.wrapExpression(controllerName + "Bean.converter")); addSelectItems(select, StaticFacesUtils.wrapExpression(controllerName + "Bean.all"), attributes); panelGrid.getChildren().add(select);
@Override protected void addSelectItems(HtmlSelectOneMenu select, String valueExpression, Map<String, String> attributes) { // Add an empty option to select menus on search pages addSelectItem(select, null, null); SelectItems items = new SelectItems(); items.putAttribute("value", valueExpression); select.getChildren().add(items); }
@Override public StaticXmlWidget buildWidget(String elementName, Map<String, String> attributes, StaticXmlMetawidget metawidget) { // Faces lookups String facesLookup = attributes.get(FACES_LOOKUP); if (facesLookup != null && !"".equals(facesLookup)) { HtmlSelectOneMenu select = new HtmlSelectOneMenu(); addSelectItems(select, facesLookup, attributes); return select; } // Lookups String lookup = attributes.get(LOOKUP); if (lookup != null && !"".equals(lookup)) { HtmlSelectOneMenu select = new HtmlSelectOneMenu(); addSelectItems(select, CollectionUtils.fromString(lookup), CollectionUtils.fromString(attributes.get(LOOKUP_LABELS))); return select; } return super.buildWidget(elementName, attributes, metawidget); }
HtmlSelectOneMenu select = new HtmlSelectOneMenu(); String selectId = dataTable.getAttribute("id") + "Select"; select.putAttribute("id", selectId); String requestScopedValue = "requestScope['" + selectId + "']"; select.setValue(StaticFacesUtils.wrapExpression(requestScopedValue)); String simpleComponentType = ClassUtils.getSimpleName(componentType); String controllerName = StringUtils.decapitalize(simpleComponentType); select.setConverter(StaticFacesUtils.wrapExpression(controllerName + "Bean.converter")); addSelectItems(select, StaticFacesUtils.wrapExpression(controllerName + "Bean.all"), attributes); panelGrid.getChildren().add(select);
private void addSelectItem( HtmlSelectOneMenu select, String value, String label ) { SelectItem selectItem = new SelectItem(); selectItem.putAttribute( "itemLabel", label ); selectItem.putAttribute( "itemValue", value ); select.getChildren().add( selectItem ); } }
@Override public StaticXmlWidget buildWidget(String elementName, Map<String, String> attributes, StaticXmlMetawidget metawidget) { // Faces lookups String facesLookup = attributes.get(FACES_LOOKUP); if (facesLookup != null && !"".equals(facesLookup)) { HtmlSelectOneMenu select = new HtmlSelectOneMenu(); addSelectItems(select, facesLookup, attributes); return select; } // Lookups String lookup = attributes.get(LOOKUP); if (lookup != null && !"".equals(lookup)) { HtmlSelectOneMenu select = new HtmlSelectOneMenu(); addSelectItems(select, CollectionUtils.fromString(lookup), CollectionUtils.fromString(attributes.get(LOOKUP_LABELS))); return select; } return super.buildWidget(elementName, attributes, metawidget); }
private void addSelectItem( HtmlSelectOneMenu select, String value, String label ) { SelectItem selectItem = new SelectItem(); selectItem.putAttribute( "itemLabel", label ); selectItem.putAttribute( "itemValue", value ); select.getChildren().add( selectItem ); } }
HtmlSelectOneMenu select = new HtmlSelectOneMenu(); addSelectItems( select, facesLookup, attributes ); return select; HtmlSelectOneMenu select = new HtmlSelectOneMenu(); addSelectItems( select, CollectionUtils.fromString( lookup ), CollectionUtils.fromString( attributes.get( LOOKUP_LABELS ) ), attributes );
public void setValue( String value ) { putAttribute( "value", value ); }
private void addSelectItem(HtmlSelectOneMenu select, String value, String label) { SelectItem item = new SelectItem(); item.putAttribute("itemValue", value); item.putAttribute("itemLabel", label); select.getChildren().add(item); } }
HtmlSelectOneMenu select = new HtmlSelectOneMenu(); addSelectItems(select, facesLookup, attributes); return select;
private void addSelectItem(HtmlSelectOneMenu select, String value, String label) { SelectItem item = new SelectItem(); item.putAttribute("itemValue", value); item.putAttribute("itemLabel", label); select.getChildren().add(item); } }
HtmlSelectOneMenu select = new HtmlSelectOneMenu(); addSelectItems( select, facesLookup, attributes ); return select;
private void addSelectItem(HtmlSelectOneMenu select, String value, String label) { SelectItem selectItem = new SelectItem(); selectItem.putAttribute("itemLabel", label); selectItem.putAttribute("itemValue", value); select.getChildren().add(selectItem); } }
@Override protected void addSelectItems(HtmlSelectOneMenu select, String valueExpression, Map<String, String> attributes) { // Add an empty option to select menus on search pages addSelectItem(select, null, null); SelectItems items = new SelectItems(); items.putAttribute("value", valueExpression); select.getChildren().add(items); }
protected void addSelectItems( HtmlSelectOneMenu select, String valueExpression, Map<String, String> attributes ) { // Empty option // // Note: a 'null' value (rather than an empty String') renders an <f:selectItem/> rather // than an <f:selectItem itemValue=""/>. This works out better if the HtmlSelectOneMenu has // a converter, because the empty String may not be a compatible value if ( WidgetBuilderUtils.needsEmptyLookupItem( attributes ) ) { addSelectItem( select, null, null ); } // Add the select items SelectItems selectItems = new SelectItems(); selectItems.putAttribute( "value", valueExpression ); select.getChildren().add( selectItems ); }
/** * Overrriden to enhance the default f:selectItem widget with more suitable item labels */ @Override protected void addSelectItems(HtmlSelectOneMenu select, String valueExpression, Map<String, String> attributes) { // Empty option // // Note: a 'null' value (rather than an empty String') renders an <f:selectItem/> rather // than an <f:selectItem itemValue=""/>. This works out better if the HtmlSelectOneMenu has // a converter, because the empty String may not be a compatible value if (WidgetBuilderUtils.needsEmptyLookupItem(attributes)) { addSelectItem(select, null, null); } // Add the select items SelectItems selectItems = new SelectItems(); selectItems.putAttribute("value", valueExpression); // For each item to be displayed, set the label to the reverse primary key value if (attributes.containsKey(REVERSE_PRIMARY_KEY)) { selectItems.putAttribute("var", SELECT_ITEM); selectItems.putAttribute("itemValue", StaticFacesUtils.wrapExpression(SELECT_ITEM)); String displayExpression = "forgeview:display(_item)"; ((BaseStaticXmlWidget) selectItems).putAdditionalNamespaceURI("forgeview", "http://jboss.org/forge/view"); selectItems.putAttribute("itemLabel", StaticFacesUtils.wrapExpression(displayExpression)); } select.getChildren().add(selectItems); }
/** * Overrriden to enhance the default f:selectItem widget with more suitable item labels */ @Override protected void addSelectItems( HtmlSelectOneMenu select, String valueExpression, Map<String, String> attributes ) { // Empty option // // Note: a 'null' value (rather than an empty String') renders an <f:selectItem/> rather // than an <f:selectItem itemValue=""/>. This works out better if the HtmlSelectOneMenu has // a converter, because the empty String may not be a compatible value if ( WidgetBuilderUtils.needsEmptyLookupItem( attributes ) ) { addSelectItem( select, null, null ); } // Add the select items SelectItems selectItems = new SelectItems(); selectItems.putAttribute("value", valueExpression); // For each item to be displayed, set the label to the reverse primary key value if (attributes.containsKey(REVERSE_PRIMARY_KEY)) { selectItems.putAttribute("var", SELECT_ITEM); selectItems.putAttribute("itemValue", StaticFacesUtils.wrapExpression(SELECT_ITEM)); String displayExpression = "forgeview:display(_item)"; ((BaseStaticXmlWidget) selectItems).putAdditionalNamespaceURI("forgeview", "http://jboss.org/forge/view"); selectItems.putAttribute("itemLabel", StaticFacesUtils.wrapExpression(displayExpression)); } select.getChildren().add( selectItems ); }