Search in sources :

Example 11 with AttributeCol52

use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools-wb by kiegroup.

the class ColumnsPagePresenter method refreshAttributeWidget.

void refreshAttributeWidget(final List<AttributeCol52> attributeColumns) {
    final Optional<GuidedDecisionTableModellerView.Presenter> optionalModeller = Optional.ofNullable(getModeller());
    final VerticalPanel attributeWidget = getAttributeWidget();
    if (!optionalModeller.isPresent()) {
        return;
    }
    final GuidedDecisionTableModellerView.Presenter modeller = optionalModeller.get();
    attributeWidget.clear();
    if (attributeColumns.isEmpty()) {
        attributeWidget.add(blankSlate());
        return;
    }
    for (final AttributeCol52 attributeColumn : attributeColumns) {
        final AttributeColumnConfigRow columnConfigRow = attributeColumnConfigRow.get();
        columnConfigRow.init(attributeColumn, modeller);
        attributeWidget.add(columnConfigRow.getView());
    }
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) GuidedDecisionTableModellerView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableModellerView) AttributeColumnConfigRow(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.AttributeColumnConfigRow)

Example 12 with AttributeCol52

use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools-wb by kiegroup.

the class GuidedDecisionTablePresenter method onDeleteSelectedColumns.

@Override
public void onDeleteSelectedColumns() {
    if (isReadOnly()) {
        return;
    }
    final Set<Integer> selectedColumnIndexes = getSelectedColumnIndexes();
    final Set<BaseColumn> columnsToDelete = new HashSet<>();
    for (int selectedColumnIndex : selectedColumnIndexes) {
        final int columnIndex = findUiColumnIndex(selectedColumnIndex);
        final BaseColumn column = model.getExpandedColumns().get(columnIndex);
        if (!(column instanceof RowNumberCol52 || column instanceof DescriptionCol52)) {
            columnsToDelete.add(column);
        }
    }
    for (BaseColumn columnToDelete : columnsToDelete) {
        if (columnToDelete instanceof AttributeCol52) {
            try {
                deleteColumn((AttributeCol52) columnToDelete);
            } catch (VetoException veto) {
                getModellerPresenter().getView().showGenericVetoMessage();
            }
        } else if (columnToDelete instanceof MetadataCol52) {
            try {
                deleteColumn((MetadataCol52) columnToDelete);
            } catch (VetoException veto) {
                getModellerPresenter().getView().showGenericVetoMessage();
            }
        } else if (columnToDelete instanceof ConditionCol52) {
            try {
                deleteColumn((ConditionCol52) columnToDelete);
            } catch (VetoException veto) {
                getModellerPresenter().getView().showUnableToDeleteColumnMessage((ConditionCol52) columnsToDelete);
            }
        } else if (columnToDelete instanceof ActionCol52) {
            try {
                deleteColumn((ActionCol52) columnToDelete);
            } catch (VetoException veto) {
                getModellerPresenter().getView().showUnableToDeleteColumnMessage((ActionCol52) columnsToDelete);
            }
        }
    }
}
Also used : ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) VetoException(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer.VetoException) MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) DescriptionCol52(org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) HashSet(java.util.HashSet) RowNumberCol52(org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)

Example 13 with AttributeCol52

use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools-wb by kiegroup.

the class GuidedDecisionTableFactory method makeTableWithAttributeCol.

public static GuidedDecisionTable52 makeTableWithAttributeCol(final String packageName, final Collection<Import> imports, final String tableName) {
    final GuidedDecisionTable52 dt = new GuidedDecisionTable52();
    dt.setPackageName(packageName);
    dt.getImports().getImports().addAll(imports);
    dt.setTableName(tableName);
    AttributeCol52 attr = new AttributeCol52();
    attr.setAttribute("ruleflow-group");
    dt.getAttributeCols().add(attr);
    dt.setData(DataUtilities.makeDataLists(new String[][] { new String[] { "1", "desc", "myRuleFlowGroup" } }));
    return dt;
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)

Example 14 with AttributeCol52

use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools-wb by kiegroup.

the class GuidedDecisionTableTheme method getModelColumnType.

ModelColumnType getModelColumnType(final GridColumn<?> uiColumn) {
    final int uiColumnIndex = uiModel.getColumns().indexOf(uiColumn);
    final BaseColumn modelColumn = model.getExpandedColumns().get(uiColumnIndex);
    if (modelColumn instanceof RowNumberCol52) {
        return ModelColumnType.ROW_NUMBER;
    } else if (modelColumn instanceof DescriptionCol52) {
        return ModelColumnType.DESCRIPTION;
    } else if (modelColumn instanceof MetadataCol52) {
        return ModelColumnType.METADATA;
    } else if (modelColumn instanceof AttributeCol52) {
        return ModelColumnType.ATTRIBUTE;
    } else if (modelColumn instanceof ConditionCol52) {
        return ModelColumnType.CONDITION;
    } else if (modelColumn instanceof ActionCol52) {
        return ModelColumnType.ACTION;
    }
    // proof rendering than throw an exception.
    return ModelColumnType.UNKNOWN;
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) DescriptionCol52(org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) RowNumberCol52(org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)

Example 15 with AttributeCol52

use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools-wb by kiegroup.

the class AttributeColumnPlugin method getAttributeCol52.

private AttributeCol52 getAttributeCol52() {
    final AttributeCol52 column = new AttributeCol52();
    column.setAttribute(attribute);
    return column;
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)

Aggregations

AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)86 Test (org.junit.Test)55 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)30 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)20 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)14 ArrayList (java.util.ArrayList)12 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)12 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)10 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)10 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)9 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)8 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)8 MetadataCol52 (org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52)7 IOException (java.io.IOException)6 InputStream (java.io.InputStream)6 ExcelParser (org.drools.decisiontable.parser.xls.ExcelParser)6 DataListener (org.drools.template.parser.DataListener)6 ConversionResult (org.drools.workbench.models.guided.dtable.shared.conversion.ConversionResult)6 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)5 IntegerUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.IntegerUiColumn)5