示例#1
0
  public void createEntryTextArea(
      final FlowPanel flowPanel, String entryStringBuilder, ScrollPanel scrollPanel) {

    String carriageReturn_LineFeed = "\r\n";
    String lines[] = entryStringBuilder.split("\\r?\\n");
    String stringBuilder = new String();

    for (int i = 0; i < lines.length; i++) {
      String line = lines[i];
      if (line.trim().startsWith("<criteriaReference")) {

        if (stringBuilder.length() > 0) {
          TextArea entryTextArea = new TextArea();
          entryTextArea.setStyleName("textarea_noborder");
          entryTextArea.addStyleName("entry_background");
          entryTextArea.setText(stringBuilder);
          flowPanel.add(entryTextArea);
          entryTextArea.setReadOnly(true);
          entryTextArea.setWidth("100%");
          entryTextArea.setHeight("100%");
          entryTextArea.setVisibleLines(getLineCount(stringBuilder) + 1);
        }

        stringBuilder = new String();

        // find more lines until the end tag </criteriaReference>
        String critRefStringBuilder = new String();
        while (!line.trim().startsWith("</criteriaReference>")) {
          critRefStringBuilder += (carriageReturn_LineFeed + line);
          i++;
          line = lines[i];
        }
        if (line.trim().startsWith("</criteriaReference>")) {
          critRefStringBuilder += (carriageReturn_LineFeed + line);
          createCritRefTextArea(flowPanel, scrollPanel, critRefStringBuilder);
        }
      } else {
        stringBuilder += (carriageReturn_LineFeed + line);
      }
    }
    if (stringBuilder.length() > 0) {
      TextArea entryTextArea = new TextArea();
      entryTextArea.setStyleName("textarea_noborder");
      entryTextArea.addStyleName("entry_background");
      entryTextArea.setText(stringBuilder);
      flowPanel.add(entryTextArea);
      entryTextArea.setReadOnly(true);
      entryTextArea.setWidth("100%");
      entryTextArea.setHeight("100%");
      entryTextArea.setVisibleLines(getLineCount(stringBuilder) + 1);
    }
  }
