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

Examples of com.google.gwt.user.client.ui.DialogBox$MouseHandler


*/
public class Dialog {

    public static void askFor(String message, final AsyncCallback<String> callback) {

        final DialogBox dialog = new DialogBox();
        dialog.setText(message);
        dialog.setPixelSize(320, 240);
        dialog.setModal(true);
        dialog.setAutoHideEnabled(true);

        VerticalPanel panel = new VerticalPanel();
        final TextArea text = new TextArea();
        panel.add(text);
        panel.add(new Button("Done", new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {
                dialog.hide();
            }
        }));

        dialog.setWidget(panel);

        dialog.addCloseHandler(new CloseHandler<PopupPanel>() {
            @Override
            public void onClose(CloseEvent<PopupPanel> popupPanelCloseEvent) {
                callback.onSuccess(text.getText());
            }
        });

        dialog.center();
        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
            @Override
            public void execute() {
                text.setFocus(true);
            }
View Full Code Here


  }

  @Override
  public Widget createIssue() {
    // Create a few extra dialog boxes
    final DialogBox dialog0 = showCustomDialog(true, true, false, "Dialog 0",
        "I cannot be dragged or closed until Dialog 2 is closed", 0, 100);
    final DialogBox dialog1 = showCustomDialog(true, false, false, "Dialog 1",
        "I cannot be dragged or closed until Dialog 2 is closed", 0, 200);
    final DialogBox dialog2 = showCustomDialog(false, false, true, "Dialog 2",
        "I can be dragged", 0, 300);
    final DialogBox dialog3 = showCustomDialog(
        true,
        false,
        false,
        "Dialog 3",
        "I should auto close as soon as you click outside of me and Dialog 4 or greater",
        0, 400);
    final DialogBox dialog4 = showCustomDialog(false, false, false, "Dialog 4",
        "I can be dragged", 0, 500);

    final VisibleDialogBox dialog = showVisibleDialog();

    SimplePanel panel = new SimplePanel() {
      @Override
      protected void onUnload() {
        if (dialog.isAttached()) {
          dialog.hide();
          dialog0.hide();
          dialog1.hide();
          dialog2.hide();
          dialog3.hide();
          dialog4.hide();
        }
      }
    };
    return panel;
  }
View Full Code Here

  }

  private DialogBox showCustomDialog(boolean autoHide,
      boolean previewAllEvents, boolean modal, String caption, String message,
      int left, int top) {
    final DialogBox dialog = new DialogBox(autoHide, modal);
    dialog.setPreviewingAllNativeEvents(previewAllEvents);

    // Set the caption
    caption += " (autoHide=" + dialog.isAutoHideEnabled();
    caption += ", previewAllEvents=" + dialog.isPreviewingAllNativeEvents();
    caption += ", modal=" + dialog.isModal() + ")";
    dialog.setText(caption);

    // Set the content
    Label content = new Label(message);
    if (autoHide || previewAllEvents) {
      dialog.setWidget(content);
    } else {
      VerticalPanel vPanel = new VerticalPanel();
      vPanel.add(content);
      vPanel.add(new Button("Close", new ClickHandler() {
        public void onClick(ClickEvent event) {
          dialog.hide();
        }
      }));
      dialog.setWidget(vPanel);
    }
    dialog.setPopupPosition(left, top);
    dialog.show();
    return dialog;
  }
View Full Code Here

  private DialogBox dialogBox = null;

  @Override
  public Widget createIssue() {
    // Create the DialogBox
    dialogBox = new DialogBox(false, false);
    dialogBox.setText("Dialog Box");

    String message = "This text should wrap when the "
        + "DialogBox is dragged to the right edge of the screen.  ";
    VerticalPanel vPanel = new VerticalPanel();
View Full Code Here

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

        this.boundaryPanel.add(s);
    }
   
    @UiHandler("addStory")
    void onButtonClick(ClickEvent event) {
        DialogBox taskForm = new DialogBox();
        taskForm.setWidget(new StoryForm(taskForm, this));
        taskForm.center();
    }
View Full Code Here

        widgetDragController.makeDraggable(widget);
    }
   
    @UiHandler("addTask")
    void onAddTaskClick(ClickEvent event) {
        DialogBox form = new DialogBox();
        form.setWidget(new TaskForm(form, this));
        form.center();
    }
View Full Code Here

    tablePanel.setVisible( false );
    if ( isAdmin ) {
      final ClickHandler newBlockoutHandler = new ClickHandler() {
        @Override
        public void onClick( final ClickEvent clickEvent ) {
          DialogBox blockoutDialog = new NewBlockoutScheduleDialog( "", refreshCallBack, false, true );
          blockoutDialog.center();
        }
      };
      createBlockoutButton( newBlockoutHandler );
      createTableControls( newBlockoutHandler );
    }
View Full Code Here

              throwable = throwable.getCause();
              if ( throwable != null ) {
                text += "Caused by: ";
              }
            }
            DialogBox dialogBox = new DialogBox( true );
            DOM.setStyleAttribute( dialogBox.getElement(), "backgroundColor", "#ABCDEF" );
            System.err.print( text );
            text = text.replaceAll( " ", "&nbsp;" );
            dialogBox.setHTML( "<pre>" + text + "</pre>" );
            dialogBox.center();
          }

          fileLabel.setRepositoryFile( file );
          filesList.setWidget( rowCounter++, 0, fileLabel );
View Full Code Here

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

TOP

Related Classes of com.google.gwt.user.client.ui.DialogBox$MouseHandler

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.