Example #1
0
  private void registrationCompleted(
      MyDialog registrationPopup, final RegisterOntologyResult uploadOntologyResult) {

    registrationPopup.hide();

    String error = uploadOntologyResult.getError();

    StringBuffer sb = new StringBuffer();

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

    if (error == null) {

      String uri = uploadOntologyResult.getUri();

      vp.add(
          new HTML(
              "<font color=\"green\">Congratulations!</font> "
                  + "Your ontology is now registered."));

      vp.add(
          new HTML(
              "<br/>The URI of the ontology is: "
                  //					+ "<a href=\"" +uri+ "\">"
                  + uri
              //					+ "</a>"
              ));

      vp.add(new HTML("<br/>For diagnostics, this is the response from the back-end server:"));

      sb.append(uploadOntologyResult.getInfo());

      // and, disable all editing fields/buttons:
      // (user will have to start from the "load" step)
      //			enable(false);
    } else {
      sb.append(error);
    }

    String msg = sb.toString();
    Orr.log(CLASS_NAME + ": Registration result: " + msg);

    final MyDialog popup = new MyDialog(null);
    popup.setCloseButtonText("Return to ontology list");
    popup.setText(error == null ? "Registration completed sucessfully" : "Error");
    popup.addTextArea(null).setText(msg);
    popup.getTextArea().setSize("600", "150");

    popup.getDockPanel().add(vp, DockPanel.NORTH);
    popup.center();

    popup.addPopupListener(
        new PopupListener() {
          public void onPopupClosed(PopupPanel sender, boolean autoClosed) {
            PortalControl.getInstance().completedRegisterOntologyResult(uploadOntologyResult);
          }
        });
    popup.show();
  }
Example #2
0
  private Widget appendComment(DiscussionRecord r) {
    SmallLabel hrd =
        new SmallLabel(constants.smallCommentBy0On1Small(r.author, new Date(r.timestamp)));
    hrd.addStyleName("discussion-header");
    commentList.add(hrd);

    String[] parts = r.note.split("\n");

    if (parts.length > 0) {
      StringBuilder txtBuilder = new StringBuilder();
      for (int i = 0; i < parts.length; i++) {
        txtBuilder.append(parts[i]);
        if (i != parts.length - 1) {
          txtBuilder.append("<br/>");
        }
      }
      HTML hth = new HTML(txtBuilder.toString());
      hth.setStyleName("form-field");
      commentList.add(hth);
    } else {
      Label lbl = new Label(r.note);
      lbl.setStyleName("form-field");
      commentList.add(lbl);
    }

    commentList.add(new HTML("<br/>"));
    return hrd;
  }
Example #3
0
  public void onModuleLoad() {
    // Make some text boxes. The password text box is identical to the text
    // box, except that the input is visually masked by the browser.
    PasswordTextBox ptb = new PasswordTextBox();
    TextBox tb = new TextBox();

    // TODO(ECC) must be tested.
    tb.addKeyPressHandler(
        new KeyPressHandler() {

          public void onKeyPress(KeyPressEvent event) {
            if (!Character.isDigit(event.getCharCode())) {
              ((TextBox) event.getSource()).cancelKey();
            }
          }
        });

    // Let's make an 80x50 text area to go along with the other two.
    TextArea ta = new TextArea();
    ta.setCharacterWidth(80);
    ta.setVisibleLines(50);

    // Add them to the root panel.
    VerticalPanel panel = new VerticalPanel();
    panel.add(tb);
    panel.add(ptb);
    panel.add(ta);
    RootPanel.get().add(panel);
  }
Example #4
0
 public void onDisplayMessage(String message, Boolean clear) {
   if (clear) {
     vp.clear();
   }
   vp.add(new Label(message));
   RootPanel.get("messages").add(vp);
 }
Example #5
0
  private void validatorActions() {
    Toolbar tb = new Toolbar();

    layout.setCellHeight(editor, "95%");
    layout.add(tb);

    ToolbarButton viewSource = new ToolbarButton();
    viewSource.setText("View source");
    viewSource.addListener(
        new ButtonListenerAdapter() {
          public void onClick(com.gwtext.client.widgets.Button button, EventObject e) {
            doViewsource();
          }
        });
    tb.addButton(viewSource);

    tb.addSeparator();

    ToolbarButton validate = new ToolbarButton();
    validate.setText("Validate");
    validate.addListener(
        new ButtonListenerAdapter() {
          public void onClick(com.gwtext.client.widgets.Button button, EventObject e) {
            doValidate();
          }
        });
    tb.addButton(validate);
  }
