private ActionFieldFunction cloneActionFieldFunction(ActionFieldFunction aff) { ActionFieldFunction clone = new ActionFieldFunction(); clone.setField(aff.getField()); clone.setNature(aff.getNature()); clone.setType(aff.getType()); clone.setValue(aff.getValue()); clone.setMethod(aff.getMethod()); return clone; }
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 void refresh() { root.clear(); if (enums != null && (enums.getFixedList() != null || enums.getQueryExpression() != null)) { root.add(new EnumDropDown(methodParameter.getValue(), new DropDownValueChanged() { public void valueChanged(String newText, String newValue) { setMethodParameterValue(newValue); } }, enums, modeller.getPath())); } else { if (methodParameter.getNature() == FieldNatureType.TYPE_UNDEFINED && methodParameter.getValue() == null) { // we have a blank slate.. // have to give them a choice root.add(choice()); } else { if (methodParameter.getNature() == FieldNatureType.TYPE_VARIABLE) { root.add(boundVariable()); } else if (methodParameter.getNature() == FieldNatureType.TYPE_FORMULA) { root.add(boundFormulaTextBox()); } else { root.add(boundLiteralTextBox()); } } } }
private ActionFieldFunction getActionFieldFunction(String param, String dataType) { param = removeNumericSuffix(param, dataType); final int fieldNature = inferFieldNature(dataType, param, boundParams, isJavaDialect); //If the field is a formula don't adjust the param value String paramValue = param; switch (fieldNature) { case FieldNatureType.TYPE_FORMULA: break; case FieldNatureType.TYPE_VARIABLE: break; case FieldNatureType.TYPE_TEMPLATE: paramValue = unwrapTemplateKey(param); break; default: paramValue = adjustParam(dataType, param, boundParams, isJavaDialect); } ActionFieldFunction actionField = new ActionFieldFunction(methodName, paramValue, dataType); actionField.setNature(fieldNature); return actionField; }
private TextBox boundLiteralTextBox() { final TextBox box = TextBoxFactory.getTextBox(methodParameter.getType()); // We need both handlers, since The textbox TextBoxFactory can return a box that changes the value in itself box.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { setMethodParameterValue(box.getValue()); } }); box.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { setMethodParameterValue(box.getValue()); } }); box.setStyleName("constraint-value-Editor"); if (this.methodParameter.getValue() != null || this.methodParameter.getValue().isEmpty()) { box.setValue(this.methodParameter.getValue()); } // This updates the model setMethodParameterValue(box.getValue()); return box; }
private void setEnums(DropDownData enums) { if (methodParameter.getType().equals(DataType.TYPE_BOOLEAN)) { this.enums = DropDownData.create(new String[]{"true", "false"}); } else { this.enums = enums; } }
callMethod1.setMethodName( "testMethod1 " ); callMethod1.setState( ActionCallMethod.TYPE_DEFINED ); callMethod1.addFieldValue( new ActionFieldFunction( "field1", "value1", "type1" ) ); model.addRhsItem( callMethod1 ); callMethod2.setMethodName( "testMethod2 " ); callMethod2.setState( ActionCallMethod.TYPE_UNDEFINED ); callMethod2.addFieldValue( new ActionFieldFunction( "field2", "value2", "type2" ) ); model.addRhsItem( callMethod2 );
private Widget valueEditor(final ActionFieldFunction val) { return new MethodParameterValueEditor( oracle, val, getEnums(val.getField()), this.getModeller(), new Command() { public void execute() { setModified(true); } }); }
private void setMethodParameterValue(String value) { methodParameter.setValue(value); if (onValueChangeCommand != null) { onValueChangeCommand.execute(); } }
private void refresh() { root.clear(); if (enums != null && (enums.getFixedList() != null || enums.getQueryExpression() != null)) { root.add(new EnumDropDown(methodParameter.getValue(), new DropDownValueChanged() { public void valueChanged(String newText, String newValue) { setMethodParameterValue(newValue); } }, enums, modeller.getPath())); } else { if (methodParameter.getNature() == FieldNatureType.TYPE_UNDEFINED && methodParameter.getValue() == null) { // we have a blank slate.. // have to give them a choice root.add(choice()); } else { if (methodParameter.getNature() == FieldNatureType.TYPE_VARIABLE) { root.add(boundVariable()); } else if (methodParameter.getNature() == FieldNatureType.TYPE_FORMULA) { root.add(boundFormulaTextBox()); } else { root.add(boundLiteralTextBox()); } } } }
private TextBox boundLiteralTextBox() { final TextBox box = TextBoxFactory.getTextBox(methodParameter.getType()); // We need both handlers, since The textbox TextBoxFactory can return a box that changes the value in itself box.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { setMethodParameterValue(box.getValue()); } }); box.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { setMethodParameterValue(box.getValue()); } }); box.setStyleName("constraint-value-Editor"); if (this.methodParameter.getValue() != null || this.methodParameter.getValue().isEmpty()) { box.setValue(this.methodParameter.getValue()); } // This updates the model setMethodParameterValue(box.getValue()); return box; }
private void setEnums(DropDownData enums) { if (methodParameter.getType().equals(DataType.TYPE_BOOLEAN)) { this.enums = DropDownData.create(new String[]{"true", "false"}); } else { this.enums = enums; } }
private Widget valueEditor(final ActionFieldFunction val) { return new MethodParameterValueEditor( oracle, val, getEnums(val.getField()), this.getModeller(), new Command() { public void execute() { setModified(true); } }); }
private void setMethodParameterValue(String value) { methodParameter.setValue(value); if (onValueChangeCommand != null) { onValueChangeCommand.execute(); } }
private ActionFieldFunction cloneActionFieldFunction(ActionFieldFunction aff) { ActionFieldFunction clone = new ActionFieldFunction(); clone.setField(aff.getField()); clone.setNature(aff.getNature()); clone.setType(aff.getType()); clone.setValue(aff.getValue()); clone.setMethod(aff.getMethod()); return clone; }