private void addCallMethod( String itemText, int position ) { this.model.addRhsItem( new ActionCallMethod( itemText ), position ); }
public ActionFieldFunction getFieldValue( int i ) { return (ActionFieldFunction) this.getFieldValues()[ i ]; }
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( ", " ); } constraintValueBuilder.buildRHSFieldValue( buf, valueFunction.getType(), valueFunction.getValue() ); } buf.append( " );\n" ); } }
m.addRhsItem( actionGlobalCollectionAdd ); } else { ActionCallMethod acm = new ActionCallMethod(); acm.setMethodName( methodName ); acm.setVariable( variable ); m.addRhsItem( acm ); String params = unwrapParenthesis( line ); acm.addFieldValue( new ActionFieldFunction( null, adjustParam( dataType, param, isJavaDialect ), dataType ) );
a.getVariable() ); assertEquals( "addName", a.getMethodName() ); assertEquals( 1, a.getFieldValues().length ); final ActionFieldValue fv = a.getFieldValue( 0 ); assertEquals( "Michael", fv.getValue() );
public void onChange( ChangeEvent event ) { model.setState( ActionCallMethod.TYPE_DEFINED ); String methodName = box.getItemText( box.getSelectedIndex() ); String methodNameWithParams = box.getValue( box.getSelectedIndex() ); model.setMethodName( methodName ); List<String> fieldList = new ArrayList<String>(); fieldList.addAll( completions.getMethodParams( variableClass, methodNameWithParams ) ); int i = 0; for ( String fieldParameter : fieldList ) { model.addFieldValue( new ActionFieldFunction( methodName, String.valueOf( i ), fieldParameter ) ); i++; } getModeller().refreshWidget(); popup.hide(); } } );
private Widget getSetterLabel() { HorizontalPanel horiz = new HorizontalPanel(); if ( model.getState() == ActionCallMethod.TYPE_UNDEFINED ) { Image edit = GuidedRuleEditorImages508.INSTANCE.AddFieldToFact(); edit.setAltText( Constants.INSTANCE.AddAnotherFieldToThisSoYouCanSetItsValue() ); edit.setTitle( Constants.INSTANCE.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 valueEditor( final ActionFieldFunction val ) { DataModelOracle completions = this.getModeller().getSuggestionCompletions(); String type = ""; if ( completions.isGlobalVariable( this.model.getVariable() ) ) { type = completions.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(); } } DropDownData enums = completions.getEnums( type, val.getField(), FieldNatureUtil.toMap( this.model.getFieldValues() ) ); return new MethodParameterValueEditor( val, enums, this.getModeller(), val.getType(), new Command() { public void execute() { setModified( true ); } } ); }
private void doLayout() { layout.clear(); layout.setWidget( 0, 0, getSetterLabel() ); DirtyableFlexTable inner = new DirtyableFlexTable(); for ( int i = 0; i < model.getFieldValues().length; i++ ) { ActionFieldFunction val = model.getFieldValue( i ); inner.setWidget( i, 0, fieldSelector( val ) ); inner.setWidget( i, 1, valueEditor( val ) ); } layout.setWidget( 0, 1, inner ); }
if ( completions.isGlobalVariable( set.getVariable() ) ) { List<MethodInfo> infos = completions.getMethodInfosForGlobalVariable( set.getVariable() ); if ( infos != null ) { this.fieldCompletionTexts = new String[ infos.size() ]; this.variableClass = completions.getGlobalVariable( set.getVariable() ); FactPattern pattern = mod.getModel().getLHSBoundFact( set.getVariable() ); if ( pattern != null ) { List<String> methodList = completions.getMethodNames( pattern.getFactType() ); ActionInsertFact patternRhs = mod.getModel().getRHSBoundFact( set.getVariable() ); if ( patternRhs != null ) { List<String> methodList = completions.getMethodNames( patternRhs.getFactType() );
m.addLhsItem( p ); ActionCallMethod acm = new ActionCallMethod(); acm.setMethodName( "method" ); acm.setVariable( "$p" ); acm.addFieldValue( new ActionFieldFunction( "f1", "String", DataType.TYPE_STRING ) ); acm.addFieldValue( new ActionFieldFunction( "f2", "true", DataType.TYPE_BOOLEAN ) ); acm.addFieldValue( new ActionFieldFunction( "f3", "31-Jan-2012", DataType.TYPE_DATE ) ); acm.addFieldValue( new ActionFieldFunction( "f4", "100", DataType.TYPE_NUMERIC_INTEGER ) ); acm.addFieldValue( new ActionFieldFunction( "f5", "100", DataType.TYPE_NUMERIC_BIGDECIMAL ) );
m.addLhsItem( p ); ActionCallMethod acm = new ActionCallMethod(); acm.setMethodName( "method" ); acm.setVariable( "$p" ); acm.addFieldValue( new ActionFieldFunction( "f1", "String", DataType.TYPE_STRING ) ); acm.addFieldValue( new ActionFieldFunction( "f2", "true", DataType.TYPE_BOOLEAN ) ); acm.addFieldValue( new ActionFieldFunction( "f3", "31-Jan-2012", DataType.TYPE_DATE ) ); acm.addFieldValue( new ActionFieldFunction( "f4", "100", DataType.TYPE_NUMERIC_INTEGER ) ); acm.addFieldValue( new ActionFieldFunction( "f5", "100", DataType.TYPE_NUMERIC_BIGDECIMAL ) );