Search in sources :

Example 1 with AbstractTreeFieldData

use of org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData in project scout.rt by eclipse.

the class FormDataStatementBuilder method build.

@SuppressWarnings("cast")
public String build(AbstractFormData formData) {
    m_where = new StringBuilder();
    // build constraints for fields
    for (BasicPartDefinition def : m_basicDefs) {
        if (def.accept(formData)) {
            Map<String, String> parentAliasMap = getAliasMapper().getRootAliases();
            EntityContribution contrib = def.createInstance(this, formData, parentAliasMap);
            String cons = createWhereConstraint(contrib);
            if (cons != null) {
                addWhere(" AND " + cons);
            }
        }
    }
    // build constraints for composer trees
    Map<Integer, Map<String, AbstractFormFieldData>> fieldsBreathFirstMap = formData.getAllFieldsRec();
    for (Map<String, AbstractFormFieldData> map : fieldsBreathFirstMap.values()) {
        for (AbstractFormFieldData f : map.values()) {
            if (f.isValueSet() && f instanceof AbstractTreeFieldData) {
                // composer tree with entity, attribute
                EntityContribution contrib = buildTreeNodes(((AbstractTreeFieldData) f).getRoots(), EntityStrategy.BuildConstraints, AttributeStrategy.BuildConstraintOfAttributeWithContext);
                String cons = createWhereConstraint(contrib);
                if (cons != null) {
                    addWhere(" AND " + cons);
                }
            }
        }
    }
    return getWhereConstraints();
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) AbstractTreeFieldData(org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData) AbstractFormFieldData(org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with AbstractTreeFieldData

use of org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData in project scout.rt by eclipse.

the class AbstractComposerField method importFormFieldData.

@Override
public void importFormFieldData(AbstractFormFieldData source, boolean valueChangeTriggersEnabled) {
    Assertions.assertNotNull(source);
    AbstractTreeFieldData treeFieldData = (AbstractTreeFieldData) source;
    if (treeFieldData.isValueSet() && m_tree != null) {
        try {
            if (!valueChangeTriggersEnabled) {
                setValueChangeTriggerEnabled(false);
            }
            // 
            m_tree.importTreeData(treeFieldData);
        } finally {
            if (!valueChangeTriggersEnabled) {
                setValueChangeTriggerEnabled(true);
            }
        }
    }
}
Also used : AbstractTreeFieldData(org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData)

Example 3 with AbstractTreeFieldData

use of org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData in project scout.rt by eclipse.

the class AbstractComposerField method exportFormFieldData.

@Override
public void exportFormFieldData(AbstractFormFieldData target) {
    if (m_tree != null) {
        AbstractTreeFieldData treeFieldData = (AbstractTreeFieldData) target;
        m_tree.exportTreeData(treeFieldData);
    }
}
Also used : AbstractTreeFieldData(org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData)

Example 4 with AbstractTreeFieldData

use of org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData in project scout.rt by eclipse.

the class AbstractTreeField method importFormFieldData.

@Override
public void importFormFieldData(AbstractFormFieldData source, boolean valueChangeTriggersEnabled) {
    Assertions.assertNotNull(source);
    AbstractTreeFieldData treeFieldData = (AbstractTreeFieldData) source;
    if (treeFieldData.isValueSet() && m_tree != null) {
        try {
            if (!valueChangeTriggersEnabled) {
                setValueChangeTriggerEnabled(false);
            }
            // 
            m_tree.importTreeData(treeFieldData);
        } finally {
            if (!valueChangeTriggersEnabled) {
                setValueChangeTriggerEnabled(true);
            }
        }
    }
}
Also used : AbstractTreeFieldData(org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData)

Aggregations

AbstractTreeFieldData (org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData)4 HashMap (java.util.HashMap)1 Map (java.util.Map)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 AbstractFormFieldData (org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData)1