@Inject
  public LoginPageView() {

    window = new Window();
    window.setHeaderIcon(AppImages.SAVARA_ICON);
    window.setTitle("console");
    window.setWidth(300);
    window.setHeight(150);
    window.setIsModal(true);
    window.setShowMinimizeButton(false);
    window.setShowCloseButton(false);
    window.centerInPage();

    DynamicForm form = new DynamicForm();
    form.setWidth(250);

    usernameItem = new TextItem();
    usernameItem.setTitle("username");

    passwordItem = new PasswordItem();
    passwordItem.setTitle("password");

    HLayout buttonLayout = new HLayout();
    IButton loginBtn = new IButton("Login");
    loginBtn.setWidth(60);
    loginBtn.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent clickEvent) {
            String name = usernameItem.getValueAsString();
            String password = passwordItem.getValueAsString();
            presenter.login(name, password);
          }
        });
    buttonLayout.addMember(loginBtn);
    buttonLayout.setAlign(Alignment.CENTER);

    form.setFields(new FormItem[] {usernameItem, passwordItem});
    form.setPadding(10);

    window.addItem(form);
    window.addItem(buttonLayout);

    HLayout versionLayout = new HLayout();
    Label versionNo = new Label(Build.VERSION);

    versionLayout.addMember(versionNo);
    versionLayout.setAlign(Alignment.RIGHT);

    window.addItem(versionLayout);
  }
Beispiel #2
0
  /**
   * This is a static utility method that is package protected so the message center view and the
   * message bar can pop up a dialog showing a message's details.
   *
   * @param message the message whose details are to be shown
   */
  static void showDetails(Message message) {
    if (message == null) {
      return;
    }

    DynamicForm form = new LocatableDynamicForm("MessageCenterDetailsForm");
    form.setWrapItemTitles(false);
    form.setAlign(Alignment.LEFT);

    StaticTextItem title = new StaticTextItem("theMessage", MSG.common_title_message());
    title.setValue(message.conciseMessage);

    StaticTextItem severity =
        new StaticTextItem("severity", MSG.view_messageCenter_messageSeverity());
    FormItemIcon severityIcon = new FormItemIcon();
    severityIcon.setSrc(getSeverityIcon(message.severity));
    severity.setIcons(severityIcon);
    severity.setValue(message.severity.name());

    StaticTextItem date = new StaticTextItem("time", MSG.view_messageCenter_messageTime());
    date.setValue(
        TimestampCellFormatter.format(message.fired, TimestampCellFormatter.DATE_TIME_FORMAT_FULL));

    StaticTextItem detail = new StaticTextItem("detail", MSG.view_messageCenter_messageDetail());
    detail.setTitleVAlign(VerticalAlignment.TOP);
    detail.setValue(message.detailedMessage);

    form.setItems(title, severity, date, detail);

    final Window dialogWin = new LocatableWindow("MessageCenterDetailsWindow");
    dialogWin.setTitle(MSG.common_title_message());
    dialogWin.setWidth(600);
    dialogWin.setHeight(400);
    dialogWin.setIsModal(true);
    dialogWin.setShowModalMask(true);
    dialogWin.setCanDragResize(true);
    dialogWin.setShowMaximizeButton(true);
    dialogWin.setShowMinimizeButton(false);
    dialogWin.centerInPage();
    dialogWin.addItem(form);
    dialogWin.show();
    dialogWin.addCloseClickHandler(
        new CloseClickHandler() {
          @Override
          public void onCloseClick(CloseClientEvent event) {
            dialogWin.destroy();
          }
        });
  }