Пример #1
0
  /**
   * Creates a form into the jsp page.
   *
   * @throws JspException If any exception occurs.
   */
  protected void makeForm() throws JspException {

    String titleCode = (String) _layout.getAttribute("TITLE");
    SourceBean buttonsSB = (SourceBean) _layout.getAttribute("BUTTONS");
    List buttons = buttonsSB.getContainedSourceBeanAttributes();

    if (titleCode != null && buttons.size() > 0) {
      // String title = PortletUtilities.getMessage(titleCode, "messages");
      String title = msgBuilder.getMessage(titleCode, _bundle, httpRequest);
      _htmlStream.append(" <table class=\"header-table-portlet-section\">\n");
      _htmlStream.append("	<tr class='header-row-portlet-section'>\n");
      _htmlStream.append(
          "			<td class=\"header-title-column-portlet-section\" style=\"vertical-align:middle;padding-left:5px;\" >"
              + title
              + "</td>\n");
      _htmlStream.append("			<td class=\"header-empty-column-portlet-section\">&nbsp;</td>\n");
      _htmlStream.append(makeButton(buttons) + "\n");
      _htmlStream.append("	</tr>\n");
      _htmlStream.append(" </table>\n");
    }

    makeColumns();
    makeRows();
    makeNavigationButton();
  } // public void makeForm()
Пример #2
0
  /**
   * Builds Table list columns, reading all request information.
   *
   * @throws JspException If any Exception occurs.
   */
  protected void makeColumns() throws JspException {

    SourceBean captionSB = (SourceBean) _layout.getAttribute("CAPTIONS");
    List captions = captionSB.getContainedSourceBeanAttributes();
    int numCaps = captions.size();

    _columns = new Vector();
    List columnsVector = _layout.getAttributeAsList("COLUMNS.COLUMN");
    for (int i = 0; i < columnsVector.size(); i++) {
      String hidden = (String) ((SourceBean) columnsVector.get(i)).getAttribute("HIDDEN");
      if (hidden == null || hidden.trim().equalsIgnoreCase("FALSE"))
        _columns.add((SourceBean) columnsVector.get(i));
    }
    if ((_columns == null) || (_columns.size() == 0)) {
      SpagoBITracer.critical("Admintools", "ListTag", "doStartTag", "Columns names not defined");
      throw new JspException("Columns names not defined");
    }

    _htmlStream.append("<TABLE style='width:100%;margin-top:1px'>\n");
    _htmlStream.append("	<TR>\n");

    for (int i = 0; i < _columns.size(); i++) {
      String nameColumn = (String) ((SourceBean) _columns.elementAt(i)).getAttribute("NAME");
      String labelColumnCode = (String) ((SourceBean) _columns.elementAt(i)).getAttribute("LABEL");
      String labelColumn = "";
      if (labelColumnCode != null)
        labelColumn = msgBuilder.getMessage(labelColumnCode, _bundle, httpRequest);
      else labelColumn = nameColumn;
      // if an horizontal-align is specified it is considered, otherwise the defualt is align='left'
      String align = (String) ((SourceBean) _columns.elementAt(i)).getAttribute("horizontal-align");
      if (align == null || align.trim().equals("")) align = "left";
      _htmlStream.append(
          "<TD class='portlet-section-header' valign='center' align='"
              + align
              + "'  >"
              + labelColumn
              + "</TD>\n");
    }
    for (int i = 0; i < numCaps; i++) {
      _htmlStream.append("<TD class='portlet-section-header' align='center'>&nbsp;</TD>\n");
    }
    _htmlStream.append("</TR>\n");
  }