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

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


    header.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    status = new Label("Ready");
    header.add(status);

    this.bodyWidget = new RichTextArea();
    bodyWidget.addKeyboardListener(new KeyboardListenerAdapter() {
      @Override
      public void onKeyPress(Widget sender, char keyCode, int modifiers) {
        String newText = bodyWidget.getText();
        if (((newText == null) && (curText != null))
            || ((newText != null) && !newText.equals(curText))) {
View Full Code Here


    vpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    vpanel.add( new Label( "Sign in name:") );
    vpanel.add( nameBox );
    vpanel.add( signInButton );
    mainPanel.add( vpanel );
    nameBox.addKeyboardListener(new KeyboardListenerAdapter() {
           public void onKeyPress(Widget sender, char keyCode, int modifiers)
           {
               if(keyCode == KEY_ENTER )
                 signIn();
           }});
View Full Code Here

        // Create the TextBox element used for non word wrapped Labels
        // and add a KeyboardListener for Return and Esc key presses
        changeText = new TextBox();
        changeText.setStyleName("editableLabel-textBox");

        changeText.addKeyboardListener(new KeyboardListenerAdapter() {
            public void onKeyPress(Widget sender, char keyCode,
                    int modifiers) {
                // If return then save, if Esc cancel the change,
                // otherwise do nothing
                switch (keyCode) {
                case 13:
                    setTextLabel();
                    break;
                case 27:
                    cancelLabelChange();
                    break;
                }
            }
        });

        // Create the TextAre element used for word-wrapped Labels
        // and add a KeyboardListener for Esc key presses (not return in
        // this case)

        changeTextArea = new TextArea();
        changeTextArea.setStyleName("editableLabel-textArea");

        changeTextArea.addKeyboardListener(new KeyboardListenerAdapter() {
            public void onKeyPress(Widget sender, char keyCode,
                    int modifiers) {
                // If Esc then cancel the change, otherwise do nothing
                switch (keyCode) {
                case 27:
View Full Code Here

        VerticalPanel uptab = new VerticalPanel();
        username = new TextBox();
        username.setName("j_username");
        username.setText(lastNameEntered);

        KeyboardListener enterListener = new KeyboardListenerAdapter() {
            public void onKeyPress(Widget sender, char keyCode,
                    int modifiers) {
                if (keyCode == KEY_ENTER) {
                    form.submit();
                }
View Full Code Here

    /**
     *
     */
    private void initListeners()
    {
        name.addKeyboardListener(new KeyboardListenerAdapter()
        {
            public void onKeyUp(Widget sender, char keyCode, int modifiers)
            {
                if (name.getText().trim().length() > 0)
                {
View Full Code Here

                public void onChange(final Widget sender) {
                    final TextBox tb = (TextBox)sender;
                    person.setName(tb.getText());
                }
            });
            tb.addKeyboardListener(new KeyboardListenerAdapter() {
                public void onKeyUp(final Widget sender, final char keyCode, final int modifiers) {
                    super.onKeyUp(sender, keyCode, modifiers);
                    if (KeyboardListener.KEY_ENTER == keyCode) {
                        final TextBox tb = (TextBox)sender;
                        tb.setFocus(false);
View Full Code Here

                            return l < person.getAge() && person.getAge() < u;
                        }
                    });
                }
            });
            lower.addKeyboardListener(new KeyboardListenerAdapter(){
                public void onKeyUp(final Widget sender, final char keyCode, final int modifiers) {
                    super.onKeyUp(sender, keyCode, modifiers);
                    if (KeyboardListener.KEY_ENTER == keyCode) {
                        filterButton.click();
                    }
                }
            });
            upper.addKeyboardListener(new KeyboardListenerAdapter(){
                public void onKeyUp(final Widget sender, final char keyCode, final int modifiers) {
                    super.onKeyUp(sender, keyCode, modifiers);
                    if (KeyboardListener.KEY_ENTER == keyCode) {
                        filterButton.click();
                    }
                }
            });
            final HorizontalPanel hp = new HorizontalPanel();
            hp.add(new Label("From:"));
            hp.add(lower);
            hp.add(new Label("to:"));
            hp.add(upper);
            hp.add(filterButton);
            fp.add(hp);
        }

        if (rel != null) {
            final TextBox maxSize = new TextBox();
            maxSize.setWidth("3em");
            maxSize.setText(Integer.toString(rel.getMaxSize()));
            rel.addListEventListener(new ListEventListener() {
                public void listChanged(final ListEvent listEvent) {
                    maxSize.setText(Integer.toString(rel.getMaxSize()));
                }
            });
            maxSize.setTitle("Enter the size of each page");
            final Button setMaxSize = new Button("Set maxSize");
            setMaxSize.addClickListener(new ClickListener() {
                public void onClick(final Widget sender) {
                    try {
                        rel.setMaxSize(Integer.parseInt(maxSize.getText()));
                    } catch (NumberFormatException nfe) {
                        Window.alert("maxSize must be a integer");
                    }
                }
            });
            maxSize.addKeyboardListener(new KeyboardListenerAdapter() {
                public void onKeyUp(final Widget sender, final char keyCode, final int modifiers) {
                    super.onKeyUp(sender, keyCode, modifiers);
                    if (KeyboardListener.KEY_ENTER == keyCode) {
                        setMaxSize.click();
                    }
                }
            });

            final TextBox start = new TextBox();
            start.setWidth("3em");
            start.setText(Integer.toString(rel.getStart()));
            rel.addListEventListener(new ListEventListener() {
                public void listChanged(final ListEvent listEvent) {
                    start.setText(Integer.toString(rel.getStart()));
                }
            });
            start.setTitle("Enter the offset for the page.");
            final Button setStart = new Button("Set start offset");
            setStart.addClickListener(new ClickListener() {
                public void onClick(final Widget sender) {
                    try {
                        rel.setStart(Integer.parseInt(start.getText()));
                    } catch (NumberFormatException nfe) {
                        Window.alert("start offset must be a integer");
                    }
                }
            });
            start.addKeyboardListener(new KeyboardListenerAdapter() {
                public void onKeyUp(final Widget sender, final char keyCode, final int modifiers) {
                    super.onKeyUp(sender, keyCode, modifiers);
                    if (KeyboardListener.KEY_ENTER == keyCode) {
                        setStart.click();
                    }
View Full Code Here

                        }
                    }
                };
        this.softBase.addMouseListener(hover);
        this.softBase.addKeyboardListener(
            new KeyboardListenerAdapter() {
                public void onKeyPress(
                    Widget sender, char keyCode, int modifiers) {
                    if(
                        (keyCode == ' ')
                            || (keyCode == KeyboardListener.KEY_ENTER)) {
View Full Code Here

      public void onLostFocus(Widget sender) {
        amountBox.setText(reformatContent());
      }
    });

    amountBox.addKeyboardListener(new KeyboardListenerAdapter() {
      public void onKeyDown(Widget sender, char keyCode, int modifiers) {
        if (keyCode == (char) KEY_ENTER) {
          amountBox.setText(reformatContent());
        }
      }
View Full Code Here

    curPageBox.setWidth("3em");
    curPageBox.setText("1");
    curPageBox.setTextAlignment(TextBoxBase.ALIGN_RIGHT);

    // Disallow non-numeric pages
    KeyboardListenerAdapter listener = new KeyboardListenerAdapter() {
      @Override
      public void onKeyPress(Widget sender, char keyCode, int modifiers) {
        if (keyCode == (char) KEY_ENTER) {
          PagingOptions.this.table.gotoPage(getPagingBoxValue(), false);
        } else if ((!Character.isDigit(keyCode)) && (keyCode != (char) KEY_TAB)
View Full Code Here

TOP

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

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.