Search in sources :

Example 81 with Command

use of com.google.gwt.user.client.Command in project drools-wb by kiegroup.

the class RuleModellerActionSelectorPopup method addLogicalInsertions.

// Add logical insertions
void addLogicalInsertions() {
    if (oracle.getFactTypes().length == 0) {
        return;
    }
    choices.addItem(SECTION_SEPARATOR);
    for (int i = 0; i < oracle.getFactTypes().length; i++) {
        final String item = oracle.getFactTypes()[i];
        choices.addItem(GuidedRuleEditorResources.CONSTANTS.LogicallyInsertFact0(item), "LINS" + item);
        cmds.put("LINS" + item, new Command() {

            public void execute() {
                model.addRhsItem(new ActionInsertLogicalFact(item), Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
                hide();
            }
        });
    }
}
Also used : Command(com.google.gwt.user.client.Command) ActionInsertLogicalFact(org.drools.workbench.models.datamodel.rule.ActionInsertLogicalFact)

Example 82 with Command

use of com.google.gwt.user.client.Command in project drools-wb by kiegroup.

the class RuleModellerActionSelectorPopup method addUpdateNotModify.

// Add update, not modify
void addUpdateNotModify() {
    List<String> vars = model.getLHSPatternVariables();
    if (vars.size() == 0) {
        return;
    }
    choices.addItem(SECTION_SEPARATOR);
    for (Iterator<String> iter = vars.iterator(); iter.hasNext(); ) {
        final String v = iter.next();
        choices.addItem(GuidedRuleEditorResources.CONSTANTS.ChangeFieldValuesOf0(v), "VAR" + v);
        cmds.put("VAR" + v, new Command() {

            public void execute() {
                addActionSetField(v, Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
                hide();
            }
        });
    }
}
Also used : Command(com.google.gwt.user.client.Command)

Example 83 with Command

use of com.google.gwt.user.client.Command in project drools-wb by kiegroup.

the class RuleModellerActionSelectorPopup method addInsertions.

// Add insertions
void addInsertions() {
    if (oracle.getFactTypes().length == 0) {
        return;
    }
    choices.addItem(SECTION_SEPARATOR);
    for (int i = 0; i < oracle.getFactTypes().length; i++) {
        final String item = oracle.getFactTypes()[i];
        choices.addItem(GuidedRuleEditorResources.CONSTANTS.InsertFact0(item), "INS" + item);
        cmds.put("INS" + item, new Command() {

            public void execute() {
                model.addRhsItem(new ActionInsertFact(item), Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
                hide();
            }
        });
    }
}
Also used : Command(com.google.gwt.user.client.Command) ActionInsertFact(org.drools.workbench.models.datamodel.rule.ActionInsertFact)

Example 84 with Command

use of com.google.gwt.user.client.Command in project drools-wb by kiegroup.

the class ActionInsertFactWidget method valueEditor.

ActionValueEditor valueEditor(final ActionFieldValue actionFieldValue) {
    final ActionValueEditor actionValueEditor = actionValueEditor(factType, actionFieldValue, model.getFieldValues(), readOnly);
    actionValueEditor.setOnChangeCommand(new Command() {

        public void execute() {
            RefreshUtil.refreshActionValueEditorsDropDownData(actionValueEditors, actionFieldValue);
            setModified(true);
        }
    });
    // Keep a reference to the value editors so they can be refreshed for dependent enums
    actionValueEditors.put(actionFieldValue, actionValueEditor);
    return actionValueEditor;
}
Also used : ActionValueEditor(org.drools.workbench.screens.guided.rule.client.editor.ActionValueEditor) Command(com.google.gwt.user.client.Command)

Example 85 with Command

use of com.google.gwt.user.client.Command 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("&nbsp;&nbsp;&nbsp;&nbsp;"));
    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);
    }
}
Also used : Command(com.google.gwt.user.client.Command) DirtyableVerticalPane(org.uberfire.ext.widgets.common.client.common.DirtyableVerticalPane) HTML(com.google.gwt.user.client.ui.HTML) IFactPattern(org.drools.workbench.models.datamodel.rule.IFactPattern)

Aggregations

Command (com.google.gwt.user.client.Command)189 AppCommand (org.rstudio.core.client.command.AppCommand)39 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)38 RepeatingCommand (com.google.gwt.core.client.Scheduler.RepeatingCommand)21 JsArrayString (com.google.gwt.core.client.JsArrayString)16 Test (org.junit.Test)16 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)15 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)15 ArrayList (java.util.ArrayList)11 ServerError (org.rstudio.studio.client.server.ServerError)11 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)10 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)10 FileSystemItem (org.rstudio.core.client.files.FileSystemItem)9 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)8 MenuItem (com.google.gwt.user.client.ui.MenuItem)8 Handler (org.rstudio.core.client.command.Handler)8 TextEditingTarget (org.rstudio.studio.client.workbench.views.source.editors.text.TextEditingTarget)8 Widget (com.google.gwt.user.client.ui.Widget)7 Operation (org.rstudio.core.client.widget.Operation)7 EditingTarget (org.rstudio.studio.client.workbench.views.source.editors.EditingTarget)7