Examples of FormStylePopup


Examples of org.uberfire.client.common.FormStylePopup

    /**
     * This shows a popup for adding fields to a composite
     */
    public void showPatternPopupForComposite( Widget w,
                                              final HasConstraints hasConstraints ) {
        final FormStylePopup popup = new FormStylePopup( GuidedRuleEditorImages508.INSTANCE.Wizard(),
                                                         Constants.INSTANCE.AddFieldsToThisConstraint() );

        final ListBox box = new ListBox();
        box.addItem( "..." );
        String[] fields = this.completions.getFieldCompletions( this.pattern.getFactType() );
        for ( int i = 0; i < fields.length; i++ ) {
            box.addItem( fields[ i ] );
        }

        box.setSelectedIndex( 0 );

        box.addChangeHandler( new ChangeHandler() {
            public void onChange( ChangeEvent event ) {
                String factType = pattern.getFactType();
                String fieldName = box.getItemText( box.getSelectedIndex() );
                String fieldType = getCompletions().getFieldType( factType,
                                                                  fieldName );
                hasConstraints.addConstraint( new SingleFieldConstraint( factType,
                                                                         fieldName,
                                                                         fieldType,
                                                                         null ) );
                modeller.refreshWidget();
                popup.hide();
            }
        } );
        popup.addAttribute( Constants.INSTANCE.AddARestrictionOnAField(),
                            box );

        final ListBox composites = new ListBox();
        composites.addItem( "..." ); //NON-NLS
        composites.addItem( Constants.INSTANCE.AllOfAnd(),
                            CompositeFieldConstraint.COMPOSITE_TYPE_AND );
        composites.addItem( Constants.INSTANCE.AnyOfOr(),
                            CompositeFieldConstraint.COMPOSITE_TYPE_OR );
        composites.setSelectedIndex( 0 );

        composites.addChangeHandler( new ChangeHandler() {
            public void onChange( ChangeEvent event ) {
                CompositeFieldConstraint comp = new CompositeFieldConstraint();
                comp.setCompositeJunctionType( composites.getValue( composites.getSelectedIndex() ) );
                hasConstraints.addConstraint( comp );
                modeller.refreshWidget();
                popup.hide();
            }
        } );

        InfoPopup infoComp = new InfoPopup( Constants.INSTANCE.MultipleFieldConstraints(),
                                            Constants.INSTANCE.MultipleConstraintsTip() );

        HorizontalPanel horiz = new HorizontalPanel();
        horiz.add( composites );
        horiz.add( infoComp );
        popup.addAttribute( Constants.INSTANCE.MultipleFieldConstraint(),
                            horiz );

        //Include Expression Editor
        popup.addRow( new SmallLabel( "<i>" + Constants.INSTANCE.AdvancedOptionsColon() + "</i>" ) );
        Button ebBtn = new Button( Constants.INSTANCE.ExpressionEditor() );

        ebBtn.addClickHandler( new ClickHandler() {
            public void onClick( ClickEvent event ) {
                SingleFieldConstraintEBLeftSide con = new SingleFieldConstraintEBLeftSide();
                con.setConstraintValueType( SingleFieldConstraint.TYPE_UNDEFINED );
                con.setExpressionLeftSide( new ExpressionFormLine( new ExpressionUnboundFact( pattern ) ) );
                hasConstraints.addConstraint( con );
                modeller.refreshWidget();
                popup.hide();
            }
        } );
        popup.addAttribute( Constants.INSTANCE.ExpressionEditor(),
                            ebBtn );

        popup.show();

    }
View Full Code Here

