Package org.drools.guvnor.client.common

Examples of org.drools.guvnor.client.common.FormStylePopup


            customFormPopUp.show( sfc.getId(),
                                  sfc.getValue() );
            return;
        }

        final FormStylePopup form = new FormStylePopup( images.newexWiz(),
                                                        constants.FieldValue() );

        Button lit = new Button( constants.LiteralValue() );
        lit.addClickHandler( new ClickHandler() {
            public void onClick(ClickEvent event) {
                con.setConstraintValueType( isDropDownDataEnum && dropDownData != null ? SingleFieldConstraint.TYPE_ENUM : SingleFieldConstraint.TYPE_LITERAL );
                doTypeChosen( form );
            }
        } );

        boolean showLiteralOrFormula = true;
        if ( con instanceof SingleFieldConstraint ) {
            SingleFieldConstraint sfc = (SingleFieldConstraint) con;
            String fieldName = sfc.getFieldName();
            if ( fieldName.equals( SuggestionCompletionEngine.TYPE_THIS ) ) {
                showLiteralOrFormula = SuggestionCompletionEngine.isCEPOperator( sfc.getOperator() );
            }
        } else if ( con instanceof ConnectiveConstraint ) {
            ConnectiveConstraint cc = (ConnectiveConstraint) con;
            String fieldName = cc.getFieldName();
            if ( fieldName.equals( SuggestionCompletionEngine.TYPE_THIS ) ) {
                showLiteralOrFormula = SuggestionCompletionEngine.isCEPOperator( cc.getOperator() );
            }
        }

        if ( showLiteralOrFormula ) {
            form.addAttribute( constants.LiteralValue() + ":",
                               widgets( lit,
                                        new InfoPopup( constants.LiteralValue(),
                                                       constants.LiteralValTip() ) ) );
        }

        if ( modeller.isTemplate() ) {
            String templateKeyLabel = constants.TemplateKey();
            Button templateKeyButton = new Button( templateKeyLabel );
            templateKeyButton.addClickHandler( new ClickHandler() {

                public void onClick(ClickEvent event) {
                    con.setConstraintValueType( BaseSingleFieldConstraint.TYPE_TEMPLATE );
                    doTypeChosen( form );
                }
            } );

            form.addAttribute( templateKeyLabel + ":",
                               widgets( templateKeyButton,
                                        new InfoPopup( templateKeyLabel,
                                                       constants.LiteralValTip() ) ) );
        }

        if ( showLiteralOrFormula ) {
            form.addRow( new HTML( "<hr/>" ) );
            form.addRow( new SmallLabel( constants.AdvancedOptions() ) );
        }

        //only want to show variables if we have some !
        List<String> bindingsInScope = this.model.getBoundVariablesInScope( this.constraint );
        if ( bindingsInScope.size() > 0
                || SuggestionCompletionEngine.TYPE_COLLECTION.equals( this.fieldType ) ) {

            List<String> applicableBindingsInScope = getApplicableBindingsInScope( bindingsInScope );
            if ( applicableBindingsInScope.size() > 0 ) {

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

                    public void onClick(ClickEvent event) {
                        con.setConstraintValueType( SingleFieldConstraint.TYPE_VARIABLE );
                        doTypeChosen( form );
                    }
                } );
                form.addAttribute( constants.AVariable(),
                                       widgets( variable,
                                                new InfoPopup( constants.ABoundVariable(),
                                                               constants.BoundVariableTip() ) ) );
            }
        }

        if ( showLiteralOrFormula ) {
            Button formula = new Button( constants.NewFormula() );
            formula.addClickHandler( new ClickHandler() {

                public void onClick(ClickEvent event) {
                    con.setConstraintValueType( SingleFieldConstraint.TYPE_RET_VALUE );
                    doTypeChosen( form );
                }
            } );

            form.addAttribute( constants.AFormula() + ":",
                               widgets( formula,
                                        new InfoPopup( constants.AFormula(),
                                                       constants.FormulaExpressionTip() ) ) );
        }

        Button expression = new Button( constants.ExpressionEditor() );
        expression.addClickHandler( new ClickHandler() {

            public void onClick(ClickEvent event) {
                con.setConstraintValueType( SingleFieldConstraint.TYPE_EXPR_BUILDER_VALUE );
                doTypeChosen( form );
            }
        } );

        form.addAttribute( constants.ExpressionEditor() + ":",
                           widgets( expression,
                                    new InfoPopup( constants.ExpressionEditor(),
                                                   constants.ExpressionEditor() ) ) );

        form.show();
    }
