Search in sources :

Example 1 with TreeComponentState

use of com.qcadoo.view.internal.components.tree.TreeComponentState in project qcadoo by qcadoo.

the class FormComponentState method copyEntityToFields.

private void copyEntityToFields(final Entity entity, final boolean requestUpdateState) {
    for (Map.Entry<String, FieldComponentState> field : getFieldComponents().entrySet()) {
        ErrorMessage message = entity.getError(field.getKey());
        copyMessage(field.getValue(), message);
        if (fieldIsGridCorrespondingLookup(field.getValue(), field.getKey(), entity)) {
            continue;
        }
        if (fieldIsDetachedEntityTree(field.getValue(), field.getKey(), entity)) {
            EntityTree tree = entity.getTreeField(field.getKey());
            if (tree != null) {
                ((TreeComponentState) field.getValue()).setRootNode(tree.getRoot());
            }
        }
        field.getValue().setFieldValue(convertFieldToString(entity.getField(field.getKey()), field.getKey()));
        if (requestUpdateState) {
            field.getValue().requestComponentUpdateState();
        }
    }
}
Also used : FieldComponentState(com.qcadoo.view.internal.components.FieldComponentState) TreeComponentState(com.qcadoo.view.internal.components.tree.TreeComponentState) ErrorMessage(com.qcadoo.model.api.validators.ErrorMessage) HashMap(java.util.HashMap) Map(java.util.Map) EntityTree(com.qcadoo.model.api.EntityTree)

Aggregations

EntityTree (com.qcadoo.model.api.EntityTree)1 ErrorMessage (com.qcadoo.model.api.validators.ErrorMessage)1 FieldComponentState (com.qcadoo.view.internal.components.FieldComponentState)1 TreeComponentState (com.qcadoo.view.internal.components.tree.TreeComponentState)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1