/**
   * reads the data for the given document and instructor
   *
   * @param doc
   * @param instructor
   */
  public void synchronize(final CachedOpenWorkingCopyDocument doc, final InstructorGWT instructor) {
    this.openDocument = doc;
    instructor.verify();
    this.instructor = instructor;
    this.openDocument.forceSynchronize(
        new AsyncCallback<Void>() {

          @Override
          public void onSuccess(Void result) {

            if ((openDocument.getCourses().size() != 0)
                || (com.google.gwt.user.client.Window.confirm(
                    "The database doesn't contain any course right now. "
                        + "Do you want to proceed?"))) {
              InstructorPreferencesView.this.coursePrefs.setDataSources(doc, instructor);
              InstructorPreferencesView.this.timePrefs.setDataSources(doc, instructor);

              parent.show();
            } else {
              parent.hide();
            }
          }

          @Override
          public void onFailure(Throwable caught) {
            Window.alert("failed to synchronize document");
          }
        });
    parent.show();
  }
  public Canvas getViewPanel() {
    Label label =
        new Label(
            "Staging: <span style=\"color: green; font-weight: bold;\">Normal</span><br/>"
                + "Production: <span style=\"color: green; font-weight: bold;\">Normal</span><br/>"
                + "Development: <span style=\"color: green; font-weight: bold;\">Normal</span>");
    label.setHeight100();
    label.setPadding(5);
    label.setValign(VerticalAlignment.TOP);

    Window window = new Window();
    window.setTitle("Minimizing a window");
    window.setWidth(300);
    window.setHeight(85);
    window.setCanDragResize(true);
    window.addItem(label);

    Canvas canvasMain = new Canvas();
    canvasMain.addChild(window);

    return canvasMain;
  }
  @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);
  }
 public void show() {
   passwordItem.clearValue();
   window.show();
 }
 public void close() {
   window.hide();
 }
Beispiel #6
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();
          }
        });
  }