@Override public void callback(final List<MethodInfo> methodInfos) { if (methodInfos != null) { checkIfFactTypeKnown(methodInfos); setMethodInfos(methodInfos, oracle.getGlobalVariable(model.getVariable())); checkIfReadOnly(null); } else { ActionCallMethodWidget.this.fieldCompletionTexts = new String[0]; ActionCallMethodWidget.this.fieldCompletionValues = new String[0]; checkIfReadOnly(true); } } });
@Override public void callback(final List<MethodInfo> methodInfos) { if (methodInfos != null) { checkIfFactTypeKnown(methodInfos); setMethodInfos(methodInfos, oracle.getGlobalVariable(model.getVariable())); checkIfReadOnly(null); } else { ActionCallMethodWidget.this.fieldCompletionTexts = new String[0]; ActionCallMethodWidget.this.fieldCompletionValues = new String[0]; checkIfReadOnly(true); } } });
private void getMethodInfosForGlobalVariable() { oracle.getMethodInfosForGlobalVariable(model.getVariable(), new Callback<List<MethodInfo>>() { @Override public void callback(final List<MethodInfo> methodInfos) { if (methodInfos != null) { checkIfFactTypeKnown(methodInfos); setMethodInfos(methodInfos, oracle.getGlobalVariable(model.getVariable())); checkIfReadOnly(null); } else { ActionCallMethodWidget.this.fieldCompletionTexts = new String[0]; ActionCallMethodWidget.this.fieldCompletionValues = new String[0]; checkIfReadOnly(true); } } }); }
private void getMethodInfosForGlobalVariable() { oracle.getMethodInfosForGlobalVariable(model.getVariable(), new Callback<List<MethodInfo>>() { @Override public void callback(final List<MethodInfo> methodInfos) { if (methodInfos != null) { checkIfFactTypeKnown(methodInfos); setMethodInfos(methodInfos, oracle.getGlobalVariable(model.getVariable())); checkIfReadOnly(null); } else { ActionCallMethodWidget.this.fieldCompletionTexts = new String[0]; ActionCallMethodWidget.this.fieldCompletionValues = new String[0]; checkIfReadOnly(true); } } }); }
private String getVariableType() { String type; if (oracle.isGlobalVariable(this.model.getVariable())) { type = oracle.getGlobalVariable(this.model.getVariable()); } else { type = this.getModeller().getModel().getLHSBindingType(this.model.getVariable()); if (type == null) { type = this.getModeller().getModel().getRHSBoundFact(this.model.getVariable()).getFactType(); } } return type; }
private String getVariableType() { String type; if (oracle.isGlobalVariable(this.model.getVariable())) { type = oracle.getGlobalVariable(this.model.getVariable()); } else { type = this.getModeller().getModel().getLHSBindingType(this.model.getVariable()); if (type == null) { type = this.getModeller().getModel().getRHSBoundFact(this.model.getVariable()).getFactType(); } } return type; }
private void getMethodInfos() { if (oracle.isGlobalVariable(model.getVariable())) { getMethodInfosForGlobalVariable(); } else { getMethodInfosForBasicFactType(); } }
private String getFactTypeLHS() { FactPattern lhsBoundFact = modeller.getModel().getLHSBoundFact(model.getVariable()); if (lhsBoundFact != null) { return lhsBoundFact.getFactType(); } return null; }
private void getMethodInfos() { if (oracle.isGlobalVariable(model.getVariable())) { getMethodInfosForGlobalVariable(); } else { getMethodInfosForBasicFactType(); } }
private String getFactTypeFromRHS() { ActionInsertFact rhsBoundFact = modeller.getModel().getRHSBoundFact(model.getVariable()); if (rhsBoundFact != null) { return rhsBoundFact.getFactType(); } return null; }
private void generateSetMethodCallsMethod(final ActionCallMethod action, final FieldNature[] fieldValues) { buf.append(indentation); if (isDSLEnhanced) { buf.append(">"); } buf.append(action.getVariable()); buf.append("."); buf.append(action.getMethodName()); buf.append("( "); boolean isFirst = true; for (int i = 0; i < fieldValues.length; i++) { ActionFieldFunction valueFunction = (ActionFieldFunction) fieldValues[i]; if (isFirst == true) { isFirst = false; } else { buf.append(", "); } if (valueFunction.isFormula()) { buf.append(valueFunction.getValue()); } else if (valueFunction.getNature() == FieldNatureType.TYPE_VARIABLE) { buf.append(valueFunction.getValue()); } else { buildDefaultFieldValue(valueFunction, buf); } } buf.append(" );\n"); } }
private String getFactTypeFromRHS() { ActionInsertFact rhsBoundFact = modeller.getModel().getRHSBoundFact(model.getVariable()); if (rhsBoundFact != null) { return rhsBoundFact.getFactType(); } return null; }
private String getFactTypeLHS() { FactPattern lhsBoundFact = modeller.getModel().getLHSBoundFact(model.getVariable()); if (lhsBoundFact != null) { return lhsBoundFact.getFactType(); } return null; }
private String getFactTypeFromLHSField() { SingleFieldConstraint lhsBoundField = modeller.getModel().getLHSBoundField(model.getVariable()); if (lhsBoundField != null) { return oracle.getFieldClassName(lhsBoundField.getFactType(), lhsBoundField.getFieldName()); } else { return null; } }
private String getFactTypeFromLHSField() { SingleFieldConstraint lhsBoundField = modeller.getModel().getLHSBoundField(model.getVariable()); if (lhsBoundField != null) { return oracle.getFieldClassName(lhsBoundField.getFactType(), lhsBoundField.getFieldName()); } else { return null; } }
private ActionCallMethod visitActionCallMethod(ActionCallMethod acm) { ActionCallMethod clone = new ActionCallMethod(); clone.setVariable(acm.getVariable()); clone.setState(acm.getState()); clone.setMethodName(acm.getMethodName()); for (ActionFieldValue aff : acm.getFieldValues()) { clone.addFieldValue(cloneActionFieldFunction((ActionFieldFunction) aff)); } return clone; }
private ActionCallMethod visitActionCallMethod(ActionCallMethod acm) { ActionCallMethod clone = new ActionCallMethod(); clone.setVariable(acm.getVariable()); clone.setState(acm.getState()); clone.setMethodName(acm.getMethodName()); for (ActionFieldValue aff : acm.getFieldValues()) { clone.addFieldValue(cloneActionFieldFunction((ActionFieldFunction) aff)); } return clone; }
private Widget getSetterLabel() { HorizontalPanel horiz = new HorizontalPanel(); if (model.getState() == ActionCallMethod.TYPE_UNDEFINED) { Image edit = GuidedRuleEditorImages508.INSTANCE.AddFieldToFact(); edit.setAltText(GuidedRuleEditorResources.CONSTANTS.AddAnotherFieldToThisSoYouCanSetItsValue()); edit.setTitle(GuidedRuleEditorResources.CONSTANTS.AddAnotherFieldToThisSoYouCanSetItsValue()); edit.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Widget w = (Widget) event.getSource(); showAddFieldPopup(w); } }); horiz.add(new SmallLabel(HumanReadable.getActionDisplayName("call") + " [" + model.getVariable() + "]")); // NON-NLS if (!this.readOnly) { horiz.add(edit); } } else { horiz.add(new SmallLabel(HumanReadable.getActionDisplayName("call") + " [" + model.getVariable() + "." + model.getMethodName() + "]")); // NON-NLS } return horiz; }
private Widget getSetterLabel() { HorizontalPanel horiz = new HorizontalPanel(); if (model.getState() == ActionCallMethod.TYPE_UNDEFINED) { Image edit = GuidedRuleEditorImages508.INSTANCE.AddFieldToFact(); edit.setAltText(GuidedRuleEditorResources.CONSTANTS.AddAnotherFieldToThisSoYouCanSetItsValue()); edit.setTitle(GuidedRuleEditorResources.CONSTANTS.AddAnotherFieldToThisSoYouCanSetItsValue()); edit.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Widget w = (Widget) event.getSource(); showAddFieldPopup(w); } }); horiz.add(new SmallLabel(HumanReadable.getActionDisplayName("call") + " [" + model.getVariable() + "]")); // NON-NLS if (!this.readOnly) { horiz.add(edit); } } else { horiz.add(new SmallLabel(HumanReadable.getActionDisplayName("call") + " [" + model.getVariable() + "." + model.getMethodName() + "]")); // NON-NLS } return horiz; }
private ActionSetField clone(final ActionSetField action) { if (action instanceof ActionUpdateField) { final ActionUpdateField auf = (ActionUpdateField) action; final ActionUpdateField clone = new ActionUpdateField(auf.getVariable()); clone.setFieldValues(auf.getFieldValues()); return clone; } else if (action instanceof ActionCallMethod) { final ActionCallMethod acm = (ActionCallMethod) action; final ActionCallMethod clone = new ActionCallMethod(acm.getVariable()); clone.setState(acm.getState()); clone.setMethodName(acm.getMethodName()); clone.setFieldValues(acm.getFieldValues()); return clone; } else if (action instanceof ActionSetField) { final ActionSetField clone = new ActionSetField(action.getVariable()); clone.setFieldValues(action.getFieldValues()); return clone; } else { return action; } } }