/** * Check whether empty values are permitted * @return True if empty values are permitted */ protected boolean allowEmptyValues() { return this.model.getTableFormat() == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY; }
/** * Check whether empty values are permitted * @return True if empty values are permitted */ protected boolean allowEmptyValues() { return this.model.getTableFormat() == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY; }
private void addColumn(final Pattern52 p, final ConditionCol52 c) { switch (model.getTableFormat()) { case EXTENDED_ENTRY: addExtendedEntryColumn(p, c); break; case LIMITED_ENTRY: addLimitedEntryColumn(c); break; } }
private ActionSetFieldCol52 newActionSetField() { final GuidedDecisionTable52.TableFormat tableFormat = getModel().getTableFormat(); switch (tableFormat) { case EXTENDED_ENTRY: return new ActionSetFieldCol52(); case LIMITED_ENTRY: return new LimitedEntryActionSetFieldCol52(); default: throw new UnsupportedOperationException("Unsupported table format: " + tableFormat); } }
private void addColumn(final ActionSetFieldCol52 a) { final ColumnValues cv = new ColumnValues(columns, EMPTY_VALUE, model.getTableFormat() == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY ? a.getDefaultValue() : new DTCellValue52(Boolean.FALSE)); cv.setExpandColumn(false); this.expandedColumns.put(a, cv); this.columns.add(cv); }
private void addColumn(final ActionSetFieldCol52 a) { final ColumnValues cv = new ColumnValues(columns, EMPTY_VALUE, model.getTableFormat() == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY ? a.getDefaultValue() : new DTCellValue52(Boolean.FALSE)); cv.setExpandColumn(false); this.expandedColumns.put(a, cv); this.columns.add(cv); }
private void addColumn(final ActionInsertFactCol52 a) { final ColumnValues cv = new ColumnValues(columns, EMPTY_VALUE, model.getTableFormat() == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY ? a.getDefaultValue() : new DTCellValue52(Boolean.FALSE)); cv.setExpandColumn(false); this.expandedColumns.put(a, cv); this.columns.add(cv); }
private void addColumn(final ActionInsertFactCol52 a) { final ColumnValues cv = new ColumnValues(columns, EMPTY_VALUE, model.getTableFormat() == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY ? a.getDefaultValue() : new DTCellValue52(Boolean.FALSE)); cv.setExpandColumn(false); this.expandedColumns.put(a, cv); this.columns.add(cv); }
@Test(expected = UnsupportedOperationException.class) public void testNewActionWrapperWhenColumnIsInvalid() throws Exception { when(model.getTableFormat()).thenReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY); when(presenter.getModel()).thenReturn(model); plugin.newActionWorkItemWrapper(mock(ConditionCol52.class)); }
@Before public void setup() { doReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY).when(model).getTableFormat(); doReturn(oracle).when(presenter).getDataModelOracle(); doReturn(presenter).when(plugin).getPresenter(); doReturn(model).when(presenter).getModel(); }
@Test public void testNewActionWrapperWhenColumnIsAnActionSetFactWrapper() throws Exception { final GuidedDecisionTable52 model = mock(GuidedDecisionTable52.class); when(model.getTableFormat()).thenReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY); when(presenter.getModel()).thenReturn(model); final ActionWrapper wrapper = plugin.newActionWrapper(mock(ActionSetFieldCol52.class)); assertTrue(wrapper instanceof ActionSetFactWrapper); }
@Test public void testPrepareValuesWhenConstraintValueIsNotLiteralAndTableFormatIsLimitedEntry() throws Exception { doReturn(BaseSingleFieldConstraint.TYPE_UNDEFINED).when(plugin).constraintValue(); doReturn(GuidedDecisionTable52.TableFormat.LIMITED_ENTRY).when(model).getTableFormat(); doReturn(model).when(presenter).getModel(); doReturn(editingCol).when(plugin).editingCol(); plugin.prepareValues(); verify(editingCol, never()).setBinding(null); }
@Test public void testGetPagesWhenItIsALimitedEntryTable() throws Exception { doReturn(GuidedDecisionTable52.TableFormat.LIMITED_ENTRY).when(model).getTableFormat(); final List<WizardPage> pages = plugin.getPages(); assertFalse(pages.stream().anyMatch(a -> a instanceof CalculationTypePage)); assertEquals(5, pages.size()); }
@Test public void testInit() { doReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY).when(model).getTableFormat(); doReturn(model).when(plugin).model(); plugin.init(wizard); verify(plugin).setupDefaultValues(); }
@Test public void testNewActionWrapperWhenColumnIsAnActionWorkItemInsertFactCol52() throws Exception { when(model.getTableFormat()).thenReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY); when(presenter.getModel()).thenReturn(model); final ActionWorkItemWrapper wrapper = plugin.newActionWorkItemWrapper(mock(ActionWorkItemInsertFactCol52.class)); assertTrue(wrapper instanceof ActionWorkItemInsertWrapper); }
@Test public void testGetPagesWhenItIsAnExtendedEntryTable() throws Exception { doReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY).when(model).getTableFormat(); final List<WizardPage> pages = plugin.getPages(); assertTrue(pages.stream().anyMatch(a -> a instanceof CalculationTypePage)); assertEquals(6, pages.size()); }
@Test public void testPrepareValuesWhenConstraintValueIsNotLiteral() throws Exception { doReturn(BaseSingleFieldConstraint.TYPE_UNDEFINED).when(plugin).constraintValue(); doReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY).when(model).getTableFormat(); doReturn(model).when(presenter).getModel(); doReturn(editingCol).when(plugin).editingCol(); plugin.prepareValues(); verify(editingCol).setBinding(null); }
@Test public void testIsBindableWhenTableIsAnExtendedEntryAndConstraintValueIsTypeFormula() { doReturn(BaseSingleFieldConstraint.TYPE_RET_VALUE).when(plugin).constraintValue(); doReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY).when(model).getTableFormat(); assertTrue(plugin.isBindable()); }
@Test public void testCanSetupDefaultValueWhenCanSetup() throws Exception { when(plugin.getFactField()).thenReturn("factField"); when(plugin.getFactType()).thenReturn("factType"); when(plugin.doesOperatorNeedValue()).thenReturn(true); when(model.getTableFormat()).thenReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY); page.enableDefaultValue(); assertTrue(page.canSetupDefaultValue()); }
protected DTCellValueWidgetFactory factory() { final GuidedDecisionTable52 model = getPlugin().getPresenter().getModel(); final AsyncPackageDataModelOracle oracle = getPlugin().getPresenter().getDataModelOracle(); final boolean allowEmptyValues = model.getTableFormat() == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY; return DTCellValueWidgetFactory.getInstance(model, oracle, false, allowEmptyValues); } }