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

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


  private Label codeLabel;
  private HTML detailsHTML;
  private Button detailsButton;

  private ErrorNotifier() {
    dialogBox = new DialogBox();
    dialogBox.setText("Error occurred");
    dialogBox.setAnimationEnabled(true);

    codeLabel = new Label();
    detailsHTML = new HTML();
View Full Code Here


    vPanel.add(button);

    RootPanel.get().add(vPanel);

    // Create the dialog box
    final DialogBox dialogBox = new DialogBox();

    // The content of the dialog comes from a User specified Preference
    dialogBox.setText(prefs.promptSomethingElse().getValue());
    dialogBox.setAnimationEnabled(true);
    Button closeButton = new Button("Close");
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.setWidth("100%");
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    dialogVPanel.add(closeButton);

    closeButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        dialogBox.hide();
      }
    });

    // Set the contents of the Widget
    dialogBox.setWidget(dialogVPanel);

    button.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        dialogBox.center();
        dialogBox.show();
      }
    });
  }
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("Add new Gadget");
    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(HasHorizontalAlignment.ALIGN_RIGHT);
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    closeButton.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        dialogBox.hide();
        sendButton.setEnabled(true);
        sendButton.setFocus(true);
      }
    });

    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.
        // create gadget

        gadget.setName(nameField.getText());
        gadget.setTitle(titleField.getText());
        gadget.setHelpUrl(helpUrlField.getText());
        gadget.setGadgetFileName(gadgetFileNameField.getText());
        gadget.setDescription(descriptionField.getText());
        if (statusField != null)
          gadget.setStatus(Integer.parseInt(statusField
              .getValue(statusField.getSelectedIndex())));
        if (typeField != null)
          gadget.setType(Integer.parseInt(typeField
              .getValue(typeField.getSelectedIndex())));
        gadget.setXmlSource(xmlSourceField.getText());
        gadget.setHandlerClassName(handlerClassNameField.getValue());

        gadget.setGadgletType(gadgletTypeField
            .getValue(gadgletTypeField.getSelectedIndex()));
     

        errorLabel.setText("");
        String textToServer = gadget.getName();
        if (!FieldVerifier.isValidName(textToServer)) {
          errorLabel
              .setText("the name must have at least four characters");
          return;
        }

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

        asyService.saveGadget(gadget, new AsyncCallback<String>() {
          @Override
          public void onFailure(Throwable caught) {
            // Show the RPC error message to the User
            dialogBox.setText("Gadget - Failure");
            serverResponseLabel
                .addStyleName("serverResponseLabelError");
            serverResponseLabel.setHTML(caught.getMessage());
            dialogBox.center();
            closeButton.setFocus(true);
          }

          @Override
          public void onSuccess(String result) {

            dialogBox.setText("Saving Gadget");
            serverResponseLabel
                .removeStyleName("serverResponseLabelError");
            serverResponseLabel.setHTML(result);
            nameField.setReadOnly(true);
            dialogBox.center();
            closeButton.setFocus(true);
          }
        });

      }
