Package org.apache.myfaces.tobago.internal.layout

Examples of org.apache.myfaces.tobago.internal.layout.IntervalList


  /**
   * 10/100/1000
   */
  @Test
  public void test1MinPrefMax() {
    IntervalList list = new IntervalList();
    list.add(new Interval(px(10), px(100), px(1000), null));
    list.evaluate();
    Assert.assertEquals(px(100), list.getCurrent());
    Assert.assertEquals(px(10), list.getMinimum());
  }
View Full Code Here


   * 20/200/2000
   * 30/300/3000
   */
  @Test
  public void test3MinPrefMax() {
    IntervalList list = new IntervalList();
    list.add(new Interval(px(10), px(100), px(1000), null));
    list.add(new Interval(px(20), px(200), px(2000), null));
    list.add(new Interval(px(30), px(300), px(3000), null));
    list.evaluate();
    Assert.assertEquals(px(300), list.getCurrent());
    Assert.assertEquals(px(30), list.getMinimum());
  }
View Full Code Here

  }

  public void preProcessing(Orientation orientation) {

    // process auto tokens
    IntervalList intervals = new IntervalList();
    for (LayoutComponent component : getLayoutContainer().getComponents()) {

      if (component != null) {
        if (component instanceof LayoutContainer) {
          ((LayoutContainer) component).getLayoutManager().preProcessing(orientation);
View Full Code Here

        } else {
          heads[i].setCurrent(Measure.ZERO);
        }
      }

      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
              }
            }
          }
        }
      }

      intervalList.evaluate();
      if (token instanceof AutoLayoutToken || token instanceof RelativeLayoutToken) {
        heads[i].setIntervalList(intervalList);
      }
      if (token instanceof AutoLayoutToken) {
        heads[i].setCurrent(intervalList.getCurrent());
      }
      i++;
    }

/*
 
View Full Code Here

        } else {
          heads[i].setCurrent(Measure.ZERO);
        }
      }

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

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

          if (token instanceof AutoLayoutToken || token instanceof RelativeLayoutToken) {
            if ((component.isRendered() || isRigid())) {
              if (origin.getSpan(orientation) == 1) {
                intervalList.add(new Interval(component, orientation));
              } else {
                if (LOG.isDebugEnabled()) {
                  LOG.debug("Components with span > 1 will be ignored in 'auto' layout rows/columns.");
                }
              }
            }
          }
        }
      }

      intervalList.evaluate();
      if (token instanceof AutoLayoutToken || token instanceof RelativeLayoutToken) {
        heads[i].setIntervalList(intervalList);
      }
      if (token instanceof AutoLayoutToken) {
        if (heads[i].isRendered()) {
          if (intervalList.size() > 0) {
            heads[i].setCurrent(intervalList.getCurrent());
          } else {
            heads[i].setCurrent(Measure.valueOf(100));
            LOG.warn("Found an 'auto' token in {} definition, but there is no component inside with span = 1! "
                + "So the value for 'auto' can't be evaluated (clientId={}). Using 100px.",
                orientation == Orientation.HORIZONTAL ? "columns" : "rows",
View Full Code Here

   * 120/222/220
   * 130/333/230
   */
  @Test
  public void test6Squeeze() {
    IntervalList list = new IntervalList();
    list.add(new Interval(null, null, null, px(100)));
    list.add(new Interval(null, null, null, px(200)));
    list.add(new Interval(null, null, null, px(300)));
    list.add(new Interval(px(10), px(111), px(210), null));
    list.add(new Interval(px(120), px(222), px(220), null));
    list.add(new Interval(px(130), px(333), px(230), null));
    list.evaluate();
    Assert.assertEquals(px(300), list.getCurrent());
    Assert.assertEquals(px(300), list.getMinimum());
  }
View Full Code Here

   * 120/222/220
   * 130/333/230
   */
  @Test
  public void test5Squeeze() {
    IntervalList list = new IntervalList();
    list.add(new Interval(null, null, null, px(100)));
    list.add(new Interval(null, null, null, px(300)));
    list.add(new Interval(px(10), px(111), px(210), null));
    list.add(new Interval(px(120), px(222), px(220), null));
    list.add(new Interval(px(130), px(333), px(230), null));
    list.evaluate();
    Assert.assertEquals(px(300), list.getCurrent());
    Assert.assertEquals(px(300), list.getMinimum());
  }
View Full Code Here

  /**
   * nothing defined
   */
  @Test
  public void test0() {
    IntervalList list = new IntervalList();
    list.evaluate();
    Assert.assertEquals(Measure.ZERO, list.getCurrent());
    Assert.assertEquals(Measure.ZERO, list.getMinimum());
  }
View Full Code Here

  /**
   * f=100
   */
  @Test
  public void test1Fixed() {
    IntervalList list = new IntervalList();
    list.add(new Interval(null, null, null, px(100)));
    list.evaluate();
    Assert.assertEquals(px(100), list.getCurrent());
    Assert.assertEquals(px(100), list.getMinimum());
  }
View Full Code Here

   * f=200
   * f=300
   */
  @Test
  public void test3Fixed() {
    IntervalList list = new IntervalList();
    list.add(new Interval(null, null, null, px(100)));
    list.add(new Interval(null, null, null, px(200)));
    list.add(new Interval(null, null, null, px(300)));
    list.evaluate();
    Assert.assertEquals(px(300), list.getCurrent());
    Assert.assertEquals(px(300), list.getMinimum());
  }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.tobago.internal.layout.IntervalList

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.