1 package org.jahia.deprecated.taglibs.container; 2 3 import javax.servlet.jsp.JspException ; 4 5 import org.jahia.data.JahiaData; 6 import org.jahia.data.containers.JahiaContainerList; 7 import org.jahia.exceptions.JahiaException; 8 import org.jahia.utils.JahiaConsole; 9 10 11 12 19 public class AbsoluteContainerListTag extends ContainerListTag { 20 21 private int pageId = -1; 22 private int pageLevel = -1; 23 private int windowSize = -1; 24 private int windowOffset = -1; 25 26 public void setPageId(String pageId) { 27 try { 28 this.pageId = Integer.parseInt(pageId); 29 } catch (NumberFormatException nfe) { 30 JahiaConsole.println("AbsoluteContainerListTag: setPageId", "The given page id is not a number"); 31 } 32 } 33 34 public void setPageLevel(String pageLevel) { 35 try { 36 this.pageLevel = Integer.parseInt(pageLevel); 37 } catch (NumberFormatException nfe) { 38 JahiaConsole.println("AbsoluteContainerListTag: setPageLevel", "The given page level is not a number"); 39 } 40 } 41 42 public void setWindowSize(String windowSize) { 43 try { 44 this.windowSize = Integer.parseInt(windowSize); 45 } catch (NumberFormatException nfe) { 46 this.windowSize = -1; 47 } 48 } 49 50 55 56 public void setWindowOffset(String windowOffset) { 57 try { 58 this.windowOffset = Integer.parseInt(windowOffset); 59 } catch (NumberFormatException nfe) { 60 this.windowOffset = -1; 61 } 62 } 63 64 69 70 protected void checkAttributes(JahiaData jData) throws JahiaException { 71 if (this.pageId == -1) { 72 if (this.pageLevel != -1) { 74 this.pageId = jData.gui().getLevelID(this.pageLevel); 75 if (this.pageId == -1) { 76 JahiaConsole.println("AbsoluteContainerListTag.checkAttributes", 77 "Couldn't find pageID for pageLevel=" + this.pageLevel); 78 } 79 } 80 } 81 } 82 83 protected void checkDeclaration(JahiaData jData) throws JahiaException { 84 if ( jData.page().getID()== this.pageId ) { 85 jData.containers().declareContainer(super.getName(), super.getTitle(), super.getFields(), this.windowSize, this.windowOffset); 86 } 87 } 88 89 90 92 protected JahiaContainerList getContainerList( JahiaData jData, String listName ) throws JahiaException { 94 return jData.containers().getAbsoluteContainerList( listName, this.pageId ); 95 } 96 97 public int doEndTag() throws JspException { 98 super.doEndTag(); 101 pageId = -1; 102 pageLevel = -1; 103 windowSize = -1; 104 windowOffset = -1; 105 return EVAL_PAGE; 106 } 107 108 109 } 110 | Popular Tags |