Search in sources :

Example 1 with GroupConditionDescriptor

use of com.haulmont.cuba.gui.components.filter.descriptor.GroupConditionDescriptor in project cuba by cuba-platform.

the class FilterEditor method addGroup.

protected void addGroup(GroupType groupType) {
    GroupConditionDescriptor conditionDescriptor = new GroupConditionDescriptor(groupType, filter.getId(), filter.getDatasource());
    AbstractCondition condition = conditionDescriptor.createCondition();
    AbstractCondition selectedCondition = conditionsDs.getItem();
    Node<AbstractCondition> newNode = new Node<>(condition);
    if (selectedCondition != null && selectedCondition instanceof GroupCondition) {
        Node<AbstractCondition> node = conditions.getNode(selectedCondition);
        if (node != null) {
            node.addChild(newNode);
            conditionsTree.expand(selectedCondition.getId());
        }
    } else {
        conditions.getRootNodes().add(newNode);
    }
    refreshConditionsDs();
    conditionsTree.setSelected(condition);
}
Also used : Node(com.haulmont.bali.datastruct.Node) GroupConditionDescriptor(com.haulmont.cuba.gui.components.filter.descriptor.GroupConditionDescriptor)

Aggregations

Node (com.haulmont.bali.datastruct.Node)1 GroupConditionDescriptor (com.haulmont.cuba.gui.components.filter.descriptor.GroupConditionDescriptor)1