use of com.google.gwt.user.client.ui.HorizontalPanel in project drools-wb by kiegroup.
the class CallMethodWidget method getSetterLabel.
private Widget getSetterLabel() {
HorizontalPanel horiz = new HorizontalPanel();
if (mCall.getState() == ActionCallMethod.TYPE_UNDEFINED) {
Image edit = TestScenarioAltedImages.INSTANCE.AddFieldToFact();
edit.setTitle(TestScenarioConstants.INSTANCE.AddAnotherFieldToThisSoYouCanSetItsValue());
edit.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
Image w = (Image) event.getSource();
showAddFieldPopup(w);
}
});
// NON-NLS
horiz.add(new SmallLabel(HumanReadable.getActionDisplayName("call") + " [" + mCall.getVariable() + "]"));
horiz.add(edit);
} else {
// NON-NLS
horiz.add(new SmallLabel(HumanReadable.getActionDisplayName("call") + " [" + mCall.getVariable() + "." + mCall.getMethodName() + "]"));
}
return horiz;
}
use of com.google.gwt.user.client.ui.HorizontalPanel in project drools-wb by kiegroup.
the class VerifyRulesFiredWidget method render.
private FlexTable render(final FixtureList rfl, final Scenario sc) {
FlexTable data = new FlexTable();
for (int i = 0; i < rfl.size(); i++) {
final VerifyRuleFired v = (VerifyRuleFired) rfl.get(i);
if (showResults && v.getSuccessResult() != null) {
if (!v.getSuccessResult().booleanValue()) {
data.setWidget(i, 0, new Image(CommonImages.INSTANCE.warning()));
data.setWidget(i, 4, new HTML(TestScenarioConstants.INSTANCE.ActualResult(v.getActualResult().toString())));
data.getCellFormatter().addStyleName(i, 4, // NON-NLS
"testErrorValue");
} else {
data.setWidget(i, 0, new Image(TestScenarioImages.INSTANCE.testPassed()));
}
}
data.setWidget(i, 1, new SmallLabel(v.getRuleName() + ":"));
data.getFlexCellFormatter().setAlignment(i, 1, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_MIDDLE);
final ListBox b = new ListBox();
b.addItem(TestScenarioConstants.INSTANCE.firedAtLeastOnce(), "y");
b.addItem(TestScenarioConstants.INSTANCE.didNotFire(), "n");
b.addItem(TestScenarioConstants.INSTANCE.firedThisManyTimes(), "e");
final TextBox num = new TextBox();
((InputElement) num.getElement().cast()).setSize(5);
if (v.getExpectedFire() != null) {
b.setSelectedIndex((v.getExpectedFire().booleanValue()) ? 0 : 1);
num.setVisible(false);
} else {
b.setSelectedIndex(2);
String xc = (v.getExpectedCount() != null) ? "" + v.getExpectedCount().intValue() : "0";
num.setText(xc);
}
b.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
String s = b.getValue(b.getSelectedIndex());
if (s.equals("y") || s.equals("n")) {
num.setVisible(false);
v.setExpectedFire((s.equals("y")) ? Boolean.TRUE : Boolean.FALSE);
v.setExpectedCount(null);
} else {
num.setVisible(true);
v.setExpectedFire(null);
num.setText("1");
v.setExpectedCount(Integer.valueOf(1));
}
}
});
b.addItem(TestScenarioConstants.INSTANCE.ChooseDotDotDot());
num.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
v.setExpectedCount(Integer.valueOf(num.getText()));
}
});
HorizontalPanel h = new HorizontalPanel();
h.add(b);
h.add(num);
data.setWidget(i, 2, h);
Button del = new Button();
del.setIcon(IconType.TRASH);
del.setTitle(TestScenarioConstants.INSTANCE.RemoveThisRuleExpectation());
del.addClickHandler(clickEvent -> {
if (Window.confirm(TestScenarioConstants.INSTANCE.AreYouSureYouWantToRemoveThisRuleExpectation())) {
rfl.remove(v);
sc.removeFixture(v);
outer.setWidget(1, 0, render(rfl, sc));
}
});
data.setWidget(i, 3, del);
// we only want numbers here...
num.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
if (Character.isLetter(event.getCharCode())) {
((TextBox) event.getSource()).cancelKey();
}
}
});
}
ScenarioUtils.addBottomAndRightPaddingToTableCells(data);
return data;
}
use of com.google.gwt.user.client.ui.HorizontalPanel in project drools-wb by kiegroup.
the class ColumnsPagePresenter method makeMetaDataWidget.
HorizontalPanel makeMetaDataWidget(final GuidedDecisionTableModellerView.Presenter modeller, final MetadataCol52 metaDataColumn) {
final HorizontalPanel horizontalPanel = makeHorizontalPanel();
final ColumnLabelWidget label = makeColumnLabel(metaDataColumn);
final boolean isEditable = modeller.isActiveDecisionTableEditable();
horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
horizontalPanel.add(label);
horizontalPanel.add(hideColumnCheckBox(modeller, metaDataColumn));
if (isEditable) {
horizontalPanel.add(deleteMetaDataColumnAnchor(modeller, metaDataColumn));
}
return horizontalPanel;
}
use of com.google.gwt.user.client.ui.HorizontalPanel in project drools-wb by kiegroup.
the class ColumnManagementView method renderColumns.
public void renderColumns(final Map<String, List<BaseColumn>> columnGroups) {
clear();
for (String groupLabel : columnGroups.keySet()) {
final VerticalPanel columnGroup = new VerticalPanel();
final HorizontalPanel columnGroupHeader = new HorizontalPanel();
final VerticalPanel columnGroupColumns = new VerticalPanel();
columnGroupHeader.add(new Label(groupLabel));
columnGroup.add(columnGroupHeader);
columnGroup.add(columnGroupColumns);
add(columnGroup);
for (final BaseColumn column : columnGroups.get(groupLabel)) {
if (column instanceof ActionCol52) {
columnGroupColumns.add(renderColumn((ActionCol52) column));
} else if (column instanceof BRLConditionColumn) {
columnGroupColumns.add(renderColumn((BRLConditionColumn) column));
} else if (column instanceof Pattern52) {
renderColumn((Pattern52) column).forEach(columnGroupColumns::add);
}
}
}
}
use of com.google.gwt.user.client.ui.HorizontalPanel in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testMakeMetaDataWidgetWhenDecisionTableIsNotEditable.
@Test
public void testMakeMetaDataWidgetWhenDecisionTableIsNotEditable() {
final HorizontalPanel expectedHorizontalPanel = mock(HorizontalPanel.class);
final ColumnLabelWidget columnLabelWidget = mock(ColumnLabelWidget.class);
final CheckBox hideColumnCheckBox = mock(CheckBox.class);
final DeleteColumnManagementAnchorWidget deleteColumnManagementAnchorWidget = mock(DeleteColumnManagementAnchorWidget.class);
final boolean isEditable = false;
doReturn(expectedHorizontalPanel).when(presenter).makeHorizontalPanel();
doReturn(columnLabelWidget).when(presenter).makeColumnLabel(metadataColumn);
doReturn(hideColumnCheckBox).when(presenter).hideColumnCheckBox(modeller, metadataColumn);
doReturn(deleteColumnManagementAnchorWidget).when(presenter).deleteMetaDataColumnAnchor(modeller, metadataColumn);
doReturn(isEditable).when(modeller).isActiveDecisionTableEditable();
final HorizontalPanel actualHorizontalPanel = presenter.makeMetaDataWidget(modeller, metadataColumn);
verify(actualHorizontalPanel).setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
verify(actualHorizontalPanel).add(columnLabelWidget);
verify(actualHorizontalPanel).add(hideColumnCheckBox);
verify(actualHorizontalPanel, never()).add(deleteColumnManagementAnchorWidget);
assertEquals(expectedHorizontalPanel, actualHorizontalPanel);
}
Aggregations