Example #6
0
  private VerticalPanel buildExtras() {

    HorizontalPanel extsBaseRow = new HorizontalPanel();

    ToggleButton bShowOnly = new ToggleButton(new Image("images/button_eye.gif"), this);
    bShowOnly.setTitle("Click to hide all route segments except this one! Click again to restore.");
    extsBaseRow.add(bShowOnly);

    soClick = new HTML("<div class=\"togglelink\">詳細內容</div>");
    soClick.setTitle("顯示詳細內容.");
    soClick.addClickListener(this);
    extsBaseRow.add(soClick);

    VerticalPanel exts = new VerticalPanel();
    exts.add(extsBaseRow);

    detailPanel = buildStopOvers();
    exts.add(detailPanel);

    exts.setStyleName("extras");
    extsBaseRow.setStyleName("base_row");
    bShowOnly.setStyleName("eye");
    detailPanel.setStyleName("stopovers");
    return exts;
  }
  /** Creates a new ProjectList */
  public ProjectList() {
    projects = new ArrayList<Project>();
    selectedProjects = new ArrayList<Project>();
    projectWidgets = new HashMap<Project, ProjectWidgets>();

    sortField = SortField.DATE_MODIFIED;
    sortOrder = SortOrder.DESCENDING;

    // Initialize UI
    table = new Grid(1, 4); // The table initially contains just the header row.
    table.addStyleName("ode-ProjectTable");
    table.setWidth("100%");
    table.setCellSpacing(0);
    nameSortIndicator = new Label("");
    dateCreatedSortIndicator = new Label("");
    dateModifiedSortIndicator = new Label("");
    refreshSortIndicators();
    setHeaderRow();

    VerticalPanel panel = new VerticalPanel();
    panel.setWidth("100%");

    panel.add(table);
    initWidget(panel);

    // It is important to listen to project manager events as soon as possible.
    Ode.getInstance().getProjectManager().addProjectManagerEventListener(this);
  }
Example #8
0
  private FlowLayoutContainer createButtons(Category cat) {
    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(10);
    vp.setWidth("400px");

    for (Type type : Type.values()) {
      vp.add(format(type.getText()));

      HorizontalPanel hp = new HorizontalPanel();
      hp.setSpacing(5);

      CellButtonBase<?> small = createButton(cat, type);
      CellButtonBase<?> medium = createButton(cat, type);
      CellButtonBase<?> large = createButton(cat, type);

      configureButton(small, type, ButtonScale.SMALL);
      configureButton(medium, type, ButtonScale.MEDIUM);
      configureButton(large, type, ButtonScale.LARGE);

      hp.add(small);
      hp.add(medium);
      hp.add(large);

      vp.add(hp);
    }

    FlowLayoutContainer f = new FlowLayoutContainer();
    f.getScrollSupport().setScrollMode(ScrollMode.AUTO);
    f.add(vp);

    con.add(f);

    return f;
  }
Example #9
0
    public Widget makeExtraUI(final WebLayerItem item) {

      final CheckBox cb =
          GwtUtil.makeCheckBox(
              "Offset Calculation",
              "Calculate the distance, delta(RA), delta(Dec), and PA between two points",
              _posAngle);
      cb.addValueChangeHandler(
          new ValueChangeHandler<Boolean>() {
            public void onValueChange(ValueChangeEvent<Boolean> ev) {
              _posAngle = ev.getValue();
              redraw();
            }
          });

      SimpleInputField units =
          SimpleInputField.createByProp("PrefGroup.Generic.field.DistanceReadout");
      String pref = Preferences.get(DIST_READOUT);
      units.setValue(pref == null ? DEG : pref);
      units
          .getField()
          .addValueChangeHandler(
              new ValueChangeHandler<String>() {
                public void onValueChange(ValueChangeEvent<String> ev) {
                  Preferences.set(DIST_READOUT, ev.getValue());
                  redraw();
                }
              });

      VerticalPanel vp = new VerticalPanel();
      vp.add(cb);
      vp.add(units);

      return vp;
    }
