Exemplo n.º 1
0
 private void resetIcon() {
   if (null == product.getIconKey()) {
     icon.setSrc("images/noicon.gif");
     containerPanel.getWidget(0).setVisible(false);
   } else {
     containerPanel.getWidget(0).setVisible(true);
     icon.setSrc(
         "gwt_marketplace/productImage?key=" + product.getId() + "&ik=" + product.getIconKey());
     icon.getStyle().setDisplay(Display.BLOCK);
   }
 }
Exemplo n.º 2
0
 @Override
 public void onSubmitComplete(SubmitCompleteEvent event) {
   String key = event.getResults();
   if (null != key && key.length() > 0) {
     product.setIconKey(key);
     resetIcon();
   }
   uploaderContainer.clear();
   uploaderContainer.add(new ProductImageUploadPanel(product, this));
 }
Exemplo n.º 3
0
  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();
  }
Exemplo n.º 4
0
 public void onCancel() {
   if (Window.confirm("Are you sure you want to cancel?")) {
     pages.goTo(product.getAlias()).execute();
   }
 }
Exemplo n.º 5
0
  public void show(final Pair<Product, String> productPair) {
    this.product = productPair.getEntity1();
    if (null != product.getDescription()) description.setHTML(product.getDescription());
    else description.setText("");
    tags.setValues(product.getTags());
    name.setValue(product.getName());
    versionNumber.setValue(product.getVersionNumber());
    organization.setValue(product.getOrganizationName());
    webpageUrl.setValue(product.getWebsiteUrl());
    wikiUrl.setValue(product.getWikiUrl());
    downloadUrl.setValue(product.getDownloadUrl());
    showcaseUrl.setValue(product.getDemoUrl());
    forumUrl.setValue(product.getForumUrl());
    issueTrackerUrl.setValue(product.getIssueTrackerUrl());
    newsfeedUrl.setValue(product.getNewsUrl());
    WidgetUtil.selectValue(license.getComponent(), product.getLicense());
    WidgetUtil.selectValue(status.getComponent(), product.getStatus());
    WidgetUtil.selectValue(category.getComponent(), product.getCategoryId());
    new GetProductCategoriesCommand() {

      @Override
      public void onSuccess(ArrayList<Category> result) {
        WidgetUtil.selectValue(category.getComponent(), product.getCategoryId());
      }
    }.execute();
    resetIcon();
    uploaderContainer.clear();
    if (null != product && null != product.getId()) {
      uploaderContainer.add(new ProductImageUploadPanel(product, this));
    }
  }