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

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


        JsArray<Selection> sel = timeline.getSelections();

        if (sel.length() > 0) {
          int row = sel.get(0).getRow();
          String info = "Selected event " + String.valueOf(row);
          RootPanel.get("lblInfo").add(new Label(info));
        } else {
          String info = "Select event &lt;nothing&gt; selected";
          RootPanel.get("lblInfo").add(new Label(info));
        }
      }
    };
  }    
View Full Code Here


              Window.confirm("Are you sure you want to change this event?") :
                true;

              if (applyChange) {
                String info = "Changed event " + String.valueOf(row);
                RootPanel.get("lblInfo").add(new Label(info));
              } else {
                // cancel the change
                timeline.cancelChange();

                String info = "Change event " + String.valueOf(row) + " cancelled";
                RootPanel.get("lblInfo").add(new Label(info));
              }
        }
      }
    };
  }
View Full Code Here

              item.put("content", new JSONString(title));
              timeline.setData(data.getJavaScriptObject());

              String info = "Added event " + String.valueOf(row);
              RootPanel.get("lblInfo").add(new Label(info));
            }
           
          }
          else {
            // cancel creating new event
            timeline.cancelAdd();
            String info = "Add event " + String.valueOf(row) + " cancelled";
            RootPanel.get("lblInfo").add(new Label(info));            
          }
        }
      }
    };
  }
View Full Code Here

              // apply the new title
              item.put("content", new JSONString(title));
              timeline.setData(data.getJavaScriptObject());

              String info = "Edited event " + String.valueOf(row);
              RootPanel.get("lblInfo").add(new Label(info));
            }
            else {
              // do nothing
              String info = "Edit event " + String.valueOf(row) + " cancelled";
              RootPanel.get("lblInfo").add(new Label(info));            
            }
          }
        }
      }
    };
View Full Code Here

          boolean confirmChanges = chkConfirmChange.getValue();

          if (confirmChanges == false) {
            String info = "Deleting event " + String.valueOf(row);
            RootPanel.get("lblInfo").add(new Label(info));
            return;
          }

          // request confirmation
          boolean applyDelete = confirmChanges ?
              Window.confirm("Are you sure you want to delete this event?") :
                true;

              if (applyDelete) {
                String info = "Deleted " + String.valueOf(row);
                RootPanel.get("lblInfo").add(new Label(info));
              } else {
                // cancel the deletion
                timeline.cancelDelete();

                String info = "Deleting event " + String.valueOf(row) + " cancelled";
                RootPanel.get("lblInfo").add(new Label(info));
              }         
        }
      }
    };
 
View Full Code Here

    he.appendChild(se);
   
    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
      public void onUncaughtException(Throwable e) {
        RootPanel.get()
            .add(new Label("There was an error parsing the spreadsheet data."));
      }
    });
    GoogleLoader.load(new Chronoscope.URLResolver() {
      public String resolveURL(String url) {
        return intrinsics.getCachedUrl(url);
View Full Code Here

            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);
View Full Code Here

   */
  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");
View Full Code Here

        super(client);
    }

    protected Object createComponentInstance(Object parent, DomNode element)
    {
        Label lbl = new Label();
        return lbl;
    }
View Full Code Here

      });

      RootPanel.get(id).add(cp);
    } catch (Exception e) {
      e.printStackTrace();
      RootPanel.get(id).add(new Label(
          "There was an error setting up the chart: " + e.getMessage()));
    }
  }
View Full Code Here

TOP

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

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.