Package org.apache.myfaces.tobago.layout

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


    }
  }

  private Style calculateHandleStyle(final AbstractUISplitLayout layout) {
    final LayoutContainer container = (LayoutContainer) ((AbstractUISplitLayout) layout).getParent();
    final LayoutComponent secondComponent = container.getComponents().get(1);
    final Style style = new Style();
    if (AbstractUISplitLayout.HORIZONTAL.equals(layout.getOrientation())) {
      style.setWidth(Measure.valueOf(5));
      style.setHeight(container.getCurrentHeight());
      style.setLeft(Measure.valueOf(secondComponent.getLeft().subtract(5)));
      style.setTop(Measure.valueOf(0));
    } else {
      style.setWidth(container.getCurrentWidth());
      style.setHeight(Measure.valueOf(5));
      style.setLeft(Measure.valueOf(0));
      style.setTop(Measure.valueOf(Measure.valueOf(secondComponent.getTop().subtract(5))));
    }
    style.setDisplay(Display.BLOCK);
    style.setPosition(Position.ABSOLUTE);
    return style;
  }
View Full Code Here


  private String submittedLayout;

  public void updateLayout(final int position) {
    final LayoutContainer container = (LayoutContainer) getParent();
    final LayoutComponent firstComponent = container.getComponents().get(0);
    final LayoutComponent secondComponent = container.getComponents().get(1);
    final int oldPosition;

    final int currentSize1;
    final int currentSize2;
    if (HORIZONTAL.equals(getOrientation())) {
      oldPosition = secondComponent.getLeft().getPixel() - 5;
      currentSize1 = firstComponent.getCurrentWidth().getPixel();
      currentSize2 = secondComponent.getCurrentWidth().getPixel();
    } else {
      oldPosition = secondComponent.getTop().getPixel() - 5;
      currentSize1 = firstComponent.getCurrentHeight().getPixel();
      currentSize2 = secondComponent.getCurrentHeight().getPixel();
    }

    final int offset = position - oldPosition;
    final int newSize1 = currentSize1 + offset;
    final int newSize2 = currentSize2 - offset;
View Full Code Here

      if (column instanceof AbstractUIColumnSelector) {
        layoutComponents.add(null); // XXX UIColumnSelector is currently not an instance of LayoutComponent
      } else if (column instanceof ColumnEvent) {
        // ignore
      } else if (column instanceof UIColumn) {
        LayoutComponent layoutComponent = null;
        for (UIComponent component : (List<UIComponent>) column.getChildren()) {
          if (component instanceof LayoutComponent) {
            if (layoutComponent == null) {
              layoutComponent = (LayoutComponent) component;
            } else {
View Full Code Here

          neitherRendered = false;
        }
        // recursion
        if (cell instanceof OriginCell) {
          OriginCell origin = (OriginCell) cell;
          LayoutComponent component = cell.getComponent();
          if (component instanceof LayoutContainer) {
            LayoutManager layoutManager = ((LayoutContainer) component).getLayoutManager();
            // TODO: may be improved
            boolean childAuto = origin.getSpan(orientation) == 1 && heads[i].getToken() instanceof AutoLayoutToken;
            layoutManager.fixRelativeInsideAuto(orientation, childAuto);
View Full Code Here

      IntervalList intervalList = new IntervalList();
      for (int j = 0; j < heads2.length; j++) {
        Cell cell = grid.getCell(i, j, orientation);
        if (cell instanceof OriginCell) {
          OriginCell origin = (OriginCell) cell;
          LayoutComponent component = cell.getComponent();

          if (component instanceof LayoutContainer) {
            ((LayoutContainer) component).getLayoutManager().preProcessing(orientation);
          }

          if (token instanceof AutoLayoutToken || token instanceof RelativeLayoutToken) {
            if (origin.getSpan(orientation) == 1 && component.isRendered()) {
              intervalList.add(new Interval(component, orientation));
            } else {
              if (LOG.isDebugEnabled()) {
                LOG.debug("Components with span > 1 will be ignored in 'auto' layout rows/columns.");
                // todo: give this information to the developer
View Full Code Here

    // call manage sizes for all sub-layout-managers
    for (int i = 0; i < heads.length; i++) {
      for (int j = 0; j < heads2.length; j++) {
        Cell cell = grid.getCell(i, j, orientation);
        if (cell instanceof OriginCell) {
          LayoutComponent component = cell.getComponent();

          component.setDisplay(Display.BLOCK); // TODO: use CSS via classes and style.css

          Integer span = ((OriginCell) cell).getSpan(orientation);

          // compute the size of the cell
          Measure size = Measure.ZERO;
View Full Code Here

    // call manage sizes for all sub-layout-managers
    for (int i = 0; i < heads.length; i++) {
      for (int j = 0; j < heads2.length; j++) {
        Cell cell = grid.getCell(i, j, orientation);
        if (cell instanceof OriginCell) {
          LayoutComponent component = cell.getComponent();

          component.setDisplay(Display.BLOCK);

          // compute the position of the cell
          Measure position = Measure.ZERO;
          position = position.add(LayoutUtils.getPaddingBegin(orientation, getLayoutContainer()));
          position = position.add(getMarginBegin(orientation));
          for (int k = 0; k < i; k++) {
            if (heads[k] != null
                && heads[k].getCurrent() != null
                && heads[k].isRendered()
                && heads[k].getCurrent().greaterThan(Measure.ZERO)) {
              position = position.add(heads[k].getCurrent());
              position = position.add(getSpacing(orientation));
            }
          }
          if (orientation == Orientation.HORIZONTAL) {
            component.setLeft(position);
          } else {
            component.setTop(position);
          }

          // call sub layout manager
          if (component instanceof LayoutContainer) {
            ((LayoutContainer) component).getLayoutManager().postProcessing(orientation);
View Full Code Here

      if (column instanceof AbstractUIColumnSelector) {
        layoutComponents.add(null); // XXX UIColumnSelector is currently not an instance of LayoutComponent
      } else if (column instanceof ColumnEvent) {
        // ignore
      } else if (column instanceof UIColumn) {
        LayoutComponent layoutComponent = null;
        for (UIComponent component : (List<UIComponent>) column.getChildren()) {
          if (component instanceof LayoutComponent) {
            if (layoutComponent == null) {
              layoutComponent = (LayoutComponent) component;
            } else {
View Full Code Here

          neitherRendered = false;
        }
        // recursion
        if (cell instanceof OriginCell) {
          OriginCell origin = (OriginCell) cell;
          LayoutComponent component = cell.getComponent();
          if (component instanceof LayoutContainer && component.isRendered()) {
            LayoutManager layoutManager = ((LayoutContainer) component).getLayoutManager();
            // TODO: may be improved
            boolean childAuto = origin.getSpan(orientation) == 1 && heads[i].getToken() instanceof AutoLayoutToken;
            layoutManager.fixRelativeInsideAuto(orientation, childAuto);
          }
View Full Code Here

      IntervalList intervalList = new IntervalList();
      for (int j = 0; j < heads2.length; j++) {
        Cell cell = grid.getCell(i, j, orientation);
        if (cell instanceof OriginCell) {
          OriginCell origin = (OriginCell) cell;
          LayoutComponent component = cell.getComponent();

          if (component instanceof LayoutContainer && component.isRendered()) {
            ((LayoutContainer) component).getLayoutManager().preProcessing(orientation);
          }

          if (token instanceof AutoLayoutToken || token instanceof RelativeLayoutToken) {
            if (origin.getSpan(orientation) == 1 && component.isRendered()) {
              intervalList.add(new Interval(component, orientation));
            } else {
              if (LOG.isDebugEnabled()) {
                LOG.debug("Components with span > 1 will be ignored in 'auto' layout rows/columns.");
                // todo: give this information to the developer
View Full Code Here

TOP

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

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.