View Full Code Here

  void setProfileExists(boolean isProfileExists) {
    this.isProfileExists = isProfileExists;
  }

  private ProfileEditDialogPanel() {
    dialogBox = new DialogBox();
    dialogBox.setAnimationEnabled(true);

    detailsHTML = new HTML();
    detailsHTML.setVisible(true);
View Full Code Here

  final Button dialogButton = new Button();
 
  protected final PreferencesUtil prefs = PreferencesUtil.nativeInitPrefs();

  public UserRegistration() {
    dialogBox = new DialogBox();
    dialogBox.setAnimationEnabled(true);
       
    detailsHTML = new HTML();
    detailsHTML.setVisible(true);
 
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

    }
  };

  private DialogBox createDialogBox(ArrayList<PublisherInfo> pubInfoList) {
    // Create a dialog box and set the caption text
    final DialogBox dialogBox = new DialogBox();
    final StringBuffer newDataSourceID = new StringBuffer();
    dialogBox.ensureDebugId("cwDialogBox");
    dialogBox.setText("Select DataSource");

    // Create a table to layout the content
    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);
    dialogBox.setWidget(dialogContents);

    final Tree dynamicTree = createDynamicTree(pubInfoList);
    dynamicTree.ensureDebugId("cwTree-dynamicTree");
    ScrollPanel dynamicTreeWrapper = new ScrollPanel(dynamicTree);
    dynamicTreeWrapper.ensureDebugId("cwTree-dynamicTree-Wrapper");
    dynamicTreeWrapper.setSize("300px", "300px");

    // Wrap the dynamic tree in a DecoratorPanel
    DecoratorPanel dynamicDecorator = new DecoratorPanel();
    dynamicDecorator.setWidget(dynamicTreeWrapper);
    dialogContents.add(dynamicDecorator);

    // Add a close button at the bottom of the dialog
    Button nextButton = new Button("Next", new ClickHandler() {
      public void onClick(ClickEvent event) {
        newDataSourceID.append(dynamicTree.getSelectedItem().getText());
        dashboardService.getDataSourceAllDetails(newDataSourceID.toString(), new AsyncCallback<DataSourceConfiguration>() {

          public void onFailure(Throwable caught) {
            // TODO Auto-generated method stub

          }

          public void onSuccess(DataSourceConfiguration result) {
            addChart(result, 400,300);
            dashboardService.addSubscription(result.getDsID(), "1", null);
          }
        });

        // createChart(newDataSourceID.toString());
        dialogBox.hide();
      }
    });
    dialogContents.add(nextButton);
    if (LocaleInfo.getCurrentLocale().isRTL()) {
      dialogContents.setCellHorizontalAlignment(nextButton, HasHorizontalAlignment.ALIGN_LEFT);

    } else {
      dialogContents.setCellHorizontalAlignment(nextButton, HasHorizontalAlignment.ALIGN_RIGHT);
    }

    // Add a close button at the bottom of the dialog
    Button closeButton = new Button("Close", new ClickHandler() {
      public void onClick(ClickEvent event) {
        dialogBox.hide();
      }
    });
    dialogContents.add(closeButton);
    if (LocaleInfo.getCurrentLocale().isRTL()) {
      dialogContents.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_LEFT);
View Full Code Here

  /**
   * Displays the Dialog.
   */
  public static void showAsDialog(StandardDialogBox dialogWidget) {
    DialogBox dialogBox = new DialogBox();
    dialogWidget.dialogBox = dialogBox;

    dialogBox.addStyleName("tty-StandardDialogBox");
    dialogBox.setText(dialogWidget.getTitle());
    dialogBox.add(dialogWidget);
    dialogBox.center();
    dialogBox.show();
  }
View Full Code Here

  }

  public static void doEditDialog(AppPackage appPackage, final RemoteDataServiceAsync remoteService, final DialogCallback callback)
  {

    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText(constants.packageEditLabelEdit(appPackage.PACKAGE_NAME));

    // Create a table to layout the content
    PackageEdit pet = new PackageEdit(appPackage, new PackageEdit.DialogCallback()
    {

      @Override
      public void result(boolean ok, final AppPackage appPackage)
      {
        if (ok)
        {
          remoteService.writeAppPackage(appPackage, new AsyncCallback<Void>()
          {

            @Override
            public void onFailure(Throwable caught)
            {

            }

            @Override
            public void onSuccess(Void result)
            {
              dialogBox.hide();
              callback.result(true, appPackage);

            }

          });
        } else
        {
          dialogBox.hide();
        }

      }
    });

    pet.setWidth("100%");
    dialogBox.setWidget(pet);
    dialogBox.center();
    dialogBox.show();

  }
View Full Code Here

  }

  public static void doAddDialog(final LoginInfo loginInfo, final RemoteDataServiceAsync remoteService, final DialogCallback callback)
  {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText(constants.packageEditLabelAdd());

    // Create a table to layout the content
    PackageEdit pet = new PackageEdit(new PackageEdit.DialogCallback()
    {

      @Override
      public void result(boolean ok, final AppPackage appPackage)
      {
        if (ok)
        {
          remoteService.addAppPackage(loginInfo, appPackage, new AsyncCallback<Void>()
          {

            @Override
            public void onFailure(Throwable caught)
            {

            }

            @Override
            public void onSuccess(Void result)
            {
              dialogBox.hide();
              callback.result(true, appPackage);

            }

          });
        } else
        {
          dialogBox.hide();
        }

      }
    });

    pet.setWidth("100%");
    dialogBox.setWidget(pet);
    dialogBox.center();
    dialogBox.show();

  }
View Full Code Here

TOP

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

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.