Examples of org.uberfire.client.common.FormStylePopup

        final String factType = getFactType( fp,
                                             con );

        String title = ( con == null ) ? Constants.INSTANCE.ModifyConstraintsFor0( fp.getFactType() ) : Constants.INSTANCE.AddSubFieldConstraint();
        final FormStylePopup popup = new FormStylePopup( GuidedRuleEditorImages508.INSTANCE.Wizard(),
                                                         title );

        final ListBox box = new ListBox();
        box.addItem( "..." );
        String[] fields = this.completions.getFieldCompletions( FieldAccessorsAndMutators.ACCESSOR,
                                                                factType );
        for ( int i = 0; i < fields.length; i++ ) {
            //You can't use "this" in a nested accessor
            if ( !isNested || !fields[ i ].equals( DataType.TYPE_THIS ) ) {
                box.addItem( fields[ i ] );
            }
        }

        box.setSelectedIndex( 0 );

        box.addChangeHandler( new ChangeHandler() {
            public void onChange( ChangeEvent event ) {
                String fieldName = box.getItemText( box.getSelectedIndex() );
                if ( "...".equals( fieldName ) ) {
                    return;
                }
                String fieldType = completions.getFieldType( factType,
                                                             fieldName );
                fp.addConstraint( new SingleFieldConstraint( factType,
                                                             fieldName,
                                                             fieldType,
                                                             con ) );
                modeller.refreshWidget();
                popup.hide();
            }
        } );
        popup.addAttribute( Constants.INSTANCE.AddARestrictionOnAField(),
                            box );

        final ListBox composites = new ListBox();
        composites.addItem( "..." );
        composites.addItem( Constants.INSTANCE.AllOfAnd(),
                            CompositeFieldConstraint.COMPOSITE_TYPE_AND );
        composites.addItem( Constants.INSTANCE.AnyOfOr(),
                            CompositeFieldConstraint.COMPOSITE_TYPE_OR );
        composites.setSelectedIndex( 0 );

        composites.addChangeHandler( new ChangeHandler() {
            public void onChange( ChangeEvent event ) {
                CompositeFieldConstraint comp = new CompositeFieldConstraint();
                comp.setCompositeJunctionType( composites.getValue( composites.getSelectedIndex() ) );
                fp.addConstraint( comp );
                modeller.refreshWidget();
                popup.hide();
            }
        } );

        InfoPopup infoComp = new InfoPopup( Constants.INSTANCE.MultipleFieldConstraints(),
                                            Constants.INSTANCE.MultipleConstraintsTip1() );

        HorizontalPanel horiz = new HorizontalPanel();

        horiz.add( composites );
        horiz.add( infoComp );
        if ( con == null ) {
            popup.addAttribute( Constants.INSTANCE.MultipleFieldConstraint(),
                                horiz );
        }

        if ( con == null ) {
            popup.addRow( new SmallLabel( "<i>" + Constants.INSTANCE.AdvancedOptionsColon() + "</i>" ) ); //NON-NLS
            Button predicate = new Button( Constants.INSTANCE.NewFormula() );
            predicate.addClickHandler( new ClickHandler() {
                public void onClick( ClickEvent event ) {
                    SingleFieldConstraint con = new SingleFieldConstraint();
                    con.setConstraintValueType( SingleFieldConstraint.TYPE_PREDICATE );
                    fp.addConstraint( con );
                    modeller.refreshWidget();
                    popup.hide();
                }
            } );
            popup.addAttribute( Constants.INSTANCE.AddANewFormulaStyleExpression(),
                                predicate );

            Button ebBtn = new Button( Constants.INSTANCE.ExpressionEditor() );

            ebBtn.addClickHandler( new ClickHandler() {
                public void onClick( ClickEvent event ) {
                    SingleFieldConstraintEBLeftSide con = new SingleFieldConstraintEBLeftSide();
                    con.setConstraintValueType( SingleFieldConstraint.TYPE_UNDEFINED );
                    fp.addConstraint( con );
                    con.setExpressionLeftSide( new ExpressionFormLine( new ExpressionUnboundFact( pattern ) ) );
                    modeller.refreshWidget();
                    popup.hide();
                }
            } );
            popup.addAttribute( Constants.INSTANCE.ExpressionEditor(),
                                ebBtn );

            doBindingEditor( popup );
        }

        popup.show();
    }
View Full Code Here

