コード例 #1
0
  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--;
      }
    }
  }
コード例 #2
0
    public void setName(String name) {
      String oldName = getName();
      propertyConfig.setName(name);

      propertyMap.remove(oldName.toUpperCase());
      propertyMap.put(name.toUpperCase(), this);

      firePropertyRenamed(oldName, name);
    }
コード例 #3
0
    public String getValue() {
      if (overrideProperties != null && overrideProperties.containsKey(getName())) {
        return overrideProperties.getProperty(getName());
      }

      if (virtualProperty != null) {
        return virtualProperty.getValue();
      }

      return propertyConfig.getValue();
    }
コード例 #4
0
    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);
    }
コード例 #5
0
  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);
  }
コード例 #6
0
 public String getName() {
   return propertyConfig.getName();
 }
コード例 #7
0
 public TestProperty addVirtualProperty(String key, TestProperty virtualProperty) {
   PropertyConfig propertyConfig = PropertyConfig.Factory.newInstance();
   propertyConfig.setName(key);
   return addProperty(propertyConfig, true, virtualProperty);
 }
コード例 #8
0
 public TestProperty addProperty(String name) {
   PropertyConfig propertyConfig = config.addNewProperty();
   propertyConfig.setName(name);
   return addProperty(propertyConfig, true, null);
 }