public void build(String headerText, Fact fact) { if (fact instanceof FactData) { FactData factData = (FactData) fact; widget.setWidget(0, ++col, new SmallLabel("[" + factData.getName() + "]")); } else { col++; } widget.setWidget(0, 0, new ClickableLabel(headerText, createAddFieldButton(fact))); // Sets row name and delete button. for (final Field field : fact.getFieldData()) { // Avoid duplicate field rows, only one for each name. if (rowIndexByFieldName.doesNotContain(field.getName())) { newRow(fact, field.getName()); } // Sets row data int fieldRowIndex = rowIndexByFieldName.getRowIndex(field.getName()); widget.setWidget(fieldRowIndex, col, editableCell(field, fact, fact.getType())); } if (fact instanceof FactData) { DeleteFactColumnButton deleteFactColumnButton = new DeleteFactColumnButton((FactData) fact); widget.setWidget(rowIndexByFieldName.amountOrRows() + 1, col, deleteFactColumnButton); } }
public DeleteFactColumnButton(final FactData fact) { super( DroolsGuvnorImages.INSTANCE.deleteItemSmall(), Constants.INSTANCE.RemoveTheColumnForScenario(fact.getName())); addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { if (scenario.isFactDataReferenced(fact)) { Window.alert( Constants.INSTANCE.CanTRemoveThisColumnAsTheName0IsBeingUsed(fact.getName())); } else if (Window.confirm( Constants.INSTANCE.AreYouSureYouWantToRemoveColumn0(fact.getName()))) { scenario.removeFixture(fact); definitionList.remove(fact); parent.renderEditor(); } } }); }