Package org.drools.workbench.models.datamodel.rule

Examples of org.drools.workbench.models.datamodel.rule.ExpressionMethod


            } else if ( this.readOnly ) {
                container.add( new Label( expressionPart.getName() ) );
            } else if ( expressionPart instanceof ExpressionMethod ) {
                container.add( new Label( expressionPart.getName() ) );
                container.add( new Label( "(" ) );
                final ExpressionMethod em = (ExpressionMethod) expressionPart;
                final List<ExpressionFormLine> emParams = em.getOrderedParams();
                for ( int index = 0; index < emParams.size(); index++ ) {
                    final ExpressionFormLine paramValueHolder = emParams.get( index );
                    final String paramDataType = em.getParameterDataType( paramValueHolder );
                    final ExpressionMethodParameter paramValue = ( (ExpressionMethodParameter) paramValueHolder.getRootExpression() );
                    final TextBox paramValueEditor = TextBoxFactory.getTextBox( paramDataType );
                    paramValueEditor.addValueChangeHandler( new ValueChangeHandler<String>() {
                        @Override
                        public void onValueChange( ValueChangeEvent<String> event ) {
View Full Code Here


                                          callback.callback( new ExpressionCollection( methodName,
                                                                                       mi.getReturnClassType(),
                                                                                       mi.getGenericType(),
                                                                                       mi.getParametricReturnType() ) );
                                      } else {
                                          callback.callback( new ExpressionMethod( mi.getName(),
                                                                                   mi.getReturnClassType(),
                                                                                   mi.getGenericType() ) );
                                      }
                                  }
                              } );
View Full Code Here

        return lb;
    }

    private void onCollectionChange( String value ) {
        if ( "size".contains( value ) ) {
            expression.appendPart( new ExpressionMethod( "size",
                                                         "int",
                                                         DataType.TYPE_NUMERIC_INTEGER ) );
        } else if ( "isEmpty".equals( value ) ) {
            expression.appendPart( new ExpressionMethod( "isEmpty",
                                                         "boolean",
                                                         DataType.TYPE_BOOLEAN ) );
        } else {
            ExpressionCollectionIndex collectionIndex;
            String factName = getDataModelOracle().getFactNameFromType( getCurrentParametricType() );
            if ( getCurrentParametricType() != null && factName != null ) {
                collectionIndex = new ExpressionCollectionIndex( "get",
                                                                 getCurrentParametricType(),
                                                                 factName );
            } else {
                collectionIndex = new ExpressionCollectionIndex( "get",
                                                                 "java.lang.Object",
                                                                 DataType.TYPE_OBJECT );
            }
            if ( "first".equals( value ) ) {
                collectionIndex.putParam( "index",
                                          new ExpressionFormLine( new ExpressionText( "0" ) ) );
                expression.appendPart( collectionIndex );
            } else if ( "last".equals( value ) ) {
                ExpressionFormLine index = new ExpressionFormLine( expression );
                index.appendPart( new ExpressionMethod( "size",
                                                        "int",
                                                        DataType.TYPE_NUMERIC_INTEGER ) );
                index.appendPart( new ExpressionText( "-1" ) );

                collectionIndex.putParam( "index",
View Full Code Here

            onCollectionChange( value );
            onChangeSelectionUpdateExpressionWidget( oldType );

        } else if ( DataType.TYPE_STRING.equals( getCurrentGenericType() ) ) {
            if ( "size".equals( value ) ) {
                expression.appendPart( new ExpressionMethod( "size",
                                                             "int",
                                                             DataType.TYPE_NUMERIC_INTEGER ) );
            } else if ( "isEmpty".equals( value ) ) {
                expression.appendPart( new ExpressionText( ".size() == 0",
                                                           "",
View Full Code Here

                                          callback.callback( new ExpressionCollection( methodName,
                                                                                       mi.getReturnClassType(),
                                                                                       mi.getGenericType(),
                                                                                       mi.getParametricReturnType() ) );
                                      } else {
                                          callback.callback( new ExpressionMethod( mi.getName(),
                                                                                   mi.getReturnClassType(),
                                                                                   mi.getGenericType() ) );
                                      }
                                  }
                              } );
View Full Code Here

                                  part.getParametricType() ) );
        moveNext( part );
    }

    public void visit( ExpressionMethod part ) {
        ExpressionMethod method = new ExpressionMethod( part.getName(),
                                                        part.getClassType(),
                                                        part.getGenericType(),
                                                        part.getParametricType() );
        copyMethodParams( part,
                          method );
View Full Code Here

            ModelField currentField = findField( typeFields,
                                                 expressionPart );

            if (fieldName.endsWith(")")) {
                expression.appendPart(
                        new ExpressionMethod(
                                expressionPart,
                                getSimpleFactType(currentField.getClassName(),
                                        dmo),
                                getSimpleFactType(currentField.getType(),
                                        dmo)));
View Full Code Here

                                          callback.callback( new ExpressionCollection( mi.getName(),
                                                                                       mi.getReturnClassType(),
                                                                                       mi.getGenericType(),
                                                                                       mi.getParametricReturnType() ) );
                                      } else {
                                          callback.callback( new ExpressionMethod( mi.getName(),
                                                                                   mi.getReturnClassType(),
                                                                                   mi.getGenericType() ) );
                                      }
                                  }
                              } );
View Full Code Here

                                          callback.callback( new ExpressionCollection( mi.getName(),
                                                                                       mi.getReturnClassType(),
                                                                                       mi.getGenericType(),
                                                                                       mi.getParametricReturnType() ) );
                                      } else {
                                          final ExpressionMethod em = new ExpressionMethod( mi.getName(),
                                                                                            mi.getReturnClassType(),
                                                                                            mi.getGenericType(),
                                                                                            mi.getParametricReturnType() );
                                          //Add applicable parameters
                                          for ( int index = 0; index < mi.getParams().size(); index++ ) {
                                              final String paramDataType = mi.getParams().get( index );
                                              final ExpressionFormLine param = new ExpressionFormLine( index );
                                              param.appendPart( new ExpressionMethodParameter( "",
                                                                                               paramDataType,
                                                                                               paramDataType ) );
                                              em.putParam( paramDataType,
                                                           param );
                                          }

                                          callback.callback( em );
                                      }
View Full Code Here

            } else if ( this.readOnly ) {
                container.add( new Label( expressionPart.getName() ) );
            } else if ( expressionPart instanceof ExpressionMethod ) {
                container.add( new Label( expressionPart.getName() ) );
                container.add( new Label( "(" ) );
                final ExpressionMethod em = (ExpressionMethod) expressionPart;
                final List<ExpressionFormLine> emParams = em.getOrderedParams();
                for ( int index = 0; index < emParams.size(); index++ ) {
                    final ExpressionFormLine paramValueHolder = emParams.get( index );
                    final String paramDataType = em.getParameterDataType( paramValueHolder );
                    final ExpressionMethodParameter paramValue = ( (ExpressionMethodParameter) paramValueHolder.getRootExpression() );
                    final TextBox paramValueEditor = TextBoxFactory.getTextBox( paramDataType );
                    paramValueEditor.addValueChangeHandler( new ValueChangeHandler<String>() {
                        @Override
                        public void onValueChange( ValueChangeEvent<String> event ) {
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.datamodel.rule.ExpressionMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.