use of org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane in project drools-wb by kiegroup.
the class CompositeFactPatternWidget method wrapLHSWidget.
/**
* Wraps a RuleModellerWidget with an icon to delete the pattern
*/
private Widget wrapLHSWidget(final CompositeFactPattern model, int i, RuleModellerWidget w) {
DirtyableHorizontalPane horiz = new DirtyableHorizontalPane();
final Image remove = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
remove.setTitle(GuidedRuleEditorResources.CONSTANTS.RemoveThisENTIREConditionAndAllTheFieldConstraintsThatBelongToIt());
final int idx = i;
remove.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (Window.confirm(GuidedRuleEditorResources.CONSTANTS.RemoveThisEntireConditionQ())) {
if (pattern.removeFactPattern(idx)) {
getModeller().refreshWidget();
}
}
}
});
horiz.setWidth("100%");
w.setWidth("100%");
horiz.add(w);
if (!(getModeller().lockLHS() || w.isReadOnly())) {
horiz.add(remove);
}
return horiz;
}
use of org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane in project drools-wb by kiegroup.
the class FromCompositeFactPatternWidget method addRemoveButton.
protected Widget addRemoveButton(Widget w, ClickHandler listener) {
DirtyableHorizontalPane horiz = new DirtyableHorizontalPane();
final Image remove = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
remove.setAltText(GuidedRuleEditorResources.CONSTANTS.RemoveThisBlockOfData());
remove.setTitle(GuidedRuleEditorResources.CONSTANTS.RemoveThisBlockOfData());
remove.addClickHandler(listener);
horiz.setWidth("100%");
w.setWidth("100%");
horiz.add(w);
if (!this.readOnly) {
horiz.add(remove);
}
return horiz;
}
use of org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane in project drools-wb by kiegroup.
the class AttributeSelectorPopup method setMetadataPanel.
private void setMetadataPanel() {
box.getElement().setAttribute("size", "15");
DirtyableHorizontalPane horiz = new DirtyableHorizontalPane();
horiz.add(box);
horiz.add(getAddButton());
addAttribute(GuidedRuleEditorResources.CONSTANTS.Metadata3(), horiz);
}
use of org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane in project drools-wb by kiegroup.
the class RuleAttributeWidget method getEditorWidget.
private Widget getEditorWidget(final RuleMetadata rm, final int idx, final boolean isReadOnly) {
IsWidget editor;
if (rm.getAttributeName().equals(LOCK_LHS) || rm.getAttributeName().equals(LOCK_RHS)) {
editor = new InfoPopup(GuidedRuleEditorResources.CONSTANTS.FrozenAreas(), GuidedRuleEditorResources.CONSTANTS.FrozenExplanation());
} else {
editor = textBoxEditor(rm, isReadOnly);
}
DirtyableHorizontalPane horiz = new DirtyableHorizontalPane();
horiz.add(editor);
if (!isReadOnly) {
horiz.add(getRemoveMetaIcon(idx));
}
return horiz;
}
use of org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane in project drools-wb by kiegroup.
the class RuleModeller method renderLhs.
/**
* Builds all the condition widgets.
*/
private void renderLhs(final RuleModel model) {
for (int i = 0; i < model.lhs.length; i++) {
DirtyableVerticalPane vert = new DirtyableVerticalPane();
vert.setWidth("100%");
// if lockLHS() set the widget RO, otherwise let them decide.
Boolean readOnly = this.lockLHS() ? true : null;
IPattern pattern = model.lhs[i];
final RuleModellerWidget widget = getWidgetFactory().getWidget(this, eventBus, pattern, readOnly);
widget.addOnModifiedCommand(this.onWidgetModifiedCommand);
vert.add(wrapLHSWidget(model, i, widget));
vert.add(spacerWidget());
layout.setWidget(currentLayoutRow, 0, new DirtyableHorizontalPane());
layout.setWidget(currentLayoutRow, 1, new DirtyableHorizontalPane());
layout.setWidget(currentLayoutRow, 2, this.wrapLineNumber(i + 1, true));
layout.getFlexCellFormatter().setHorizontalAlignment(currentLayoutRow, 2, HasHorizontalAlignment.ALIGN_CENTER);
layout.getFlexCellFormatter().setVerticalAlignment(currentLayoutRow, 2, HasVerticalAlignment.ALIGN_MIDDLE);
layout.setWidget(currentLayoutRow, 3, vert);
layout.getFlexCellFormatter().setHorizontalAlignment(currentLayoutRow, 3, HasHorizontalAlignment.ALIGN_LEFT);
layout.getFlexCellFormatter().setVerticalAlignment(currentLayoutRow, 3, HasVerticalAlignment.ALIGN_TOP);
layout.getFlexCellFormatter().setWidth(currentLayoutRow, 3, "100%");
layout.getRowFormatter().addStyleName(currentLayoutRow, (i % 2 == 0 ? GuidedRuleEditorResources.INSTANCE.css().evenRow() : GuidedRuleEditorResources.INSTANCE.css().oddRow()));
if (!widget.isFactTypeKnown()) {
addInvalidPatternIcon();
addFactTypeKnownValueChangeHandler(widget, currentLayoutRow);
}
final int index = i;
if (!(this.lockLHS() || widget.isReadOnly())) {
this.addActionsButtonsToLayout(GuidedRuleEditorResources.CONSTANTS.AddAConditionBelow(), new ClickHandler() {
public void onClick(ClickEvent event) {
showConditionSelector(index + 1);
}
}, new ClickHandler() {
public void onClick(ClickEvent event) {
model.moveLhsItemDown(index);
refreshWidget();
}
}, new ClickHandler() {
public void onClick(ClickEvent event) {
model.moveLhsItemUp(index);
refreshWidget();
}
});
}
this.lhsWidgets.add(widget);
currentLayoutRow++;
}
}
Aggregations