Example #10
0
  // PostData page contains a list of Posts
  //  Created when user clicks "View Posts"
  public void viewPostData(List<PostData> posts) {
    if (posts == null) return;

    RootPanel rootPanel = RootPanel.get();
    rootPanel.clear();
    makeMenuBar(rootPanel);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    rootPanel.add(horizontalPanel, 10, 79);

    makeSideBar(horizontalPanel);

    VerticalPanel dataListPanel = new VerticalPanel();
    horizontalPanel.add(dataListPanel);

    FlowPanel flowPanel = new FlowPanel();
    dataListPanel.add(flowPanel);

    Label programTitlebar = new Label("GusList");
    programTitlebar.addStyleName("appTitleBar");
    programTitlebar.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    flowPanel.add(programTitlebar);

    makePostTable(posts, flowPanel, dataListPanel);
  }
  public void showContainerSizePanel() {
    CaptionPanel bodySize = new CaptionPanel(constants.containerSizeTitle());
    bodySize.setWidth("185px");

    final VerticalPanel content = new VerticalPanel();

    containerSizeListBox = new CustomListBox();

    content.add(containerSizeListBox);
    bodySize.setContentWidget(content);

    HorizontalPanel setSizePanel = new HorizontalPanel();

    setSizeDisclosurePanel = new DisclosurePanel(constants.sizeInPixel());
    setSizeDisclosurePanel.setAnimationEnabled(true);
    setSizeDisclosurePanel.setOpen(true);
    setSizeDisclosurePanel.setVisible(false);

    setSizeDisclosurePanel.add(setSizePanel);

    customSizeTextBox = new TextBox();
    customSizeTextBox.setWidth("50px");
    setSizePanel.add(customSizeTextBox);

    validCustomSizeButton = new Button("OK");

    setSizePanel.add(validCustomSizeButton);

    content.add(setSizeDisclosurePanel);

    builderContent.add(bodySize);
  }
Example #12
0
  // Helper method to make list of buttons on left side of View
  public void makeSideBar(HorizontalPanel hp) {
    VerticalPanel sidePanel = new VerticalPanel();
    hp.add(sidePanel);
    sidePanel.setSize("72px", "98px");

    Button postAdButton = new Button("Post Ad");
    postAdButton.setStyleName("sideBarButton");
    postAdButton.setText("Post Ad");
    // add a clickListener to the button
    postAdButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            viewPostAdForm();
          }
        });
    sidePanel.add(postAdButton);

    Button viewAdsButton = new Button("View Ads");
    viewAdsButton.setStyleName("sideBarButton");
    viewAdsButton.setText("View Ads");
    // add a clickListener to the button
    viewAdsButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            control.viewAdDataFromServer();
          }
        });
    sidePanel.add(viewAdsButton);

    Hyperlink adminHyperlink = new Hyperlink("Admin Page", false, "newHistoryToken");
    sidePanel.add(adminHyperlink);
  }
Example #13
0
        public void onSuccess(List<PacketUserData> result) {
          clear();
          add(html);
          HorizontalPanel horizontalPanel = new HorizontalPanel();
          for (PacketUserData data : result) {
            final VerticalPanel panel = new VerticalPanel();
            panel.setHorizontalAlignment(ALIGN_CENTER);

            final Image image = new Image(Constant.ICON_URL_PREFIX + data.imageFileName);
            image.setPixelSize(Constant.ICON_SIZE_BIG, Constant.ICON_SIZE_BIG);
            panel.add(image);

            final Label label = new Label(data.playerName);
            panel.add(label);

            horizontalPanel.add(panel);

            if (horizontalPanel.getWidgetCount() == 8) {
              add(horizontalPanel);
              horizontalPanel = new HorizontalPanel();
            }
          }

          if (horizontalPanel.getWidgetCount() != 0) {
            add(horizontalPanel);
          }
        }
Example #14
0
  private void reviewCompleted(
      final MyDialog popup, final CreateOntologyResult createOntologyResult) {
    String error = createOntologyResult.getError();

    //  Issue 211: Remove unnecesary registration confirmation dialogs
    if (error == null) {
      doRegister(popup, createOntologyResult);
      return;
    }

    StringBuffer sb = new StringBuffer();

    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(4);
    sb.append(error);

    String msg = sb.toString();

    popup.getTextArea().setText(msg);
    popup.getDockPanel().add(vp, DockPanel.NORTH);
    popup.setText(error == null ? "Ontology ready to be registered" : "Error");
    popup.center();

    Orr.log(CLASS_NAME + ": Review result: " + msg);
  }