View Full Code Here


    private String userNameLoggedIn;

    public void show() {
        Image image = new Image(images.login());
        image.setAltText(ConstantsCore.INSTANCE.Login());
        final FormStylePopup pop = new FormStylePopup(image,
                constants.Login());

        final TextBox userName = new TextBox();
        pop.addAttribute(constants.UserName(),
                userName);
        final PasswordTextBox password = new PasswordTextBox();
        pop.addAttribute(constants.Password(),
                password);

        KeyPressHandler kph = new KeyPressHandler() {
            public void onKeyPress(KeyPressEvent event) {
                if (KeyCodes.KEY_ENTER == event.getNativeEvent().getKeyCode()) {
                    doLogin(userName,
                            password,
                            pop);
                }
            }
        };
        userName.addKeyPressHandler(kph);
        password.addKeyPressHandler(kph);

        Button b = new Button(constants.OK());
        b.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                doLogin(userName,
                        password,
                        pop);
            }
        });

        pop.addAttribute("",
                b);

        pop.setAfterShow(new Command() {
            public void execute() {
                Scheduler scheduler = Scheduler.get();
                scheduler.scheduleDeferred(new Command() {
                    public void execute() {
                        userName.setFocus(true);
                    }
                });
            }
        });

        pop.show();
    }
View Full Code Here

        LoadingPopup.showMessage( constants.CalculatingSource() );

        try {
            Image image = new Image(images.viewSource());
            image.setAltText(ConstantsCore.INSTANCE.ViewSource());
            FormStylePopup pop = new FormStylePopup(image,
                    constants.ViewingDiagram(),
                    800);

            pop.addRow( new ScrollPanel( ruleFlowViewer ) );
            pop.addRow( parameterPanel );

            pop.show();
        } catch (Exception e) {
            ErrorPopup.showMessage( constants.CouldNotCreateTheRuleflowDiagramItIsPossibleThatTheRuleflowFileIsInvalid() );
        }

        LoadingPopup.close();
View Full Code Here

    }

    private void showEditor(final String dependencyPath) {
        Image image = new Image(ImagesCore.INSTANCE.management());
        image.setAltText(ConstantsCore.INSTANCE.Management());
        final FormStylePopup editor = new FormStylePopup(image,
                "Edit Dependency");
        /*    editor.addRow(new HTML("<i>" + "Choose the version you want to depend on"
                + "</i>"));
        */
        editor.addAttribute("Dependency Path: ",
                new Label(decodeDependencyPath(dependencyPath)[0]));
        final VersionChooser versionChoose = new VersionChooser(clientFactory,
                eventBus,
                decodeDependencyPath(dependencyPath)[1],
                conf.getUuid(),
                decodeDependencyPath(dependencyPath)[0],
                new Command() {
                    public void execute() {
                        table.refresh();
                    }
                });
        editor.addAttribute("Dependency Version: ",
                versionChoose);

        HorizontalPanel hp = new HorizontalPanel();
        Button useSelectedVersionButton = new Button("Use selected version");
        hp.add(useSelectedVersionButton);
        useSelectedVersionButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent w) {
                String selectedVersion = versionChoose.getSelectedVersionName();
                if (selectedVersion == null) {
                    return;
                }
                if (Window.confirm("Are you sure you want to use version: " + selectedVersion + " as dependency?")) {
                    ModuleServiceAsync moduleService = GWT.create(ModuleService.class);
                    moduleService.updateDependency(
                            conf.getUuid(),
                            encodeDependencyPath(DependencyWidget
                                    .decodeDependencyPath(dependencyPath)[0],
                                    selectedVersion),
                            new GenericCallback<Void>() {
                                public void onSuccess(Void v) {
                                    editor.hide();
                                    table.refresh();
                                }
                            });
                }
            }
        });
        useSelectedVersionButton.setEnabled(!isHistoricalReadOnly);

        Button cancel = new Button(ConstantsCore.INSTANCE.Cancel());
        hp.add(cancel);
        cancel.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent w) {
                editor.hide();
            }
        });

        editor.addAttribute("",
                hp);
        editor.show();
    }
