Ejemplo n.º 1
0
  /**
   * Sets up the widget with all required information. It initializes the JQuery comment plugin with
   * and it parameterizes from Silverpeas settings and from the resource for which the comments
   * should be rendered.
   *
   * @return a container of rendering elements.
   * @throws JspException if an error occurs while initializing the JQuery comment plugin.
   */
  public ElementContainer initWidget() throws JspException {
    String context = URLManager.getApplicationURL();
    ElementContainer xhtmlcontainer = new ElementContainer();
    div comments = new div();
    comments.setID(COMMENT_WIDGET_DIV_ID);
    comments.setClass(COMMENT_WIDGET_DIV_CLASS);
    script checkForm =
        new script().setType("text/javascript").setSrc(context + "/util/javaScript/checkForm.js");
    script initCommentPlugin =
        new script().setType("text/javascript").addElement(setUpJQueryCommentPlugin());

    xhtmlcontainer.addElement(comments).addElement(checkForm);
    JavascriptPluginInclusion.includeUserZoom(xhtmlcontainer);
    JavascriptPluginInclusion.includeComment(xhtmlcontainer);
    xhtmlcontainer.addElement(initCommentPlugin);
    return xhtmlcontainer;
  }