示例#2
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);
  }
  public WorkItemDefinitionEditor() {
    textArea.setWidth("100%");
    textArea.setVisibleLines(25);
    textArea.setStyleName(WorkItemsEditorResources.INSTANCE.CSS().defaultTextArea());
    textArea.getElement().setAttribute("spellcheck", "false");

    textArea.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            isDirty = true;
          }
        });

    textArea.addKeyDownHandler(
        new KeyDownHandler() {

          public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_TAB) {
              event.preventDefault();
              event.stopPropagation();
              int pos = textArea.getCursorPos();
              insertText("\t");
              textArea.setCursorPos(pos + 1);
              textArea.cancelKey();
              textArea.setFocus(true);
            }
          }
        });

    initWidget(textArea);
  }
  /** This is used when creating a new rule. */
  public NewAssetWizard(EditItemEvent afterCreate, boolean showCats, String format, String title) {
    super("images/new_wiz.gif", title);
    this.showCats = showCats;
    this.format = format;

    this.afterCreate = afterCreate;

    addAttribute("Name:", name);

    if (showCats) {
      addAttribute("Initial category:", getCatChooser());
    }

    if (format == null) {
      addAttribute("Type (format) of rule:", this.formatChooser);
    }

    addAttribute("Package:", packageSelector);

    description.setVisibleLines(4);
    description.setWidth("100%");
    addAttribute("Initial description:", description);

    Button ok = new Button("OK");
    ok.addClickListener(
        new ClickListener() {
          public void onClick(Widget arg0) {
            ok();
          }
        });

    addAttribute("", ok);

    setStyleName("ks-popups-Popup");
  }
  private void replyToComment(final Comment parentComment) {
    String replyPromptMessage = "Reply";
    if (parentComment.getAuthor() != null) {
      replyPromptMessage = "Reply To: " + parentComment.getAuthor().getUsername();
    } else if (!StringUtils.isEmpty(parentComment.getEmail())) {
      replyPromptMessage = "Reply To: " + parentComment.getEmail();
    }
    PromptDialogBox dialog =
        new PromptDialogBox(replyPromptMessage, "Submit", null, "Cancel", false, true);
    dialog.setAllowKeyboardEvents(false);
    VerticalPanel replyPanel = new VerticalPanel();

    final TextArea textArea = new TextArea();
    textArea.setCharacterWidth(60);
    textArea.setVisibleLines(4);
    final TextBox emailTextBox = new TextBox();
    if (AuthenticationHandler.getInstance().getUser() == null) {
      replyPanel.add(new Label("Email:"));
      replyPanel.add(emailTextBox);
    }
    replyPanel.add(textArea);

    dialog.setFocusWidget(textArea);
    dialog.setContent(replyPanel);
    dialog.setValidatorCallback(
        new IDialogValidatorCallback() {
          public boolean validate() {
            if (textArea.getText() == null || "".equals(textArea.getText())) {
              MessageDialogBox dialog =
                  new MessageDialogBox("Error", "Comment is blank.", false, true, true);
              dialog.center();
              return false;
            }
            return true;
          }
        });
    dialog.setCallback(
        new IDialogCallback() {
          public void okPressed() {
            Comment newComment = new Comment();
            newComment.setGlobalRead(true);
            newComment.setOwner(permissibleObject.getOwner());
            newComment.setAuthor(AuthenticationHandler.getInstance().getUser());
            newComment.setComment(textArea.getText());
            newComment.setParent(permissibleObject);
            newComment.setParentComment(parentComment);
            newComment.setEmail(emailTextBox.getText());
            submitComment(newComment);
          }

          public void cancelPressed() {}
        });
    dialog.center();
  }
  public DefaultRuleContentWidget(RuleAsset a, int visibleLines) {
    asset = a;
    data = (RuleContentText) asset.getContent();

    if (data.content == null) {
      data.content = "";
    }

    text = new TextArea();
    text.setWidth("100%");
    text.setVisibleLines((visibleLines == -1) ? 16 : visibleLines);
    text.setText(data.content);

    text.getElement().setAttribute("spellcheck", "false"); // NON-NLS

    text.setStyleName("default-text-Area"); // NON-NLS

    text.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            data.content = text.getText();
            makeDirty();
          }
        });

    text.addKeyDownHandler(
        new KeyDownHandler() {

          public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_TAB) {
              int pos = text.getCursorPos();
              insertText("\t");
              text.setCursorPos(pos + 1);
              text.cancelKey();
              text.setFocus(true);
            }
          }
        });

    initWidget(text);
  }
示例#7
0
  public void createCritRefTextArea(
      final FlowPanel flowPanel, final ScrollPanel scrollPanel, String critRefStringBuilder) {
    final TextArea critReftextArea = new TextArea();
    critReftextArea.setStyleName("textarea_noborder");
    critReftextArea.addStyleName("criteriaRef_background");
    critReftextArea.setText(critRefStringBuilder);
    flowPanel.add(critReftextArea);
    critReftextArea.setReadOnly(true);
    critReftextArea.setWidth("100%");
    critReftextArea.setHeight("100%");
    critReftextArea.setVisibleLines(critRefStringBuilder.split("\\r?\\n").length + 1);
    critReftextArea.setTitle("Double click to go see the entry.");

    critReftextArea.addDoubleClickHandler(
        new DoubleClickHandler() {

          @Override
          public void onDoubleClick(DoubleClickEvent event) {
            handleTextAreaClick(flowPanel, event, critReftextArea, scrollPanel);
          }
        });
  }
示例#8
0
  public XmlFileWidget(final RuleAsset asset, final RuleViewer viewer) {
    super(asset, viewer);
    data = (RuleContentText) asset.getContent();

    if (data.content == null) {
      data.content = "";
    }

    text = new TextArea();
    text.setWidth("100%");
    text.setVisibleLines(16);
    text.setText(data.content);

    text.setStyleName("default-text-Area");

    text.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            data.content = text.getText();
          }
        });

    layout.addRow(text);
  }
