1 24 package org.riotfamily.components.render; 25 26 import java.io.IOException ; 27 import java.util.List ; 28 29 import javax.servlet.http.HttpServletRequest ; 30 import javax.servlet.http.HttpServletResponse ; 31 32 import org.riotfamily.components.ComponentList; 33 import org.riotfamily.components.ComponentRepository; 34 import org.riotfamily.components.ComponentVersion; 35 import org.riotfamily.components.VersionContainer; 36 import org.riotfamily.components.config.ComponentListConfiguration; 37 import org.riotfamily.components.dao.ComponentDao; 38 39 public class PreviewModeRenderStrategy extends AbstractRenderStrategy { 40 41 public PreviewModeRenderStrategy(ComponentDao dao, 42 ComponentRepository repository, ComponentListConfiguration config, 43 HttpServletRequest request, HttpServletResponse response) 44 throws IOException { 45 46 super(dao, repository, config, request, response); 47 } 48 49 53 protected List getComponentsToRender(ComponentList list) { 54 if (list.isDirty()) { 55 log.debug("List is dirty - rendering preview containers"); 56 return list.getPreviewContainers(); 57 } 58 else { 59 log.debug("List is *NOT* dirty - rendering live containers"); 60 return list.getLiveContainers(); 61 } 62 } 63 64 68 protected ComponentVersion getVersionToRender(VersionContainer container) { 69 return container.getLatestVersion(); 70 } 71 72 } 73 | Popular Tags |