001: /* Copyright 2002 The JA-SIG Collaborative. All rights reserved.
002: * See license distributed with this file and
003: * available online at http://www.uportal.org/license.html
004: */
005:
006: package org.jasig.portal.layout;
007:
008: import java.util.Enumeration;
009: import org.jasig.portal.PortalException;
010: import org.jasig.portal.layout.node.IUserLayoutNodeDescription;
011: import org.w3c.dom.Document;
012: import org.xml.sax.ContentHandler;
013:
014: /**
015: * An interface representing the user layout.
016: *
017: * @author <a href="mailto:mvi@immagic.com">Michael Ivanov</a>
018: * @version $Revision: 35168 $
019: */
020: public interface IUserLayout {
021: /**
022: * The name to use for the root node of the layout. This should be used with
023: * regard to rendering position within the layout tree.
024: */
025: public static final String ROOT_NODE_NAME = "root";
026:
027: /**
028: * Writes user layout content (with appropriate markings) into
029: * a <code>ContentHandler</code>
030: *
031: * @param ch a <code>ContentHandler</code> value
032: * @exception PortalException if an error occurs
033: */
034: public void writeTo(ContentHandler ch) throws PortalException;
035:
036: /**
037: * Writes subtree of a user layout (with appropriate markings) defined by a particular node into
038: * a <code>ContentHandler</code>
039: *
040: * @param nodeId a <code>String</code> a node determining a user layout subtree.
041: * @param ch a <code>ContentHandler</code> value
042: * @exception PortalException if an error occurs
043: */
044: public void writeTo(String nodeId, ContentHandler ch)
045: throws PortalException;
046:
047: /**
048: * Writes user layout content (with appropriate markings) into
049: * a <code>Document</code> object
050: *
051: * @param document a <code>Document</code> value
052: * @exception PortalException if an error occurs
053: */
054: public void writeTo(Document document) throws PortalException;
055:
056: /**
057: * Writes subtree of a user layout (with appropriate markings) defined by a particular node into
058: * a <code>Document</code>
059: *
060: * @param nodeId a <code>String</code> a node determining a user layout subtree.
061: * @param document a <code>Document</code> object
062: * @exception PortalException if an error occurs
063: */
064: public void writeTo(String nodeId, Document document)
065: throws PortalException;
066:
067: /**
068: * Obtain a description of a node (channel or a folder) in a given user layout.
069: *
070: * @param nodeId a <code>String</code> channel subscribe id or folder id.
071: * @return an <code>UserLayoutNodeDescription</code> value
072: * @exception PortalException if an error occurs
073: */
074: public IUserLayoutNodeDescription getNodeDescription(String nodeId)
075: throws PortalException;
076:
077: /**
078: * Returns an Id of a parent user layout node.
079: * The user layout root node always has ID="root"
080: *
081: * @param nodeId a <code>String</code> value
082: * @return a <code>String</code> value
083: * @exception PortalException if an error occurs
084: */
085: public String getParentId(String nodeId) throws PortalException;
086:
087: /**
088: * Returns a list of child node Ids for a given node.
089: *
090: * @param nodeId a <code>String</code> value
091: * @return a <code>Enumeration</code> of <code>String</code> child node Ids.
092: * @exception PortalException if an error occurs
093: */
094: public Enumeration getChildIds(String nodeId)
095: throws PortalException;
096:
097: /**
098: * Determine an Id of a next sibling node.
099: *
100: * @param nodeId a <code>String</code> value
101: * @return a <code>String</code> Id value of a next sibling node, or <code>null</code> if this is the last sibling.
102: * @exception PortalException if an error occurs
103: */
104: public String getNextSiblingId(String nodeId)
105: throws PortalException;
106:
107: /**
108: * Determine an Id of a previous sibling node.
109: *
110: * @param nodeId a <code>String</code> value
111: * @return a <code>String</code> Id value of a previous sibling node, or <code>null</code> if this is the first sibling.
112: * @exception PortalException if an error occurs
113: */
114: public String getPreviousSiblingId(String nodeId)
115: throws PortalException;
116:
117: /**
118: * Return a cache key, uniqly corresponding to the composition and the structure of the user layout.
119: *
120: * @return a <code>String</code> value
121: * @exception PortalException if an error occurs
122: */
123: public String getCacheKey() throws PortalException;
124:
125: /**
126: * Register a layout event listener
127: *
128: * @param l a <code>LayoutEventListener</code> object
129: * @return a <code>boolean</code> success status
130: */
131: public boolean addLayoutEventListener(LayoutEventListener l);
132:
133: /**
134: * Remove a registered layout event listener.
135: *
136: * @param l a <code>LayoutEventListener</code> object
137: * @return a <code>boolean</code> success status
138: */
139: public boolean removeLayoutEventListener(LayoutEventListener l);
140:
141: /**
142: * Returns a layout Id associated with this manager/
143: *
144: * @return an <code>String</code> layout Id value;
145: */
146: public String getId();
147:
148: /**
149: * Returns a node id associated with the supplied functional name.
150: *
151: * @param fname the functional name to lookup
152: * @return a <code>String</code> subscription id
153: * @exception PortalException if an error occurs
154: */
155: public String getNodeId(String fname) throws PortalException;
156:
157: /**
158: * Returns a list of node Ids in the layout.
159: *
160: * @return a <code>Enumeration</code> of node Ids
161: * @exception PortalException if an error occurs
162: */
163: public Enumeration getNodeIds() throws PortalException;
164:
165: /**
166: * Returns an id of the root node.
167: *
168: * @return a <code>String</code> value
169: */
170: public String getRootId();
171:
172: }
|