示例#9
0
  private Widget getDetailSection() {
    HorizontalPanel panel = new HorizontalPanel();
    panel.setWidth("100%");
    panel.setStyleName("studio-Bottom-Panel");

    VerticalPanel ruleDefPanel = new VerticalPanel();
    ruleDefPanel.setWidth("95%");

    Label lbl = new Label();
    lbl.setText("Rule Definition");
    lbl.setStyleName("studio-Label-Small");

    ruleDef = new TextArea();
    ruleDef.setWidth("100%");
    ruleDef.setVisibleLines(5);
    ruleDef.setReadOnly(true);

    ruleDefPanel.add(lbl);
    ruleDefPanel.add(ruleDef);

    panel.add(ruleDefPanel);

    return panel.asWidget();
  }
 {
   inputNoteTitle.setStyleName("formField");
   inputNoteText.setStyleName("formField");
   inputNoteText.setVisibleLines(3);
 }
  public WorkitemDefinitionEditor(RuleAsset a, int visibleLines) {
    asset = a;
    data = (RuleContentText) asset.getContent();
    if (data.content == null) {
      data.content = "Empty!";
    }

    Grid layout = new Grid(1, 2);

    WorkitemDefinitionElementsBrowser browser =
        new WorkitemDefinitionElementsBrowser(
            new WorkitemDefinitionElementSelectedListener() {

              public void onElementSelected(String elementName, String pasteValue) {
                insertText(pasteValue, true);
              }
            });

    layout.setWidget(0, 0, browser);
    text = new TextArea();
    text.setWidth("100%");
    text.setVisibleLines((visibleLines == -1) ? 25 : visibleLines);
    text.setText(data.content);
    text.getElement().setAttribute("spellcheck", "false"); // NON-NLS

    text.setStyleName("default-text-Area"); // NON-NLS

    text.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            data.content = text.getText();
            makeDirty();
          }
        });

    text.addKeyDownHandler(
        new KeyDownHandler() {

          public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_TAB) {
              event.preventDefault();
              event.stopPropagation();
              int pos = text.getCursorPos();
              insertText("\t", false);
              text.setCursorPos(pos + 1);
              text.cancelKey();
              text.setFocus(true);
            }
          }
        });

    layout.setWidget(0, 1, text);

    layout.getColumnFormatter().setWidth(0, "10%");
    layout.getColumnFormatter().setWidth(1, "90%");
    layout
        .getCellFormatter()
        .setAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP);
    layout
        .getCellFormatter()
        .setAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP);
    layout.setWidth("95%");

    initWidget(layout);
  }
  public FunctionPlotterExample() {
    presets.put("id", new String[] {"-10", "10", "function(x) {\n  return x;\n}"});
    presets.put("sine", new String[] {"-10", "10", "function(x) {\n  return Math.sin(x);\n}"});
    presets.put(
        "taylor",
        new String[] {
          "-3", "3", "function(x) {\n  return [Math.cos(x), 1 - x*x/2 + x*x*x*x/24];\n}"
        });
    presets.put(
        "sawtooth",
        new String[] {
          "-10",
          "10",
          "function(x) {\n  var y = 0;\n  for (var i = 1; i < 20; i+=2) {\n    y += Math.sin(i * x)/i;\n  }\n  var final = 1 - 2*(Math.abs(Math.floor(x / Math.PI)) % 2);\n  return [4/Math.PI * y, final];\n}"
        });

    initWidget(panel);
    panel.add(new HTML("<p><b>Equation: </b><br>"));
    textArea.setVisibleLines(10);
    textArea.setCharacterWidth(80);
    textArea.setValue(
        "function(x) {\n"
            + "  return [0.1 * x, 0.1 * x + Math.sin(x), 0.1*x + Math.cos(x)];\n"
            + "}");
    panel.add(textArea);

    presetsDD.addItem("(custom)", "custom");
    presetsDD.addItem("Identity", "id");
    presetsDD.addItem("Sine Wave", "sine");
    presetsDD.addItem("Taylor series", "taylor");
    presetsDD.addItem("Sawtooth", "sawtooth");
    presetsDD.setSelectedIndex(0);
    presetsDD.getElement().getStyle().setDisplay(Style.Display.INLINE_BLOCK);

    presetsDD.addChangeHandler(
        (event) -> {
          String value = presetsDD.getSelectedValue();
          if (value.equalsIgnoreCase("custom")) {
            return;
          }

          String[] preset = presets.get(value);
          fromTb.setValue(preset[0]);
          toTb.setValue(preset[1]);
          textArea.setValue(preset[2]);
          plot();
        });

    HorizontalPanel presetContainer = new HorizontalPanel();
    presetContainer.add(new HTML("<b>Preset functions:</b>"));
    presetContainer.add(presetsDD);
    panel.add(presetContainer);
    panel.add(new HTML("<p></p>"));
    HorizontalPanel rangeContainer = new HorizontalPanel();
    rangeContainer.add(new HTML("<b>x range:</b>"));
    fromTb.setVisibleLength(5);
    fromTb.setValue("-10");

    toTb.setVisibleLength(5);
    toTb.setValue("10");
    rangeContainer.add(fromTb);
    rangeContainer.add(new InlineLabel("to"));
    rangeContainer.add(toTb);
    panel.add(rangeContainer);
    Button plotBtn = new Button("Plot");

    plotBtn.addClickHandler((ev) -> plot());

    panel.add(new HTML("<p></p>"));
    panel.add(plotBtn);
    plot();
  }