Examples of org.uberfire.client.common.FormStylePopup

        final Button run = new Button(TestScenarioConstants.INSTANCE.RunScenario());
        run.setTitle(TestScenarioConstants.INSTANCE.RunScenarioTip());
        run.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                final FormStylePopup pop = new FormStylePopup();
                final TextBox sessionNameTextBox = new TextBox();       
                pop.addAttribute(TestScenarioConstants.INSTANCE.SessionName() + ":", sessionNameTextBox);

                Button ok = new Button("OK");
                ok.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        if(sessionNameTextBox.getText() == null || "".equals(sessionNameTextBox.getText())) {
                            Window.alert(TestScenarioConstants.INSTANCE.PleaseInputSessionName());
                            return;
                        }
                       
                        BusyPopup.showMessage(TestScenarioConstants.INSTANCE.BuildingAndRunningScenario());

                        testScenarioEditorService.call(new RemoteCallback<Void>() {
                            @Override
                            public void callback(Void v) {
                                pop.hide();
                                BusyPopup.close();
                                layout.clear();
                                layout.add(actions);
                                layout.add(results);
                                actions.setVisible(true);
                            }
                        },
                                new HasBusyIndicatorDefaultErrorCallback(TestRunnerWidget.this)
                        ).runScenario(path, scenario, sessionNameTextBox.getText());                       
                    }
                });
                pop.addAttribute( "", ok);
                pop.show();               
             }
        });

        actions.add(run);
        layout.add(actions);
View Full Code Here

Examples of org.uberfire.client.common.FormStylePopup

        return tb;
    }

    private void showTypeChoice(Widget w,
                                final VerifyField con) {
        final FormStylePopup form = new FormStylePopup(TestScenarioAltedImages.INSTANCE.Wizard(),
                TestScenarioConstants.INSTANCE.FieldValue() );

        Button lit = new Button( TestScenarioConstants.INSTANCE.LiteralValue() );
        lit.addClickHandler( new ClickHandler() {

            public void onClick(ClickEvent event) {
                con.setNature( FieldData.TYPE_LITERAL );
                doTypeChosen( form );
            }

        } );
        form.addAttribute( TestScenarioConstants.INSTANCE.LiteralValue() + ":",
                widgets( lit,
                        new InfoPopup( TestScenarioConstants.INSTANCE.LiteralValue(),
                                TestScenarioConstants.INSTANCE.LiteralValTip() ) ) );

        form.addRow( new HTML( "<hr/>" ) );
        form.addRow( new SmallLabel( TestScenarioConstants.INSTANCE.AdvancedOptions() ) );

        // If we are here, then there must be a bound variable compatible with
        // me

        Button variable = new Button( TestScenarioConstants.INSTANCE.BoundVariable() );
        variable.addClickHandler( new ClickHandler() {

            public void onClick(ClickEvent event) {
                con.setNature( FieldData.TYPE_VARIABLE );
                doTypeChosen( form );
            }
        } );
        form.addAttribute( TestScenarioConstants.INSTANCE.AVariable(),
                widgets( variable,
                        new InfoPopup( TestScenarioConstants.INSTANCE.ABoundVariable(),
                                TestScenarioConstants.INSTANCE.BoundVariableTip() ) ) );

        form.show();
    }
View Full Code Here

Examples of org.uberfire.client.common.FormStylePopup

        this.parent = parent;
    }

    @Override
    public void onClick(ClickEvent event) {
        final FormStylePopup pop = new FormStylePopup();
        pop.setTitle(TestScenarioConstants.INSTANCE.ChooseDotDotDot());

        pop.addAttribute(TestScenarioConstants.INSTANCE.ChooseAFieldToAdd(), createAddNewField(pop));

        pop.show();
    }
View Full Code Here

Examples of org.uberfire.client.common.FormStylePopup

        return horiz;
    }

    protected void showAddFieldPopup(Widget w) {
        final FormStylePopup popup = new FormStylePopup(TestScenarioAltedImages.INSTANCE.Wizard(),
                                                         TestScenarioConstants.INSTANCE.ChooseAMethodToInvoke() );
        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( TestScenarioConstants.INSTANCE.ChooseAMethodToInvoke(),
                            box );
        box.addChangeHandler( new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                mCall.setState( ActionCallMethod.TYPE_DEFINED );
                ListBox sourceW = (ListBox) event.getSource();
                String methodName = sourceW.getItemText( sourceW.getSelectedIndex() );
                String methodNameWithParams = sourceW.getValue( sourceW.getSelectedIndex() );

                mCall.setMethodName( methodName );
                List<String> fieldList = new ArrayList<String>();

                fieldList.addAll( dmo.getMethodParams( variableClass,
                                                       methodNameWithParams ) );

                // String fieldType = completions.getFieldType( variableClass,
                // fieldName );
                int i = 0;
                for ( String fieldParameter : fieldList ) {
                    mCall.addFieldValue( new CallFieldValue( methodName,
                                                             String.valueOf( i ),
                                                             fieldParameter ) );
                    i++;
                }

                parent.renderEditor();
                popup.hide();

            }
        } );

        popup.setPopupPosition( w.getAbsoluteLeft(),
                                w.getAbsoluteTop() );
        popup.show();

    }
