Beispiel #1
0
  @Override
  public void onModuleLoad() {
    class Handler implements FocusHandler, BlurHandler {

      @Override
      public void onBlur(BlurEvent event) {
        System.out.println("blur");
      }

      @Override
      public void onFocus(FocusEvent event) {
        System.out.println("focus");
      }
    }

    TextField field = new TextField();
    field.setName("thename");
    field.setEmptyText("sdfsdf");
    field.addValidator(new EmptyValidator<String>());

    Handler h = new Handler();
    field.addFocusHandler(h);
    field.addBlurHandler(h);

    NumberField<Double> number = new NumberField<Double>(new DoublePropertyEditor());
    number.setEmptyText("sdfdsfsf");
    h = new Handler();
    number.addFocusHandler(h);
    number.addBlurHandler(h);

    DateField date = new DateField();
    h = new Handler();
    date.addFocusHandler(h);
    date.addBlurHandler(h);
    date.setEmptyText("empty texxxt");
    // field.setFieldLabel("Name");
    // field.markInvalid("error", null);

    TextArea area = new TextArea();
    area.setEmptyText("sdfdsfsdf");

    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(10);

    vp.add(field);
    vp.add(number);
    vp.add(date);
    vp.add(area);

    RootPanel.get().add(vp);

    date.redraw();
    field.redraw();
    number.redraw();
  }
  public ProfileEditorViewImpl() {
    ContentPanel panel = new ContentPanel();
    panel.setShadow(true);
    panel.setHeadingText("Your Profile");

    FlowLayoutContainer container = new FlowLayoutContainer();

    container.add(new FieldLabel(username, "username"));
    container.add(new FieldLabel(displayName, "display name"));
    container.add(new FieldLabel(organization, "organization"));
    container.add(new FieldLabel(description, "about me"));
    description.setHeight(100);
    compiledTodayCount.setReadOnly(true);
    compiledTodayCount.setEnabled(false);
    container.add(new FieldLabel(compiledTodayCount, "times compiled today"));

    panel.add(container, new MarginData(10));

    panel.addButton(
        new TextButton(
            "Back",
            new SelectHandler() {
              @Override
              public void onSelect(SelectEvent event) {
                getPresenter().back();
              }
            }));
    panel.addButton(
        new TextButton(
            "Save",
            new SelectHandler() {
              @Override
              public void onSelect(SelectEvent event) {
                getPresenter().save();
              }
            }));

    driver.initialize(this);

    CenterLayoutContainer center = new CenterLayoutContainer();
    center.setWidget(panel);

    initWidget(center);
  }
  public ErrorDialog3(SafeHtml errorMsg, String description) {

    setHeadingText(I18N.DISPLAY.error());
    this.setMinHeight(300);
    this.setMinWidth(350);
    this.setResizable(false);

    add(uiBinder.createAndBindUi(this));
    detailsPanel.setHeadingText(I18N.DISPLAY.details());
    detailsPanel.setSize("330", "150");

    if (errorMsg != null) {
      this.errorMsg.setHTML(errorMsg);
    }

    detailsContainer.setScrollMode(ScrollMode.AUTO);
    descriptionArea.setText(description);
    detailsPanel.setCollapsible(true);
    detailsPanel.expand();
  }
Beispiel #4
0
  private ContentPanel createContent() {
    TEXT_AREA.setReadOnly(true);

    final TextButton refreshButton = new TextButton("Refresh");
    refreshButton.addSelectHandler(
        new SelectEvent.SelectHandler() {
          @Override
          public void onSelect(SelectEvent event) {
            refresh();
          }
        });

    final TextButton newPatButton = new TextButton("Obtain new PAT token");
    newPatButton.addSelectHandler(
        new SelectEvent.SelectHandler() {
          @Override
          public void onSelect(SelectEvent event) {
            final ProgressDialog progressDialog = new ProgressDialog("Perform operation...");
            progressDialog.show();
            getService()
                .obtainNewPat(
                    new AsyncCallback<String>() {
                      @Override
                      public void onFailure(Throwable caught) {
                        progressDialog.hide();
                        handleException(caught);
                        GwtUtils.showError("Unable to obtain new PAT token.");
                        refresh();
                      }

                      @Override
                      public void onSuccess(String result) {
                        progressDialog.hide();
                        GwtUtils.showInformation("PAT token is obtained successfully.");
                        refresh();
                      }
                    });
          }
        });

    final TextButton clearButton = new TextButton("Clear");
    clearButton.addSelectHandler(
        new SelectEvent.SelectHandler() {
          @Override
          public void onSelect(SelectEvent event) {
            getService()
                .clearLogs(
                    new AsyncCallback<Void>() {
                      @Override
                      public void onFailure(Throwable p_throwable) {
                        handleException(p_throwable);
                        GwtUtils.showError("Unable to clear logs.");
                      }

                      @Override
                      public void onSuccess(Void p_void) {
                        TEXT_AREA.setValue("");
                      }
                    });
          }
        });

    final HBoxLayoutContainer h = new HBoxLayoutContainer();
    h.add(refreshButton, new BoxLayoutContainer.BoxLayoutData(DEFAULT_MARGINS));
    h.add(clearButton, new BoxLayoutContainer.BoxLayoutData(DEFAULT_MARGINS));
    h.add(newPatButton, new BoxLayoutContainer.BoxLayoutData(DEFAULT_MARGINS));

    final VerticalLayoutContainer v = new VerticalLayoutContainer();
    v.add(h, new VerticalLayoutContainer.VerticalLayoutData(1, -1, DEFAULT_MARGINS));
    v.add(TEXT_AREA, new VerticalLayoutContainer.VerticalLayoutData(1, 1, DEFAULT_MARGINS));

    final ContentPanel cp = new ContentPanel();
    cp.setHeadingText("Resource Server Monitor");
    cp.add(v);
    return cp;
  }