Search in sources :

Example 76 with Command

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

the class RuleModellerConditionSelectorPopup method addExistentialConditionalElements.

// The list of existential CEs
private void addExistentialConditionalElements() {
    String[] ces = HumanReadable.CONDITIONAL_ELEMENTS;
    choices.addItem(SECTION_SEPARATOR);
    for (int i = 0; i < ces.length; i++) {
        final String ce = ces[i];
        String key = "CE" + ce;
        choices.addItem(HumanReadable.getCEDisplayName(ce) + " ...", key);
        cmds.put(key, new Command() {

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

Example 77 with Command

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

the class RuleModellerConditionSelectorPopup method addFromConditionalElements.

// The list of from CEs
private void addFromConditionalElements() {
    String[] fces = HumanReadable.FROM_CONDITIONAL_ELEMENTS;
    choices.addItem(SECTION_SEPARATOR);
    for (int i = 0; i < fces.length; i++) {
        final String ce = fces[i];
        String key = "FCE" + ce;
        choices.addItem(HumanReadable.getCEDisplayName(ce) + " ...", key);
        cmds.put(key, new Command() {

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

Example 78 with Command

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

the class RuleModellerConditionSelectorPopup method addFacts.

// The list of facts
private void addFacts() {
    if (oracle.getFactTypes().length > 0) {
        choices.addItem(SECTION_SEPARATOR);
        for (int i = 0; i < oracle.getFactTypes().length; i++) {
            final String f = oracle.getFactTypes()[i];
            String key = "NF" + f;
            choices.addItem(f + " ...", key);
            cmds.put(key, new Command() {

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

Example 79 with Command

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

the class RuleModellerConditionSelectorPopup method addFreeFormDrl.

// Free form DRL
private void addFreeFormDrl() {
    choices.addItem(SECTION_SEPARATOR);
    choices.addItem(GuidedRuleEditorResources.CONSTANTS.FreeFormDrl(), "FF");
    cmds.put("FF", new Command() {

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

Example 80 with Command

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

the class RuleModellerActionSelectorPopup method addCallMethodOn.

// Add "Call method on.." options
void addCallMethodOn() {
    List<String> lhsVars = model.getAllLHSVariables();
    List<String> rhsVars = model.getRHSBoundFacts();
    String[] globals = oracle.getGlobalVariables();
    // Add globals
    if (globals.length > 0) {
        choices.addItem(SECTION_SEPARATOR);
    }
    for (int i = 0; i < globals.length; i++) {
        final String v = globals[i];
        choices.addItem(GuidedRuleEditorResources.CONSTANTS.CallMethodOn0(v), "GLOBCALL" + v);
        cmds.put("GLOBCALL" + v, new Command() {

            public void execute() {
                addCallMethod(v, Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
                hide();
            }
        });
    }
    // Method calls
    if (lhsVars.size() > 0) {
        choices.addItem(SECTION_SEPARATOR);
    }
    for (Iterator<String> iter = lhsVars.iterator(); iter.hasNext(); ) {
        final String v = iter.next();
        choices.addItem(GuidedRuleEditorResources.CONSTANTS.CallMethodOn0(v), "CALL" + v);
        cmds.put("CALL" + v, new Command() {

            public void execute() {
                addCallMethod(v, Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex())));
                hide();
            }
        });
    }
    // Update, not modify
    if (rhsVars.size() > 0) {
        choices.addItem(SECTION_SEPARATOR);
    }
    for (Iterator<String> iter = rhsVars.iterator(); iter.hasNext(); ) {
        final String v = iter.next();
        choices.addItem(GuidedRuleEditorResources.CONSTANTS.CallMethodOn0(v), "CALL" + v);
        cmds.put("CALL" + v, new Command() {

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

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