public void setPropertyValue(String name, String value) { PropertiesStepProperty property = getProperty(name); if (property != null) { property.setValue(value); } else { addProperty(name).setValue(value); } }
public boolean renameProperty(String name, String newName) { if (getProperty(newName) != null) { return false; } PropertiesStepProperty property = getProperty(name); if (property == null) { return false; } property.setName(newName); return true; }
/** * sort properties list and make sure that virtualproperties are always placed after properties */ private void sortVirtualLast() { List<PropertiesStepProperty> virtualProperties = new ArrayList<PropertiesStepProperty>(); List<PropertiesStepProperty> nonVirtualProperties = new ArrayList<PropertiesStepProperty>(); for (PropertiesStepProperty psp : properties) { if (psp.isVirtualProperty()) { if (!virtualProperties.contains(psp)) { virtualProperties.add(psp); } } else { nonVirtualProperties.add(psp); } } properties.clear(); properties.addAll(nonVirtualProperties); properties.addAll(virtualProperties); }
protected PropertiesStepProperty addProperty( PropertyConfig propertyConfig, boolean notify, TestProperty virtualProperty) { PropertiesStepProperty propertiesStepProperty = new PropertiesStepProperty(propertyConfig, virtualProperty); properties.add(propertiesStepProperty); sortVirtualLast(); propertyMap.put(propertiesStepProperty.getName().toUpperCase(), propertiesStepProperty); if (notify) { firePropertyAdded(propertiesStepProperty.getName()); } return propertiesStepProperty; }
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); }