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

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


    return t;
  }

  protected Widget profileTree() {
    final FlexTable table = new FlexTable();
    final TextBox branches = new TextBox();
    int row = 0;
    table.setText(row, 0, "children per node");
    table.setText(row, 1, "total number of rows");
    table.setText(row, 2, "what type of node");
    ++row;
    table.setWidget(row, 0, branches);
    branches.setText("5");
    final TextBox nodes = new TextBox();

    table.setWidget(row, 1, nodes);
    nodes.setText("2000");
    table.setTitle("Number of nodes");

    final ListBox type = new ListBox();
    type.addItem("Text");
    type.addItem("HTML");
    type.addItem("CheckBox");
    type.setSelectedIndex(1);
    table.setWidget(row, 2, type);
    ++row;
    final int widgetRow = row + 1;
    table.setWidget(row, 0, new Button("Normal tree", new ClickListener() {
      public void onClick(Widget sender) {
        long time = System.currentTimeMillis();
        Tree t = new Tree();
        profileCreateTree(t, Integer.parseInt(branches.getText()),
            Integer.parseInt(nodes.getText()),
            TreeType.getType(type.getSelectedIndex()));
        table.setWidget(widgetRow, 0, t);
        Window.alert("Elapsed time: " + (System.currentTimeMillis() - time));
      }
    }));

    table.setWidget(row, 1, new Button("Fast tree", new ClickListener() {
      public void onClick(Widget sender) {
        long time = System.currentTimeMillis();
        FastTree t = new FastTree();
        profileCreateTree(t, Integer.parseInt(branches.getText()),
            Integer.parseInt(nodes.getText()),
            TreeType.getType(type.getSelectedIndex()));
        table.setWidget(widgetRow, 1, t);
        Window.alert("Elapsed time: " + (System.currentTimeMillis() - time));
      }
    }));
View Full Code Here


    cellFormatter.setHorizontalAlignment(0, 0,
        HasHorizontalAlignment.ALIGN_CENTER);

    // Add some standard form options
    layout.setHTML(1, 0, "Name");
    layout.setWidget(1, 1, new TextBox());
    layout.setHTML(2, 0, "Description");
    layout.setWidget(2, 1, new TextBox());

    // Wrap the content in a DecoratorPanel
    DecoratorPanel decPanel = new DecoratorPanel();
    decPanel.setWidget(layout);
    return decPanel;
View Full Code Here

                }));

        dockPanel.add(numbersP, DockPanel.CENTER);
        dockPanel.add(controls, DockPanel.EAST);

        inputBox = new TextBox();
        inputBox.addStyleName("ResultBox");
        dockPanel.add(inputBox, DockPanel.NORTH);

        ticker = new TextArea();
        ticker.setSize("7em", "140px");
