Package org.richfaces.component

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


        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

    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

  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

    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;line-height:0px; font-size:0px; 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

TOP

Related Classes of org.richfaces.component.LayoutStructure

Copyright © 2018 www.massapicom. 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.