use of org.drools.workbench.screens.guided.dtable.client.wizard.table.pages.AbstractGuidedDecisionTableWizardPage in project drools-wb by kiegroup.
the class NewGuidedDecisionTableWizard method setContent.
public void setContent(final Path contextPath, final String baseFileName, final GuidedDecisionTable52.TableFormat tableFormat, final GuidedDecisionTable52.HitPolicy hitPolicy, final AsyncPackageDataModelOracle oracle, final GuidedDecisionTableWizardHandler handler) {
this.model = new GuidedDecisionTable52();
this.model.setTableFormat(tableFormat);
this.model.setHitPolicy(hitPolicy);
if (GuidedDecisionTable52.HitPolicy.RESOLVED_HIT.equals(hitPolicy)) {
final MetadataCol52 metadataCol52 = new MetadataCol52();
metadataCol52.setMetadata(GuidedDecisionTable52.HitPolicy.RESOLVED_HIT_METADATA_NAME);
this.model.getMetadataCols().add(metadataCol52);
}
this.contextPath = contextPath;
this.oracle = oracle;
this.handler = handler;
final Validator validator = new Validator(model.getConditions());
for (WizardPage page : pages) {
final AbstractGuidedDecisionTableWizardPage dtp = (AbstractGuidedDecisionTableWizardPage) page;
dtp.setContent(contextPath, baseFileName, tableFormat, hitPolicy, oracle, model, validator);
dtp.initialise();
}
}
use of org.drools.workbench.screens.guided.dtable.client.wizard.table.pages.AbstractGuidedDecisionTableWizardPage 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);
}
use of org.drools.workbench.screens.guided.dtable.client.wizard.table.pages.AbstractGuidedDecisionTableWizardPage in project drools-wb by kiegroup.
the class NewGuidedDecisionTableWizard method getPageWidget.
@Override
public Widget getPageWidget(final int pageNumber) {
final AbstractGuidedDecisionTableWizardPage dtp = (AbstractGuidedDecisionTableWizardPage) this.pages.get(pageNumber);
final Widget w = dtp.asWidget();
dtp.prepareView();
return w;
}
Aggregations