Examples of LayoutStructure


Examples of org.jasig.portal.layout.LayoutStructure

        Element root, int structId) throws java.sql.SQLException, Exception {
      while (structId != 0) {
        if (DEBUG>1) {
          System.err.println("CreateLayout(" + structId + ")");
        }
        LayoutStructure ls = (LayoutStructure) layoutStructure.get(new Integer(structId));
        // replaced with call to method in containing class to allow overriding
        // by subclasses of RDBMUserLayoutStore.
        // Element structure = ls.getStructureDocument(doc);
        Element structure = getStructure(doc, ls);
        root.appendChild(structure);

        String id = structure.getAttribute("ID");
        if (id != null && ! id.equals("")) {
            structure.setIdAttribute("ID", true);
        }

        createLayout(layoutStructure, doc,  structure, ls.getChildId());
        structId = ls.getNextId();
      }
  }
View Full Code Here

Examples of org.jasig.portal.layout.LayoutStructure

        HashMap layoutStructure = new HashMap();
        StringBuffer structChanIds = new StringBuffer();

        try {
          int lastStructId = 0;
          LayoutStructure ls = null;
          String sepChar = "";
          if (foundLayout) {
            int structId = rs.getInt(1);
            // Result Set returns 0 by default if structId was null
            // Except if you are using poolman 2.0.4 in which case you get -1 back
            if (rs.wasNull()) {
              structId = 0;
            }
            readLayout: while (true) {
              if (DEBUG > 1) System.err.println("Found layout structureID " + structId);

              int nextId = rs.getInt(2);
              if (rs.wasNull()) {
                nextId = 0;
              }
              int childId = rs.getInt(3);
              if (rs.wasNull()) {
                childId = 0;
              }
              int chanId = rs.getInt(4);
              if (rs.wasNull()) {
                chanId = 0;
              }
              String temp5=rs.getString(5); // Some JDBC drivers require columns accessed in order
              String temp6=rs.getString(6); // Access 5 and 6 now, save till needed.

              // uPortal i18n
              int name_index, value_index;
              if (localeAware) {
                  ls = new LayoutStructure(
                              structId, nextId, childId, chanId,
                              rs.getString(7),rs.getString(8),rs.getString(9),
                              localeManager.getLocales()
                              [0].toString());
                  name_index=10;
                  value_index=11;
              else {
                  ls = new LayoutStructure(structId, nextId, childId, chanId, rs.getString(7),rs.getString(8),rs.getString(9));
                  name_index=10;
                  value_index=11;
              }
              layoutStructure.put(new Integer(structId), ls);
              lastStructId = structId;
              if (!ls.isChannel()) {
                ls.addFolderData(temp5, temp6); // Plug in saved column values
              }
              if (this.databaseMetadata.supportsOuterJoins()) {
                do {
                  String name = rs.getString(name_index);
                  String value = rs.getString(value_index); // Oracle JDBC requires us to do this for longs
                  if (name != null) { // may not be there because of the join
                    ls.addParameter(name, value);
                  }
                  if (!rs.next()) {
                    break readLayout;
                  }
                  structId = rs.getInt(1);
                  if (rs.wasNull()) {
                    structId = 0;
                  }
                } while (structId == lastStructId);
              } else { // Do second SELECT later on for structure parameters
                if (ls.isChannel()) {
                  structChanIds.append(sepChar + ls.getChanId());
                  sepChar = ",";
                }
                if (rs.next()) {
                  structId = rs.getInt(1);
                  if (rs.wasNull()) {
                    structId = 0;
                  }
                } else {
                  break readLayout;
                }
              }
            } // while
          }
        } finally {
          rs.close();
        }

        if (!this.databaseMetadata.supportsOuterJoins()) { // Pick up structure parameters
          // first, get the struct ids for the channels
          String sql = "SELECT STRUCT_ID FROM UP_LAYOUT_STRUCT WHERE USER_ID=" + userId +
            " AND LAYOUT_ID=" + layoutId +
            " AND CHAN_ID IN (" + structChanIds.toString() + ") ORDER BY STRUCT_ID";

          if (log.isDebugEnabled())
              log.debug("RDBMUserLayoutStore::getUserLayout(): " + sql);
          StringBuffer structIdsSB = new StringBuffer( "" );
          String sep = "";
          rs = stmt.executeQuery(sql);
          try {
            // use the results to build a correct list of struct ids to look for
            while( rs.next()) {
              structIdsSB.append(sep + rs.getString(1));
              sep = ",";
            }// while
          } finally {
            rs.close();
          } // be a good doobie


          sql = "SELECT STRUCT_ID, STRUCT_PARM_NM,STRUCT_PARM_VAL FROM UP_LAYOUT_PARAM WHERE USER_ID=" + userId + " AND LAYOUT_ID=" + layoutId +
            " AND STRUCT_ID IN (" + structIdsSB.toString() + ") ORDER BY STRUCT_ID";
          if (log.isDebugEnabled())
              log.debug("RDBMUserLayoutStore::getUserLayout(): " + sql);
          rs = stmt.executeQuery(sql);
          try {
            if (rs.next()) {
              int structId = rs.getInt(1);
              readParm: while(true) {
                LayoutStructure ls = (LayoutStructure)layoutStructure.get(new Integer(structId));
                int lastStructId = structId;
                do {
                  ls.addParameter(rs.getString(2), rs.getString(3));
                  if (!rs.next()) {
                    break readParm;
                  }
                } while ((structId = rs.getInt(1)) == lastStructId);
              }
View Full Code Here

Examples of org.jasig.portal.layout.LayoutStructure

        Element root, int structId) throws java.sql.SQLException, Exception {
      while (structId != 0) {
        if (DEBUG>1) {
          System.err.println("CreateLayout(" + structId + ")");
        }
        LayoutStructure ls = (LayoutStructure) layoutStructure.get(new Integer(structId));
        // replaced with call to method in containing class to allow overriding
        // by subclasses of RDBMUserLayoutStore.
        // Element structure = ls.getStructureDocument(doc);
        Element structure = getStructure(doc, ls);
        root.appendChild(structure);
       
        String id = structure.getAttribute("ID");
        if (id != null && ! id.equals("")) {
            structure.setIdAttribute("ID", true);
        }
       
        if (!ls.isChannel()) {          // Folder
          createLayout(layoutStructure, doc,  structure, ls.getChildId());
        }
        structId = ls.getNextId();
      }
  }
View Full Code Here

Examples of org.jasig.portal.layout.LayoutStructure

        HashMap layoutStructure = new HashMap();
        StringBuffer structChanIds = new StringBuffer();

        try {
          int lastStructId = 0;
          LayoutStructure ls = null;
          String sepChar = "";
          if (foundLayout) {
            int structId = rs.getInt(1);
            // Result Set returns 0 by default if structId was null
            // Except if you are using poolman 2.0.4 in which case you get -1 back
            if (rs.wasNull()) {
              structId = 0;
            }
            readLayout: while (true) {
              if (DEBUG > 1) System.err.println("Found layout structureID " + structId);

              int nextId = rs.getInt(2);
              if (rs.wasNull()) {
                nextId = 0;
              }
              int childId = rs.getInt(3);
              if (rs.wasNull()) {
                childId = 0;
              }
              int chanId = rs.getInt(4);
              if (rs.wasNull()) {
                chanId = 0;
              }
              String temp5=rs.getString(5); // Some JDBC drivers require columns accessed in order
              String temp6=rs.getString(6); // Access 5 and 6 now, save till needed.

              // uPortal i18n
              int name_index, value_index;
              if (localeAware) {
                  ls = new LayoutStructure(structId, nextId, childId, chanId, rs.getString(7),rs.getString(8),rs.getString(9),localeManager.getLocales()[0].toString());
                  name_index=10;
                  value_index=11;
              else {
                  ls = new LayoutStructure(structId, nextId, childId, chanId, rs.getString(7),rs.getString(8),rs.getString(9));
                  name_index=10;
                  value_index=11;
              }
              layoutStructure.put(new Integer(structId), ls);
              lastStructId = structId;
              if (!ls.isChannel()) {
                ls.addFolderData(temp5, temp6); // Plug in saved column values
              }
              if (RDBMServices.getDbMetaData().supportsOuterJoins()) {
                do {
                  String name = rs.getString(name_index);
                  String value = rs.getString(value_index); // Oracle JDBC requires us to do this for longs
                  if (name != null) { // may not be there because of the join
                    ls.addParameter(name, value);
                  }
                  if (!rs.next()) {
                    break readLayout;
                  }
                  structId = rs.getInt(1);
                  if (rs.wasNull()) {
                    structId = 0;
                  }
                } while (structId == lastStructId);
              } else { // Do second SELECT later on for structure parameters
                if (ls.isChannel()) {
                  structChanIds.append(sepChar + ls.getChanId());
                  sepChar = ",";
                }
                if (rs.next()) {
                  structId = rs.getInt(1);
                  if (rs.wasNull()) {
                    structId = 0;
                  }
                } else {
                  break readLayout;
                }
              }
            } // while
          }
        } finally {
          rs.close();
        }

        if (!RDBMServices.getDbMetaData().supportsOuterJoins()) { // Pick up structure parameters
          // first, get the struct ids for the channels
          String sql = "SELECT STRUCT_ID FROM UP_LAYOUT_STRUCT WHERE USER_ID=" + userId +
            " AND LAYOUT_ID=" + layoutId +
            " AND CHAN_ID IN (" + structChanIds.toString() + ") ORDER BY STRUCT_ID";

          if (log.isDebugEnabled())
              log.debug("RDBMUserLayoutStore::getUserLayout(): " + sql);
          StringBuffer structIdsSB = new StringBuffer( "" );
          String sep = "";
          rs = stmt.executeQuery(sql);
          try {
            // use the results to build a correct list of struct ids to look for
            while( rs.next()) {
              structIdsSB.append(sep + rs.getString(1));
              sep = ",";
            }// while
          } finally {
            rs.close();
          } // be a good doobie


          sql = "SELECT STRUCT_ID, STRUCT_PARM_NM,STRUCT_PARM_VAL FROM UP_LAYOUT_PARAM WHERE USER_ID=" + userId + " AND LAYOUT_ID=" + layoutId +
            " AND STRUCT_ID IN (" + structIdsSB.toString() + ") ORDER BY STRUCT_ID";
          if (log.isDebugEnabled())
              log.debug("RDBMUserLayoutStore::getUserLayout(): " + sql);
          rs = stmt.executeQuery(sql);
          try {
            if (rs.next()) {
              int structId = rs.getInt(1);
              readParm: while(true) {
                LayoutStructure ls = (LayoutStructure)layoutStructure.get(new Integer(structId));
                int lastStructId = structId;
                do {
                  ls.addParameter(rs.getString(2), rs.getString(3));
                  if (!rs.next()) {
                    break readParm;
                  }
                } while ((structId = rs.getInt(1)) == lastStructId);
              }
View Full Code Here

Examples of org.jasig.portal.layout.LayoutStructure

     * @exception java.sql.SQLException
     */
    protected final void createLayout (HashMap layoutStructure, Document doc,
                                       Element root, int structId) throws java.sql.SQLException {
        while (structId != 0) {
            LayoutStructure ls = (LayoutStructure) layoutStructure.get(new Integer(structId));
            // replaced with call to method in containing class to allow overriding
            // by subclasses of RDBMUserLayoutStore.
            // Element structure = ls.getStructureDocument(doc);
            Element structure = getStructure(doc, ls);
            root.appendChild(structure);

            String id = structure.getAttribute("ID");
            if (id != null && ! id.equals("")) {
                structure.setIdAttribute("ID", true);
            }

            createLayout(layoutStructure, doc,  structure, ls.getChildId());
            structId = ls.getNextId();
        }
    }
View Full Code Here

Examples of org.jasig.portal.layout.LayoutStructure

                    HashMap layoutStructure = new HashMap();
                    StringBuffer structChanIds = new StringBuffer();

                    try {
                        int lastStructId = 0;
                        LayoutStructure ls = null;
                        String sepChar = "";
                        if (foundLayout) {
                            int structId = rs.getInt(1);
                            // Result Set returns 0 by default if structId was null
                            // Except if you are using poolman 2.0.4 in which case you get -1 back
                            if (rs.wasNull()) {
                                structId = 0;
                            }
                            readLayout: while (true) {

                                int nextId = rs.getInt(2);
                                if (rs.wasNull()) {
                                    nextId = 0;
                                }
                                int childId = rs.getInt(3);
                                if (rs.wasNull()) {
                                    childId = 0;
                                }
                                int chanId = rs.getInt(4);
                                if (rs.wasNull()) {
                                    chanId = 0;
                                }
                                String temp5=rs.getString(5); // Some JDBC drivers require columns accessed in order
                                String temp6=rs.getString(6); // Access 5 and 6 now, save till needed.

                                // uPortal i18n
                                int name_index, value_index;
                                if (localeAware) {
                                    Locale[] locales = localeManager.getLocales();
                                    String locale = locales[0].toString();
                                    ls = new LayoutStructure(
                                            structId, nextId, childId, chanId,
                                            rs.getString(7),rs.getString(8),rs.getString(9),
                                            locale);
                                    name_index=10;
                                    value_index=11;
                                else {
                                    ls = new LayoutStructure(structId, nextId, childId, chanId, rs.getString(7),rs.getString(8),rs.getString(9));
                                    name_index=10;
                                    value_index=11;
                                }
                                layoutStructure.put(new Integer(structId), ls);
                                lastStructId = structId;
                                if (!ls.isChannel()) {
                                    ls.addFolderData(temp5, temp6); // Plug in saved column values
                                }
                                if (databaseMetadata.supportsOuterJoins()) {
                                    do {
                                        String name = rs.getString(name_index);
                                        String value = rs.getString(value_index); // Oracle JDBC requires us to do this for longs
                                        if (name != null) { // may not be there because of the join
                                            ls.addParameter(name, value);
                                        }
                                        if (!rs.next()) {
                                            break readLayout;
                                        }
                                        structId = rs.getInt(1);
                                        if (rs.wasNull()) {
                                            structId = 0;
                                        }
                                    } while (structId == lastStructId);
                                } else { // Do second SELECT later on for structure parameters
                                    if (ls.isChannel()) {
                                        structChanIds.append(sepChar + ls.getChanId());
                                        sepChar = ",";
                                    }
                                    if (rs.next()) {
                                        structId = rs.getInt(1);
                                        if (rs.wasNull()) {
                                            structId = 0;
                                        }
                                    } else {
                                        break readLayout;
                                    }
                                }
                            } // while
                        }
                    } finally {
                        rs.close();
                    }

                    if (!databaseMetadata.supportsOuterJoins() && structChanIds.length() > 0) { // Pick up structure parameters
                        // first, get the struct ids for the channels
                        String sql = "SELECT STRUCT_ID FROM UP_LAYOUT_STRUCT WHERE USER_ID=" + userId +
                                " AND LAYOUT_ID=" + layoutId +
                                " AND CHAN_ID IN (" + structChanIds.toString() + ") ORDER BY STRUCT_ID";

                        logger.debug("getUserLayout(): {}", sql);
                        StringBuffer structIdsSB = new StringBuffer( "" );
                        String sep = "";
                        rs = stmt.executeQuery(sql);
                        try {
                            // use the results to build a correct list of struct ids to look for
                            while( rs.next()) {
                                structIdsSB.append(sep + rs.getString(1));
                                sep = ",";
                            }// while
                        } finally {
                            rs.close();
                        } // be a good doobie


                        sql = "SELECT STRUCT_ID, STRUCT_PARM_NM,STRUCT_PARM_VAL FROM UP_LAYOUT_PARAM WHERE USER_ID=" + userId + " AND LAYOUT_ID=" + layoutId +
                                " AND STRUCT_ID IN (" + structIdsSB.toString() + ") ORDER BY STRUCT_ID";
                        logger.debug("getUserLayout(): {}", sql);
                        rs = stmt.executeQuery(sql);
                        try {
                            if (rs.next()) {
                                int structId = rs.getInt(1);
                                readParm: while(true) {
                                    LayoutStructure ls = (LayoutStructure)layoutStructure.get(new Integer(structId));
                                    int lastStructId = structId;
                                    do {
                                        ls.addParameter(rs.getString(2), rs.getString(3));
                                        if (!rs.next()) {
                                            break readParm;
                                        }
                                    } while ((structId = rs.getInt(1)) == lastStructId);
                                }
View Full Code Here

Examples of org.richfaces.component.LayoutStructure

    renderLayout(writer,context, (UILayout) component);
  }
 
  public void renderLayout(ResponseWriter writer,FacesContext context, UILayout layout)
      throws IOException {
    LayoutStructure structure = new LayoutStructure(layout);
    structure.calculateWidth();
    Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
    Object oldLayout = requestMap.get(LAYOUT_STRUCTURE_ATTRIBUTE);
    requestMap.put(LAYOUT_STRUCTURE_ATTRIBUTE, structure);
    // Detect layout content;
    if (null != structure.getTop()) {
      structure.getTop().encodeAll(context);
    }
    if (structure.getColumns() > 0) {
      // Reorder panels to fill ordeg left->center->right.
      if (null != structure.getLeft()) {
        structure.getLeft().encodeAll(context);
      }
      if (null != structure.getCenter()) {
        structure.getCenter().encodeAll(context);
      }
      if (null != structure.getRight()) {
        structure.getRight().encodeAll(context);
      }
    }
    // line separator.
    writer.startElement(HTML.DIV_ELEM, layout);
    writer.writeAttribute(HTML.style_ATTRIBUTE, "display: block; height: 0; clear: both; visibility: hidden;", null);
    writer.writeText(".", null);
    writer.endElement(HTML.DIV_ELEM);
    if (null != structure.getBottom()) {
      renderChild(context, structure.getBottom());
    }
    requestMap.put(LAYOUT_STRUCTURE_ATTRIBUTE, oldLayout);
  }
View Full Code Here

Examples of org.richfaces.component.LayoutStructure

        return true;
    }

    public void renderLayout(ResponseWriter writer, FacesContext context, AbstractLayout layout)
            throws IOException {
        LayoutStructure structure = new LayoutStructure(layout);
        structure.calculateWidth();
        Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
        Object oldLayout = requestMap.get(LAYOUT_STRUCTURE_ATTRIBUTE);
        requestMap.put(LAYOUT_STRUCTURE_ATTRIBUTE, structure);
        // Detect layout content;
        if (null != structure.getTop()) {
            structure.getTop().encodeAll(context);
        }
        if (structure.getColumns() > 0) {
            // Reorder panels to fill ordeg left->center->right.
            if (null != structure.getLeft()) {
                structure.getLeft().encodeAll(context);
            }
            if (null != structure.getCenter()) {
                structure.getCenter().encodeAll(context);
            }
            if (null != structure.getRight()) {
                structure.getRight().encodeAll(context);
            }
        }
        // line separator.
        writer.startElement(HtmlConstants.DIV_ELEM, layout);
        writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, "display: block; height: 0;line-height:0px; font-size:0px; clear: both; visibility: hidden;", null);
        writer.writeText(".", null);
        writer.endElement(HtmlConstants.DIV_ELEM);
        if (null != structure.getBottom()) {
            renderChildren(context, structure.getBottom());
        }
        requestMap.put(LAYOUT_STRUCTURE_ATTRIBUTE, oldLayout);
    }
View Full Code Here

Examples of org.richfaces.component.LayoutStructure

    public String layoutStyle(FacesContext context, AbstractLayoutPanel panel) {
        StringBuilder style = new StringBuilder();
        LayoutPosition position = panel.getPosition();
        Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
        Object parentLayout = requestMap.get(LayoutRenderer.LAYOUT_STRUCTURE_ATTRIBUTE);
        LayoutStructure structure;
        if (null != parentLayout && parentLayout instanceof LayoutStructure) {
            structure = (LayoutStructure) parentLayout;
        } else {
            structure = new LayoutStructure(panel);
            structure.calculateWidth();
        }
        Object componentStyle = panel.getAttributes().get(HtmlConstants.STYLE_ATTRIBUTE);
        if (null != componentStyle) {
            style.append(componentStyle).append(";");
        }
        if (!LayoutPosition.top.equals(position)
                && !LayoutPosition.bottom.equals(position)) {
            if (LayoutPosition.right.equals(position)) {
                style.append("float:right;");
            } else {
                style.append("float:left;");
            }
            // calculate real width.
            float coef = 1.0f - ((float) structure.getDeep() / 100.00f);
            String width = structure.getWidth(panel, coef);
            if (null != width) {
                style.append("width:").append(width).append(";");
                coef = coef * 0.95f;
                width = structure.getWidth(panel, coef);
                style.append("*width:").append(width).append(";");
            }
        } else {
            // top and buttom style.
        }
View Full Code Here

Examples of org.richfaces.component.LayoutStructure

  public String layoutStyle(FacesContext context, UILayoutPanel panel) {
    StringBuilder style = new StringBuilder();
    LayoutPosition position = panel.getPosition();
    Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
    Object parentLayout = requestMap.get(LayoutRenderer.LAYOUT_STRUCTURE_ATTRIBUTE);
    LayoutStructure structure;
    if (null != parentLayout && parentLayout instanceof LayoutStructure) {
      structure = (LayoutStructure) parentLayout;     
    } else {
      structure = new LayoutStructure(panel);
      structure.calculateWidth();
    }
    Object componentStyle = panel.getAttributes().get(HTML.style_ATTRIBUTE);
    if (null != componentStyle) {
      style.append(componentStyle).append(";");
    }
    if (!LayoutPosition.top.equals(position)
        && !LayoutPosition.bottom.equals(position)) {
      if (LayoutPosition.right.equals(position)) {
        style.append("float:right;");
      } else {
        style.append("float:left;");
      }
      // calculate real width.
      float coef = 1.0f-((float)structure.getDeep()/100.00f);
      String width = structure.getWidth(panel,coef);
       if(null != width){
       style.append("width:").append(width).append(";");
       coef = coef*0.95f;
       width = structure.getWidth(panel,coef);;
       style.append("*width:").append(width).append(";");
       }
    } else {
      // top and buttom style.
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.