Exemple #1
0
  protected void processHQMF(
      RichTextArea textArea,
      SplitLayoutPanel splitLayoutPanel,
      VerticalPanel summaryVerticalPanel) {

    String text = textArea.getText();
    final ScrollPanel xmlPanel = getPanelForXML(text);
    if (xmlPanel != null) {
      splitLayoutPanel.remove(textArea);
      splitLayoutPanel.add(xmlPanel);
    }

    for (final Map.Entry<String, TextArea> entry : bookmarkMap.entrySet()) {
      String key = entry.getKey();
      Label label = new Label(key);
      label.setStyleName("bookMarkLabel");
      label.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              TextArea textArea = entry.getValue();
              xmlPanel.setVerticalScrollPosition(textArea.getElement().getOffsetTop());
            }
          });
      summaryVerticalPanel.add(label);
    }
  }
  public void onSave() {
    ArrayList<Message> messages = new ArrayList<Message>();
    WidgetUtil.checkNull(
        new LabeledContainer[] {name, category, status, license, webpageUrl}, messages);
    if (isNull(description.getText())) {
      messages.add(Message.error("Please enter the description", description));
    }
    if (messages.size() > 0) {
      Messages.get().setMessages(null, messages);
      return;
    }

    product.setDescription(description.getHTML());
    if (null == product.getId()) product.setName(name.getComponent().getValue());
    List<String> _tags = tags.getValues();
    if (null != _tags && _tags.size() > 0) {
      product.setTags(_tags.toArray(new String[_tags.size()]));
    } else {
      product.setTags(null);
    }
    product.setOrganizationName(organization.getValue());
    product.setVersionNumber(versionNumber.getComponent().getValue());
    product.setStatus(status.getValue(status.getSelectedIndex()));
    product.setLicense(license.getValue(license.getSelectedIndex()));
    product.setCategoryId(WidgetUtil.getSelectedValue(category.getComponent()));
    product.setWebsiteUrl(webpageUrl.getValue());
    product.setDownloadUrl(downloadUrl.getValue());
    product.setWikiUrl(wikiUrl.getValue());
    product.setDemoUrl(showcaseUrl.getValue());
    product.setIssueTrackerUrl(issueTrackerUrl.getValue());
    product.setForumUrl(forumUrl.getValue());
    product.setNewsUrl(newsfeedUrl.getValue());
    new SaveProductCommand(product) {
      @Override
      public void onSuccess(Product result) {
        pages
            .goTo(
                result.getAlias(),
                new PageRequestSessionWithMessage("The product details were saved."))
            .execute();
      }
    }.execute();
  }