use of org.uberfire.ext.widgets.common.client.common.DirtyableVerticalPane in project drools-wb by kiegroup.
the class RuleModeller method renderRhs.
/**
* Do all the widgets for the RHS.
*/
private void renderRhs(final RuleModel model) {
for (int i = 0; i < model.rhs.length; i++) {
DirtyableVerticalPane widget = new DirtyableVerticalPane();
widget.setWidth("100%");
IAction action = model.rhs[i];
// if lockRHS() set the widget RO, otherwise let them decide.
Boolean readOnly = this.lockRHS() ? true : null;
RuleModellerWidget w = getWidgetFactory().getWidget(this, eventBus, action, readOnly);
w.addOnModifiedCommand(this.onWidgetModifiedCommand);
widget.add(wrapRHSWidget(model, i, w));
widget.add(spacerWidget());
layout.setWidget(currentLayoutRow, 0, new DirtyableHorizontalPane());
layout.setWidget(currentLayoutRow, 1, new DirtyableHorizontalPane());
layout.setWidget(currentLayoutRow, 2, this.wrapLineNumber(i + 1, false));
layout.getFlexCellFormatter().setHorizontalAlignment(currentLayoutRow, 2, HasHorizontalAlignment.ALIGN_CENTER);
layout.getFlexCellFormatter().setVerticalAlignment(currentLayoutRow, 2, HasVerticalAlignment.ALIGN_MIDDLE);
layout.setWidget(currentLayoutRow, 3, widget);
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 (!w.isFactTypeKnown()) {
addInvalidPatternIcon();
addFactTypeKnownValueChangeHandler(w, currentLayoutRow);
}
final int index = i;
if (!(this.lockRHS() || w.isReadOnly())) {
this.addActionsButtonsToLayout(GuidedRuleEditorResources.CONSTANTS.AddAnActionBelow(), new ClickHandler() {
public void onClick(ClickEvent event) {
showActionSelector(index + 1);
}
}, new ClickHandler() {
public void onClick(ClickEvent event) {
model.moveRhsItemDown(index);
refreshWidget();
}
}, new ClickHandler() {
public void onClick(ClickEvent event) {
model.moveRhsItemUp(index);
refreshWidget();
}
});
}
this.rhsWidgets.add(w);
currentLayoutRow++;
}
}
use of org.uberfire.ext.widgets.common.client.common.DirtyableVerticalPane in project drools-wb by kiegroup.
the class CompositeFactPatternWidget method doLayout.
protected void doLayout() {
this.layout.setWidget(0, 0, getCompositeLabel());
this.layout.getFlexCellFormatter().setColSpan(0, 0, 2);
// this.layout.getFlexCellFormatter().setWidth(0, 0, "15%");
this.layout.setWidget(1, 0, new HTML(" "));
if (this.pattern.getPatterns() != null) {
DirtyableVerticalPane vert = new DirtyableVerticalPane();
IFactPattern[] facts = pattern.getPatterns();
for (int i = 0; i < facts.length; i++) {
RuleModellerWidget widget = this.getModeller().getWidgetFactory().getWidget(this.getModeller(), this.getEventBus(), facts[i], this.readOnly);
widget.addOnModifiedCommand(new Command() {
public void execute() {
setModified(true);
}
});
// Wrap widget so the Fact pattern can be deleted
vert.add(wrapLHSWidget(pattern, i, widget));
vert.add(spacerWidget());
}
this.layout.setWidget(1, 1, vert);
}
}
use of org.uberfire.ext.widgets.common.client.common.DirtyableVerticalPane 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