Package org.drools.guvnor.client.modeldriven.ui

Examples of org.drools.guvnor.client.modeldriven.ui.BindingTextBox


        for ( int i = 0; i < sce.getFactTypes().length; i++ ) {
            types.addItem( sce.getFactTypes()[i] );
        }
        pop.addAttribute( constants.FactType(),
                          types );
        final TextBox binding = new BindingTextBox();
        binding.addChangeHandler( new ChangeHandler() {
            public void onChange(ChangeEvent event) {
                binding.setText( binding.getText().replace( " ",
                                                            "" ) );
            }
        } );
        pop.addAttribute( constants.Binding(),
                          binding );

        //Patterns can be negated, i.e. "not Pattern(...)"
        final CheckBox chkNegated = new CheckBox();
        pop.addAttribute( constants.negatePattern(),
                          chkNegated );

        Button ok = new Button( constants.OK() );
        ok.addClickHandler( new ClickHandler() {
            public void onClick(ClickEvent w) {

                String ft = types.getItemText( types.getSelectedIndex() );
                String fn = binding.getText();
                if ( fn.equals( "" ) ) {
                    Window.alert( constants.PleaseEnterANameForFact() );
                    return;
                } else if ( fn.equals( ft ) ) {
                    Window.alert( constants.PleaseEnterANameThatIsNotTheSameAsTheFactType() );
View Full Code Here


        for ( int i = 0; i < sce.getFactTypes().length; i++ ) {
            types.addItem( sce.getFactTypes()[i] );
        }
        pop.addAttribute( constants.FactType(),
                          types );
        final TextBox binding = new BindingTextBox();
        binding.addChangeHandler( new ChangeHandler() {
            public void onChange(ChangeEvent event) {
                binding.setText( binding.getText().replace( " ",
                                                            "" ) );
            }
        } );
        pop.addAttribute( constants.Binding(),
                          binding );

        //Patterns can be negated, i.e. "not Pattern(...)"
        final CheckBox chkNegated = new CheckBox();
        pop.addAttribute( constants.negatePattern(),
                          chkNegated );

        Button ok = new Button( constants.OK() );
        ok.addClickHandler( new ClickHandler() {
            public void onClick(ClickEvent w) {

                String ft = types.getItemText( types.getSelectedIndex() );
                String fn = binding.getText();
                if ( fn.equals( "" ) ) {
                    Window.alert( constants.PleaseEnterANameForFact() );
                    return;
                } else if ( fn.equals( ft ) ) {
                    Window.alert( constants.PleaseEnterANameThatIsNotTheSameAsTheFactType() );
View Full Code Here

                                   String[] fields,
                                   final PopupCreator popupCreator) {
        final FormStylePopup popup = new FormStylePopup();
        popup.setWidth( 500 + "px" );
        final HorizontalPanel vn = new HorizontalPanel();
        final TextBox varName = new BindingTextBox();
        if ( con.getFieldBinding() != null ) {
            varName.setText( con.getFieldBinding() );
        }
        final Button ok = new Button( constants.Set() );
        vn.add( varName );
        vn.add( ok );

        ok.addClickHandler( new ClickHandler() {
            public void onClick(ClickEvent event) {
                String var = varName.getText();
                if ( modeller.isVariableNameUsed( var ) ) {
                    Window.alert( constants.TheVariableName0IsAlreadyTaken( var ) );
                    return;
                }
                con.setFieldBinding( var );
View Full Code Here

     * not be editable.
     */
    private void doBindingEditor(final FormStylePopup popup) {
        if ( bindable || !(modeller.getModel().isBoundFactUsed( pattern.getBoundName() )) ) {
            HorizontalPanel varName = new HorizontalPanel();
            final TextBox varTxt = new BindingTextBox();
            if ( pattern.getBoundName() == null ) {
                varTxt.setText( "" );
            } else {
                varTxt.setText( pattern.getBoundName() );
            }

            varTxt.setVisibleLength( 6 );
            varName.add( varTxt );

            Button bindVar = new Button( constants.Set() );
            bindVar.addClickHandler( new ClickHandler() {
                public void onClick(ClickEvent event) {
                    String var = varTxt.getText();
                    if ( modeller.isVariableNameUsed( var ) ) {
                        Window.alert( constants.TheVariableName0IsAlreadyTaken( var ) );
                        return;
                    }
                    pattern.setBoundName( varTxt.getText() );
                    modeller.refreshWidget();
                    popup.hide();
                }
            } );

View Full Code Here

                                   String[] fields,
                                   final PopupCreator popupCreator) {
        final FormStylePopup popup = new FormStylePopup();
        popup.setWidth( 500 + "px" );
        final HorizontalPanel vn = new HorizontalPanel();
        final TextBox varName = new BindingTextBox();
        if ( con.getFieldBinding() != null ) {
            varName.setText( con.getFieldBinding() );
        }
        final Button ok = new Button( constants.Set() );
        vn.add( varName );
        vn.add( ok );

        ok.addClickHandler( new ClickHandler() {
            public void onClick(ClickEvent event) {
                String var = varName.getText();
                if ( modeller.isVariableNameUsed( var ) ) {
                    Window.alert( constants.TheVariableName0IsAlreadyTaken( var ) );
                    return;
                }
                con.setFieldBinding( var );
View Full Code Here

     * already bound, and the name is used, it should not be editable.
     */
    private void doBindingEditor(final FormStylePopup popup) {
        if ( bindable || !(modeller.getModel().isBoundFactUsed( pattern.getBoundName() )) ) {
            HorizontalPanel varName = new HorizontalPanel();
            final TextBox varTxt = new BindingTextBox();
            if ( pattern.getBoundName() == null ) {
                varTxt.setText( "" );
            } else {
                varTxt.setText( pattern.getBoundName() );
            }

            varTxt.setVisibleLength( 6 );
            varName.add( varTxt );

            Button bindVar = new Button( constants.Set() );
            bindVar.addClickHandler( new ClickHandler() {
                public void onClick(ClickEvent event) {
                    String var = varTxt.getText();
                    if ( modeller.isVariableNameUsed( var ) ) {
                        Window.alert( constants.TheVariableName0IsAlreadyTaken( var ) );
                        return;
                    }
                    pattern.setBoundName( varTxt.getText() );
                    modeller.refreshWidget();
                    popup.hide();
                }
            } );

View Full Code Here

TOP

Related Classes of org.drools.guvnor.client.modeldriven.ui.BindingTextBox

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.