Search in sources :

Example 1 with RowExpander

use of org.drools.workbench.screens.guided.dtable.client.wizard.table.pages.RowExpander in project drools-wb by kiegroup.

the class NewGuidedDecisionTableWizard method complete.

@Override
public void complete() {
    // Ensure each page updates the decision table as necessary
    for (WizardPage page : this.pages) {
        AbstractGuidedDecisionTableWizardPage gep = (AbstractGuidedDecisionTableWizardPage) page;
        gep.makeResult(model);
    }
    // Expand rows
    final RowExpander re = new RowExpander(model, oracle);
    // Mark columns on which we are to expand (default is to include all)
    for (BaseColumn c : model.getExpandedColumns()) {
        re.setExpandColumn(c, false);
    }
    final List<ConditionCol52> columns = columnExpansionPage.getColumnsToExpand();
    for (ConditionCol52 c : columns) {
        re.setExpandColumn(c, true);
    }
    // Slurp out expanded rows and construct decision table data
    int rowIndex = 0;
    final RowExpander.RowIterator ri = re.iterator();
    while (ri.hasNext()) {
        List<DTCellValue52> row = ri.next();
        model.getData().add(row);
        model.getData().get(rowIndex).get(0).setNumericValue(new BigDecimal(rowIndex + 1));
        rowIndex++;
    }
    // Save it!
    final String baseFileName = summaryPage.getBaseFileName();
    final Path contextPath = this.contextPath;
    model.setTableName(baseFileName);
    super.complete();
    handler.save(contextPath, baseFileName, model);
}
Also used : Path(org.uberfire.backend.vfs.Path) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) BigDecimal(java.math.BigDecimal) RowExpander(org.drools.workbench.screens.guided.dtable.client.wizard.table.pages.RowExpander) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) AbstractGuidedDecisionTableWizardPage(org.drools.workbench.screens.guided.dtable.client.wizard.table.pages.AbstractGuidedDecisionTableWizardPage) WizardPage(org.uberfire.ext.widgets.core.client.wizards.WizardPage) AbstractGuidedDecisionTableWizardPage(org.drools.workbench.screens.guided.dtable.client.wizard.table.pages.AbstractGuidedDecisionTableWizardPage) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)

Aggregations

BigDecimal (java.math.BigDecimal)1 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)1 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)1 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)1 AbstractGuidedDecisionTableWizardPage (org.drools.workbench.screens.guided.dtable.client.wizard.table.pages.AbstractGuidedDecisionTableWizardPage)1 RowExpander (org.drools.workbench.screens.guided.dtable.client.wizard.table.pages.RowExpander)1 Path (org.uberfire.backend.vfs.Path)1 WizardPage (org.uberfire.ext.widgets.core.client.wizards.WizardPage)1