Package com.google.sitebricks.routing

Examples of com.google.sitebricks.routing.PageBook$Page


        placeRect(bestNode);
        rects.removeIndex(bestRectIndex);
      }

      Page result = getResult();
      result.remainingRects = rects;
      return result;
    }
View Full Code Here


      for (int i = 0; i < usedRectangles.size; i++) {
        Rect rect = usedRectangles.get(i);
        w = Math.max(w, rect.x + rect.width);
        h = Math.max(h, rect.y + rect.height);
      }
      Page result = new Page();
      result.outputRects = new Array(usedRectangles);
      result.occupancy = getOccupancy();
      result.width = w;
      result.height = h;
      return result;
View Full Code Here

      }
    }

    Array<Page> pages = new Array();
    while (inputRects.size > 0) {
      Page result = packPage(inputRects);
      pages.add(result);
      inputRects = result.remainingRects;
    }
    return pages;
  }
View Full Code Here

    // Find the minimal page size that fits all rects.
    BinarySearch widthSearch = new BinarySearch(minWidth, settings.maxWidth, settings.fast ? 25 : 15, settings.pot);
    BinarySearch heightSearch = new BinarySearch(minHeight, settings.maxHeight, settings.fast ? 25 : 15, settings.pot);
    int width = widthSearch.reset(), height = heightSearch.reset(), i = 0;
    Page bestResult = null;
    while (true) {
      Page bestWidthResult = null;
      while (width != -1) {
        Page result = packAtSize(true, width - edgePaddingX, height - edgePaddingY, inputRects);
        if (++i % 70 == 0) System.out.println();
        System.out.print(".");
        bestWidthResult = getBest(bestWidthResult, result);
        width = widthSearch.next(result == null);
      }
View Full Code Here

  }

  /** @param fully If true, the only results that pack all rects will be considered. If false, all results are considered, not all
   *           rects may be packed. */
  private Page packAtSize (boolean fully, int width, int height, Array<Rect> inputRects) {
    Page bestResult = null;
    for (int i = 0, n = methods.length; i < n; i++) {
      maxRects.init(width, height);
      Page result;
      if (!settings.fast) {
        result = maxRects.pack(inputRects, methods[i]);
      } else {
        Array<Rect> remaining = new Array();
        for (int ii = 0, nn = inputRects.size; ii < nn; ii++) {
View Full Code Here

  public final void pageEmbeddingSupressesNormalWidgetChain(String pageName, final String passOn, final String expression)
      throws ExpressionCompileException, IOException {
    //forName expects pageName to be in all-lower case (it's an optimization)
    pageName = pageName.toLowerCase();

    final PageBook pageBook = createMock(PageBook.class);
    final PageBook.Page page = createMock(PageBook.Page.class);
    final Respond respond = RespondersForTesting.newRespond();
    final Renderable widget = createMock(Renderable.class);

    expect(pageBook.forName(pageName))
        .andReturn(page);


    //mypage does?
    final MyEmbeddedPage myEmbeddedPage = new MyEmbeddedPage();
View Full Code Here

      throws ExpressionCompileException, IOException {

    //forName expects pageName to be in all-lower case (it's an optimization)
    pageName = pageName.toLowerCase();

    final PageBook pageBook = createMock(PageBook.class);
    final PageBook.Page page = createMock(PageBook.Page.class);
    final Respond respond = RespondersForTesting.newRespond();


    final MvelEvaluator evaluator = new MvelEvaluator();

    final WidgetChain widget = new ProceedingWidgetChain();
    final WidgetChain targetWidgetChain = new ProceedingWidgetChain();

    //noinspection unchecked
    targetWidgetChain.addWidget(new XmlWidget(new TerminalWidgetChain(), "p", new MvelEvaluatorCompiler(Object.class),
        new LinkedHashMap<String, String>() {{
          put("class", "pretty");
          put("id", "a-p-tag");
        }}));
    widget.addWidget(new ShowIfWidget(targetWidgetChain, "true", evaluator));

    Renderable bodyWrapper = new XmlWidget(widget, "body", createMock(EvaluatorCompiler.class), Collections.<String, String>emptyMap());

    expect(pageBook.forName(pageName))
        .andReturn(page);


    //mypage does?
    final MyEmbeddedPage myEmbeddedPage = new MyEmbeddedPage();
View Full Code Here

      throws ExpressionCompileException, IOException {

    //forName expects pageName to be in all-lower case (it's an optimization)
    targetPageName = targetPageName.toLowerCase();

    final PageBook pageBook = createMock(PageBook.class);
    final PageBook.Page page = createMock(PageBook.Page.class);
    final Respond respond = RespondersForTesting.newRespond();


    final MvelEvaluator evaluator = new MvelEvaluator();

    final WidgetChain widget = new ProceedingWidgetChain();
    final WidgetChain targetWidgetChain = new ProceedingWidgetChain();
    //noinspection unchecked
    targetWidgetChain.addWidget(new XmlWidget(new ProceedingWidgetChain()
        .addWidget(new IncludeWidget(new TerminalWidgetChain(), "'me'", evaluator)),

        "p", new MvelEvaluatorCompiler(Object.class), new LinkedHashMap<String, String>() {{
          put("class", "pretty");
          put("id", "a-p-tag");
        }}));
    widget.addWidget(new ShowIfWidget(targetWidgetChain, "true", evaluator));

    Renderable bodyWrapper = new XmlWidget(widget, "body", createMock(EvaluatorCompiler.class), Collections.<String, String>emptyMap());

    expect(pageBook.forName(targetPageName))
        .andReturn(page);


    //mypage does?
    final MyEmbeddedPage myEmbeddedPage = new MyEmbeddedPage();
View Full Code Here

      throws ExpressionCompileException, IOException {

    //forName expects pageName to be in all-lower case (it's an optimization)
    pageName = pageName.toLowerCase();

    final PageBook pageBook = createMock(PageBook.class);
    final PageBook.Page page = createMock(PageBook.Page.class);
    final Respond respond = RespondersForTesting.newRespond();


    final MvelEvaluator evaluator = new MvelEvaluator();

    final ProceedingWidgetChain widget = new ProceedingWidgetChain();
    final WidgetChain targetWidgetChain = new ProceedingWidgetChain();
    //noinspection unchecked
    targetWidgetChain.addWidget(new XmlWidget(new TerminalWidgetChain(), "p", new MvelEvaluatorCompiler(Object.class), new LinkedHashMap<String, String>() {{
      put("class", "pretty");
      put("id", "a-p-tag");
    }}));
    widget.addWidget(new ShowIfWidget(targetWidgetChain, "false", evaluator));

    expect(pageBook.forName(pageName))
        .andReturn(page);


    //mypage does?
    final MyEmbeddedPage myEmbeddedPage = new MyEmbeddedPage();
View Full Code Here

  public final void pageEmbeddingAndBinding(String pageName, final String passOn, final String expression)
      throws IOException {
    //forName expects pageName to be in all-lower case (it's an optimization)
    pageName = pageName.toLowerCase();

    final PageBook pageBook = createMock(PageBook.class);
    final PageBook.Page page = createMock(PageBook.Page.class);
    final Respond mockRespond = createNiceMock(Respond.class);
    final Renderable widget = createMock(Renderable.class);

    expect(pageBook.forName(pageName))
        .andReturn(page);


    //mypage does?
    final MyEmbeddedPage myEmbeddedPage = new MyEmbeddedPage();
View Full Code Here

TOP

Related Classes of com.google.sitebricks.routing.PageBook$Page

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.