示例#13
0
  // Helper method to create the internals of the HTML Form (FormPanel)
  //  Submit form may be for new post, or for editing existing post
  private FormPanel makeSubmitPostForm(final PostData post) {
    final FormPanel submitFormPanel = new FormPanel();
    VerticalPanel postFormPanel = new VerticalPanel();
    postFormPanel.addStyleName("submitPostVertPanel");
    submitFormPanel.add(postFormPanel);

    // Name input
    HorizontalPanel nameRow = new HorizontalPanel();
    Label nameLabel = new Label("Name (First Last");
    final TextBox nameTextbox = new TextBox();
    nameRow.add(nameLabel);
    nameRow.add(nameTextbox);
    postFormPanel.add(nameRow);

    // Title input
    HorizontalPanel titleRow = new HorizontalPanel();
    Label titleLabel = new Label("Title (e.g. car, bike, etc)");
    final TextBox titleTextbox = new TextBox();
    titleRow.add(titleLabel);
    titleRow.add(titleTextbox);
    postFormPanel.add(titleRow);

    // Description input
    HorizontalPanel descrRow = new HorizontalPanel();
    Label descrLabel = new Label("Item Short description");
    final TextArea descrText = new TextArea();
    descrText.setCharacterWidth(40);
    descrText.setVisibleLines(10);
    descrRow.add(descrLabel);
    descrRow.add(descrText);
    postFormPanel.add(descrRow);

    // Price input
    HorizontalPanel priceRow = new HorizontalPanel();
    Label priceLabel = new Label("Price ($)");
    final TextBox priceTextbox = new TextBox();
    priceTextbox.setVisibleLength(6);
    priceRow.add(priceLabel);
    priceRow.add(priceTextbox);
    postFormPanel.add(priceRow);

    // Address input
    HorizontalPanel addressRow = new HorizontalPanel();
    Label addressLabel = new Label("Address");
    final TextArea addressText = new TextArea();
    addressText.setCharacterWidth(40);
    addressText.setVisibleLines(5);
    addressRow.add(addressLabel);
    addressRow.add(addressText);
    postFormPanel.add(addressRow);

    if (post != null) {
      nameTextbox.setText(post.getSellerName());
      titleTextbox.setText(post.getTitle());
      descrText.setText(post.getDescription());
      priceTextbox.setText("" + post.getPrice());
      addressText.setText(post.getAddress());
    }

    // New widget for file upload
    HorizontalPanel fileRow = new HorizontalPanel();
    final FileUpload upload = new FileUpload();
    if (post != null) {
      Anchor link = new Anchor("Stored File", post.getURL());
      link.setTarget("_blank");
      fileRow.add(link);
      upload.setTitle("Change Uploaded File");
    } else upload.setTitle("Upload a File for Post");
    fileRow.add(upload);
    postFormPanel.add(fileRow);

    // Submit button
    Button submitButton;
    if (post != null) {
      submitButton = new Button("Submit Changes");
      submitButton.setText("Submit Changes");
    } else {
      submitButton = new Button("Submit Ad");
      submitButton.setText("Submit Ad");
    }
    submitButton.setStyleName("sideBarButton");
    postFormPanel.add(submitButton);

    // The submitFormPanel, when submitted, will trigger an HTTP call to the
    // servlet.  The following parameters must be set
    submitFormPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
    submitFormPanel.setMethod(FormPanel.METHOD_POST);

    // Set Names for the text boxes so that they can be retrieved from the
    // HTTP call as parameters
    nameTextbox.setName("name");
    titleTextbox.setName("title");
    descrText.setName("description");
    priceTextbox.setName("price");
    addressText.setName("address");
    upload.setName("upload");

    // Upon clicking "Submit" control goes to Controller
    submitButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (post == null) control.handlePostFromSubmitForm(submitFormPanel);
            else control.handlePostEditFromSubmitForm(post, submitFormPanel);
          }
        });

    // This event handler is "fired" just before the Form causes a doPost
    //  message to server
    submitFormPanel.addSubmitHandler(
        new FormPanel.SubmitHandler() {
          public void onSubmit(SubmitEvent event) {
            // This event is fired just before the form is submitted.
            //  We can take this opportunity to perform validation.
            if (nameTextbox.getText().length() == 0) {
              Window.alert("The author is required.");
              event.cancel();
            }
            if (titleTextbox.getText().length() == 0) {
              Window.alert("The title is required.");
              event.cancel();
            }
            Double price = Double.parseDouble(priceTextbox.getText());
            if (priceTextbox.getText().length() == 0 || Double.isNaN(price)) {
              Window.alert("The price is required. It must be a valid number");
              event.cancel();
            }
            if (addressText.getText().length() == 0) {
              Window.alert("The address is required.");
              event.cancel();
            }
            if (upload.getFilename().length() == 0 && post == null) {
              Window.alert("The upload file is required.");
              event.cancel();
            }
          }
        });

    // The doPost message itself is sent from the Form and not intercepted
    //  by GWT.

    // This event handler is "fired" just after the Form causes a doPost
    //  message to server
    submitFormPanel.addSubmitCompleteHandler(
        new FormPanel.SubmitCompleteHandler() {
          public void onSubmitComplete(SubmitCompleteEvent event) {
            if (post == null) {
              submitFormPanel.reset();
              nameTextbox.setFocus(true);
            } else control.viewAdDataFromServer();
          }
        });
    return submitFormPanel;
  }
