예제 #1
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));
    }
  }
 public RichTextArea create(Element e) {
   String v = null;
   RichTextArea richArea = null;
   TextAreaElement textElement = null;
   if ($(e).widget(0) != null && $(e).widget(0) instanceof RichTextArea) {
     richArea = $(e).widget(0);
     v = richArea.getHTML();
   } else if ("textarea".equalsIgnoreCase(e.getTagName())) {
     v = $(e).val();
     textElement = TextAreaElement.as(e);
   } else if (WidgetsUtils.matchesTags(e, "div", "span")) {
     v = $(e).html();
   }
   if (v != null) {
     final RichTextWithToolbar richWidget = new RichTextWithToolbar(richArea, textElement);
     richArea = richWidget.area;
     richArea.setHTML(v);
     if (textElement != null) {
       WidgetsUtils.hideAndAfter(textElement, richWidget);
     } else {
       WidgetsUtils.replaceOrAppend(e, richWidget);
     }
     return richArea;
   }
   return null;
 }
  public EditProblemInterview(JSONObject interview) {

    this.setSpacing(20);

    this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    String companyUniqueID = ConvertJson.convertToString(interview.get("company"));
    if (companyUniqueID == null) {

      companyUniqueID =
          ConvertJson.convertToString(UniqueIDGlobalVariables.companyUniqueID.get("ID"));

      ConvertJson.setStringValue(interview, companyUniqueID, "company");
    }

    String interviewerUniqueID = ConvertJson.convertToString(interview.get("interviewer"));
    if (interviewerUniqueID == null && UniqueIDGlobalVariables.uniqueID != null) {

      interviewerUniqueID = ConvertJson.convertToString(UniqueIDGlobalVariables.uniqueID.get("ID"));

      ConvertJson.setStringValue(interview, interviewerUniqueID, "interviewer");
    }
    this.add(FormField.getStringField("Interviewer", interviewerUniqueID));

    String date = ConvertJson.convertToString(interview.get("datetime"));
    if (date == null) {
      dateTime.setValue(new Date());
    } else {
      dateTime.setValue(new Date(new Long(date)));
    }

    this.add(FormField.getFormField("<font color=red>*</font> Date", dateTime));

    String problem = ConvertJson.convertToString(interview.get("problem"));
    problemField = new ProblemsListbox(problem);
    this.add(FormField.getFormField("<font color=red>*</font> Problem", problemField));

    String customerName = ConvertJson.convertToString(interview.get("customerName"));
    customerNameField.setValue(customerName);
    this.add(FormField.getFormField("<font color=red>*</font> Customer Name", customerNameField));

    String customerUniqueID = ConvertJson.convertToString(interview.get("customerUniqueID"));
    customerUniqueIDField.setValue(customerUniqueID);
    this.add(FormField.getFormField("Customer UniqueID", customerUniqueIDField));

    String videoURLValue = ConvertJson.convertToString(interview.get("videoURL"));
    videoURLField.setValue(videoURLValue);
    this.add(FormField.getFormField("Video URL", videoURLField));
    videoURLField.setWidth("300px");

    String notesValue = ConvertJson.convertToString(interview.get("notes"));
    notes.setHTML(notesValue);
    this.add(FormField.getFormField("Notes", notes));
    notes.setSize("300px", "100px");
  }
 /**
  * Sets the content of the textbox to the specified value.
  *
  * @param newText the new content of the textbox
  */
 public void setHTML(String newText) {
   bodyWidget.setHTML(newText);
 }
  protected void initItem(int width, int height) {
    String legacyHtml = "";
    if (toolBar != null) {
      toolBar.removeFromParent();
    }
    if (textArea != null) {
      legacyHtml = textArea.getHTML();
      textArea.removeFromParent();
    }
    if (mainLayout != null) {
      removeItem(mainLayout);
      mainLayout.destroy();
    }
    textArea = new RichTextArea();
    toolBar = new RichTextToolbar(textArea, DisplayType.DETAILED);

    saveButton = new IButton(BLCMain.getMessageManager().getString("ok"));
    IButton cancelButton = new IButton(BLCMain.getMessageManager().getString("cancel"));
    cancelButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            hide();
          }
        });

    final HtmlEditingPresenter pp = HtmlEditingPresenter.getInstance();

    final HLayout buttonsLayout = new HLayout(10);
    buttonsLayout.setAlign(Alignment.CENTER);
    buttonsLayout.addMember(saveButton);
    buttonsLayout.addMember(cancelButton);
    buttonsLayout.setLayoutTopMargin(2);
    buttonsLayout.setLayoutBottomMargin(2);
    buttonsLayout.setWidth100();
    buttonsLayout.setHeight(25);

    mainLayout = new VLayout();
    mainLayout.setWidth100();
    mainLayout.setHeight100();

    toolBar.setHeight("60px");
    final VLayout toolbarLayout = new VLayout();
    toolbarLayout.setWidth100();
    toolbarLayout.setHeight(60);
    toolbarLayout.addMember(toolBar);

    int textHeight = height - 130;
    textArea.setHeight(textHeight + "px");
    textArea.setWidth(width + "px");
    final VLayout textAreaLayout = new VLayout();
    textAreaLayout.setWidth100();
    textAreaLayout.setHeight(textHeight);
    textAreaLayout.addMember(textArea);

    mainLayout.addMember(toolbarLayout);
    mainLayout.addMember(textAreaLayout);
    mainLayout.addMember(buttonsLayout);
    addItem(mainLayout);

    toolBar.addAssetHandler(
        new Command() {
          @Override
          public void execute() {
            pp.displayAssetSearchDialog(toolBar);
          }
        });

    textArea.setHTML(legacyHtml);

    saveButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (richTextItem != null) {
              richTextItem.setValue(toolBar.getHTML());
              richTextItem.getForm().fireEvent(new ItemChangedEvent(richTextItem.getJsObj()));
            }
            hide();
          }
        });
  }