Package org.apache.myfaces.tobago.component

Examples of org.apache.myfaces.tobago.component.LayoutTokens


  private int calculateLayoutHeight(
      FacesContext facesContext, UIComponent component, boolean minimum) {
    UIGridLayout layout = (UIGridLayout) UILayout.getLayout(component);
    final List<UIGridLayout.Row> rows = layout.ensureRows();

    LayoutTokens layoutTokens = layout.getRowLayout();

    if (layoutTokens == null && !minimum && LOG.isDebugEnabled()) {
      LOG.debug("No rowLayout found using " + (minimum ? "'minimum'" : "'fixed'")
          + " for all " + rows.size() + " rows."
          + " (clientId='" + layout.getClientId(facesContext) + "')");
    }
    if (rows.size() != layoutTokens.getSize()) {
      LOG.warn("Unbalanced layout: rows.size()=" + rows.size()
          + " != layoutTokens.length=" + layoutTokens.getSize()
          + " rowLayout='" + layoutTokens + "'"
          + " (clientId='" + layout.getClientId(facesContext) + "')");
      layoutTokens.ensureSize(rows.size(), new RelativeLayoutToken(1));
    }
    // TODO alternative? rows.size() == 1 ? new RelativeLayoutToken(1) : new FixedLayoutToken()
    //new FixedLayoutToken() );
    //String[] layoutTokens
    //    = LayoutInfo.createLayoutTokens(rowLayout, rows.size(),
    //        minimum ? "minimum" : "fixed");


    int size = Math.min(rows.size(), layoutTokens.getSize());

    int height = 0;
    height += getMarginAsInt(layout.getMarginTop());
    height += getMarginAsInt(layout.getMarginBottom());
    boolean first = true;
    for (int i = 0; i < size; i++) {
      if (!rowIsRendered(rows.get(i))) {
        continue;
      }
      height += getCellPadding(facesContext, layout,  first);
      first = false;
      LayoutToken token = layoutTokens.get(i);
      if (token instanceof PixelLayoutToken) {
        height += ((PixelLayoutToken) token).getPixel();
      } else if (token instanceof FixedLayoutToken) {
        height += getMaxHeight(facesContext, rows.get(i), false);
      } else if (token instanceof MinimumLayoutToken) {
View Full Code Here


    UIGridLayout layout = (UIGridLayout) UILayout.getLayout(component);
    final List<UIGridLayout.Row> rows = layout.ensureRows();
    UIGridLayout.Row row = rows.get(0);


    LayoutTokens layoutTokens = layout.getColumnLayout();

    if (layoutTokens == null && !minimum && LOG.isDebugEnabled()) {
      LOG.debug("No rowLayout found using " + (minimum ? "'minimum'" : "'fixed'")
          + " for all " + rows.size() + " rows of "
          + layout.getClientId(facesContext) + " !");
    }

    if (row.getColumns() != layoutTokens.getSize()) {
      LOG.warn("Unbalanced layout: rows.size()=" + rows.size()
          + " != layoutTokens.length=" + layoutTokens.getSize()
          + " columnLayout='" + layoutTokens + "'"
          + " (clientId='" + layout.getClientId(facesContext) + "')");
      layoutTokens.ensureSize(row.getColumns(), new FixedLayoutToken());
    }

    int size = Math.min(rows.size(), layoutTokens.getSize());

    int width = 0;
    width += getMarginAsInt(layout.getMarginLeft());
    width += getMarginAsInt(layout.getMarginRight());
    boolean first = true;
    for (int i = 0; i < size; i++) {
      if (!columnIsRendered(rows,  i)) {
        continue;
      }
      width += getCellPadding(facesContext, layout,  first);
      first = false;
      LayoutToken token = layoutTokens.get(i);
      if (token instanceof PixelLayoutToken) {
        width += ((PixelLayoutToken) token).getPixel();
      } else if (token instanceof FixedLayoutToken) {
        width += getMaxWidth(facesContext, rows, i, false);
      } else if (token instanceof MinimumLayoutToken) {
View Full Code Here

      FacesContext facesContext) {

    final List<UIGridLayout.Row> rows = layout.ensureRows();
    //final int columnCount = layout.getColumnCount();

    final LayoutTokens layoutTokens = layout.getColumnLayout();
    //layoutTokens.ensureSize(columnCount, new RelativeLayoutToken(1));

    //LayoutInfo.createLayoutTokens((String)
        //layout.getAttributes().get(ATTR_COLUMNS), columnCount);

    int renderedColumnCount = 0;
    if (!rows.isEmpty()) {
      UIGridLayout.Row row = rows.get(0);
      final List cells = row.getElements();
      renderedColumnCount = cells.size();
      for (int i = 0; i < cells.size(); i++) {
        Object cell = cells.get(i);
        boolean hidden = false;
        if (isHidden(cell)) {
          hidden = true;
          for (int j = 1; j < rows.size(); j++) {
            hidden &= isHidden(rows.get(j).getElements().get(i));
          }
        }
        if (hidden) {
          layoutTokens.set(i, new HideLayoutToken());
          renderedColumnCount--;
        }
      }
    }

    innerWidth -= getWidthSpacingSum(layout, facesContext, renderedColumnCount);
    LayoutInfo layoutInfo =
        new LayoutInfo(layoutTokens.getSize(), innerWidth.intValue(), layoutTokens, layout.getClientId(facesContext),
            layout.isIgnoreFree());

    parseFixedWidth(layoutInfo, layout, facesContext);
    layoutInfo.parseColumnLayout(innerWidth.doubleValue(),
        getCellSpacing(facesContext, layout));
View Full Code Here

  private void layoutHeight(Integer innerHeight, UIGridLayout layout,
      FacesContext facesContext) {

    final List<UIGridLayout.Row> rows = layout.ensureRows();
    LayoutTokens layoutTokens = layout.getRowLayout();
    layoutTokens.ensureSize(rows.size(), rows.size() == 1 ? new RelativeLayoutToken(1) : new FixedLayoutToken());
        /*LayoutInfo.createLayoutTokens(
        (String) layout.getAttributes().get(ATTR_ROWS),
        rows.size(), rows.size() == 1 ? "1*" : "fixed");*/

    int renderedRowCount = rows.size();
    for (int i = 0; i < rows.size(); i++) {
      boolean hidden = true;
      UIGridLayout.Row row = rows.get(i);
      List cells = row.getElements();
      for (Object cell : cells) {
        hidden &= isHidden(cell);
      }
      row.setHidden(hidden);
      if (hidden) {
        layoutTokens.set(i, new HideLayoutToken());
        renderedRowCount--;
      }
    }

    innerHeight -= getHeightSpacingSum(layout, facesContext, renderedRowCount);

    LayoutInfo layoutInfo
        = new LayoutInfo(rows.size(), innerHeight.intValue(), layoutTokens, layout.getClientId(facesContext));

    if (!layoutTokens.isEmpty()) {
      parseFixedHeight(layoutInfo, layout, facesContext);
      layoutInfo.parseColumnLayout(innerHeight.doubleValue(),
          getCellSpacing(facesContext, layout));
    }

View Full Code Here

    }
  }
  private void parseFixedSpace(LayoutInfo layoutInfo, UIGridLayout layout,
                               boolean width, FacesContext facesContext) {

    LayoutTokens tokens = layoutInfo.getLayoutTokens();
    for (int i = 0; i < tokens.getSize(); i++) {
      LayoutToken token = tokens.get(i);
      if (token instanceof FixedLayoutToken) {
        int max = 0;
        final List<UIGridLayout.Row> rows = layout.ensureRows();
        if (!rows.isEmpty()) {
          if (width) {
View Full Code Here

  private int calculateLayoutHeight(
      FacesContext facesContext, UIComponent component, boolean minimum) {
    UIGridLayout layout = (UIGridLayout) UILayout.getLayout(component);
    final List<UIGridLayout.Row> rows = layout.ensureRows();

    LayoutTokens layoutTokens = layout.getRowLayout();

    if (layoutTokens == null && !minimum && LOG.isDebugEnabled()) {
      LOG.debug("No rowLayout found using " + (minimum ? "'minimum'" : "'fixed'")
          + " for all " + rows.size() + " rows."
          + " (clientId='" + layout.getClientId(facesContext) + "')");
    }
    if (rows.size() != layoutTokens.getSize()) {
      LOG.warn("Unbalanced layout: rows.size()=" + rows.size()
          + " != layoutTokens.length=" + layoutTokens.getSize()
          + " rowLayout='" + layoutTokens + "'"
          + " (clientId='" + layout.getClientId(facesContext) + "')");
      layoutTokens.ensureSize(rows.size(), new RelativeLayoutToken(1));
    }
    // TODO alternative? rows.size() == 1 ? new RelativeLayoutToken(1) : new FixedLayoutToken()
    //new FixedLayoutToken() );
    //String[] layoutTokens
    //    = LayoutInfo.createLayoutTokens(rowLayout, rows.size(),
    //        minimum ? "minimum" : "fixed");


    int size = Math.min(rows.size(), layoutTokens.getSize());

    int height = 0;
    height += getMarginAsInt(layout.getMarginTop());
    height += getMarginAsInt(layout.getMarginBottom());
    boolean first = true;
    for (int i = 0; i < size; i++) {
      if (!rowIsRendered(rows.get(i))) {
        continue;
      }
      height += getCellPadding(facesContext, layout,  first);
      first = false;
      LayoutToken token = layoutTokens.get(i);
      if (token instanceof PixelLayoutToken) {
        height += ((PixelLayoutToken) token).getPixel();
      } else if (token instanceof FixedLayoutToken) {
        height += getMaxHeight(facesContext, rows.get(i), false);
      } else if (token instanceof MinimumLayoutToken) {
View Full Code Here

    UIGridLayout layout = (UIGridLayout) UILayout.getLayout(component);
    final List<UIGridLayout.Row> rows = layout.ensureRows();
    UIGridLayout.Row row = rows.get(0);


    LayoutTokens layoutTokens = layout.getColumnLayout();

    if (layoutTokens == null && !minimum && LOG.isDebugEnabled()) {
      LOG.debug("No rowLayout found using " + (minimum ? "'minimum'" : "'fixed'")
          + " for all " + rows.size() + " rows of "
          + layout.getClientId(facesContext) + " !");
    }

    if (row.getColumns() != layoutTokens.getSize()) {
      LOG.warn("Unbalanced layout: rows.size()=" + rows.size()
          + " != layoutTokens.length=" + layoutTokens.getSize()
          + " columnLayout='" + layoutTokens + "'"
          + " (clientId='" + layout.getClientId(facesContext) + "')");
      layoutTokens.ensureSize(row.getColumns(), new FixedLayoutToken());
    }

    int size = Math.min(rows.size(), layoutTokens.getSize());

    int width = 0;
    width += getMarginAsInt(layout.getMarginLeft());
    width += getMarginAsInt(layout.getMarginRight());
    boolean first = true;
    for (int i = 0; i < size; i++) {
      if (!columnIsRendered(rows,  i)) {
        continue;
      }
      width += getCellPadding(facesContext, layout,  first);
      first = false;
      LayoutToken token = layoutTokens.get(i);
      if (token instanceof PixelLayoutToken) {
        width += ((PixelLayoutToken) token).getPixel();
      } else if (token instanceof FixedLayoutToken) {
        width += getMaxWidth(facesContext, rows, i, false);
      } else if (token instanceof MinimumLayoutToken) {
View Full Code Here

      FacesContext facesContext) {

    final List<UIGridLayout.Row> rows = layout.ensureRows();
    //final int columnCount = layout.getColumnCount();

    final LayoutTokens layoutTokens = layout.getColumnLayout();
    //layoutTokens.ensureSize(columnCount, new RelativeLayoutToken(1));

    //LayoutInfo.createLayoutTokens((String)
        //layout.getAttributes().get(ATTR_COLUMNS), columnCount);

    int renderedColumnCount = 0;
    if (!rows.isEmpty()) {
      UIGridLayout.Row row = rows.get(0);
      final List cells = row.getElements();
      renderedColumnCount = cells.size();
      for (int i = 0; i < cells.size(); i++) {
        Object cell = cells.get(i);
        boolean hidden = false;
        if (isHidden(cell)) {
          hidden = true;
          for (int j = 1; j < rows.size(); j++) {
            hidden &= isHidden(rows.get(j).getElements().get(i));
          }
        }
        if (hidden) {
          layoutTokens.set(i, new HideLayoutToken());
          renderedColumnCount--;
        }
      }
    }

    innerWidth -= getWidthSpacingSum(layout, facesContext, renderedColumnCount);
    LayoutInfo layoutInfo =
        new LayoutInfo(layoutTokens.getSize(), innerWidth.intValue(), layoutTokens, layout.getClientId(facesContext),
            layout.isIgnoreFree());

    parseFixedWidth(layoutInfo, layout, facesContext);
    layoutInfo.parseColumnLayout(innerWidth.doubleValue(),
        getCellSpacing(facesContext, layout));
View Full Code Here

  private void layoutHeight(Integer innerHeight, UIGridLayout layout,
      FacesContext facesContext) {

    final List<UIGridLayout.Row> rows = layout.ensureRows();
    LayoutTokens layoutTokens = layout.getRowLayout();
    layoutTokens.ensureSize(rows.size(), rows.size() == 1 ? new RelativeLayoutToken(1) : new FixedLayoutToken());
        /*LayoutInfo.createLayoutTokens(
        (String) layout.getAttributes().get(ATTR_ROWS),
        rows.size(), rows.size() == 1 ? "1*" : "fixed");*/

    int renderedRowCount = rows.size();
    for (int i = 0; i < rows.size(); i++) {
      boolean hidden = true;
      UIGridLayout.Row row = rows.get(i);
      List cells = row.getElements();
      for (Object cell : cells) {
        hidden &= isHidden(cell);
      }
      row.setHidden(hidden);
      if (hidden) {
        layoutTokens.set(i, new HideLayoutToken());
        renderedRowCount--;
      }
    }

    innerHeight -= getHeightSpacingSum(layout, facesContext, renderedRowCount);

    LayoutInfo layoutInfo
        = new LayoutInfo(rows.size(), innerHeight.intValue(), layoutTokens, layout.getClientId(facesContext));

    if (!layoutTokens.isEmpty()) {
      parseFixedHeight(layoutInfo, layout, facesContext);
      layoutInfo.parseColumnLayout(innerHeight.doubleValue(),
          getCellSpacing(facesContext, layout));
    }

View Full Code Here

    }
  }
  private void parseFixedSpace(LayoutInfo layoutInfo, UIGridLayout layout,
                               boolean width, FacesContext facesContext) {

    LayoutTokens tokens = layoutInfo.getLayoutTokens();
    for (int i = 0; i < tokens.getSize(); i++) {
      LayoutToken token = tokens.get(i);
      if (token instanceof FixedLayoutToken) {
        int max = 0;
        final List<UIGridLayout.Row> rows = layout.ensureRows();
        if (!rows.isEmpty()) {
          if (width) {
View Full Code Here

TOP

Related Classes of org.apache.myfaces.tobago.component.LayoutTokens

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.