Package org.apache.myfaces.tobago.layout

Examples of org.apache.myfaces.tobago.layout.Measure


  }

  private List<Measure> findPreferredInInterval(Measure min, Measure max) {
    List<Measure> result = new ArrayList<Measure>();
    for (Interval interval : this) {
      Measure value = interval.getCurrent();
      if (value == null) {
        value = interval.getPreferred();
      }
      if (value != null && value.greaterOrEqualThan(min) && value.lessOrEqualThan(max)) {
        result.add(value);
      }
    }
    return result;
  }
View Full Code Here


    if (title == null && diff > 0) {
      title = Integer.toString(100 * model.getValue() / diff) + " %";
    }

    final Style style = new Style(facesContext, progress);
    final Measure width = style.getWidth();
    final Measure valueWidth = diff > 0 ? width.multiply(model.getValue()).divide(diff) : width;

    final Style valueStyle = new Style();
    valueStyle.setHeight(style.getHeight());
    valueStyle.setWidth(valueWidth);

View Full Code Here

    String value = null;
    try {
      value = (String) facesContext.getExternalContext().getRequestParameterMap().get(name);
      if (StringUtils.isNotBlank(value)) {
        StringTokenizer tokenizer = new StringTokenizer(value, ";");
        Measure vertical = Measure.valueOf(tokenizer.nextToken());
        Measure horizontal = Measure.valueOf(tokenizer.nextToken());
        if (vertical.greaterThan(Measure.valueOf(30)) || vertical.lessThan(Measure.valueOf(3))
           || horizontal.greaterThan(Measure.valueOf(30)) || horizontal.lessThan(Measure.valueOf(3))) {
          LOG.error("Ignoring strange values: vertical=" + vertical + " horizontal=" + horizontal);
        } else {
          ClientProperties client = VariableResolverUtils.resolveClientProperties(facesContext);
          client.setVerticalScrollbarWeight(vertical);
          client.setHorizontalScrollbarWeight(horizontal);
View Full Code Here

    writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "content");
    Style style = new Style(facesContext, page);
    // XXX position the div, so that the scrollable area is correct.
    // XXX better to take this fact into layout management.
    // XXX is also useful in boxes, etc.
    Measure border = getBorderBottom(facesContext, page);
    style.setHeight(page.getCurrentHeight().subtract(border));
    style.setTop(border);
    writer.writeStyleAttribute(style);
  }
View Full Code Here

  }

  @Override
  public Measure getWidth(FacesContext facesContext, Configurable component) {
    // width of the actual browser window
    Measure width = (Measure) FacesContext.getCurrentInstance().getExternalContext()
        .getRequestMap().get("tobago-page-clientDimension-width");
    if (width != null) {
      return width;
    } else {
      return super.getWidth(facesContext, component);
View Full Code Here

  }

  @Override
  public Measure getHeight(FacesContext facesContext, Configurable component) {
    // height of the actual browser window
    Measure height = (Measure) FacesContext.getCurrentInstance().getExternalContext()
        .getRequestMap().get("tobago-page-clientDimension-height");
    if (height != null) {
      return height;
    } else {
      return super.getHeight(facesContext, component);
View Full Code Here

          AbstractUIColumn column = (AbstractUIColumn) ((UIComponent) component).getParent();
          if (!column.isRendered()) {
            // XXX here not index++, because the widthList has only the rendered=true, todo: change it.
            continue;
          }
          Measure width = Measure.valueOf(widthList.get(index));
          width = width.subtractNotNegative(LayoutUtils.getBorderBegin(orientation, column));
          width = width.subtractNotNegative(LayoutUtils.getPaddingBegin(orientation, column));
          width = width.subtractNotNegative(LayoutUtils.getPaddingEnd(orientation, column));
          width = width.subtractNotNegative(LayoutUtils.getBorderEnd(orientation, column));
          final LayoutComponentRenderer renderer = sheet.getLayoutComponentRenderer(facesContext);
          width = width.subtractNotNegative(renderer.getCustomMeasure(facesContext, sheet, "columnSeparator"));
          LayoutUtils.setCurrentSize(orientation, component, width);
          component.setDisplay(Display.BLOCK); // TODO: use CSS via classes and style.css
          // call sub layout manager
          if (component instanceof LayoutContainer && component.isRendered()) {
            ((LayoutContainer) component).getLayoutManager().mainProcessing(orientation);
View Full Code Here

    for (LayoutComponent component : sheet.getComponents()) {

      if (component != null) {
        // compute the position of the cell
        Measure position = LayoutUtils.getBorderBegin(orientation, sheet);
        if (orientation == Orientation.HORIZONTAL) {
          component.setLeft(position);
        } else {
          component.setTop(position);
        }
View Full Code Here

            }
          }
        }
      }

      Measure space = data.getCurrentWidth();
      final LayoutComponentRenderer renderer = data.getLayoutComponentRenderer(facesContext);
      space = space.subtractNotNegative(renderer.getBorderLeft(facesContext, data));
      space = space.subtractNotNegative(renderer.getBorderRight(facesContext, data));
      if (needVerticalScrollbar(facesContext, data)) {
        space = space.subtractNotNegative(renderer.getVerticalScrollbarWeight(facesContext, data));
      }
/*
      // todo: not nice: 1 left + 1 right border
      space = space.subtract(renderedColumns.size() * 2);
*/
      LayoutInfo layoutInfo =
          new LayoutInfo(newTokens.getSize(), space.getPixel(), newTokens, data.getClientId(facesContext), false);
      final Measure columnSelectorWidth
          = data.getLayoutComponentRenderer(facesContext).getCustomMeasure(facesContext, data, "columnSelectorWidth");
      parseFixedWidth(layoutInfo, renderedColumns, columnSelectorWidth);
      layoutInfo.parseColumnLayout(space.getPixel());
      currentWidthList = layoutInfo.getSpaceList();
    }
View Full Code Here

      if (sheet.getCurrentHeight() != null) {
        int first = sheet.getFirst();
        int rows = sheet.isRowsUnlimited()
            ? sheet.getRowCount()
            : Math.min(sheet.getRowCount(), first + sheet.getRows()) - first;
        Measure heightNeeded = getRowHeight(facesContext, sheet).multiply(rows);
        if (sheet.isShowHeader()) {
          heightNeeded = heightNeeded.add(getHeaderHeight(facesContext, sheet));
        }
        if (sheet.isPagingVisible()) {
          heightNeeded = heightNeeded.add(getFooterHeight(facesContext, sheet));
        }
        result = heightNeeded.greaterThan(sheet.getCurrentHeight());
      } else {
        result = false;
      }
    }
    sheet.setNeedVerticalScrollbar(result);
View Full Code Here

TOP

Related Classes of org.apache.myfaces.tobago.layout.Measure

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.