Example #15
0
  public Widget draw() {

    VerticalPanel vp = new VerticalPanel();
    vp.getElement().setAttribute("style", "padding-top: 5px;");
    vp.setSize("100%", "100%");

    FindAllAuthors callback = new FindAllAuthors();
    CellTable<Author> table =
        callback.getTable(
            new FieldUpdater<Author, String>() {
              public void update(int index, Author object, String value) {
                if (session.isPerunAdmin()) {
                  session.getTabManager().addTab(new UsersPublicationsTabItem(object.getId()));
                }
              }
            });

    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel();
    sp.add(table);
    sp.addStyleName("perun-tableScrollPanel");

    vp.add(sp);

    // resize perun table to correct size on screen
    session.getUiElements().resizeSmallTabPanel(sp, 350, this);

    this.contentWidget.setWidget(vp);

    return getWidget();
  }
Example #16
0
  /** Constructor. */
  private ExportBox() {
    super(false);

    panel = new VerticalPanel();
    panel.getElement().getStyle().setMarginTop(1, Unit.EM);

    setHeadline(R.lang.Export());
    setDraggable(true);
    setWidth(WIDTH_PX + "px");

    btnExportXML = new Button(R.lang.exportInFile());
    btnExportXML.getElement().getStyle().setFloat(Float.RIGHT);
    btnExportXML.addClickHandler(this);

    btnClose = new Button(R.lang.Close());
    btnClose.getElement().getStyle().setMarginLeft(1, Unit.EM);
    btnClose.getElement().getStyle().setFloat(Float.RIGHT);
    btnClose.addClickHandler(this);

    textarea = new TextArea();
    textarea.setWidth((WIDTH_PX - 10) + "px");
    textarea.setHeight("200px");

    btnPanel = new FlowPanel();
    btnPanel.add(btnClose);
    btnPanel.add(btnExportXML);

    panel.add(textarea);
    panel.add(btnPanel);

    setContentWidget(panel);
  }
Example #17
0
  private void showLogonDialog() {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Login");
    dialogBox.setGlassEnabled(true);
    dialogBox.setAnimationEnabled(true);

    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setSpacing(4);
    dialogBox.setWidget(verticalPanel);

    final TextBox username = new TextBox();
    verticalPanel.add(new HTML("Username:"******"Logon",
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                dialogBox.hide();
                login(username.getValue());
              }
            });
    verticalPanel.add(closeButton);

    dialogBox.center();
    dialogBox.show();
  }
Example #18
0
  private Panel buildPanelBrowse() {

    this._panelBrowse.setSpacing(Constantes.SPACING_MIN);
    this._panelBrowse.setHeight(Constantes.Dim50PX);
    this._panelBrowse.setWidth(Constantes.MAX_SIZE);
    this._panelBrowse.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
    this._panelBrowse.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    // radio button
    final VerticalPanel vPanelLabel = new VerticalPanel();
    vPanelLabel.add(this._rbChoisirArchive);
    vPanelLabel.add(this._rbChoisirRepSource);
    this._panelBrowse.add(vPanelLabel);
    this._panelBrowse.setCellWidth(vPanelLabel, "300px");

    // action panel
    final FlowPanel actionPanel = new FlowPanel();
    actionPanel.add(this._fileUploader);
    actionPanel.add(this.buildAppletButton());
    this._panelBrowse.add(actionPanel);
    this._panelBrowse.setCellWidth(actionPanel, "350px");

    // buttons
    this._panelBrowse.add(this._btGoInfo);
    this._panelBrowse.setCellWidth(this._btGoInfo, "50px");

    this._panelBrowse.add(this._btDemo);

    return this._panelBrowse;
  }