示例#14
0
  private void makeBookMarks(FlowPanel flowPanel, TextArea textArea) {

    // TextArea firstTextArea = (TextArea) flowPanel.getWidget(0);

    // Check for data criteria section. This has Measure Details and the start of
    // dataCriteriaSection.
    // We need to break it up so that "Measure Details" and dataCriteriaSection are 2 different
    // textareas.

    String text = textArea.getText();
    int dataCritIndex = text.indexOf("<dataCriteriaSection>");
    if (dataCritIndex > -1) {
      String measureDetailsText = text.substring(0, dataCritIndex);
      String dataCritSection = text.substring(dataCritIndex);
      textArea.setText(measureDetailsText);
      textArea.setVisibleLines(getLineCount(measureDetailsText) + 3);

      TextArea dataCritTextArea = new TextArea();
      dataCritTextArea.setStyleName("textarea_noborder");
      dataCritTextArea.setText(dataCritSection);
      flowPanel.add(dataCritTextArea);
      dataCritTextArea.setReadOnly(true);
      dataCritTextArea.setWidth("100%");
      dataCritTextArea.setHeight("100%");
      dataCritTextArea.setVisibleLines(getLineCount(dataCritSection) + 3);

      flowPanel.insert(dataCritTextArea, flowPanel.getWidgetIndex(textArea) + 1);
      bookmarkMap.put("Data Criteria Section", dataCritTextArea);
    } else {
      // make sure the textarea does not have a style class of 'entry_background' and
      // 'criteriaRef_background',
      // find '<populationCriteriaSection>'.
      int isEntryTextArea = textArea.getStyleName().indexOf("entry_background");
      int isCritRefTextArea = textArea.getStyleName().indexOf("criteriaRef_background");

      if (isEntryTextArea == -1 && isCritRefTextArea == -1) {
        if (text.indexOf("<populationCriteriaSection>") > -1) {
          int extensionIndex = text.indexOf("<id extension=\"");
          if (extensionIndex > -1) {
            int startExtensionIndex = extensionIndex + "<id extension=\"".length();
            String extension =
                text.substring(startExtensionIndex, text.indexOf("\"", startExtensionIndex));
            System.out.println("Pop Crit Extension:" + extension);
            bookmarkMap.put(extension, textArea);
          }
        }
      }
    }

    // int textAreaCount = flowPanel.getWidgetCount();
    // Go through rest of the textAreas (from index 2) and for the textAreas which do
    // not have a style class of 'entry_background' and 'criteriaRef_background',
    // find '<populationCriteriaSection>'.

    // for(int i = 2;i < textAreaCount; i++){

    //			TextArea textArea = (TextArea) flowPanel.getWidget(i);
    //			int isEntryTextArea = textArea.getStyleName().indexOf("entry_background");
    //			int isCritRefTextArea = textArea.getStyleName().indexOf("criteriaRef_background");
    //
    //			if (isEntryTextArea == -1 && isCritRefTextArea == -1){
    //				if(textArea.getText().indexOf("<populationCriteriaSection>") > -1){
    //					String popCritText = textArea.getText();
    //					int extensionIndex = popCritText.indexOf("<id extension=\"");
    //					if(extensionIndex > -1){
    //						int startExtensionIndex = extensionIndex + "<id extension=\"".length();
    //						String extension = popCritText.substring(startExtensionIndex,
    // popCritText.indexOf("\"",startExtensionIndex));
    //						System.out.println("Pop Crit Extension:"+extension);
    //						bookmarkMap.put(extension, textArea);
    //					}
    //				}
    //			}

    // }

  }