View Full Code Here

                break;
            case 6 :
                // TODO: Not a manager -Rikkola-
                Frame aboutInfoFrame = new Frame( "../AboutInfo.html" ); // NON-NLS

                FormStylePopup aboutPop = new FormStylePopup();
                aboutPop.setWidth( 600 + "px" );
                aboutPop.setTitle( constants.About() );
                String hhurl = GWT.getModuleBaseURL()
                               + "webdav";
                aboutPop.addAttribute( constants.WebDAVURL()
                                               + ":",
                                       new SmallLabel( "<b>"
                                                       + hhurl
                                                       + "</b>" ) );
                aboutPop.addAttribute( constants.Version()
                                               + ":",
                                       aboutInfoFrame );
                aboutPop.show();

                //When the popup is closed signal closure of place
                aboutPop.addCloseHandler( new CloseHandler<PopupPanel>() {

                    public void onClose(CloseEvent<PopupPanel> event) {
                        ManagerPlace place = new ManagerPlace( id );
                        eventBus.fireEvent( new ClosePlaceEvent( place ) );
                    }
View Full Code Here

    private Command       loggedInEvent;
    private String        userNameLoggedIn;

    public void show() {
        final FormStylePopup pop = new FormStylePopup( images.login(),
                                                       constants.Login() );

        final TextBox userName = new TextBox();
        pop.addAttribute( constants.UserName(),
                          userName );
        final PasswordTextBox password = new PasswordTextBox();
        pop.addAttribute( constants.Password(),
                          password );

        KeyPressHandler kph = new KeyPressHandler() {
            public void onKeyPress(KeyPressEvent event) {
                if ( KeyCodes.KEY_ENTER == event.getNativeEvent().getKeyCode() ) {
                    doLogin( userName,
                             password,
                             pop );
                }
            }
        };
        userName.addKeyPressHandler( kph );
        password.addKeyPressHandler( kph );

        Button b = new Button( constants.OK() );
        b.addClickHandler( new ClickHandler() {
            public void onClick(ClickEvent event) {
                doLogin( userName,
                         password,
                         pop );
            }
        } );

        pop.addAttribute( "",
                          b );
      
        pop.setAfterShow( new Command() {
            public void execute() {
                Scheduler scheduler = Scheduler.get();
                scheduler.scheduleDeferred( new Command() {
                    public void execute() {
                        userName.setFocus( true );
                    }
                });
            }
        } );

        pop.show();
    }
View Full Code Here

                                              String dependencyVersion) {
        return dependencyPath + "?version=" + dependencyVersion;
    }

    private void showEditor(final String dependencyPath) {
        final FormStylePopup editor = new FormStylePopup(images.management(),
                "Edit Dependency");
        /*    editor.addRow(new HTML("<i>" + "Choose the version you want to depend on"
                + "</i>"));
        */
        editor.addAttribute("Dependency Path: ",
                new Label(decodeDependencyPath(dependencyPath)[0]));
        final VersionChooser versionChoose = new VersionChooser(clientFactory,
                eventBus,
                decodeDependencyPath(dependencyPath)[1],
                conf.getUuid(),
                decodeDependencyPath(dependencyPath)[0],
                new Command() {
                    public void execute() {
                        table.refresh();
                    }
                });
        editor.addAttribute("Dependency Version: ",
                versionChoose);

        HorizontalPanel hp = new HorizontalPanel();
        Button useSelectedVersionButton = new Button("Use selected version");
        hp.add(useSelectedVersionButton);
        useSelectedVersionButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent w) {
                String selectedVersion = versionChoose.getSelectedVersionName();
                if (selectedVersion == null) {
                    return;
                }
                if (Window.confirm("Are you sure you want to use version: " + selectedVersion + " as dependency?")) {
                    RepositoryServiceFactory.getPackageService().updateDependency(
                            conf.getUuid(),
                            encodeDependencyPath(DependencyWidget
                                    .decodeDependencyPath(dependencyPath)[0],
                                    selectedVersion),
                            new GenericCallback<Void>() {
                                public void onSuccess(Void v) {
                                    editor.hide();
                                    table.refresh();
                                }
                            });
                }
            }
        });
        useSelectedVersionButton.setEnabled(!isHistoricalReadOnly);

        Button cancel = new Button(constants.Cancel());
        hp.add(cancel);
        cancel.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent w) {
                editor.hide();
            }
        });

        editor.addAttribute("",
                hp);
        editor.show();
    }
