Search in sources :

Example 6 with AbstractPropertyData

use of org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData in project scout.rt by eclipse.

the class AbstractFormData method initConfig.

@Override
protected void initConfig() {
    // add properties
    List<Class<AbstractPropertyData>> configuredPropertyDatas = getConfiguredPropertyDatas();
    Map<Class<? extends AbstractPropertyData>, AbstractPropertyData> propMap = new HashMap<Class<? extends AbstractPropertyData>, AbstractPropertyData>(configuredPropertyDatas.size());
    for (Class<AbstractPropertyData> propertyDataClazz : configuredPropertyDatas) {
        AbstractPropertyData p = ConfigurationUtility.newInnerInstance(this, propertyDataClazz);
        propMap.put(p.getClass(), p);
    }
    if (!propMap.isEmpty()) {
        m_propertyMap = propMap;
    }
    // add fields
    List<Class<? extends AbstractFormFieldData>> formFieldDataClazzes = getConfiguredFieldDatas();
    m_fieldMap = new HashMap<Class<? extends AbstractFormFieldData>, AbstractFormFieldData>(formFieldDataClazzes.size());
    Map<Class<?>, Class<? extends AbstractFormFieldData>> replacements = ConfigurationUtility.getReplacementMapping(formFieldDataClazzes);
    if (!replacements.isEmpty()) {
        m_fieldDataReplacements = replacements;
    }
    for (Class<? extends AbstractFormFieldData> formFieldDataClazz : formFieldDataClazzes) {
        AbstractFormFieldData f = ConfigurationUtility.newInnerInstance(this, formFieldDataClazz);
        m_fieldMap.put(f.getClass(), f);
    }
}
Also used : AbstractFormFieldData(org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData) HashMap(java.util.HashMap) AbstractPropertyData(org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData)

Example 7 with AbstractPropertyData

use of org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData in project scout.rt by eclipse.

the class AbstractFormData method getAllPropertiesRec.

/**
 * @return all properties of the form data and all its external template field data in a map with qualified ids<br>
 *         The array of returned fields is the result of a top-down breadth-first tree traversal
 *         <p>
 *         Example:
 *
 *         <pre>
 * A (p1, p4)
 *   U
 *     E (p3)
 *     F
 *   V
 * B
 *   X (p2)
 *   Y
 *         </pre>
 *
 *         would be returned as p1, p4, p2, p3
 */
public Map<Integer, Map<String, /* qualified property id */
AbstractPropertyData<?>>> getAllPropertiesRec() {
    TreeMap<Integer, Map<String, AbstractPropertyData<?>>> breadthFirstMap = new TreeMap<Integer, Map<String, AbstractPropertyData<?>>>();
    HashMap<String, AbstractPropertyData<?>> rootMap = new HashMap<String, /* qualified field id */
    AbstractPropertyData<?>>();
    breadthFirstMap.put(0, rootMap);
    for (AbstractPropertyData<?> prop : getAllProperties()) {
        rootMap.put(prop.getClass().getSimpleName(), prop);
    }
    for (AbstractFormFieldData child : getFields()) {
        collectAllPropertiesRec(child, breadthFirstMap, 1, child.getFieldId() + FIELD_PATH_DELIM);
    }
    return breadthFirstMap;
}
Also used : AbstractFormFieldData(org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData) HashMap(java.util.HashMap) AbstractPropertyData(org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData) TreeMap(java.util.TreeMap) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap) Map(java.util.Map)

Aggregations

AbstractPropertyData (org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData)7 AbstractFormFieldData (org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData)5 HashMap (java.util.HashMap)3 Map (java.util.Map)3 ClassIdentifier (org.eclipse.scout.rt.platform.classid.ClassIdentifier)2 AbstractValueFieldData (org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData)2 ArrayList (java.util.ArrayList)1 TreeMap (java.util.TreeMap)1