示例#15
0
  private ScrollPanel getPanelForXML(String text) {

    String carriageReturn_LineFeed = "\r\n";

    final FlowPanel flowPanel = new FlowPanel();
    final ScrollPanel scrollPanel = new ScrollPanel();

    String lines[] = text.split("\\r?\\n");
    String stringBuilder = new String();
    for (int i = 0; i < lines.length; i++) {
      String line = lines[i];
      if (line.trim().startsWith("<criteriaReference")) {

        TextArea textArea = new TextArea();
        textArea.setStyleName("textarea_noborder");
        textArea.setText(stringBuilder);
        flowPanel.add(textArea);
        textArea.setReadOnly(true);
        textArea.setWidth("100%");
        textArea.setHeight("100%");
        textArea.setVisibleLines(getLineCount(stringBuilder) + 1);
        makeBookMarks(flowPanel, textArea);

        stringBuilder = new String();

        // find more lines until the end tag </criteriaReference>
        String critRefStringBuilder = new String();
        while (!line.trim().startsWith("</criteriaReference>")) {
          critRefStringBuilder += (carriageReturn_LineFeed + line);
          i++;
          line = lines[i];
        }
        if (line.trim().startsWith("</criteriaReference>")) {
          critRefStringBuilder += (carriageReturn_LineFeed + line);
          createCritRefTextArea(flowPanel, scrollPanel, critRefStringBuilder);
        }
      } else {
        String cleanLine = line.trim().replaceAll("<!--.*?-->", "");

        if (cleanLine.trim().startsWith("<entry")) {

          if (stringBuilder.length() > 0) {
            TextArea textArea = new TextArea();
            textArea.setStyleName("textarea_noborder");

            textArea.setEnabled(false);
            textArea.setWidth("100%");
            textArea.setHeight("100%");
            textArea.setText(stringBuilder);
            flowPanel.add(textArea);
            textArea.setVisibleLines(getLineCount(stringBuilder) + 1);
            makeBookMarks(flowPanel, textArea);
          }

          stringBuilder = new String();

          // find more lines until the end tag </criteriaReference>
          String entryStringBuilder = new String();
          while (!line.trim().startsWith("</entry>")) {
            entryStringBuilder += (carriageReturn_LineFeed + line);
            i++;
            line = lines[i];
          }
          if (line.trim().startsWith("</entry>")) {
            entryStringBuilder += (carriageReturn_LineFeed + line);

            createEntryTextArea(flowPanel, entryStringBuilder, scrollPanel);
          }
        } else {
          stringBuilder += (carriageReturn_LineFeed + line);
        }
      }
    }
    if (stringBuilder.trim().length() > 0) {
      TextArea textArea = new TextArea();
      textArea.setStyleName("textarea_noborder");
      textArea.setText(stringBuilder);
      flowPanel.add(textArea);
      textArea.setReadOnly(true);
      textArea.setWidth("100%");
      textArea.setHeight("100%");
      textArea.setVisibleLines(getLineCount(stringBuilder) + 1);
      makeBookMarks(flowPanel, textArea);
    }

    VerticalPanel vPanel = new VerticalPanel();
    vPanel.setWidth("100%");
    vPanel.setHeight("100%");

    vPanel.add(flowPanel);
    scrollPanel.add(vPanel);
    return scrollPanel;
  }
 private DisclosurePanel createCommentPostPanel() {
   DisclosurePanel postCommentDisclosurePanel = new DisclosurePanel("Post Comment");
   postCommentDisclosurePanel.setWidth("100%");
   postCommentDisclosurePanel.setOpen(true);
   VerticalPanel postCommentPanel = new VerticalPanel();
   postCommentPanel.setWidth("100%");
   // create text area for comment
   final TextArea commentTextArea = new TextArea();
   commentTextArea.setVisibleLines(3);
   commentTextArea.setWidth("500px");
   // create textfield for email address (if not logged in)
   final TextBox emailTextField = new TextBox();
   emailTextField.setVisibleLength(60);
   // create button panel
   HorizontalPanel buttonPanelWrapper = new HorizontalPanel();
   buttonPanelWrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
   buttonPanelWrapper.setWidth("500px");
   HorizontalPanel buttonPanel = new HorizontalPanel();
   // create buttons
   final Button submitButton = new Button("Submit");
   submitButton.addClickHandler(
       new ClickHandler() {
         public void onClick(ClickEvent event) {
           String commentStr = commentTextArea.getText();
           if (commentStr == null || "".equals(commentStr.trim())) {
             return;
           }
           Comment comment = new Comment();
           comment.setGlobalRead(true);
           comment.setOwner(permissibleObject.getOwner());
           comment.setAuthor(AuthenticationHandler.getInstance().getUser());
           comment.setComment(commentStr);
           comment.setParent(permissibleObject);
           comment.setEmail(emailTextField.getText());
           submitButton.setEnabled(false);
           submitComment(comment);
         }
       });
   final Button clearButton = new Button("Clear");
   clearButton.addClickHandler(
       new ClickHandler() {
         public void onClick(ClickEvent event) {
           commentTextArea.setText("");
           submitButton.setEnabled(true);
         }
       });
   // add buttons
   buttonPanel.add(clearButton);
   buttonPanel.add(submitButton);
   buttonPanelWrapper.add(buttonPanel);
   // add panels
   if (AuthenticationHandler.getInstance().getUser() == null) {
     postCommentPanel.add(new Label("Email:"));
     postCommentPanel.add(emailTextField);
   }
   postCommentPanel.add(new Label("Comment:"));
   postCommentPanel.add(commentTextArea);
   postCommentPanel.add(buttonPanelWrapper);
   postCommentDisclosurePanel.setContent(postCommentPanel);
   return postCommentDisclosurePanel;
 }