Examples of TextBox


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

                       "y" );
            b.addItem( constants.didNotFire(),
                       "n" );
            b.addItem( constants.firedThisManyTimes(),
                       "e" );
            final TextBox num = new TextBox();
            num.setVisibleLength( 5 );

            if ( v.getExpectedFire() != null ) {
                b.setSelectedIndex( (v.getExpectedFire().booleanValue()) ? 0 : 1 );
                num.setVisible( false );
            } else {
                b.setSelectedIndex( 2 );
                String xc = (v.getExpectedCount() != null) ? "" + v.getExpectedCount().intValue() : "0";
                num.setText( xc );
            }

            b.addChangeHandler( new ChangeHandler() {
                public void onChange(ChangeEvent event) {
                    String s = b.getValue( b.getSelectedIndex() );
                    if ( s.equals( "y" ) || s.equals( "n" ) ) {
                        num.setVisible( false );
                        v.setExpectedFire( (s.equals( "y" )) ? Boolean.TRUE : Boolean.FALSE );
                        v.setExpectedCount( null );
                    } else {
                        num.setVisible( true );
                        v.setExpectedFire( null );
                        num.setText( "1" );
                        v.setExpectedCount( new Integer( 1 ) );
                    }
                }
            } );

            b.addItem( constants.ChooseDotDotDot() );

            num.addChangeHandler( new ChangeHandler() {
                public void onChange(ChangeEvent event) {
                    v.setExpectedCount( new Integer( num.getText() ) );
                }
            } );

            HorizontalPanel h = new HorizontalPanel();
            h.add( b );
            h.add( num );
            data.setWidget( i,
                            2,
                            h );

            Image del = new ImageButton( images.deleteItemSmall(),
                                         constants.RemoveThisRuleExpectation(),
                                         new ClickHandler() {
                                             public void onClick(ClickEvent w) {
                                                 if ( Window.confirm( constants.AreYouSureYouWantToRemoveThisRuleExpectation() ) ) {
                                                     rfl.remove( v );
                                                     sc.removeFixture( v );
                                                     outer.setWidget( 1,
                                                                      0,
                                                                      render( rfl,
                                                                              sc ) );
                                                 }
                                             }
                                         } );

            data.setWidget( i,
                            3,
                            del );

            //we only want numbers here...
            num.addKeyPressHandler( new KeyPressHandler() {
                public void onKeyPress(KeyPressEvent event) {
                    if ( Character.isLetter( event.getCharCode() ) ) {
                        ((TextBox) event.getSource()).cancelKey();
                    }
                }
View Full Code Here

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

        class ActivateRuleFlowPanel extends BasePanel<TextBox> {

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

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

            }

            @Override
            protected void initWidgets() {
                factNameTextBox = new TextBox();
                factNameTextBox.setVisibleLength( 5 );

                add( valueWidget );
                add( new SmallLabel( constants.FactName() ) );
                add( factNameTextBox );
View Full Code Here

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

    /**
     * An editor for the retval "formula" (expression).
     */
    private Widget returnValueEditor() {
        TextBox box = new BoundTextBox( constraint );

        if ( this.readOnly ) {
            return new SmallLabel( box.getText() );
        }

        String msg = constants.FormulaEvaluateToAValue();
        Image img = new Image( images.functionAssets() );
        img.setTitle( msg );
        box.setTitle( msg );
        box.addChangeHandler( new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                executeOnValueChangeCommand();
            }
        } );
View Full Code Here

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

     */
    public static KeyPressHandler getNumericFilter(final TextBox box) {
        return new KeyPressHandler() {

            public void onKeyPress(KeyPressEvent event) {
                TextBox w = (TextBox) event.getSource();
                char c = event.getCharCode();
                if ( Character.isLetter( c ) && c != '=' && !(box.getText().startsWith( "=" )) ) {
                    ((TextBox) w).cancelKey();
                }

View Full Code Here

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

    }

    private HorizontalPanel simulDate() {
        HorizontalPanel horizontalPanel = new HorizontalPanel();
        final String format = "yyyy-MM-dd HH:mm"; //NON-NLS
        final TextBox textBox = new TextBox();
        if ( executionTrace.getScenarioSimulatedDate() == null ) {
            textBox.setText( "<" + format + ">" );
        } else {
            textBox.setText( DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT).format(executionTrace.getScenarioSimulatedDate()));
        }
        final SmallLabel dateHint = new SmallLabel();
        textBox.addKeyUpHandler( new KeyUpHandler() {

            public void onKeyUp(KeyUpEvent event) {
                try {
                    String exampleDate = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT).format(new Date());
                    String suggestedDate = textBox.getText() + exampleDate.substring(textBox.getText().length());
                    Date d = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT).parse(suggestedDate);
                    dateHint.setText( DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT).format(d) );
                } catch ( Exception e ) {
                    dateHint.setText( "..."  );
                }
            }
        } );

        textBox.addChangeHandler( new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                if ( textBox.getText().trim().equals( "" ) ) {
                    textBox.setText( constants.currentDateAndTime() );
                } else {
                    try {
                        //Date d1 = new Date();
                        Date d = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT).parse(textBox.getText());
                        executionTrace.setScenarioSimulatedDate( d );
                        textBox.setText( DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT).format(d) );
                        dateHint.setText( "" );
                    } catch ( Exception e ) {
                        ErrorPopup.showMessage( constants.BadDateFormatPleaseTryAgainTryTheFormatOf0( format ) );
                    }
                }
View Full Code Here

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

    }

    public Widget getRuleSelectionWidget(final String packageName,
                                         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 );
View Full Code Here

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

            } 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

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

        }
        return listVariable;
    }

    private TextBox boundTextBox(final CallFieldValue c) {
        final TextBox box = new TextBox();
        box.setStyleName( "constraint-value-Editor" );
        if ( c.value == null ) {
            box.setText( "" );
        } else {
            if ( c.value.trim().equals( "" ) ) {
                c.value = "";
            }
            box.setText( c.value );
        }

        if ( c.value == null || c.value.length() < 5 ) {
            box.setVisibleLength( 6 );
        } else {
            box.setVisibleLength( c.value.length() - 1 );
        }

        box.addChangeHandler( new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                c.value = box.getText();
                if ( onValueChangeCommand != null ) {
                    onValueChangeCommand.execute();
                }
                makeDirty();
            }

        } );

        box.addKeyUpHandler( new KeyUpHandler() {

            public void onKeyUp(KeyUpEvent event) {
                box.setVisibleLength( box.getText().length() );
            }
        } );

        if ( methodParameter.type.equals( SuggestionCompletionEngine.TYPE_NUMERIC ) ) {
            box.addKeyPressHandler( new NumbericFilterKeyPressHandler( box ) );
        }

        return box;
    }
View Full Code Here

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

    private void refreshEditor() {
        String key = factType + "." + field.getName();
        String flType = sce.getFieldType( key );
        panel.clear();
        if ( flType != null && flType.equals( SuggestionCompletionEngine.TYPE_NUMERIC ) ) {
            final TextBox box = editableTextBox( callback,
                                                 field.getName(),
                                                 field.getValue() );
            box.addKeyPressHandler( new NumbericFilterKeyPressHandler( box ) );
            panel.add( box );
        } else if ( flType != null && flType.equals( SuggestionCompletionEngine.TYPE_BOOLEAN ) ) {
            String[] c = new String[]{"true", "false"};
            panel.add( new EnumDropDown( field.getValue(),
                                         new DropDownValueChanged() {
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.