Package com.dragome.render.interfaces

Examples of com.dragome.render.interfaces.TemplateHandler


  }

  public void repeatItems(Iterable<T> items, ItemProcessor<T> itemProcessor)
  {
    Map<T, List<Template>> templatesByItemReplacement= new LinkedHashMap<T, List<Template>>();
    TemplateHandler templateHandler= ServiceLocator.getInstance().getTemplateHandler();

    Entry<T, List<Template>> entry= null;
    Iterator<Entry<T, List<Template>>> entriesIterator= shownTemplates.entrySet().iterator();

    if (updating)
    {
      if (!shownTemplates.isEmpty())
        entry= entriesIterator.next();
    }

    for (T item : items)
    {
      List<Template> templatesOfItem= templatesByItem.get(item);

      if (templatesOfItem == null || templatesOfItem.isEmpty())
      {
        List<Template> repeatChildren= itemProcessor.getRepeatTemplates(item);
        for (Template template : repeatChildren)
          templateHandler.makeInvisible(template);

        templatesOfItem= templateHandler.cloneTemplates(repeatChildren);
        insertTemplates(itemProcessor, item, templatesOfItem, entry);

        for (Template repeatChild : templatesOfItem)
          templateHandler.makeVisible(repeatChild);

        itemProcessor.fillTemplates(item, templatesOfItem);
        if (templatesOfItem.size() == 1)
          itemProcessor.fillTemplate(item, templatesOfItem.get(0));
      }
View Full Code Here


    };
  }

  public Template getUpdatedTemplateFor(T item)
  {
    TemplateHandler templateHandler= ServiceLocator.getInstance().getTemplateHandler();
    Template updatedTemplate= itemProcessor.getRepeatTemplates(item).get(0);
    Template clone= templateHandler.clone(updatedTemplate);
    templateHandler.makeVisible(clone);

    templatesByItem.get(item).add(clone);
    return clone;
  }
View Full Code Here

TOP

Related Classes of com.dragome.render.interfaces.TemplateHandler

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.