View Full Code Here

        RepositoryServiceFactory.getAssetService().loadRuleAsset( versionUUID,
                                                             new GenericCallback<Asset>() {

                                                                 public void onSuccess(Asset asset) {
                                                                     asset.setReadonly( true );
                                                                     final FormStylePopup pop = new FormStylePopup( images.snapshot(),
                                                                                                                    constants.VersionNumber0Of1(
                                                                                                                                   asset.getVersionNumber(),
                                                                                                                                   asset.getName() ),
                                                                             800);

                                                                     RuleViewerWrapper viewer = new RuleViewerWrapper(
                                                                             clientFactory,
                                                                             eventBus,
                                                                             asset,
                                                                             true
                                                                                                                                                          );
                                                                     viewer.setWidth( "100%" );
                                                                     viewer.setHeight( "100%" );

                                                                     pop.addRow( viewer );
                                                                     pop.show();
                                                                 }
                                                             } );
    }
View Full Code Here

                break;
            case 6 :
                // TODO: Not a manager -Rikkola-
                Frame aboutInfoFrame = new Frame( "../AboutInfo.html" ); // NON-NLS

                FormStylePopup aboutPop = new FormStylePopup();
                aboutPop.setWidth( 600 + "px" );
                aboutPop.setTitle( constants.About() );
                String hhurl = GWT.getModuleBaseURL()
                               + "webdav";
                aboutPop.addAttribute( constants.WebDAVURL()
                                               + ":",
                                       new SmallLabel( "<b>"
                                                       + hhurl
                                                       + "</b>" ) );
                aboutPop.addAttribute( constants.Version()
                                               + ":",
                                       aboutInfoFrame );
                aboutPop.show();

                //When the popup is closed signal closure of place
                aboutPop.addCloseHandler( new CloseHandler<PopupPanel>() {

                    public void onClose(CloseEvent<PopupPanel> event) {
                        ManagerPlace place = new ManagerPlace( id );
                        eventBus.fireEvent( new ClosePlaceEvent( place ) );
                    }
View Full Code Here

    private void doViewDiagram() {
        LoadingPopup.showMessage( constants.CalculatingSource() );

        try {
            FormStylePopup pop = new FormStylePopup( images.viewSource(),
                    constants.ViewingDiagram(),
                    800);

            pop.addRow( new ScrollPanel( ruleFlowViewer ) );
            pop.addRow( parameterPanel );

            pop.show();
        } catch (Exception e) {
            ErrorPopup.showMessage( constants.CouldNotCreateTheRuleflowDiagramItIsPossibleThatTheRuleflowFileIsInvalid() );
        }

        LoadingPopup.close();
View Full Code Here

TOP

Related Classes of org.drools.guvnor.client.common.FormStylePopup

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.