View Full Code Here

Examples of org.uberfire.client.common.FormStylePopup

        initWidget(filter);
    }

    private void showRulePopup(final ListBox box,
                               final List<String> filterList) {
        final FormStylePopup pop = new FormStylePopup(TestScenarioAltedImages.INSTANCE.RuleAsset(),
                TestScenarioConstants.INSTANCE.SelectRule());

        Widget ruleSelector = scenarioWidgetComponentCreator.getRuleSelectionWidget(
                new RuleSelectionEvent() {
                    public void ruleSelected(String r) {
                        filterList.add(r);
                        box.addItem(r);
                        pop.hide();

                    }
                });

        pop.addRow(ruleSelector);

        pop.show();

    }
View Full Code Here

Examples of org.uberfire.client.common.FormStylePopup

    }

    private void addGlobalButtonClickHandler() {
        addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                final FormStylePopup popup = new NewGlobalPopup();
                popup.show();
            }
        });
    }
View Full Code Here

Examples of org.uberfire.client.common.FormStylePopup

        this.parent = scenarioWidget;
        this.dmo = dmo;

        addClickHandler( new ClickHandler() {
            public void onClick(ClickEvent event) {
                final FormStylePopup pop = getPopUp();
                pop.show();
            }
        } );
    }
View Full Code Here

Examples of org.uberfire.client.common.FormStylePopup

        } );
        return clickme;
    }

    protected void showTypeChoice(Widget w) {
        final FormStylePopup form = new FormStylePopup(TestScenarioAltedImages.INSTANCE.Wizard(),
                                                        TestScenarioConstants.INSTANCE.FieldValue() );
        Button lit = new Button( TestScenarioConstants.INSTANCE.LiteralValue() );
        lit.addClickHandler( new ClickHandler() {

            public void onClick(ClickEvent event) {
                methodParameter.nature = FieldData.TYPE_LITERAL;
                methodParameter.value = " ";
                makeDirty();
                refresh();
                form.hide();
            }

        } );
        form.addAttribute( TestScenarioConstants.INSTANCE.LiteralValue() + ":",
                           widgets( lit,
                                    new InfoPopup( TestScenarioConstants.INSTANCE.Literal(),
                                            TestScenarioConstants.INSTANCE.LiteralValTip() ) ) );
        form.addRow( new HTML( "<hr/>" ) );
        form.addRow( new SmallLabel( TestScenarioConstants.INSTANCE.AdvancedSection() ) );

        /*
         * If there is a bound variable that is the same type of the current
         * variable type, then show abutton
         */

        List<String> vars = model.getFactNamesInScope( ex,
                                                       true );
        for ( String v : vars ) {
            boolean createButton = false;
            Button variable = new Button( TestScenarioConstants.INSTANCE.BoundVariable() );
            FactData factData = (FactData) model.getFactTypes().get( v );
            if ( factData.getType().equals( this.parameterType ) ) {
                createButton = true;
            }
            if ( createButton == true ) {
                form.addAttribute( TestScenarioConstants.INSTANCE.BoundVariable() + ":",
                                   variable );
                variable.addClickHandler( new ClickHandler() {

                    public void onClick(ClickEvent event) {
                        methodParameter.nature = FieldData.TYPE_VARIABLE;
                        methodParameter.value = "=";
                        makeDirty();
                        refresh();
                        form.hide();
                    }

                } );
                break;
            }

        }
        form.show();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.