use of org.uberfire.ext.widgets.common.client.common.ClickableLabel in project drools-wb by kiegroup.
the class RuleModeller method initWidget.
/**
* This updates the widget to reflect the state of the model.
*/
public void initWidget() {
layout.removeAllRows();
currentLayoutRow = 0;
Image addPattern = GuidedRuleEditorImages508.INSTANCE.NewItem();
addPattern.setTitle(GuidedRuleEditorResources.CONSTANTS.AddAConditionToThisRule());
addPattern.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
showConditionSelector(null);
}
});
layout.getColumnFormatter().setWidth(0, "20px");
layout.getColumnFormatter().setWidth(1, "20px");
layout.getColumnFormatter().setWidth(2, "48px");
layout.getColumnFormatter().setWidth(4, "64px");
if (this.showExtendedRuleDropdown()) {
addExtendedRuleDropdown();
}
if (this.showLHS()) {
layout.setWidget(currentLayoutRow, 0, new SmallLabel("<b>" + GuidedRuleEditorResources.CONSTANTS.WHEN() + "</b>"));
layout.getFlexCellFormatter().setColSpan(currentLayoutRow, 0, 4);
if (!lockLHS()) {
layout.setWidget(currentLayoutRow, 1, addPattern);
}
currentLayoutRow++;
renderLhs(this.model);
}
if (this.showRHS()) {
layout.setWidget(currentLayoutRow, 0, new SmallLabel("<b>" + GuidedRuleEditorResources.CONSTANTS.THEN() + "</b>"));
layout.getFlexCellFormatter().setColSpan(currentLayoutRow, 0, 4);
Image addAction = GuidedRuleEditorImages508.INSTANCE.NewItem();
addAction.setTitle(GuidedRuleEditorResources.CONSTANTS.AddAnActionToThisRule());
addAction.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
showActionSelector(null);
}
});
if (!lockRHS()) {
layout.setWidget(currentLayoutRow, 1, addAction);
}
currentLayoutRow++;
renderRhs(this.model);
}
if (showAttributes()) {
final int optionsRowIndex = currentLayoutRow;
if (!this.showingOptions) {
ClickableLabel showMoreOptions = new ClickableLabel(GuidedRuleEditorResources.CONSTANTS.ShowOptions(), new ClickHandler() {
public void onClick(ClickEvent event) {
showingOptions = true;
renderOptions(optionsRowIndex);
}
});
layout.setWidget(optionsRowIndex, 2, showMoreOptions);
} else {
renderOptions(optionsRowIndex);
}
}
currentLayoutRow++;
layout.setWidget(currentLayoutRow + 1, 3, spacerWidget());
layout.getCellFormatter().setHeight(currentLayoutRow + 1, 3, "100%");
}
use of org.uberfire.ext.widgets.common.client.common.ClickableLabel in project drools-wb by kiegroup.
the class ActionInsertFactWidget method getAssertLabel.
private Widget getAssertLabel() {
ClickHandler cl = new ClickHandler() {
public void onClick(ClickEvent event) {
Widget w = (Widget) event.getSource();
showAddFieldPopup(w);
}
};
// NON-NLS
String assertType = "assert";
if (this.model instanceof ActionInsertLogicalFact) {
// NON-NLS
assertType = "assertLogical";
}
String lbl = (model.isBound() == false) ? HumanReadable.getActionDisplayName(assertType) + " <b>" + this.model.getFactType() + "</b>" : HumanReadable.getActionDisplayName(assertType) + " <b>" + this.model.getFactType() + "</b>" + " <b>[" + model.getBoundName() + "]</b>";
if (this.model.getFieldValues() != null && model.getFieldValues().length > 0) {
lbl = lbl + ":";
}
return new ClickableLabel(lbl, cl, !this.readOnly);
}
use of org.uberfire.ext.widgets.common.client.common.ClickableLabel in project drools-wb by kiegroup.
the class ActionSetFieldWidget method getSetterLabel.
private Widget getSetterLabel() {
ClickHandler clk = new ClickHandler() {
public void onClick(ClickEvent event) {
// Widget w = (Widget)event.getSource();
showAddFieldPopup(event);
}
};
String modifyType = "set";
if (this.model instanceof ActionUpdateField) {
modifyType = "modify";
}
String type = this.getModeller().getModel().getLHSBindingType(model.getVariable());
String descFact = (type != null) ? type + " <b>[" + model.getVariable() + "]</b>" : model.getVariable();
String sl = GuidedRuleEditorResources.CONSTANTS.setterLabel(HumanReadable.getActionDisplayName(modifyType), descFact);
return new ClickableLabel(sl, clk, // HumanReadable.getActionDisplayName(modifyType) + " value of <b>[" + model.variable + "]</b>", clk);
!this.readOnly);
}
use of org.uberfire.ext.widgets.common.client.common.ClickableLabel in project drools-wb by kiegroup.
the class FromEntryPointFactPatternWidget method getCompositeLabel.
@Override
protected Widget getCompositeLabel() {
ClickHandler click = new ClickHandler() {
public void onClick(ClickEvent event) {
showFactTypeSelector();
}
};
String lbl = "<div class='form-field'>" + HumanReadable.getCEDisplayName("from entry-point") + "</div>";
FlexTable panel = new FlexTable();
int r = 0;
if (pattern.getFactPattern() == null) {
panel.setWidget(r, 0, new ClickableLabel("<br> <font color='red'>" + GuidedRuleEditorResources.CONSTANTS.clickToAddPatterns() + "</font>", click, !this.readOnly));
r++;
}
panel.setWidget(r, 0, new HTML(lbl));
this.txtEntryPoint = new TextBox();
this.txtEntryPoint.setText(getFromEntryPointPattern().getEntryPointName());
this.txtEntryPoint.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
getFromEntryPointPattern().setEntryPointName(txtEntryPoint.getText());
setModified(true);
}
});
panel.setWidget(r, 1, this.txtEntryPoint);
return panel;
}
use of org.uberfire.ext.widgets.common.client.common.ClickableLabel in project drools-wb by kiegroup.
the class FactPatternWidget method compositeFieldConstraintEditor.
/**
* This will show the constraint editor - allowing field constraints to be
* nested etc.
*/
private Widget compositeFieldConstraintEditor(final CompositeFieldConstraint constraint) {
FlexTable t = new FlexTable();
String desc = null;
ClickHandler click = new ClickHandler() {
public void onClick(ClickEvent event) {
popupCreator.showPatternPopupForComposite(constraint);
}
};
if (constraint.getCompositeJunctionType().equals(CompositeFieldConstraint.COMPOSITE_TYPE_AND)) {
desc = GuidedRuleEditorResources.CONSTANTS.AllOf() + ":";
} else {
desc = GuidedRuleEditorResources.CONSTANTS.AnyOf() + ":";
}
t.setWidget(0, 0, new ClickableLabel(desc, click, !this.readOnly));
t.getFlexCellFormatter().setColSpan(0, 0, 2);
FieldConstraint[] nested = constraint.getConstraints();
FlexTable inner = new FlexTable();
if (nested != null) {
for (int i = 0; i < nested.length; i++) {
this.renderFieldConstraint(inner, i, nested[i], constraint, true, 0);
// add in remove icon here...
final int currentRow = i;
Image clear = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
clear.setTitle(GuidedRuleEditorResources.CONSTANTS.RemoveThisNestedRestriction());
clear.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (Window.confirm(GuidedRuleEditorResources.CONSTANTS.RemoveThisItemFromNestedConstraint())) {
setModified(true);
constraint.removeConstraint(currentRow);
getModeller().refreshWidget();
}
}
});
if (!this.readOnly) {
// This used to be 5 and Connectives were not rendered
inner.setWidget(i, 6, clear);
}
}
}
t.setWidget(1, 1, inner);
t.setWidget(1, 0, new HTML(" "));
return t;
}
Aggregations