public XmlBeansPropertiesTestPropertyHolder(ModelItem modelItem, PropertiesTypeConfig config) { this.modelItem = modelItem; this.config = config; for (int c = 0; c < config.sizeOfPropertyArray(); c++) { PropertyConfig propertyConfig = config.getPropertyArray(c); if (StringUtils.hasContent(propertyConfig.getName())) { addProperty(propertyConfig, false, null); } else { config.removeProperty(c); c--; } } }
public void setName(String name) { String oldName = getName(); propertyConfig.setName(name); propertyMap.remove(oldName.toUpperCase()); propertyMap.put(name.toUpperCase(), this); firePropertyRenamed(oldName, name); }
public String getValue() { if (overrideProperties != null && overrideProperties.containsKey(getName())) { return overrideProperties.getProperty(getName()); } if (virtualProperty != null) { return virtualProperty.getValue(); } return propertyConfig.getValue(); }
public void setValue(String value) { String oldValue = getValue(); propertyConfig.setValue(value); if (overrideProperties != null && overrideProperties.containsKey(getName())) { overrideProperties.remove(getName()); if (overrideProperties.isEmpty()) { overrideProperties = null; } } firePropertyValueChanged(getName(), oldValue, value); }
public void moveProperty(String propertyName, int targetIndex) { PropertiesStepProperty property = getProperty(propertyName); int ix = properties.indexOf(property); if (ix == targetIndex) { return; } if (targetIndex < 0) { targetIndex = 0; } String value = property.getValue(); config.removeProperty(ix); PropertyConfig propertyConfig = null; if (targetIndex < properties.size()) { properties.add(targetIndex, properties.remove(ix)); propertyConfig = config.insertNewProperty(targetIndex); } else { properties.add(properties.remove(ix)); propertyConfig = config.addNewProperty(); } propertyConfig.setName(propertyName); propertyConfig.setValue(value); resetPropertiesConfig(config); if (targetIndex > properties.size()) { targetIndex = properties.size(); } firePropertyMoved(propertyName, ix, targetIndex); }
public String getName() { return propertyConfig.getName(); }
public TestProperty addVirtualProperty(String key, TestProperty virtualProperty) { PropertyConfig propertyConfig = PropertyConfig.Factory.newInstance(); propertyConfig.setName(key); return addProperty(propertyConfig, true, virtualProperty); }
public TestProperty addProperty(String name) { PropertyConfig propertyConfig = config.addNewProperty(); propertyConfig.setName(name); return addProperty(propertyConfig, true, null); }