ActionRetractFactCol52 newColumn() { switch (tableFormat()) { case EXTENDED_ENTRY: return new ActionRetractFactCol52(); case LIMITED_ENTRY: final LimitedEntryActionRetractFactCol52 col52 = new LimitedEntryActionRetractFactCol52(); col52.setValue(new DTCellValue52("")); return col52; default: throw new UnsupportedOperationException("Unsupported table format: " + tableFormat()); } }
ActionRetractFactCol52 newColumn() { switch (tableFormat()) { case EXTENDED_ENTRY: return new ActionRetractFactCol52(); case LIMITED_ENTRY: final LimitedEntryActionRetractFactCol52 col52 = new LimitedEntryActionRetractFactCol52(); col52.setValue(new DTCellValue52("")); return col52; default: throw new UnsupportedOperationException("Unsupported table format: " + tableFormat()); } }
public AbstractDecisionTableBuilder withRetract() { final ActionRetractFactCol52 col52 = new ActionRetractFactCol52(); col52.setHeader("retract header"); table.getActionCols().add(col52); return this; }
public AbstractDecisionTableBuilder withRetract() { final ActionRetractFactCol52 col52 = new ActionRetractFactCol52(); col52.setHeader("retract header"); table.getActionCols().add(col52); return this; }
private ActionRetractFactCol52 makeNewColumn(ActionRetractFactCol c) { ActionRetractFactCol52 nc = new ActionRetractFactCol52(); nc.setDefaultValue(new DTCellValue52(c.defaultValue)); nc.setHeader(c.header); nc.setHideColumn(c.hideColumn); nc.setWidth(c.width); return nc; }
@Test @SuppressWarnings("unchecked") public void knownColumnType_ActionRetractFactCol52() { final BaseColumn column = new ActionRetractFactCol52(); final Callback<String> callback = mock(Callback.class); columnDefinitionFactory.generateColumnDefinition(dtPresenter, column, callback); verify(actionRetractFactCol52DefinitionBuilder, times(1)).generateDefinition(eq(dtPresenter), eq(column), any(Callback.class)); verify(callback, times(1)).callback(any(String.class)); }
@Test public void simpleAction() { final AtomicBoolean calledBack = new AtomicBoolean( false ); final ActionRetractFactCol52 arf = new ActionRetractFactCol52(); model.getActionCols().add( arf ); builder.generateDefinition( dtPresenter, arf, ( String definition ) -> { calledBack.set( true ); assertEquals( "retract( x );", definition ); } ); assertTrue( calledBack.get() ); }
ActionRetractFactCol52 clone(final ActionRetractFactCol52 col52) { final ActionRetractFactCol52 clone; if (col52 instanceof LimitedEntryCol) { clone = new LimitedEntryActionRetractFactCol52(); final DTCellValue52 oldValue = ((LimitedEntryCol) col52).getValue(); final DTCellValue52 newValue = new DTCellValue52(oldValue.getStringValue()); ((LimitedEntryCol) clone).setValue(newValue); } else { clone = new ActionRetractFactCol52(); } clone.setHeader(col52.getHeader()); clone.setHideColumn(col52.isHideColumn()); return clone; }
ActionRetractFactCol52 clone(final ActionRetractFactCol52 col52) { final ActionRetractFactCol52 clone; if (col52 instanceof LimitedEntryCol) { clone = new LimitedEntryActionRetractFactCol52(); final DTCellValue52 oldValue = ((LimitedEntryCol) col52).getValue(); final DTCellValue52 newValue = new DTCellValue52(oldValue.getStringValue()); ((LimitedEntryCol) clone).setValue(newValue); } else { clone = new ActionRetractFactCol52(); } clone.setHeader(col52.getHeader()); clone.setHideColumn(col52.isHideColumn()); return clone; }
@Test public void testAppend() throws VetoException { final ActionRetractFactCol52 column = new ActionRetractFactCol52(); column.setHeader("col1"); modelSynchronizer.appendColumn(column); assertEquals(1, model.getActionCols().size()); assertEquals(3, uiModel.getColumns().size()); assertTrue(uiModel.getColumns().get(2) instanceof BoundFactUiColumn); assertEquals(true, ((BaseSingletonDOMElementUiColumn) uiModel.getColumns().get(2)).isEditable()); }
@Test public void testDelete() throws VetoException { final ActionRetractFactCol52 column = new ActionRetractFactCol52(); column.setHeader("col1"); modelSynchronizer.appendColumn(column); assertEquals(1, model.getActionCols().size()); assertEquals(3, uiModel.getColumns().size()); modelSynchronizer.deleteColumn(column); assertEquals(0, model.getActionCols().size()); assertEquals(2, uiModel.getColumns().size()); }
@Test public void testUpdate() throws VetoException { final ActionRetractFactCol52 column = spy(new ActionRetractFactCol52()); column.setHeader("col1"); modelSynchronizer.appendColumn(column); final ActionRetractFactCol52 edited = new ActionRetractFactCol52(); edited.setWidth(column.getWidth()); edited.setHideColumn(true); edited.setHeader("updated"); List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(column, edited); assertEquals(2, diffs.size()); verify(column).diff(edited); assertEquals(1, model.getActionCols().size()); assertEquals(3, uiModel.getColumns().size()); assertTrue(uiModel.getColumns().get(2) instanceof BoundFactUiColumn); assertEquals("updated", uiModel.getColumns().get(2).getHeaderMetaData().get(0).getTitle()); assertEquals(false, uiModel.getColumns().get(2).isVisible()); }
@Test public void testRuleModelWithRHSBoundFactsUsageWithActionRetractFact() { final GuidedDecisionTable52 dt = new GuidedDecisionTable52(); //Setup Decision Table columns final Pattern52 p1 = new Pattern52(); p1.setFactType("Driver"); p1.setBoundName("$d"); dt.getConditions().add(p1); final ActionRetractFactCol52 del = new ActionRetractFactCol52(); dt.getActionCols().add(del); dt.getData().add(Arrays.asList(new DTCellValue52(1), new DTCellValue52("description"), new DTCellValue52("$d"))); final BRLRuleModel model = new BRLRuleModel(dt); //Checks assertTrue(model.isBoundFactUsed("$d")); assertFalse(model.isBoundFactUsed("$cheese")); }
@Test public void getSafeHtml_ActionRetract() { ActionRetractFactCol52 originalColumn = new ActionRetractFactCol52(); originalColumn.setHeader("action1"); originalColumn.setHideColumn(false); originalColumn.setDefaultValue(new DTCellValue52("def1")); ActionRetractFactCol52 newColumn = new ActionRetractFactCol52(); newColumn.setHeader("action2"); newColumn.setHideColumn(true); newColumn.setDefaultValue(new DTCellValue52("def2")); List<BaseColumnFieldDiff> diffs = originalColumn.diff(newColumn); SafeHtml result = helper.getSafeHtml(new UpdateColumnAuditLogEntry("mock user", originalColumn, newColumn, diffs)); assertEquals(getHeaderRepre(newColumn.getHeader()) + getDiffRepre(diffs), result.asString()); }
@Test public void testMoveColumnTo_MoveLeft() throws VetoException { final ActionRetractFactCol52 column1 = new ActionRetractFactCol52(); column1.setHeader("retract1"); final ActionRetractFactCol52 column2 = new ActionRetractFactCol52(); column2.setHeader("retract2");
@Test public void testMoveColumnTo_OutOfBounds() throws VetoException { final ActionRetractFactCol52 column1 = new ActionRetractFactCol52(); column1.setHeader("retract1"); final ActionRetractFactCol52 column2 = new ActionRetractFactCol52(); column2.setHeader("retract2");
dt.getActionCols().add(ins); ActionRetractFactCol52 ret = new ActionRetractFactCol52(); dt.getActionCols().add(ret);
dt.getActionCols().add(ins); ActionRetractFactCol52 ret = new ActionRetractFactCol52(); dt.getActionCols().add(ret);
dt.getActionCols().add(ins); ActionRetractFactCol52 ret = new ActionRetractFactCol52(); dt.getActionCols().add(ret);
cols.add(asf2); ActionRetractFactCol52 ret = new ActionRetractFactCol52(); cols.add(ret);