Example #19
0
  public Widget asWidget() {
    VerticalPanel layout = new VerticalPanel();
    layout.addStyleName("window-content");

    ConnectorForm form =
        new ConnectorForm(
            new FormToolStrip.FormCallback<ActivemqConnector>() {
              @Override
              public void onSave(Map<String, Object> changeset) {}

              @Override
              public void onDelete(ActivemqConnector entity) {}
            },
            type);

    form.setIsCreate(true);
    layout.add(form.asWidget());

    DialogueOptions options =
        new DialogueOptions(
            event -> {
              Form<ActivemqConnector> actualForm = form.getForm();
              FormValidation validation = actualForm.validate();
              if (!validation.hasErrors()) {
                ActivemqConnector entity = actualForm.getUpdatedEntity();
                entity.setType(type);
                presenter.onCreateConnector(entity);
              }
            },
            event -> presenter.closeDialogue());

    return new WindowContentBuilder(layout, options).build();
  }
  /**
   * Create a Date picker. The code comes from the GWT show case :
   * http://gwt.google.com/samples/Showcase/Showcase.html#!CwDatePicker@
   *
   * @return
   */
  private VerticalPanel createDatePanel() {
    // Create a basic date picker
    DatePicker datePicker = new DatePicker();
    final Label text = new Label();

    // Set the value in the text box when the user selects a date
    datePicker.addValueChangeHandler(
        new ValueChangeHandler<Date>() {
          public void onValueChange(ValueChangeEvent<Date> event) {
            Date date = event.getValue();
            String dateString = DateTimeFormat.getMediumDateFormat().format(date);
            text.setText(dateString);
          }
        });

    // Set the default value
    datePicker.setValue(new Date(), true);

    // Combine the widgets into a panel and return them
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.add(new HTML("Permanent DatePicker:"));
    vPanel.add(text);
    vPanel.add(datePicker);
    return vPanel;
  }
    private void addFileUploadWidget() {
      final FileUpload upload = new FileUpload();
      upload.setWidth("200px");
      upload.setName(getUniqueId());
      uploadForms.add(upload);
      final HorizontalPanel hPanel = new HorizontalPanel();
      hPanel.setHeight("30px");
      hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
      // Don't display ability to remove form if expecting exactly 1 upload or if this is the first
      // upload element
      if (isMultiple() && uploadForms.size() > 1) {
        com.google.gwt.user.client.ui.Image crossImage = new com.google.gwt.user.client.ui.Image();
        crossImage.setUrl(Resources.CROSS);
        crossImage.addClickHandler(
            new com.google.gwt.event.dom.client.ClickHandler() {
              public void onClick(final com.google.gwt.event.dom.client.ClickEvent clickEvent) {
                panel.remove(hPanel);
                uploadForms.remove(hPanel.getWidget(1));
              }
            });
        hPanel.add(crossImage);
      } else {
        com.google.gwt.user.client.ui.VerticalPanel space =
            new com.google.gwt.user.client.ui.VerticalPanel();
        space.setSize("16px", "1px");
        hPanel.add(space);
      }

      hPanel.add(upload);
      panel.add(hPanel);
      if (get() != null) {
        get().markForRedraw();
      }
    }
  /**
   * Create a Dynamic tree. The code comes from the GWT show case :
   * http://gwt.google.com/samples/Showcase/Showcase.html#!CwTabPanel
   */
  @SuppressWarnings("deprecation")
  private DecoratedTabPanel createTabPanel() {
    // Create a tab panel
    DecoratedTabPanel tabPanel = new DecoratedTabPanel();
    tabPanel.setWidth("400px");
    tabPanel.setAnimationEnabled(true);

    // Add a home tab
    String[] tabTitles = {"Home", "GWT Logo", "More info"};
    HTML homeText =
        new HTML("Click one of the tabs to see more content. <br/> You can drag me now !");
    tabPanel.add(homeText, tabTitles[0]);

    // Add a tab with an image
    /*
     * VerticalPanel vPanel = new VerticalPanel(); vPanel.add(new
     * Image(Showcase.images.gwtLogo()));
     */
    // TODO add gwt logo
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.add(new com.google.gwt.user.client.ui.Image(Image.INSTANCE.gwtLogo()));
    tabPanel.add(new com.google.gwt.user.client.ui.Image(Image.INSTANCE.gwtLogo()), tabTitles[1]);

    // Add a tab
    HTML moreInfo = new HTML("Tabs are highly customizable using CSS.");
    tabPanel.add(moreInfo, tabTitles[2]);

    // Return the content
    tabPanel.selectTab(0);
    tabPanel.ensureDebugId("cwTabPanel");
    return tabPanel;
  }
