コード例 #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));
    }
  }
コード例 #2
0
ファイル: HQMFViewer.java プロジェクト: chinbaj/CQL_POC
  public void onModuleLoad() {

    TabLayoutPanel tabLayoutPanel = new TabLayoutPanel(2.5, Unit.EM);
    final SplitLayoutPanel splitLayoutPanel = new SplitLayoutPanel();
    final HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hPanel.setSpacing(10);
    hPanel.add(new HTML("HQMF Viewer."));
    Button processHQMFButton = new Button("Process HQMF.");
    processHQMFButton.addStyleName("sendButton");
    hPanel.add(processHQMFButton);
    hPanel.add(new HTML("\t(For some reason, works only in IE right now.)"));

    final VerticalPanel summaryVerticalPanel = new VerticalPanel();
    summaryVerticalPanel.setSpacing(3);
    processHQMFButton.setStyleName("summaryVPanel");
    summaryVerticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    summaryVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    splitLayoutPanel.addNorth(hPanel, 50);
    splitLayoutPanel.addWest(summaryVerticalPanel, 0);

    final RichTextArea textArea = new RichTextArea();
    textArea.setTitle("Paste your HQMF XML here.");
    textArea.setText("Paste your HQMF XML here.");
    textArea.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            if (textArea.getText().length() < 30
                && textArea.getText().equals("Paste your HQMF XML here.")) {
              textArea.setText("");
            }
          }
        });
    textArea.addStyleName("boxsizingBorder");
    textArea.setWidth("100%");
    textArea.setHeight("100%");

    processHQMFButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            processHQMF(textArea, splitLayoutPanel, summaryVerticalPanel);
            splitLayoutPanel.remove(hPanel);
            splitLayoutPanel.setWidgetSize(summaryVerticalPanel, 200);
            splitLayoutPanel.setWidgetToggleDisplayAllowed(summaryVerticalPanel, true);
          }
        });
    splitLayoutPanel.add(textArea);

    MySplitLayoutPanel mySplitPanel = new MySplitLayoutPanel();
    final VerticalPanel testVerticalPanel = new VerticalPanel();
    testVerticalPanel.setSpacing(3);

    testVerticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    testVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    // final RichTextArea testtextArea = getSmartTextArea();
    // final AceEditor testtextArea = getAceEditor();
    AceEditor aceTxtArea = new AceEditor();
    aceTxtArea.setWidth("100%");
    aceTxtArea.setHeight("100%");

    mySplitPanel.addEast(testVerticalPanel, 0);
    mySplitPanel.add(aceTxtArea);
    //		mySplitPanel.add(testtextArea);

    aceTxtArea.startEditor();

    setAceEditorProperties(aceTxtArea);

    mySplitPanel.setWidgetToggleDisplayAllowed(testVerticalPanel, true);

    tabLayoutPanel.add(mySplitPanel, "test CQL Editor.");
    tabLayoutPanel.add(splitLayoutPanel, "HQMF Viewer");

    RootLayoutPanel.get().add(tabLayoutPanel);
  }
コード例 #3
0
ファイル: HQMFViewer.java プロジェクト: chinbaj/CQL_POC
  public RichTextArea getSmartTextArea() {
    final RichTextArea testtextArea = new RichTextArea();
    testtextArea.setTitle("test test test.");
    testtextArea.setText("test test test.");
    testtextArea.addStyleName("boxsizingBorder");
    testtextArea.setWidth("100%");
    testtextArea.setHeight("100%");

    //		testtextArea.addKeyPressHandler(new KeyPressHandler() {
    //            @Override
    //            public void onKeyPress(KeyPressEvent event) {
    //                System.out.println( "KeyPressEvent:" +
    //                              event.getCharCode() + ":" +
    //                              event.isAnyModifierKeyDown() + ":" +
    //                              event.isControlKeyDown());
    //            }
    //
    //
    //        });

    testtextArea.addKeyUpHandler(
        new KeyUpHandler() {
          @Override
          public void onKeyUp(KeyUpEvent event) {

            // if(event.getNativeKeyCode() == 32 && event.isControlKeyDown()){
            if (event.getNativeKeyCode() == 32) {
              System.out.println(
                  "Show popup with context sensitive alternatives. Give focus to popup.");
              event.preventDefault();
              event.stopPropagation();
              //            		int xCoOrdinate = event.getNativeEvent().getScreenX();
              //            		int yCoOrdinate = event.getNativeEvent().getScreenY();

              RichTextArea richTextArea = (RichTextArea) event.getSource();

              String htmlText = richTextArea.getHTML();
              boolean isEndParagraphTagRemoved = false;
              System.out.println("before htmlText:" + htmlText);
              if (htmlText.endsWith("</p>")) {
                htmlText = htmlText.substring(0, htmlText.length() - 4);
                isEndParagraphTagRemoved = true;
              }

              System.out.println("after htmlText:" + htmlText);

              for (int i = htmlText.length() - 2; i >= 0; i--) {
                char c = htmlText.charAt(i);

                if (c == ' ') {
                  String newText = htmlText.substring(i).trim();
                  if (newText.length() > 0) {
                    htmlText = htmlText.substring(0, i);
                    String setHTMLString =
                        htmlText
                            + " <span style='color:blue'>"
                            + newText
                            + " </span>"
                            + (isEndParagraphTagRemoved ? "</p>" : "");
                    System.out.println(setHTMLString);
                    richTextArea.setHTML(setHTMLString);
                  } else {
                    String setHTMLString = htmlText + (isEndParagraphTagRemoved ? "</p>" : "");
                    System.out.println(setHTMLString);
                    richTextArea.setHTML(setHTMLString);
                  }

                  break;
                }
              }
              System.out.println("New html:" + richTextArea.getHTML());

              //            		System.out.println("x:"+xCoOrdinate);
              //            		System.out.println("y:"+yCoOrdinate);
              //
              //            		ListBox listBox = new ListBox();
              //            		listBox.addItem("define", "define");
              //            		listBox.addItem("function", "function");
              //            		listBox.addItem("library", "library");
              //            		listBox.addItem("using", "using");
              //            		listBox.addItem("include", "include");
              //            		listBox.addItem("public", "public");
              //            		listBox.addItem("private", "private");
              //            		listBox.addItem("valueset", "valueset");
              //            		listBox.addItem("List", "List");
              //            		listBox.addItem("Tuple", "Tuple");
              //            		listBox.addItem("Interval", "Interval");
              //
              //            		listBox.setVisibleItemCount(listBox.getItemCount()+1);

              // PopupPanel popupPanel = new PopupPanel(true);
              // popupPanel.add(listBox);
              // popupPanel.setPopupPosition(xCoOrdinate, yCoOrdinate);
              // popupPanel.show();

            }
          }
        });

    return testtextArea;
  }