Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.ListBox


    protected void showAddFieldPopup(Widget w) {

        final FormStylePopup popup = new FormStylePopup( images.newexWiz(),
                                                         constants.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( constants.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( suggestionCompletionEngine.getMethodParams( variableClass,
View Full Code Here


        this.executionTrace = executionTrace;

        final HorizontalPanel simulDatePanel = simulDate();
        simulDatePanel.setVisible( isScenarioSimulatedDateSet() );

        final ListBox choice = new ListBox();

        choice.addItem( constants.UseRealDateAndTime() );
        choice.addItem( constants.UseASimulatedDateAndTime() );
        choice.setSelectedIndex( (executionTrace.getScenarioSimulatedDate() == null) ? 0 : 1 );
        choice.addChangeHandler( new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                if ( choice.getSelectedIndex() == 0 ) {
                    simulDatePanel.setVisible( false );
                    executionTrace.setScenarioSimulatedDate( null );
                } else {
                    simulDatePanel.setVisible( true );
                }
View Full Code Here

        public NewGlobalPopup() {
            super( images.ruleAsset(),
                   constants.NewGlobal() );

            factTypes = new ListBox();
            addButton = new AddButton();
            warning = getMissingGlobalsWarning();

            fillFactTypes();
View Full Code Here

                                         final RuleSelectionEvent selected) {
        final HorizontalPanel horizontalPanel = new HorizontalPanel();
        final TextBox ruleNameTextBox = scenarioWidgetComponentCreator.createRuleNameTextBox();
        horizontalPanel.add( ruleNameTextBox );
        if ( availableRules != null ) {
            final ListBox availableRulesBox = scenarioWidgetComponentCreator.createAvailableRulesBox( availableRules );
            availableRulesBox.setSelectedIndex( 0 );
            if ( availableRulesHandlerRegistration != null ) {
                availableRulesHandlerRegistration.removeHandler();
            }
            final ChangeHandler ruleSelectionCL = scenarioWidgetComponentCreator.createRuleChangeHandler( ruleNameTextBox,
                                                                                                          availableRulesBox );

            availableRulesHandlerRegistration = availableRulesBox.addChangeHandler( ruleSelectionCL );
            horizontalPanel.add( availableRulesBox );

        } else {

            final Button showList = new Button( constants.showListButton() );
            horizontalPanel.add( showList );
            showList.addClickHandler( new ClickHandler() {

                public void onClick(ClickEvent event) {
                    horizontalPanel.remove( showList );
                    final Image busy = new Image( images.searching() );
                    final Label loading = new SmallLabel( constants.loadingList1() );
                    horizontalPanel.add( busy );
                    horizontalPanel.add( loading );

                    Scheduler scheduler = Scheduler.get();
                    scheduler.scheduleDeferred( new Command() {
                        public void execute() {
                            RepositoryServiceFactory.getPackageService().listRulesInPackage( packageName,
                                                                                      createGenericCallback( horizontalPanel,
                                                                                                             ruleNameTextBox,
                                                                                                             busy,
                                                                                                             loading ) );
                        }

                        private GenericCallback<String[]> createGenericCallback(final HorizontalPanel horizontalPanel,
                                                                                final TextBox ruleNameTextBox,
                                                                                final Image busy,
                                                                                final Label loading) {
                            return new GenericCallback<String[]>() {

                                public void onSuccess(String[] list) {
                                    availableRules = (list);
                                    final ListBox availableRulesBox = scenarioWidgetComponentCreator.createAvailableRulesBox( list );

                                    final ChangeHandler ruleSelectionCL = new ChangeHandler() {
                                        public void onChange(ChangeEvent event) {
                                            ruleNameTextBox.setText( availableRulesBox.getItemText( availableRulesBox.getSelectedIndex() ) );
                                        }
                                    };
                                    availableRulesHandlerRegistration = availableRulesBox.addChangeHandler( ruleSelectionCL );
                                    availableRulesBox.setSelectedIndex( 0 );
                                    horizontalPanel.add( availableRulesBox );
                                    horizontalPanel.remove( busy );
                                    horizontalPanel.remove( loading );
                                }
View Full Code Here

                }
            }

            @Override
            public ListBox getWidget() {
                return new ListBox();
            }
View Full Code Here

                // we have a blank slate..
                // have to give them a choice
                root.add( choice() );
            } else {
                if ( methodParameter.nature == FieldNature.TYPE_VARIABLE ) {
                    ListBox list = boundVariable( methodParameter );
                    root.add( list );
                } else {
                    TextBox box = boundTextBox( this.methodParameter );
                    root.add( box );
                }
View Full Code Here

    private ListBox boundVariable(final FieldNature c) {
        /*
         * If there is a bound variable that is the same type of the current
         * variable type, then propose a list
         */
        final ListBox listVariable = new ListBox();
        List<String> vars = model.getFactNamesInScope( ex,
                                                       true );
        for ( String v : vars ) {
            FactData factData = (FactData) model.getFactTypes().get( v );
            if ( factData.getType().equals( this.methodParameter.type ) ) {
                // First selection is empty
                if ( listVariable.getItemCount() == 0 ) {
                    listVariable.addItem( "..." );
                }

                listVariable.addItem( "=" + v );
            }
        }
        if ( methodParameter.value.equals( "=" ) ) {
            listVariable.setSelectedIndex( 0 );
        } else {
            for ( int i = 0; i < listVariable.getItemCount(); i++ ) {
                if ( listVariable.getItemText( i ).equals( methodParameter.value ) ) {
                    listVariable.setSelectedIndex( i );
                }
            }
        }
        if ( listVariable.getItemCount() > 0 ) {

            listVariable.addChangeHandler( new ChangeHandler() {

                public void onChange(ChangeEvent event) {
                    methodParameter.value = listVariable.getValue( listVariable.getSelectedIndex() );
                    if ( onValueChangeCommand != null ) {
                        onValueChangeCommand.execute();
                    }
                    makeDirty();
                    refresh();
View Full Code Here

                }
                String[] fields = (String[]) suggestionCompletionEngine.getModelFields( type );
                final FormStylePopup pop = new FormStylePopup(); //NON-NLS
                pop.setTitle( constants.ChooseDotDotDot() );
                final ListBox fieldsListBox = new ListBox();
                for ( int i = 0; i < fields.length; i++ ) {
                    String field = fields[i];
                    if ( !existingFields.contains( field ) ) fieldsListBox.addItem( field );
                }

                Button ok = new Button( constants.OK() );
                ok.addClickHandler( new ClickHandler() {

                    public void onClick(ClickEvent event) {
                        String field = fieldsListBox.getItemText( fieldsListBox.getSelectedIndex() );
                        for ( Fixture fixture : definitionList ) {
                            if ( fixture instanceof FactData ) {
                                FactData factData = (FactData) fixture;
                                factData.getFieldData().add( new FieldData( field,
                                                                            "" ) );
View Full Code Here

    private Widget variableEditor(final ValueChanged changed) {
        List<String> vars = this.scenario.getFactNamesInScope( this.executionTrace,
                                                               true );

        final ListBox box = new ListBox();

        if ( this.field.getValue() == null ) {
            box.addItem( constants.Choose() );
        }
        int j = 0;
        for ( int i = 0; i < vars.size(); i++ ) {
            String var = (String) vars.get( i );
            FactData f = (FactData) this.scenario.getFactTypes().get( var );
            String fieldType = null;
            if ( field.collectionType == null ) {
                fieldType = sce.getFieldType( this.factType,
                                              field.getName() );
            } else {
                fieldType = field.collectionType;
            }

            if ( f.getType().equals( fieldType ) ) {
                if ( box.getItemCount() == 0 ) {
                    box.addItem( "..." );
                    j++;
                }
                box.addItem( "=" + var );
                if ( this.field.getValue() != null && this.field.getValue().equals( "=" + var ) ) {
                    box.setSelectedIndex( j );

                }
                j++;
            }
        }

        box.addChangeHandler( new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                field.setValue( box.getItemText( box.getSelectedIndex() ) );
                changed.valueChanged( field.getValue() );
            }
        } );

        return box;
View Full Code Here

            richText.addClickListener(listener);
        }
    }

    private ListBox createColorList(String caption) {
        ListBox lb = new ListBox();
        lb.addChangeListener(listener);
        lb.setVisibleItemCount(1);

        lb.addItem(caption);
        lb.addItem(strings.white(), "white");
        lb.addItem(strings.black(), "black");
        lb.addItem(strings.red(), "red");
        lb.addItem(strings.green(), "green");
        lb.addItem(strings.yellow(), "yellow");
        lb.addItem(strings.blue(), "blue");
        return lb;
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.ListBox

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.