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();
}
});
}
}
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();
}
});
}
}
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();
}
});
}
}
}
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();
}
});
}
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();
}
});
}
}
Aggregations