Example #23
0
  private void refreshWidgets() {
    this.artifactEditor = new ArtifactEditor(asset, null);
    this.ruleViewer =
        new RuleViewer(
            asset,
            this.editEvent,
            this.closeCommand,
            this.checkedInCommand,
            this.archiveCommand,
            this.isHistoricalReadOnly,
            actionToolbarButtonsConfigurationProvider,
            ruleViewerSettings);
    this.actionToolBar = this.ruleViewer.getActionToolbar();

    VerticalPanel vp = new VerticalPanel();
    vp.add(this.actionToolBar);

    TabPanel tPanel = new TabPanel();
    tPanel.setWidth("100%");

    ScrollPanel pnl = new ScrollPanel();
    pnl.add(this.artifactEditor);
    tPanel.add(pnl, "Attributes");
    // tPanel.selectTab(0);

    pnl = new ScrollPanel();
    // pnl1.setWidth("100%");
    pnl.add(this.ruleViewer);
    tPanel.add(pnl, "Edit");
    tPanel.selectTab(1);

    vp.add(tPanel);
    initWidget(vp);
  }
Example #24
0
  /** Initialize this example. */
  private Widget initialize() {

    // Create a new panel
    absolutePanel = new AbsolutePanel();

    // Add a widget that we will animate
    animateeTop = new Image("gwtLogoThumb.png");
    animateeBottom = new Image("gwtLogoThumb.png");
    animateeLeft = new Image("gwtLogoThumb.png");
    animateeRight = new Image("gwtLogoThumb.png");
    absolutePanel.add(animateeTop);
    absolutePanel.add(animateeBottom);
    absolutePanel.add(animateeLeft);
    absolutePanel.add(animateeRight);

    // Wrap the absolute panel in a DecoratorPanel
    VerticalPanel absolutePanelWrapper = new VerticalPanel();
    absolutePanelWrapper.add(absolutePanel);

    // Add the components to a panel and return it
    absolutePanelWrapper.add(createOptionsBar());

    // Create the custom animation
    animation = new CustomAnimation(70);

    // Set the start position of the widgets
    animation.onComplete();

    absolutePanel.setSize((animation.centerX * 2 + 10) + "px", (animation.centerY * 2 + 10) + "px");

    // Return the layout
    return absolutePanelWrapper;
  }
Example #25
0
  private Panel createNewNameInput(final ScrollPanel contentPanel) {
    VerticalPanel form = new VerticalPanel();
    HorizontalPanel nameForm = new HorizontalPanel();
    nameForm.add(new Label("Name"));
    final TextBox nameTextBox = new TextBox();
    nameTextBox.setName("personName");
    nameForm.add(nameTextBox);
    form.add(nameForm);
    Button saveButton =
        new Button(
            "Store",
            new ClickListener() {
              public void onClick(Widget sender) {
                String name = nameTextBox.getText();
                RaffleServiceGwtRemoteAsync service = RaffleServiceGwtRemote.App.getInstance();
                AsyncCallback callback =
                    new AsyncCallback() {
                      public void onFailure(Throwable caught) {
                        GWT.log("Failure while creating a new name", caught);
                      }

                      public void onSuccess(Object result) {
                        contentPanel.setWidget(new Label("Name is stored"));
                      }
                    };
                service.storeName(name, callback);
              }
            });
    form.add(saveButton);
    return form;
  }
Example #26
0
  public SubGoalDialogBox(
      final Command riksPane,
      List<GwtSubGoal> allSubGoals,
      List<GwtSubGoal> curretSelectedSubGoals) {

    // Set the dialog box's caption.
    setText(messages.associateGoals());

    this.allSubGoals = allSubGoals;
    this.oldSelectedSubGoals = curretSelectedSubGoals;

    final VerticalPanel checkBoxContainer = new VerticalPanel();
    checkBoxContainer.setSpacing(10);
    for (GwtSubGoal a : allSubGoals) {

      SubGoalCheckBox checkBox = new SubGoalCheckBox();
      checkBox.setText(a.getDescription());
      checkBox.setSubGoalID(a.getId());
      if (isCurrentSubGoalSelected(a.getId())) {
        checkBox.setValue(true);
      }
      checkBoxContainer.add(checkBox);
    }

    Button ok = new Button(messages.ok());
    Button cancel = new Button(messages.cancel());
    cancel.setWidth("60px");
    ok.setWidth("60px");

    FlexTable buttonsTable = new FlexTable();
    buttonsTable.setWidth("100%");
    buttonsTable.setCellPadding(3);
    buttonsTable.setWidget(0, 0, ok);
    buttonsTable.setWidget(0, 1, cancel);
    buttonsTable
        .getCellFormatter()
        .setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    buttonsTable.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT);

    ok.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            loadSelectedSubGoals(checkBoxContainer);
            riksPane.execute();
            SubGoalDialogBox.this.hide();
          }
        });

    cancel.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {

            SubGoalDialogBox.this.hide();
          }
        });

    checkBoxContainer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    checkBoxContainer.add(buttonsTable);
    setWidget(checkBoxContainer);
  }
