Package ch.entwine.weblounge.common.content.page

Examples of ch.entwine.weblounge.common.content.page.PageletURI


   */
  public SearchQuery atPosition(int position) throws IllegalStateException {
    ensureConfigurationArray(Pagelet.class);
    Pagelet[] pagelets = (Pagelet[]) stack.peek();
    for (Pagelet pagelet : pagelets) {
      PageletURI uri = pagelet.getURI();
      if (uri == null) {
        uri = new PageletURIImpl(null, null, position);
      } else {
        uri.setPosition(position);
      }
      pagelet.setURI(uri);
    }
    return this;
  }
View Full Code Here


   */
  public SearchQuery inComposer(String composer) throws IllegalStateException {
    ensureConfigurationArray(Pagelet.class);
    Pagelet[] pagelets = (Pagelet[]) stack.peek();
    for (Pagelet pagelet : pagelets) {
      PageletURI uri = pagelet.getURI();
      if (uri == null) {
        uri = new PageletURIImpl(null, composer, -1);
      } else {
        uri.setComposer(composer);
      }
      pagelet.setURI(uri);
    }
    return this;
  }
View Full Code Here

   * @see java.lang.Object#equals(java.lang.Object)
   */
  @Override
  public boolean equals(Object o) {
    if (o instanceof PageletURI) {
      PageletURI l = (PageletURI) o;
      if (l.getPageURI() != null && l.getComposer() != null)
        return l.getPageURI().equals(pageURI) && l.getComposer().equals(composer) && l.getPosition() == position;
    }
    return false;
  }
View Full Code Here

      Page page = new MockPageImpl(site);
      Pagelet pagelet = null;
      for (Module m : site.getModules()) {
        if (m.getRenderers().length > 0) {
          PageletRenderer r = m.getRenderers()[0];
          PageletURI pageletURI = new PageletURIImpl(page.getURI(), PageTemplate.DEFAULT_STAGE, 0);
          pagelet = new PageletImpl(pageletURI, m.getIdentifier(), r.getIdentifier());
        }
      }

      // Collect all renderers from modules and ask for precompilation
View Full Code Here

    else {
      c.add(pagelet);
    }

    // Adjust pagelet location
    PageletURI location = pagelet.getURI();
    if (location == null) {
      location = new PageletURIImpl(uri, composer, position);
      pagelet.setURI(location);
    } else {
      location.setURI(uri);
      location.setComposer(composer);
      location.setPosition(position);
    }
    return pagelet;
  }
View Full Code Here

      }

      // pagelet
      else if ("pagelet".equals(raw)) {
        parserContext = ParserContext.Pagelet;
        PageletURI l = new PageletURIImpl(page.getURI(), composer, position);
        pageletReader.setPageletLocation(l);
      }

    }
View Full Code Here

  public void startElement(String uri, String local, String raw,
      Attributes attrs) throws SAXException {

    // pagelet
    if ("pagelet".equals(raw)) {
      PageletURI l = new PageletURIImpl(pageURI, composer.getIdentifier(), position);
      pageletReader.setPageletLocation(l);
    }

    pageletReader.startElement(uri, local, raw, attrs);
  }
View Full Code Here

  public void testEqualsObject() {
    assertTrue(pagelet.equals(new PageletImpl(module, id)));
    assertFalse(pagelet.equals(new PageletImpl(module, "x")));
    assertFalse(pagelet.equals(new PageletImpl("x", id)));
    assertTrue(pagelet.equals(new PageletImpl(location, module, id)));
    PageletURI otherLocation = new PageletURIImpl(uri, composer, position + 1);
    assertFalse(pagelet.equals(new PageletImpl(otherLocation, module, id)));
  }
View Full Code Here

   * {@link ch.entwine.weblounge.common.impl.content.page.PageletImpl#compareTo(ch.entwine.weblounge.common.language.Localizable, ch.entwine.weblounge.common.language.Language)}
   * .
   */
  @Test
  public void testCompareTo() {
    PageletURI otherLocation = new PageletURIImpl(uri, composer, position + 1);
    assertEquals(0, pagelet.compareTo(new PageletImpl(module, id), german));
    assertEquals(-1, pagelet.compareTo(new PageletImpl(otherLocation, module, id), german));
  }
View Full Code Here

   */
  @Test
  public void testEqualsObject() {
    uri = new PageURIImpl(site, path);
    location = new PageletURIImpl(uri, composer, position);
    PageletURI sameLocation = new PageletURIImpl(uri, composer, position);
    assertEquals(location, sameLocation);
    assertFalse(location.equals(new PageletURIImpl(new PageURIImpl(site, "/test2"), composer, position)));
    assertFalse(location.equals(new PageletURIImpl(uri, "main2", position)));
    assertFalse(location.equals(new PageletURIImpl(uri, composer, position + 1)));
  }
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.content.page.PageletURI

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.