Search in sources :

Example 1 with GridLayoutPattern

use of com.qcadoo.view.internal.components.layout.GridLayoutPattern in project qcadoo by qcadoo.

the class FormComponentPattern method tryAddVersionField.

private void tryAddVersionField() {
    List<ComponentPattern> layouts = getChildren().values().stream().filter(childComponentPattern -> childComponentPattern instanceof GridLayoutPattern).collect(Collectors.toList());
    if (!layouts.isEmpty()) {
        GridLayoutPattern gridLayoutPattern = (GridLayoutPattern) layouts.get(0);
        FieldComponentPattern versionComponentPattern = getVersionField(gridLayoutPattern);
        gridLayoutPattern.addChild(versionComponentPattern);
        GridLayoutCell[][] cells = gridLayoutPattern.getCells();
        if (cells != null && cells[0] != null && cells[0][0] != null) {
            cells[0][0].addComponent(versionComponentPattern);
        }
    }
}
Also used : ViewDefinitionParserNodeException(com.qcadoo.view.internal.xml.ViewDefinitionParserNodeException) VersionableConstants(com.qcadoo.model.constants.VersionableConstants) ComponentDefinition(com.qcadoo.view.internal.ComponentDefinition) FieldComponentPattern(com.qcadoo.view.internal.components.FieldComponentPattern) ComponentState(com.qcadoo.view.api.ComponentState) SecurityRole(com.qcadoo.security.api.SecurityRole) ViewDefinitionParser(com.qcadoo.view.internal.xml.ViewDefinitionParser) AbstractContainerPattern(com.qcadoo.view.internal.patterns.AbstractContainerPattern) Collectors(java.util.stream.Collectors) GridLayoutPattern(com.qcadoo.view.internal.components.layout.GridLayoutPattern) JSONException(org.json.JSONException) List(java.util.List) ComponentPattern(com.qcadoo.view.internal.api.ComponentPattern) JSONObject(org.json.JSONObject) HiddenComponentPattern(com.qcadoo.view.internal.components.HiddenComponentPattern) Locale(java.util.Locale) GridLayoutCell(com.qcadoo.view.internal.components.layout.GridLayoutCell) Node(org.w3c.dom.Node) ComponentOption(com.qcadoo.view.internal.ComponentOption) FieldComponentPattern(com.qcadoo.view.internal.components.FieldComponentPattern) GridLayoutPattern(com.qcadoo.view.internal.components.layout.GridLayoutPattern) FieldComponentPattern(com.qcadoo.view.internal.components.FieldComponentPattern) ComponentPattern(com.qcadoo.view.internal.api.ComponentPattern) HiddenComponentPattern(com.qcadoo.view.internal.components.HiddenComponentPattern)

Aggregations

VersionableConstants (com.qcadoo.model.constants.VersionableConstants)1 SecurityRole (com.qcadoo.security.api.SecurityRole)1 ComponentState (com.qcadoo.view.api.ComponentState)1 ComponentDefinition (com.qcadoo.view.internal.ComponentDefinition)1 ComponentOption (com.qcadoo.view.internal.ComponentOption)1 ComponentPattern (com.qcadoo.view.internal.api.ComponentPattern)1 FieldComponentPattern (com.qcadoo.view.internal.components.FieldComponentPattern)1 HiddenComponentPattern (com.qcadoo.view.internal.components.HiddenComponentPattern)1 GridLayoutCell (com.qcadoo.view.internal.components.layout.GridLayoutCell)1 GridLayoutPattern (com.qcadoo.view.internal.components.layout.GridLayoutPattern)1 AbstractContainerPattern (com.qcadoo.view.internal.patterns.AbstractContainerPattern)1 ViewDefinitionParser (com.qcadoo.view.internal.xml.ViewDefinitionParser)1 ViewDefinitionParserNodeException (com.qcadoo.view.internal.xml.ViewDefinitionParserNodeException)1 List (java.util.List)1 Locale (java.util.Locale)1 Collectors (java.util.stream.Collectors)1 JSONException (org.json.JSONException)1 JSONObject (org.json.JSONObject)1 Node (org.w3c.dom.Node)1