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

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


   *
   * @see java.lang.Object#equals(java.lang.Object)
   */
  public boolean equals(Object o) {
    if (o instanceof Pagelet) {
      Pagelet p = (Pagelet) o;
      if (p.getModule().equals(moduleId) && p.getIdentifier().equals(pageletId)) {
        if (p.getURI() != null)
          return p.getURI().equals(uri);
        return true;
      }
    }
    return false;
  }
View Full Code Here


   *      ch.entwine.weblounge.common.language.Language)
   * @see ch.entwine.weblounge.common.content.page.PageletURI#compareTo(PageletURI)
   */
  public int compareTo(Localizable o, Language l) {
    if (uri != null && o instanceof Pagelet) {
      Pagelet p = (Pagelet) o;
      if (p.getURI() != null)
        return uri.compareTo(p.getURI());
    }
    return 0;
  }
View Full Code Here

      request.setServletPath("");

      // Prepare a fake page in order to prevent erratic behavior during
      // precompilation
      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());
View Full Code Here

    List<Pagelet> c = composers.get(composer);
    if (c != null) {
      l.addAll(c);
      int i = 0;
      while (i < l.size()) {
        Pagelet p = l.get(i);
        if (!p.getModule().equals(module) || !p.getIdentifier().equals(id)) {
          l.remove(i);
        } else {
          i++;
        }
      }
View Full Code Here

    // Test index
    if (pagelets == null || pagelets.size() < position)
      throw new IndexOutOfBoundsException("No pagelet found at position " + position);

    // Remove the pagelet and update uris of following pagelets
    Pagelet pagelet = pagelets.remove(position);
    for (int i = position; i < pagelets.size(); i++) {
      pagelets.get(i).getURI().setPosition(i);
    }
    return pagelet;
  }
View Full Code Here

  /**
   * Test method for {@link ch.entwine.weblounge.common.impl.content.page.PageImpl#addPagelet(ch.entwine.weblounge.common.content.page.Pagelet, java.lang.String)}.
   */
  @Test
  public void testAddPageletPageletString() {
    Pagelet p = new PageletImpl(module, pagelet);
    assertTrue(p.getURI() == null);
    page.addPagelet(p, composer);
    assertTrue(p.getURI() != null);
    assertEquals(2, page.getPagelets(composer).length);
    page.addPagelet(p, "xxx");
    assertEquals(1, page.getPagelets("xxx").length);
  }
View Full Code Here

  /**
   * Test method for {@link ch.entwine.weblounge.common.impl.content.page.PageImpl#addPagelet(ch.entwine.weblounge.common.content.page.Pagelet, java.lang.String, int)}.
   */
  @Test
  public void testAddPageletPageletStringInt() {
    Pagelet p = new PageletImpl(module, pagelet);
    page.addPagelet(p, composer, 0);
    page.addPagelet(p, composer, 1);
    assertEquals(3, page.getPagelets(composer).length);
    page.addPagelet(p, "xxx", 0);
    assertEquals(1, page.getPagelets("xxx").length);
View Full Code Here

  public void testUpdate() throws IllegalArgumentException,
      ContentRepositoryException {

    String propertyName = "testproperty";
    String propertyValue = "testvalue";
    Pagelet p = new PageletImpl("testmodule", "testid");
    p.addProperty(propertyName, propertyValue);
    page.addPagelet(p, "stage");

    try {
      idx.add(page);
      assertEquals(1, idx.getResourceCount());
View Full Code Here

    query = new SearchQueryImpl(site);
    query.withPagelet(new PageletImpl(pagelet.getModule(), pagelet.getIdentifier()));
    query.andProperty(propertyName, propertyValue);
    assertEquals(1, query.getPagelets().size());
    Collection<SearchTerms<Pagelet>> pagelets = query.getPagelets();
    Pagelet firstPagelet = pagelets.iterator().next().getTerms().iterator().next();
    assertEquals(propertyValue, firstPagelet.getProperty(propertyName));
  }
View Full Code Here

    query = new SearchQueryImpl(site, german);
    query.withPagelet(new PageletImpl(pagelet.getModule(), pagelet.getIdentifier()));
    query.andElement(textName, textValue);
    assertEquals(1, query.getPagelets().size());
    Collection<SearchTerms<Pagelet>> pagelets = query.getPagelets();
    Pagelet firstPagelet = pagelets.iterator().next().getTerms().iterator().next();
    assertEquals(textValue, firstPagelet.getContent(textName));
  }
View Full Code Here

TOP

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

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.