use of org.drools.workbench.screens.guided.rule.client.editor.events.TemplateVariablesChangedEvent in project drools-wb by kiegroup.
the class ActionValueEditor method executeOnTemplateVariablesChange.
// Signal (potential) change in Template variables
private void executeOnTemplateVariablesChange() {
TemplateVariablesChangedEvent tvce = new TemplateVariablesChangedEvent(model);
eventBus.fireEventFromSource(tvce, model);
}
use of org.drools.workbench.screens.guided.rule.client.editor.events.TemplateVariablesChangedEvent in project drools-wb by kiegroup.
the class ConstraintValueEditor method executeOnTemplateVariablesChange.
// Signal (potential) change in Template variables
private void executeOnTemplateVariablesChange() {
TemplateVariablesChangedEvent tvce = new TemplateVariablesChangedEvent(model);
eventBus.fireEventFromSource(tvce, model);
}
use of org.drools.workbench.screens.guided.rule.client.editor.events.TemplateVariablesChangedEvent 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 org.drools.workbench.screens.guided.rule.client.editor.events.TemplateVariablesChangedEvent 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 org.drools.workbench.screens.guided.rule.client.editor.events.TemplateVariablesChangedEvent in project drools-wb by kiegroup.
the class ActionSetFieldWidget method doLayout.
private void doLayout() {
layout.clear();
for (int i = 0; i < model.getFieldValues().length; i++) {
ActionFieldValue val = model.getFieldValues()[i];
layout.setWidget(i, 0, getSetterLabel());
layout.setWidget(i, 1, fieldSelector(val));
layout.setWidget(i, 2, valueEditor(val));
final int idx = i;
Image remove = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
remove.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (Window.confirm(GuidedRuleEditorResources.CONSTANTS.RemoveThisItem())) {
model.removeField(idx);
setModified(true);
getModeller().refreshWidget();
// Signal possible change in Template variables
TemplateVariablesChangedEvent tvce = new TemplateVariablesChangedEvent(getModeller().getModel());
getEventBus().fireEventFromSource(tvce, getModeller().getModel());
}
}
});
if (!this.readOnly) {
layout.setWidget(i, 3, remove);
}
}
if (model.getFieldValues().length == 0) {
HorizontalPanel h = new HorizontalPanel();
h.add(getSetterLabel());
if (!this.readOnly) {
Image image = GuidedRuleEditorImages508.INSTANCE.Edit();
image.setAltText(GuidedRuleEditorResources.CONSTANTS.AddFirstNewField());
image.setTitle(GuidedRuleEditorResources.CONSTANTS.AddFirstNewField());
image.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent sender) {
showAddFieldPopup(sender);
}
});
h.add(image);
}
layout.setWidget(0, 0, h);
}
// layout.setWidget( 0, 1, inner );
}
Aggregations