private static boolean isEnum(PropertyDefinitionSimple simplePropertyDefinition) { return !simplePropertyDefinition.getEnumeratedValues().isEmpty(); }
private void ensureOrdering() { if (null == this.enumeratedValues) { return; } for (int i = 0, size = getEnumeratedValues().size(); (i < size); ++i) { getEnumeratedValues().get(i).setOrderIndex(i); } }
public void removeEnumeratedValues(PropertyDefinitionEnumeration... enumerations) { // Don't replace the possible Hibernate proxy when orphanRemoval=true. It can cause // "collection with cascade=all-delete-orphan was no longer referenced" exceptions. for (PropertyDefinitionEnumeration enumeration : enumerations) { getEnumeratedValues().remove(enumeration); } ensureOrdering(); }
public void addEnumeratedValues(PropertyDefinitionEnumeration... enumerations) { if (this.enumeratedValues == null) { this.enumeratedValues = new ArrayList<PropertyDefinitionEnumeration>(1); } for (PropertyDefinitionEnumeration enumeration : enumerations) { enumeration.setPropertyDefinitionSimple(this); getEnumeratedValues().add(enumeration); } ensureOrdering(); }
private void processPropertyOptionsSource(Resource resource, Resource baseResource, PropertyDefinitionSimple pds, PropertyOptionsSource.TargetType tt, String expression, Pattern filterPattern, Resource foundResource) { if (tt == PropertyOptionsSource.TargetType.RESOURCE) { String name = foundResource.getName(); // filter if the user provided a filter if (filterPattern != null) { Matcher m = filterPattern.matcher(name); if (m.matches()) { PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, "" + name); pds.getEnumeratedValues().add(pde); } } else { // Filter is null -> none provided -> do not filter PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, "" + name); pds.getEnumeratedValues().add(pde); } } else if (tt == PropertyOptionsSource.TargetType.CONFIGURATION) { // for configuration we need to drill down into the resource configuration if (!handleConfigurationTarget(resource, baseResource, pds, expression, foundResource)) return; } }
if (name != null) { PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name); pds.getEnumeratedValues().add(pde); if (name != null) { PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name); pds.getEnumeratedValues().add(pde);
private static UIInput createInputForEnumProperty(PropertyDefinitionSimple propertyDefinitionSimple) { UISelectOne selectOne; if (propertyDefinitionSimple.getEnumeratedValues().size() >= LISTBOX_THRESHOLD_ENUM_SIZE) { // Use a drop down menu for larger enums... HtmlSelectOneMenu menu = FacesComponentUtility.createComponent(HtmlSelectOneMenu.class, null); // TODO: Use CSS to set the width of the menu. selectOne = menu; } else { // ...and a radio for smaller ones. HtmlSelectOneRadio radio = FacesComponentUtility.createComponent(HtmlSelectOneRadio.class, null); radio.setLayout("pageDirection"); // TODO: We may want to use CSS to get less space between the radio buttons // (see http://jira.jboss.com/jira/browse/JBMANCON-21). selectOne = radio; } List<PropertyDefinitionEnumeration> options = propertyDefinitionSimple.getEnumeratedValues(); for (PropertyDefinitionEnumeration option : options) { UISelectItem selectItem = FacesComponentUtility.createComponent(UISelectItem.class, null); selectItem.setItemLabel(option.getName()); selectItem.setItemValue(option.getValue()); selectOne.getChildren().add(selectItem); } return selectOne; }
List<PropertyDefinitionEnumeration> existingOptions = existingPDS.getEnumeratedValues(); List<PropertyDefinitionEnumeration> newOptions = newPDS.getEnumeratedValues();