use of org.uberfire.ext.widgets.common.client.common.SmallLabel in project drools-wb by kiegroup.
the class ActivateRuleFlowWidget method render.
private void render(final FixtureList retList, final FlexTable outer, final Scenario sc) {
outer.clear();
outer.getCellFormatter().setStyleName(0, 0, "modeller-fact-TypeHeader");
outer.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE);
outer.setStyleName("modeller-fact-pattern-Widget");
outer.setWidget(0, 0, new SmallLabel(TestScenarioConstants.INSTANCE.ActivateRuleFlowGroup()));
outer.getFlexCellFormatter().setColSpan(0, 0, 2);
int row = 1;
for (Fixture fixture : retList) {
final ActivateRuleFlowGroup acticateRuleFlowGroup = (ActivateRuleFlowGroup) fixture;
outer.setWidget(row, 0, new SmallLabel(acticateRuleFlowGroup.getName()));
Button deleteButton = new Button();
deleteButton.setIcon(IconType.TRASH);
deleteButton.setTitle(TestScenarioConstants.INSTANCE.RemoveThisRuleFlowActivation());
deleteButton.addClickHandler(clickEvent -> {
retList.remove(acticateRuleFlowGroup);
sc.getFixtures().remove(acticateRuleFlowGroup);
render(retList, outer, sc);
parent.renderEditor();
});
outer.setWidget(row, 1, deleteButton);
row++;
}
ScenarioUtils.addBottomAndRightPaddingToTableCells(outer);
}
use of org.uberfire.ext.widgets.common.client.common.SmallLabel 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 org.uberfire.ext.widgets.common.client.common.SmallLabel in project drools-wb by kiegroup.
the class MethodParameterCallValueEditor method showTypeChoice.
protected void showTypeChoice(final Widget w) {
final FormStylePopup form = new FormStylePopup(TestScenarioAltedImages.INSTANCE.Wizard(), TestScenarioConstants.INSTANCE.FieldValue());
Button lit = new Button(TestScenarioConstants.INSTANCE.LiteralValue());
lit.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
methodParameter.nature = FieldData.TYPE_LITERAL;
methodParameter.value = " ";
refresh();
form.hide();
}
});
form.addAttribute(TestScenarioConstants.INSTANCE.LiteralValue() + ":", widgets(lit, new InfoPopup(TestScenarioConstants.INSTANCE.Literal(), TestScenarioConstants.INSTANCE.LiteralValTip())));
form.addRow(new HTML("<hr/>"));
form.addRow(new SmallLabel(TestScenarioConstants.INSTANCE.AdvancedSection()));
/*
* If there is a bound variable that is the same type of the current
* variable type, then show a button
*/
List<String> vars = model.getFactNamesInScope(ex, true);
for (String v : vars) {
boolean createButton = false;
Button variable = new Button(TestScenarioConstants.INSTANCE.BoundVariable());
FactData factData = (FactData) model.getFactTypes().get(v);
if (factData.getType().equals(this.parameterType)) {
createButton = true;
}
if (createButton == true) {
form.addAttribute(TestScenarioConstants.INSTANCE.BoundVariable() + ":", variable);
variable.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
methodParameter.nature = FieldData.TYPE_VARIABLE;
methodParameter.value = "=";
refresh();
form.hide();
}
});
break;
}
}
form.show();
}
use of org.uberfire.ext.widgets.common.client.common.SmallLabel 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 org.uberfire.ext.widgets.common.client.common.SmallLabel in project drools-wb by kiegroup.
the class AttributeColumnConfigRowView method addDefaultValue.
public void addDefaultValue(AttributeCol52 attributeColumn, boolean isEditable, DefaultValueWidgetFactory.DefaultValueChangedEventHandler handler) {
final FlowPanel panel = new FlowPanel();
panel.add(new SmallLabel(new StringBuilder(GuidedDecisionTableConstants.INSTANCE.DefaultValue()).append(GuidedDecisionTableConstants.COLON).toString()));
panel.add(DefaultValueWidgetFactory.getDefaultValueWidget(attributeColumn, !isEditable, handler));
add(panel);
}
Aggregations