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

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


 
  private Map<String,String> checkFields(String userName) {
    Map<String,String> values = new HashMap<String,String>();
    for String name : tbs.keySet() ) {
      Entry entry = tbs.get(name);
      TextBox tb = entry.tb;
      String value = tb.getText().trim();
      values.put(name, value);
     
      if ( tb instanceof PasswordTextBox ) {
        continue// passwords checked below
      }
     
      if ( value.length() == 0 ) {
        // Issue 226: Phone field is required
        // allow the following to be empty (optional):
        if ( ! name.equals("phone") ) {
          statusError("Missing value for field: " +entry.label);
          tb.setFocus(true);
          tb.selectAll();
          return null;
        }
      }
      else if ( name.equals("email") ) {
        // basic check:  something@something:
        String[] toks = value.split("@");
        if ( toks.length != 2 ) {
          statusError("Malformed email address. Expected name and domain");
          tb.setFocus(true);
          tb.selectAll();
          return null;
        }
      }
    }
   
View Full Code Here


     * Builds the Insert Hyperlink form.
     */
  @Override
  protected void buildForm() {
    content.setWidth("500px");
    text = new TextBox();
    text.setWidth("250px");
    url = new TextBox();
    url.setWidth("250px");
      addField(text, "Text:");
      addField(url, "URL:");
      submit.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
View Full Code Here

          content.getRowFormatter().setVisible(i, value);
        }
        center();
      }
      });
    caption = new TextBox();
    caption.setWidth("250px");
    label = new TextBox();
    label.setWidth("250px");
    herePosition = new CheckBox("Here");
    topPosition = new CheckBox("Top of the page");
      topPosition.setValue(true);
    bottomPosition = new CheckBox("Bottom of the page");
View Full Code Here

          content.getRowFormatter().setVisible(i, value);
        }
        center();
      }
      });
    caption = new TextBox();
    caption.setWidth("250px");
    label = new TextBox();
    label.setWidth("250px");
    herePosition = new CheckBox("Here");
    topPosition = new CheckBox("Top of the page");
      topPosition.setValue(true);
    bottomPosition = new CheckBox("Bottom of the page");
View Full Code Here

    level.addItem("Sub-Section");
    level.addItem("Sub-Sub-Section");
    level.addItem("Paragraph");
    level.addItem("Sub-Paragraph");
    level.setSelectedIndex(2);
    title = new TextBox();
    title.setWidth("250px");
    label = new TextBox();
    label.setWidth("250px");
      addField(level, "Level:");
      addField(title, "Title:");
      addField(label, "Label:");
      submit.addClickHandler(new ClickHandler() {
View Full Code Here

      addHeader("Automatic Saving");
      useAutoSave = new CheckBox("Automatically save current document on a recurring basis.");
      useAutoSave.setValue(true);
      useAutoSave.addValueChangeHandler(changeHandler);
      addField(useAutoSave);
      autoSaveInterval = new TextBox();
      autoSaveInterval.setWidth("60px");
      addField(autoSaveInterval, "Save Interval (seconds)");
      submit.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
        if (useAutoSave.getValue()) {
View Full Code Here

        "<br /><br />For more information visit the <a href=\"http://code.google.com/p/latex-lab\" target=\"_blank\">Privacy</a> " +
        "and <a href=\"http://code.google.com/p/latex-lab\" target=\"_blank\">Terms and Conditions</a> pages." +
        "<br /><br />By using the default LaTeX Lab compiler you agree to the " +
        "<a href=\"http://code.google.com/p/latex-lab\" target=\"_blank\">Terms and Conditions</a>."));
    addField(warning);
    clsiServiceUrl = new TextBox();
    clsiServiceUrl.setWidth("400px");
    addField(clsiServiceUrl, "Service URL:");
    clsiServiceToken = new TextBox();
    clsiServiceToken.setWidth("200px");
    addField(clsiServiceToken, "Service token:");
    clsiAsyncPath = new TextBox();
    clsiAsyncPath.setWidth("400px");
    addField(clsiAsyncPath, "Service output path:");
    compilerName = new TextBox();
    compilerName.setWidth("200px");
    compilerName.setValue("latex");
    addField(compilerName, "Compiler name:");
    submit.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
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

    VerticalPanel panel = new VerticalPanel();
   
    // new wiki page
    newPanel = new Grid(2,2);
    newPanel.setWidget(0, 0, new HTML("Name:"));
    final TextBox name = new TextBox();
    newPanel.setWidget(0, 1, name);
    Button newButton = new Button("Erzeugen");
    newButton.addClickHandler(new ClickHandler() {
     
      @Override
      public void onClick(ClickEvent event) {
        String wikiPageName = name.getText();
        for (WikiPageBoxHandler handler: newHandler)
          handler.onWikiPage(wikiPageName);
        name.setText("");
      }
    });
    newPanel.setWidget(1, 1, newButton);
    panel.add(newPanel);
   
View Full Code Here

    public static TextBoxBase createTextBoxBase(int nl, String width,
      ChangeListener cl) {
    final TextBoxBase tb;
    if ( nl <=1 ) {
      tb = new TextBox();
      tb.setWidth(width);
    }
    else {
      // avoid huge textareas (TODO max 20 line is arbitrary)
      if ( nl > 20 ) {
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.