use of com.google.gwt.user.client.ui.FlexTable in project drools-wb by kiegroup.
the class RuleModeller method wrapLHSWidget.
/**
* This adds the widget to the UI, also adding the remove icon.
*/
private Widget wrapLHSWidget(final RuleModel model, int i, RuleModellerWidget w) {
final FlexTable wrapper = new FlexTable();
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 (model.removeLhsItem(idx)) {
refreshWidget();
// Signal possible change in Template variables
TemplateVariablesChangedEvent tvce = new TemplateVariablesChangedEvent(model);
eventBus.fireEventFromSource(tvce, model);
} else {
ErrorPopup.showMessage(GuidedRuleEditorResources.CONSTANTS.CanTRemoveThatItemAsItIsUsedInTheActionPartOfTheRule());
}
}
}
});
wrapper.getColumnFormatter().setWidth(0, "100%");
w.setWidth("100%");
wrapper.setWidget(0, 0, w);
if (!(this.lockLHS() || w.isReadOnly()) || !w.isFactTypeKnown()) {
wrapper.setWidget(0, 1, remove);
wrapper.getColumnFormatter().setWidth(1, "20px");
}
return wrapper;
}
use of com.google.gwt.user.client.ui.FlexTable in project drools-wb by kiegroup.
the class RuleModeller method wrapRHSWidget.
/**
* This adds the widget to the UI, also adding the remove icon.
*/
private Widget wrapRHSWidget(final RuleModel model, int i, RuleModellerWidget w) {
final FlexTable wrapper = new FlexTable();
final Image remove = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
remove.setTitle(GuidedRuleEditorResources.CONSTANTS.RemoveThisAction());
final int idx = i;
remove.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (Window.confirm(GuidedRuleEditorResources.CONSTANTS.RemoveThisItem())) {
model.removeRhsItem(idx);
refreshWidget();
// Signal possible change in Template variables
TemplateVariablesChangedEvent tvce = new TemplateVariablesChangedEvent(model);
eventBus.fireEventFromSource(tvce, model);
}
}
});
// if ( !(w instanceof ActionRetractFactWidget) ) {
// w.setWidth( "100%" );
// horiz.setWidth( "100%" );
// }
wrapper.getColumnFormatter().setWidth(0, "100%");
w.setWidth("100%");
wrapper.setWidget(0, 0, w);
if (!(this.lockRHS() || w.isReadOnly()) || !w.isFactTypeKnown()) {
wrapper.setWidget(0, 1, remove);
wrapper.getColumnFormatter().setWidth(1, "20px");
}
return wrapper;
}
use of com.google.gwt.user.client.ui.FlexTable in project drools-wb by kiegroup.
the class RuleModeller method doLayout.
protected void doLayout() {
layout = new FlexTable();
initWidget();
layout.setStyleName("model-builder-Background");
initWidget(layout);
setWidth("100%");
setHeight("100%");
}
use of com.google.gwt.user.client.ui.FlexTable 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 com.google.gwt.user.client.ui.FlexTable 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