Example #27
0
  private void showAddNewComment() {
    newCommentLayout.clear();
    final TextArea comment = new TextArea();
    comment.setWidth("100%");
    newCommentLayout.add(comment);

    Button ok = new Button(constants.OK());
    Button cancel = new Button(constants.Cancel());

    ok.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent sender) {
            sendNewComment(comment.getText());
          }
        });

    cancel.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent sender) {
            showNewCommentButton();
          }
        });

    HorizontalPanel hp = new HorizontalPanel();
    hp.add(ok);
    hp.add(cancel);

    newCommentLayout.add(hp);

    comment.setFocus(true);
  }
Example #28
0
    public CategorySelector() {
      setTitle(constants.SelectCategoryToAdd());
      VerticalPanel vert = new VerticalPanel();

      selector =
          new CategoryExplorerWidget(
              new CategorySelectHandler() {
                public void selected(String sel) {
                  selectedPath = sel;
                }
              });

      vert.add(selector);
      vert.add(ok);

      addRow(vert);

      ok.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              if (selectedPath != null && !"".equals(selectedPath)) {
                addToCategory(selectedPath);
              }
              hide();
            }
          });
    }
  /**
   * This method is called when GWT loads the Notes application (as defined in the Notes.gwt.xml).
   */
  public void onModuleLoad() {

    final HorizontalPanel mainpanel = new HorizontalPanel();

    final HTML displayTitle = new HTML("Existing Notes");
    displayTitle.setStyleName("displayTitle");
    final HTML entryTitle = new HTML("Create A Note");
    entryTitle.setStyleName("entryTitle");

    final VerticalPanel displayPanel = new VerticalPanel();
    displayPanel.setVerticalAlignment(VerticalPanel.ALIGN_TOP);
    displayPanel.setStyleName("displayPanel");
    displayPanel.add(displayTitle);

    final VerticalPanel entryPanel = new VerticalPanel();
    entryPanel.setVerticalAlignment(VerticalPanel.ALIGN_TOP);
    entryPanel.setStyleName("entryPanel");
    entryPanel.add(entryTitle);

    displayPanel.add(notesPanel);

    final VerticalPanel form = createForm();
    entryPanel.add(form);

    mainpanel.add(displayPanel);
    mainpanel.add(entryPanel);

    RootPanel.get("notes").add(mainpanel);

    getNotes();
  }
Example #30
0
  public MainPanel() {
    super(Unit.PX);

    Image logoUfcg = new Image(Adicionais.RESOURCES.logoUfcg());
    Image logoAdicionais = new Image(Adicionais.RESOURCES.logoAdicionais());
    HorizontalPanel header = new HorizontalPanel();
    header.add(logoUfcg);
    header.setCellVerticalAlignment(logoUfcg, HasVerticalAlignment.ALIGN_MIDDLE);
    header.add(logoAdicionais);
    header.setCellHorizontalAlignment(logoAdicionais, HasHorizontalAlignment.ALIGN_RIGHT);
    header.setWidth("100%");
    header.setStyleName(Adicionais.RESOURCES.css().header());
    this.addNorth(header, 88);

    VerticalPanel footer = new VerticalPanel();
    Label developersLabel =
        new Label("Desenvolvido por Cleber Gonçalves de Sousa e Vitor Morato Almeida");
    developersLabel.setStyleName(Adicionais.RESOURCES.css().developers());
    footer.add(developersLabel);

    this.addSouth(footer, 23);
    footer.setWidth("100%");
    footer.setStyleName(Adicionais.RESOURCES.css().footer());

    this.contentArea = new SimplePanel();
    this.contentArea.setStyleName(Adicionais.RESOURCES.css().content());
    this.add(this.contentArea);
  }