Examples of LayoutInformationProvider


Examples of org.apache.myfaces.tobago.renderkit.LayoutInformationProvider

  public static int getFixedHeightForPanel(UIComponent component, FacesContext facesContext) {
    int height = -1;
    // first ask layoutManager
    UIComponent layout = component.getFacet(FACET_LAYOUT);
    if (layout != null) {
      LayoutInformationProvider renderer = ComponentUtil.getRenderer(facesContext, layout);
      height = renderer.getFixedHeight(facesContext, component);
    }
    if (height < 0) {

      if (component.getChildren().size() == 0) {
        height = 0;
      } else {

        if (LOG.isDebugEnabled()) {
          LOG.debug("Can't calculate fixedHeight! "
              + "using estimation by contained components. for "
              + component.getClientId(facesContext) + " = "
              + component.getClass().getName() + " "
              + component.getRendererType());
        }

        height = 0;
        for (Object o : component.getChildren()) {
          UIComponent child = (UIComponent) o;
          LayoutInformationProvider renderer = ComponentUtil.getRenderer(facesContext, child);
          if (renderer == null
              && child instanceof UINamingContainer
              && child.getChildren().size() > 0) {
            // this is a subview component ??
            renderer = ComponentUtil.getRenderer(facesContext, (UIComponent) child.getChildren().get(0));
          }
          if (renderer != null) {
            int h = renderer.getFixedHeight(facesContext, child);
            if (h > 0) {
              height += h;
            }
          }
        }
View Full Code Here

Examples of org.apache.myfaces.tobago.renderkit.LayoutInformationProvider

  private static final Log LOG = LogFactory.getLog(GridLayoutRenderer.class);

  public int getFixedHeight(FacesContext facesContext, UIComponent component) {
    int height = calculateLayoutHeight(facesContext, component, false);

    LayoutInformationProvider containerRenderer =
        ComponentUtil.getRenderer(facesContext, component);
    height += containerRenderer.getHeaderHeight(facesContext, component);
    height += containerRenderer.getPaddingHeight(facesContext, component);
    return height;
  }
View Full Code Here

Examples of org.apache.myfaces.tobago.renderkit.LayoutInformationProvider

  }

  public int getFixedWidth(FacesContext facesContext, UIComponent component) {
    int width = calculateLayoutWidth(facesContext, component, false);

    LayoutInformationProvider containerRenderer =
         ComponentUtil.getRenderer(facesContext, component);
    width += containerRenderer.getPaddingWidth(facesContext, component);
    return width;
  }
View Full Code Here

Examples of org.apache.myfaces.tobago.renderkit.LayoutInformationProvider

        UIComponent component = (UIComponent) cell;
        int height = -1;
        if (minimum) {
          height = (int) LayoutUtil.getMinimumSize(facesContext, component).getHeight();
        } else {
          LayoutInformationProvider renderer = ComponentUtil.getRenderer(facesContext, component);
          if (renderer != null) {
            height = renderer.getFixedHeight(facesContext, component);
          }
        }
        maxHeight = Math.max(maxHeight, height);
      } else if (cell instanceof UIGridLayout.Marker) {
        // ignore
View Full Code Here

Examples of org.apache.myfaces.tobago.renderkit.LayoutInformationProvider

          }
          int max = -1;
          if (minimum) {
            max = (int) LayoutUtil.getMinimumSize(facesContext, component).getWidth();
          } else {
            LayoutInformationProvider renderer = ComponentUtil.getRenderer(facesContext, component);
            if (renderer != null) {
              max = renderer.getFixedWidth(facesContext, component);
            }
          }
          maxWidth = Math.max(maxWidth, max);
        } else if (object instanceof UIGridLayout.Marker) {
        // ignore
View Full Code Here

Examples of org.apache.myfaces.tobago.renderkit.LayoutInformationProvider

          component.getAttributes().remove(ATTR_INNER_HEIGHT);
        }
      }
    }
    if (space > 0) {
      LayoutInformationProvider renderer = ComponentUtil.getRenderer(facesContext, component);
      if (layoutSpace != null
          || !ComponentUtil.getBooleanAttribute(component, ATTR_INLINE)) {
        int styleSpace = space;
        if (renderer != null) {
          if (width) {
            styleSpace -= renderer.getComponentExtraWidth(facesContext, component);
          } else {
            styleSpace -= renderer.getComponentExtraHeight(facesContext, component);
          }
        }

        replaceStyleAttribute(component, styleAttribute, styleSpace);
View Full Code Here

Examples of org.apache.myfaces.tobago.renderkit.LayoutInformationProvider

    createHeaderAndBodyStyles(facesContext, component, true);
    createHeaderAndBodyStyles(facesContext, component, false);
  }

  public static void createHeaderAndBodyStyles(FacesContext facesContext, UIComponent component, boolean width) {
    LayoutInformationProvider renderer = ComponentUtil.getRenderer(facesContext, component);
    HtmlStyleMap style = (HtmlStyleMap) component.getAttributes().get(ATTR_STYLE);
    Integer styleSpace = null;
    try {
      styleSpace = style.getInt(width ? "width" : "height");
    } catch (Exception e) {
      /* ignore */
    }
    if (styleSpace != null) {
      int bodySpace = 0;
      int headerSpace = 0;
      if (!width) {
        if (renderer != null) {
          headerSpace = renderer.getHeaderHeight(facesContext, component);
        }
        bodySpace = styleSpace - headerSpace;
      }
      HtmlStyleMap headerStyle = ensureStyleAttributeMap(component, ATTR_STYLE_HEADER);
      HtmlStyleMap bodyStyle = ensureStyleAttributeMap(component, ATTR_STYLE_BODY);
View Full Code Here

Examples of org.apache.myfaces.tobago.renderkit.LayoutInformationProvider

        int width = 0;
        if (!rendereredColumns.isEmpty()) {
          if (i < rendereredColumns.size()) {
            UIColumn column = rendereredColumns.get(i);
            if (column instanceof UIColumnSelector) {
              LayoutInformationProvider renderer
                  = ComponentUtil.getRenderer(facesContext, column);
              if (renderer == null) {
                LOG.warn("can't find renderer for " + column.getClass().getName());
                renderer = ComponentUtil.getRenderer(facesContext, UIPanel.COMPONENT_FAMILY, RENDERER_TYPE_OUT);
              }
              width = renderer.getFixedWidth(facesContext, column);

            } else {
              for (UIComponent component : (List<UIComponent>) column.getChildren()) {
                LayoutInformationProvider renderer
                    = ComponentUtil.getRenderer(facesContext, component);
                width += renderer.getFixedWidth(facesContext, component);
              }
            }
            layoutInfo.update(width, i);
          } else {
            layoutInfo.update(0, i);
View Full Code Here

Examples of org.apache.myfaces.tobago.renderkit.LayoutInformationProvider

      int outerSpace, boolean width) {
    int margin = 0;
    if (component.getRendererType() != null) {
      try {

        LayoutInformationProvider renderer = ComponentUtil.getRenderer(facesContext, component);

        if (width) {
          margin += renderer.getPaddingWidth(facesContext, component);
          margin += renderer.getComponentExtraWidth(facesContext, component);
        } else {
          margin += renderer.getHeaderHeight(facesContext, component);
          margin += renderer.getPaddingHeight(facesContext, component);
          margin += renderer.getComponentExtraHeight(facesContext, component);
        }
      } catch (Exception e) {
        if (LOG.isDebugEnabled()) {
          LOG.debug("cannot find margin", e);
        }
View Full Code Here

Examples of org.apache.myfaces.tobago.renderkit.LayoutInformationProvider

  public static int calculateFixedHeightForChildren(FacesContext facesContext, UIComponent component) {
    int height = 0;
    for (Object o : component.getChildren()) {
      UIComponent child = (UIComponent) o;
      LayoutInformationProvider renderer = ComponentUtil.getRenderer(facesContext, child);
      if (renderer == null
          && child instanceof UINamingContainer
          && child.getChildren().size() > 0) {
        // this is a subview component ??
        renderer = ComponentUtil.getRenderer(facesContext, (UIComponent) child.getChildren().get(0));
      }
      if (renderer != null) {
        int h = renderer.getFixedHeight(facesContext, child);
        if (h > 0) {
          height += h;
        }
      }
    }
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.