View Full Code Here

    private boolean prompting = false;

    public VTextualDate() {
        super();
        text = new TextBox();
        text.addChangeHandler(this);
        text.addFocusHandler(new FocusHandler() {
            @Override
            public void onFocus(FocusEvent event) {
                text.addStyleName(VTextField.CLASSNAME + "-"
View Full Code Here

public class ClientSideModule implements EntryPoint {

    @Override
    public void onModuleLoad() {
        final TextBox nameField = new TextBox();
        nameField.setText("GWT User");
        final Button button = new Button("Check");

        VerticalPanel vp = new VerticalPanel();
        vp.add(nameField);
        vp.add(button);
        RootPanel.get().add(vp);

        button.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                if ("GWT User".equals(nameField.getText())) {
                    Window.alert("User OK");
                } else {
                    Window.alert("Unauthorized user");
                }
            }
View Full Code Here

    Logger.getLogger("").addHandler(
        new RequestFactoryLogHandler(provider, Level.ALL,
            new ArrayList<String>()));

    final Button sendButton = new Button("Send");
    final TextBox nameField = new TextBox();
    nameField.setText("Aleksey");
    final Label errorLabel = new Label();

    // We can add style names to widgets
    sendButton.addStyleName("sendButton");

    // Add the nameField and sendButton to the RootPanel
    // Use RootPanel.get() to get the entire body element
    RootPanel.get("nameFieldContainer").add(nameField);
    RootPanel.get("sendButtonContainer").add(sendButton);
    RootPanel.get("errorLabelContainer").add(errorLabel);

    // Focus the cursor on the name field when the app loads
    nameField.setFocus(true);
    nameField.selectAll();

    // Create the popup dialog box
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Remote Procedure Call");
    dialogBox.setAnimationEnabled(true);
    final Button closeButton = new Button("Close");
    // We can set the id of a widget by accessing its Element
    closeButton.getElement().setId("closeButton");
    final Label textToServerLabel = new Label();
    final HTML serverResponseLabel = new HTML();
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.add(new HTML("<b>Sending name to the server:</b>"));
    dialogVPanel.add(textToServerLabel);
    dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
    dialogVPanel.add(serverResponseLabel);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    // Add a handler to close the DialogBox
    closeButton.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        dialogBox.hide();
        sendButton.setEnabled(true);
        sendButton.setFocus(true);
      }
    });

    // Create a handler for the sendButton and nameField
    class MyHandler implements ClickHandler, KeyUpHandler {
      /**
       * Fired when the user clicks on the sendButton.
       */
      @Override
      public void onClick(ClickEvent event) {
        sendNameToServer();
      }

      /**
       * Fired when the user types in the nameField.
       */
      @Override
      public void onKeyUp(KeyUpEvent event) {
        if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
          sendNameToServer();
        }
      }

      /**
       * Send the name from the nameField to the server and wait for a response.
       */
      private void sendNameToServer() {
        // First, we validate the input.
        errorLabel.setText("");
        String textToServer = nameField.getText();
        if (!FieldVerifier.isValidName(textToServer)) {
          errorLabel.setText("Please enter at least four characters");
          return;
        }

        // Then, we send the input to the server.
        sendButton.setEnabled(false);
        textToServerLabel.setText(textToServer);
        serverResponseLabel.setText("");

        UserRequest userContext = requests.userRequest();
        UserProxy user = userContext.create(UserProxy.class);
        user.setName(textToServer);
        userContext.save(user).fire(new Receiver<Long>() {

          @Override
          public void onSuccess(Long response) {
            Long id = response;
            Window.alert("Success saved." + id);
            // UserRequest userContext = requests.userRequest();
            // userContext.find((long) id).fire(new Receiver<UserProxy>() {
            //
            // @Override
            // public void onSuccess(UserProxy response) {
            // UserProxy user = response;
            // dialogBox.setText("Remote Procedure Call");
            // serverResponseLabel.removeStyleName("serverResponseLabelError");
            // serverResponseLabel.setHTML(user.getName());
            // dialogBox.center();
            // closeButton.setFocus(true);
            // }
            //
            // });

          }

        });
        // greetingService.greetServer(textToServer, new AsyncCallback<String>()
        // {
        // public void onFailure(Throwable caught) {
        // // Show the RPC error message to the user
        // dialogBox.setText("Remote Procedure Call - Failure");
        // serverResponseLabel.addStyleName("serverResponseLabelError");
        // serverResponseLabel.setHTML(SERVER_ERROR);
        // dialogBox.center();
        // closeButton.setFocus(true);
        // }
        //
        // public void onSuccess(String result) {
        // dialogBox.setText("Remote Procedure Call");
        // serverResponseLabel.removeStyleName("serverResponseLabelError");
        // serverResponseLabel.setHTML(result);
        // dialogBox.center();
        // closeButton.setFocus(true);
        // }
        // });
      }
    }

    // Add a handler to send the name to the server
    MyHandler handler = new MyHandler();
    sendButton.addClickHandler(handler);
    nameField.addKeyUpHandler(handler);
  }
View Full Code Here

  /**
   * This is the entry point method.
   */
  public void onModuleLoad() {
    final Button sendButton = new Button("Send");
    final TextBox nameField = new TextBox();
    nameField.setText("GWT User");
    final Label errorLabel = new Label();

    // We can add style names to widgets
    sendButton.addStyleName("sendButton");

    // Add the nameField and sendButton to the RootPanel
    // Use RootPanel.get() to get the entire body element
    RootPanel.get("nameFieldContainer").add(nameField);
    RootPanel.get("sendButtonContainer").add(sendButton);
    RootPanel.get("errorLabelContainer").add(errorLabel);

    // Focus the cursor on the name field when the app loads
    nameField.setFocus(true);
    nameField.selectAll();

    // Create the popup dialog box
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Remote Procedure Call");
    dialogBox.setAnimationEnabled(true);
    final Button closeButton = new Button("Close");
    // We can set the id of a widget by accessing its Element
    closeButton.getElement().setId("closeButton");
    final Label textToServerLabel = new Label();
    final HTML serverResponseLabel = new HTML();
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.add(new HTML("<b>Sending name to the server:</b>"));
    dialogVPanel.add(textToServerLabel);
    dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
    dialogVPanel.add(serverResponseLabel);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    // Add a handler to close the DialogBox
    closeButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        dialogBox.hide();
        sendButton.setEnabled(true);
        sendButton.setFocus(true);
      }
    });

    // Create a handler for the sendButton and nameField
    class MyHandler implements ClickHandler, KeyUpHandler {
      /**
       * Fired when the user clicks on the sendButton.
       */
      public void onClick(ClickEvent event) {
        sendNameToServer();
      }

      /**
       * Fired when the user types in the nameField.
       */
      public void onKeyUp(KeyUpEvent event) {
        if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
          sendNameToServer();
        }
      }

      /**
       * Send the name from the nameField to the server and wait for a response.
       */
      private void sendNameToServer() {
        // First, we validate the input.
        errorLabel.setText("");
        String textToServer = nameField.getText();
        if (!FieldVerifier.isValidName(textToServer)) {
          errorLabel.setText("Please enter at least four characters");
          return;
        }
       
        // Then, we send the input to the server.
        sendButton.setEnabled(false);
        textToServerLabel.setText(textToServer);
        serverResponseLabel.setText("");
        greetingService.greetServer(textToServer, new AsyncCallback<String>() {
          public void onFailure(Throwable caught) {
            // Show the RPC error message to the user
            dialogBox.setText("Remote Procedure Call - Failure");
            serverResponseLabel.addStyleName("serverResponseLabelError");
            serverResponseLabel.setHTML(SERVER_ERROR);
            dialogBox.center();
            closeButton.setFocus(true);
          }

          public void onSuccess(String result) {
            dialogBox.setText("Remote Procedure Call");
            serverResponseLabel.removeStyleName("serverResponseLabelError");
            serverResponseLabel.setHTML(result);
            dialogBox.center();
            closeButton.setFocus(true);
          }
        });
      }
    }

    // Add a handler to send the name to the server
    MyHandler handler = new MyHandler();
    sendButton.addClickHandler(handler);
    nameField.addKeyUpHandler(handler);
  }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    protected Object createComponentInstance(Object parent, DomNode element)
    {
        TextBox tb = new TextBox();
        return tb;
    }
