use of org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52 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.models.guided.dtable.shared.model.GuidedDecisionTable52 in project drools-wb by kiegroup.
the class FactPatternConstraintsPageViewImpl method makeNewConditionColumn.
private ConditionCol52 makeNewConditionColumn(final AvailableField f) {
final GuidedDecisionTable52.TableFormat format = presenter.getTableFormat();
if (format == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY) {
final ConditionCol52 c = new ConditionCol52();
c.setFactField(f.getName());
c.setFieldType(f.getType());
c.setConstraintValueType(f.getCalculationType());
return c;
} else {
final LimitedEntryConditionCol52 c = new LimitedEntryConditionCol52();
c.setFactField(f.getName());
c.setFieldType(f.getType());
c.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
return c;
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52 in project drools-wb by kiegroup.
the class ActionSetFieldsPageViewImpl method makeNewActionColumn.
private ActionSetFieldCol52 makeNewActionColumn(final AvailableField f) {
final GuidedDecisionTable52.TableFormat format = presenter.getTableFormat();
if (format == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY) {
final ActionSetFieldCol52 a = new ActionSetFieldCol52();
a.setBoundName(availablePatternsSelection.getBoundName());
a.setFactField(f.getName());
a.setType(f.getType());
return a;
} else {
final LimitedEntryActionSetFieldCol52 a = new LimitedEntryActionSetFieldCol52();
a.setBoundName(availablePatternsSelection.getBoundName());
a.setFactField(f.getName());
a.setType(f.getType());
return a;
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52 in project drools-wb by kiegroup.
the class GuidedDecisionTableEditorPresenterTest method testGetIsDirtySupplierWhenItIsNotDirty.
@Test
public void testGetIsDirtySupplierWhenItIsNotDirty() {
final GuidedDecisionTableView.Presenter presenter = mock(GuidedDecisionTableView.Presenter.class);
final GuidedDecisionTable52 model = mock(GuidedDecisionTable52.class);
final int currentHash = 123;
final int originalHash = 123;
doReturn(currentHash).when(this.presenter).currentHashCode(presenter);
doReturn(originalHash).when(this.presenter).originalHashCode(presenter);
doReturn(model).when(presenter).getModel();
doReturn(presenter).when(this.presenter).getActiveDocument();
final boolean isDirty = this.presenter.getIsDirtySupplier().get();
assertFalse(isDirty);
}
use of org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52 in project drools-wb by kiegroup.
the class CellContextMenuTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
model = new GuidedDecisionTable52();
uiModel = new GuidedDecisionTableUiModel(mock(ModelSynchronizer.class));
clipboard = new DefaultClipboard();
when(dtPresenter.getView()).thenReturn(dtPresenterView);
when(dtPresenter.getModel()).thenReturn(model);
when(dtPresenter.getAccess()).thenReturn(access);
when(dtPresenterView.getModel()).thenReturn(uiModel);
uiModel.appendColumn(new BaseGridColumn<String>(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100));
uiModel.appendColumn(new BaseGridColumn<String>(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100));
uiModel.appendColumn(new BaseGridColumn<String>(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100));
uiModel.appendRow(new BaseGridRow());
menu = spy(new CellContextMenu(view, clipboard));
menu.setup();
}
Aggregations