Package org.kie.workbench.common.widgets.client.datamodel

Examples of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle


                          inner );

    }

    private Widget valueEditor( final ActionFieldValue val ) {
        AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();
        DropDownData enums = oracle.getEnums( this.factType,
                                              val.getField(),
                                              FieldNatureUtil.toMap( this.model.getFieldValues() ) );

        ActionValueEditor actionValueEditor = new ActionValueEditor( val,
                                                                     enums,
View Full Code Here


                                   !this.readOnly );

    }

    protected void showAddFieldPopup( Widget w ) {
        final AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();

        final FormStylePopup popup = new FormStylePopup( GuidedRuleEditorImages508.INSTANCE.Wizard(),
                                                         Constants.INSTANCE.AddAField() );
        final ListBox box = new ListBox();
        box.addItem( "..." );

        for ( int i = 0; i < fieldCompletions.length; i++ ) {
            box.addItem( fieldCompletions[ i ].getName() );
        }

        box.setSelectedIndex( 0 );

        popup.addAttribute( Constants.INSTANCE.AddField(),
                            box );
        box.addChangeHandler( new ChangeHandler() {
            public void onChange( ChangeEvent event ) {
                String fieldName = box.getItemText( box.getSelectedIndex() );
                String fieldType = oracle.getFieldType( model.getFactType(),
                                                        fieldName );
                model.addFieldValue( new ActionFieldValue( fieldName,
                                                           "",
                                                           fieldType ) );
                setModified( true );
View Full Code Here

        this.model = set;
        this.layout = new DirtyableFlexTable();

        layout.setStyleName( "model-builderInner-Background" );

        AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();

        if ( oracle.isGlobalVariable( set.getVariable() ) ) {
            oracle.getFieldCompletionsForGlobalVariable( set.getVariable(),
                                                         new Callback<ModelField[]>() {
                                                             @Override
                                                             public void callback( ModelField[] fieldCompletions ) {
                                                                 ActionSetFieldWidget.this.fieldCompletions = fieldCompletions;
                                                             }
                                                         } );
            this.variableClass = oracle.getGlobalVariable( set.getVariable() );
        } else {
            String type = mod.getModel().getLHSBindingType( set.getVariable() );
            if ( type != null ) {
                oracle.getFieldCompletions( type,
                                            FieldAccessorsAndMutators.MUTATOR,
                                            new Callback<ModelField[]>() {
                                                @Override
                                                public void callback( final ModelField[] fields ) {
                                                    fieldCompletions = fields;
                                                }
                                            } );
                this.variableClass = type;
                this.isBoundFact = true;
            } else {
                ActionInsertFact patternRhs = mod.getModel().getRHSBoundFact( set.getVariable() );
                if ( patternRhs != null ) {
                    oracle.getFieldCompletions( patternRhs.getFactType(),
                                                FieldAccessorsAndMutators.MUTATOR,
                                                new Callback<ModelField[]>() {
                                                    @Override
                                                    public void callback( final ModelField[] fields ) {
                                                        fieldCompletions = fields;
                                                    }
                                                }
                                              );
                    this.variableClass = patternRhs.getFactType();
                    this.isBoundFact = true;
                }
            }
        }

        if ( this.variableClass == null ) {
            readOnly = true;
            ErrorPopup.showMessage( Constants.INSTANCE.CouldNotFindTheTypeForVariable0( set.getVariable() ) );
        }

        this.isFactTypeKnown = oracle.isFactTypeRecognized( this.variableClass );
        if ( readOnly == null ) {
            this.readOnly = !this.isFactTypeKnown;
        } else {
            this.readOnly = readOnly;
        }
View Full Code Here

                                   clk,
                                   !this.readOnly );//HumanReadable.getActionDisplayName(modifyType) + " value of <b>[" + model.variable + "]</b>", clk);
    }

    protected void showAddFieldPopup( ClickEvent w ) {
        final AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();
        final FormStylePopup popup = new FormStylePopup( GuidedRuleEditorImages508.INSTANCE.Wizard(),
                                                         Constants.INSTANCE.AddAField() );

        final ListBox box = new ListBox();
        box.addItem( "..." );

        for ( int i = 0; i < fieldCompletions.length; i++ ) {
            box.addItem( fieldCompletions[ i ].getName() );
        }

        box.setSelectedIndex( 0 );

        popup.addAttribute( Constants.INSTANCE.AddField(),
                            box );
        box.addChangeHandler( new ChangeHandler() {

            public void onChange( ChangeEvent event ) {
                String fieldName = box.getItemText( box.getSelectedIndex() );

                String fieldType = oracle.getFieldType( variableClass,
                                                        fieldName );
                model.addFieldValue( new ActionFieldValue( fieldName,
                                                           "",
                                                           fieldType ) );
                setModified( true );
View Full Code Here

        popup.show();

    }

    private Widget valueEditor( final ActionFieldValue val ) {
        AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();
        String type = "";
        if ( oracle.isGlobalVariable( this.model.getVariable() ) ) {
            type = oracle.getGlobalVariable( this.model.getVariable() );
        } else {
            type = this.getModeller().getModel().getLHSBindingType( this.model.getVariable() );
            /*
             * to take in account if the using a rhs bound variable
             */
            if ( type == null && !this.readOnly ) {
                type = this.getModeller().getModel().getRHSBoundFact( this.model.getVariable() ).getFactType();
            }
        }

        DropDownData enums = oracle.getEnums( type,
                                              val.getField(),
                                              FieldNatureUtil.toMap( this.model.getFieldValues() ) );
        ActionValueEditor actionValueEditor = new ActionValueEditor( val,
                                                                     enums,
                                                                     this.getModeller(),
View Full Code Here

    /**
     * Pops up the fact selector.
     */
    protected void showRightPatternSelector( final Widget w ) {
        final ListBox box = new ListBox();
        AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();
        String[] facts = oracle.getFactTypes();

        box.addItem( Constants.INSTANCE.Choose() );
        for ( int i = 0; i < facts.length; i++ ) {
            box.addItem( facts[ i ] );
        }
View Full Code Here

        this.model = set;
        this.layout = new DirtyableFlexTable();

        layout.setStyleName( "model-builderInner-Background" ); // NON-NLS

        final AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();
        if ( oracle.isGlobalVariable( set.getVariable() ) ) {

            oracle.getMethodInfosForGlobalVariable( set.getVariable(),
                                                    new Callback<List<MethodInfo>>() {
                                                        @Override
                                                        public void callback( final List<MethodInfo> infos ) {
                                                            if ( infos != null ) {
                                                                ActionCallMethodWidget.this.fieldCompletionTexts = new String[ infos.size() ];
                                                                ActionCallMethodWidget.this.fieldCompletionValues = new String[ infos.size() ];
                                                                int i = 0;
                                                                for ( MethodInfo info : infos ) {
                                                                    ActionCallMethodWidget.this.fieldCompletionTexts[ i ] = info.getName();
                                                                    ActionCallMethodWidget.this.fieldCompletionValues[ i ] = info.getNameWithParameters();
                                                                    i++;
                                                                }

                                                                ActionCallMethodWidget.this.variableClass = oracle.getGlobalVariable( set.getVariable() );

                                                            } else {
                                                                ActionCallMethodWidget.this.fieldCompletionTexts = new String[ 0 ];
                                                                ActionCallMethodWidget.this.fieldCompletionValues = new String[ 0 ];
                                                                ActionCallMethodWidget.this.readOnly = true;
                                                            }
                                                        }
                                                    } );

        } else {

            final FactPattern pattern = mod.getModel().getLHSBoundFact( set.getVariable() );
            if ( pattern != null ) {
                oracle.getMethodNames( pattern.getFactType(),
                                       new Callback<List<String>>() {
                                           @Override
                                           public void callback( final List<String> methodList ) {
                                               ActionCallMethodWidget.this.fieldCompletionTexts = new String[ methodList.size() ];
                                               ActionCallMethodWidget.this.fieldCompletionValues = new String[ methodList.size() ];
                                               int i = 0;
                                               for ( String methodName : methodList ) {
                                                   ActionCallMethodWidget.this.fieldCompletionTexts[ i ] = methodName;
                                                   ActionCallMethodWidget.this.fieldCompletionValues[ i ] = methodName;
                                                   i++;
                                               }
                                               ActionCallMethodWidget.this.variableClass = pattern.getFactType();
                                               ActionCallMethodWidget.this.isBoundFact = true;

                                           }
                                       } );

            } else {
                /*
                 * if the call method is applied on a bound variable created in the rhs
                 */
                final ActionInsertFact patternRhs = mod.getModel().getRHSBoundFact( set.getVariable() );
                if ( patternRhs != null ) {
                    oracle.getMethodNames( patternRhs.getFactType(),
                                           new Callback<List<String>>() {
                                               @Override
                                               public void callback( final List<String> methodList ) {
                                                   ActionCallMethodWidget.this.fieldCompletionTexts = new String[ methodList.size() ];
                                                   ActionCallMethodWidget.this.fieldCompletionValues = new String[ methodList.size() ];
                                                   int i = 0;
                                                   for ( String methodName : methodList ) {
                                                       ActionCallMethodWidget.this.fieldCompletionTexts[ i ] = methodName;
                                                       ActionCallMethodWidget.this.fieldCompletionValues[ i ] = methodName;
                                                       i++;
                                                   }
                                                   ActionCallMethodWidget.this.variableClass = patternRhs.getFactType();
                                                   ActionCallMethodWidget.this.isBoundFact = true;
                                               }
                                           } );
                } else {
                    this.readOnly = true;
                }
            }
        }

        this.isFactTypeKnown = oracle.isFactTypeRecognized( this.variableClass );
        if ( readOnly == null ) {
            this.readOnly = !this.isFactTypeKnown;
        } else {
            this.readOnly = readOnly;
        }
View Full Code Here

        return horiz;
    }

    protected void showAddFieldPopup( Widget w ) {

        final AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();

        final FormStylePopup popup = new FormStylePopup( GuidedRuleEditorImages508.INSTANCE.Wizard(),
                                                         Constants.INSTANCE.ChooseAMethodToInvoke() );
        final ListBox box = new ListBox();
        box.addItem( "..." );

        for ( int i = 0; i < fieldCompletionTexts.length; i++ ) {
            box.addItem( fieldCompletionTexts[ i ],
                         fieldCompletionValues[ i ] );
        }

        box.setSelectedIndex( 0 );

        popup.addAttribute( Constants.INSTANCE.ChooseAMethodToInvoke(),
                            box );
        box.addChangeHandler( new ChangeHandler() {

            public void onChange( ChangeEvent event ) {

                final String methodName = box.getItemText( box.getSelectedIndex() );
                final String methodNameWithParams = box.getValue( box.getSelectedIndex() );

                model.setMethodName( methodName );
                model.setState( ActionCallMethod.TYPE_DEFINED );

                oracle.getMethodParams( variableClass,
                                        methodNameWithParams,
                                        new Callback<List<String>>() {
                                            @Override
                                            public void callback( final List<String> methodParameters ) {
                                                int i = 0;
View Full Code Here

    }

    private Widget valueEditor( final ActionFieldFunction val ) {

        AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();

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

        DropDownData enums = oracle.getEnums( type,
                                              val.getField(),
                                              FieldNatureUtil.toMap( this.model.getFieldValues() ) );

        return new MethodParameterValueEditor( val,
                                               enums,
View Full Code Here

    /**
     * Pops up the fact selector.
     */
    protected void showFactTypeSelector( final Widget w ) {
        AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();
        final ListBox box = new ListBox();
        String[] facts = oracle.getFactTypes();

        box.addItem( Constants.INSTANCE.Choose() );

        for ( int i = 0; i < facts.length; i++ ) {
            box.addItem( facts[ i ] );
View Full Code Here

TOP

Related Classes of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle

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.