View Full Code Here

  /** displays a popup to prompt the user for the URI or revert to default assignment
   * @param left
   * @param top
  */
  void promptUserUri(int left, int top) {
    final TextBoxBase textBox = new TextBox();
    final MyDialog popup = new MyDialog(textBox) {
      public boolean onKeyUpPreview(char key, int modifiers) {
        // avoid ENTER from closing the popup without proper reaction
        if ( key == KeyboardListener.KEY_ESCAPE ) {
          hide();      // only ESCAPE keystroke closes the popup
          return false;
        }
       
        if ( key == KeyboardListener.KEY_ENTER ) {
          String str = textBox.getText().trim();
          _processAccept(str, this);
        }
          return true;
        }
    };
    popup.setText("Specify the namespace root for the ontology URI");
   
    textBox.setWidth("300");
    if ( namespaceRoot != null ) {
      textBox.setText(namespaceRoot);
    }

    popup.getButtonsPanel().insert(
        new PushButton("OK", new ClickListener() {
          public void onClick(Widget sender) {
            String str = textBox.getText().trim();
            _processAccept(str, popup);
          }
        })
        , 0
    );

    if ( userGiven ) {
      popup.getButtonsPanel().insert(
          new PushButton("Revert to default", new ClickListener() {
            public void onClick(Widget sender) {
              userGiven = false;
              namespaceRoot = defaultNameSpace;
              update();
              popup.hide();
            }
          })
          , 0
      );
    }
   
    popup.setPopupPosition(left, top + 20);
    new Timer() { @Override
      public void run() {
        textBox.setFocus(true);
      }
    }.schedule(180);
   
    popup.show();

View Full Code Here

//      infoImg.addClickListener(new ClickListener() {
//        public void onClick(Widget sender) {
//          _pickedForInfo();        }
//      });
     
      textBox = new TextBox();
      textBox.setStylePrimaryName("SearchResultsTable-TextBox");
     
      String str = VineMain.getCodedTerm(entity.getUri());
     
      textBox.setText(str);
View Full Code Here

TOP

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

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.