Search in sources :

Example 1 with TemplateVariablesChangedEvent

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);
}
Also used : TemplateVariablesChangedEvent(org.drools.workbench.screens.guided.rule.client.editor.events.TemplateVariablesChangedEvent)

Example 2 with TemplateVariablesChangedEvent

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);
}
Also used : TemplateVariablesChangedEvent(org.drools.workbench.screens.guided.rule.client.editor.events.TemplateVariablesChangedEvent)

Example 3 with TemplateVariablesChangedEvent

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;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FlexTable(com.google.gwt.user.client.ui.FlexTable) Image(com.google.gwt.user.client.ui.Image) TemplateVariablesChangedEvent(org.drools.workbench.screens.guided.rule.client.editor.events.TemplateVariablesChangedEvent)

Example 4 with TemplateVariablesChangedEvent

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;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FlexTable(com.google.gwt.user.client.ui.FlexTable) Image(com.google.gwt.user.client.ui.Image) TemplateVariablesChangedEvent(org.drools.workbench.screens.guided.rule.client.editor.events.TemplateVariablesChangedEvent)

Example 5 with TemplateVariablesChangedEvent

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 );
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ActionFieldValue(org.drools.workbench.models.datamodel.rule.ActionFieldValue) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Image(com.google.gwt.user.client.ui.Image) TemplateVariablesChangedEvent(org.drools.workbench.screens.guided.rule.client.editor.events.TemplateVariablesChangedEvent)

Aggregations

TemplateVariablesChangedEvent (org.drools.workbench.screens.guided.rule.client.editor.events.TemplateVariablesChangedEvent)6 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)4 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 Image (com.google.gwt.user.client.ui.Image)4 FlexTable (com.google.gwt.user.client.ui.FlexTable)3 ActionFieldValue (org.drools.workbench.models.datamodel.rule.ActionFieldValue)2 HTML (com.google.gwt.user.client.ui.HTML)1 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)1