|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jasig.portal.layout.dlm.DistributedLayoutManager
public class DistributedLayoutManager
A layout manager that provides layout control through layout fragments that are derived from regular portal user accounts.
Field Summary | |
---|---|
protected java.lang.String |
cacheKey
|
private boolean |
channelsAdded
|
private boolean |
isFragment
|
protected java.util.Set |
listeners
|
private static org.apache.commons.logging.Log |
LOG
|
protected IPerson |
owner
|
protected UserProfile |
profile
|
static java.lang.String |
RCS_ID
|
protected static java.util.Random |
rnd
|
protected java.lang.String |
rootNodeId
|
protected IUserLayoutStore |
store
|
protected org.w3c.dom.Document |
userLayoutDocument
|
Constructor Summary | |
---|---|
DistributedLayoutManager(IPerson owner,
UserProfile profile,
IUserLayoutStore store)
|
Method Summary | |
---|---|
boolean |
addLayoutEventListener(LayoutEventListener l)
Register a layout event listener |
IUserLayoutNodeDescription |
addNode(IUserLayoutNodeDescription node,
java.lang.String parentId,
java.lang.String nextSiblingId)
Add a new node to a current user layout. |
protected boolean |
canAddNode(IUserLayoutNodeDescription node,
IUserLayoutNodeDescription parent,
java.lang.String nextSiblingId)
|
boolean |
canAddNode(IUserLayoutNodeDescription node,
java.lang.String parentId,
java.lang.String nextSiblingId)
Test if a particular node can be added at a given location. |
protected boolean |
canDeleteNode(IUserLayoutNodeDescription node)
Returns true if the node exists in the underlying DOM model and it does not contain a 'deleteAllowed' attribute with a value of 'false'. |
boolean |
canDeleteNode(java.lang.String nodeId)
Tests if a particular node can be deleted. |
private boolean |
canMoveLeft(java.lang.String nodeId,
java.lang.String targetNextSibId)
|
protected boolean |
canMoveNode(IUserLayoutNodeDescription node,
IUserLayoutNodeDescription parent,
java.lang.String nextSiblingId)
|
boolean |
canMoveNode(java.lang.String nodeId,
java.lang.String parentId,
java.lang.String nextSiblingId)
Test if a particular node can be moved to a given location. |
private boolean |
canMoveRight(java.lang.String nodeId,
java.lang.String targetNextSibId)
|
boolean |
canUpdateNode(IUserLayoutNodeDescription node)
Returns true if the node is a folder node and edits on the folder are allowed or if the folder is a channel. |
boolean |
canUpdateNode(java.lang.String nodeId)
|
IUserLayoutNodeDescription |
createNodeDescription(int nodeType)
A factory method to create an empty IUserLayoutNodeDescription instance |
boolean |
deleteNode(java.lang.String nodeId)
Delete a node (folder or a channel) from a user layout. |
java.lang.String |
getCacheKey()
Return a cache key, uniqly corresponding to the composition and the structure of the user layout. |
java.util.Enumeration |
getChildIds(java.lang.String nodeId)
Returns a list of child node Ids for a given node. |
private java.util.Enumeration |
getChildIds(java.lang.String nodeId,
boolean visibleOnly)
|
int |
getDepth(java.lang.String nodeId)
Returns the depth of a node in the layout tree. |
int |
getLayoutId()
Returns a layout Id associated with this manager/ |
protected IUserLayoutStore |
getLayoutStore()
|
java.lang.String |
getNextSiblingId(java.lang.String nodeId)
Determine an Id of a next sibling node. |
IUserLayoutNodeDescription |
getNode(java.lang.String nodeId)
Obtain a description of a node (channel or a folder) in a given user layout. |
java.lang.String |
getParentId(java.lang.String nodeId)
Returns an Id of a parent user layout node. |
java.lang.String |
getPreviousSiblingId(java.lang.String nodeId)
Determine an Id of a previous sibling node. |
java.lang.String |
getRootFolderId()
Returns an id of the root folder. |
java.lang.String |
getSubscribeId(java.lang.String fname)
Returns the subscribe ID of a channel having the passed in functional name or null if it can't find such a channel in the layout. |
IUserLayout |
getUserLayout()
Gets a user layout (with appropriate markings). |
void |
getUserLayout(org.xml.sax.ContentHandler ch)
Output user layout (with appropriate markings) into a ContentHandler |
protected void |
getUserLayout(org.w3c.dom.Node n,
org.xml.sax.ContentHandler ch)
|
void |
getUserLayout(java.lang.String nodeId,
org.xml.sax.ContentHandler ch)
Output subtree of a user layout (with appropriate markings) defined by a particular node into a ContentHandler |
org.w3c.dom.Document |
getUserLayoutDOM()
|
private java.util.Enumeration |
getVisibleChildIds(java.lang.String nodeId)
|
void |
loadUserLayout()
Signal manager to load a user layout from a database |
void |
markAddTargets(IUserLayoutNodeDescription node)
Ask manager to output markings at the locations where a given node can be added. |
void |
markMoveTargets(java.lang.String nodeId)
Ask manager to output markings at the locations where a given node can be moved. |
boolean |
moveNode(java.lang.String nodeId,
java.lang.String parentId,
java.lang.String nextSiblingId)
Move a node (channel or folder) from one location to another. |
private void |
pushChanDiffsIntoPlf(org.w3c.dom.Element element,
IUserLayoutChannelDescription newChan,
IUserLayoutChannelDescription oldChan)
|
private void |
pushFolderDiffsIntoPlf(org.w3c.dom.Element element,
UserLayoutFolderDescription newF,
UserLayoutFolderDescription oldF)
|
boolean |
removeLayoutEventListener(LayoutEventListener l)
Remove a registered layout event listener. |
void |
saveUserLayout()
Signal manager to persist user layout to a database |
void |
setLayoutStore(IUserLayoutStore store)
Set a user layout store implementation. |
void |
setUserLayout(IUserLayout userLayout)
Sets a user layout (with appropriate markings). |
private void |
setUserLayoutDOM(org.w3c.dom.Document doc)
|
private void |
updateCacheKey()
This is outright cheating ! We're supposed to analyze the user layout tree and return a key that corresponds uniqly to the composition and the sturcture of the tree. |
boolean |
updateNode(IUserLayoutNodeDescription node)
Update a given node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String RCS_ID
private static final org.apache.commons.logging.Log LOG
protected final IPerson owner
protected final UserProfile profile
protected IUserLayoutStore store
protected java.util.Set listeners
protected org.w3c.dom.Document userLayoutDocument
protected static java.util.Random rnd
protected java.lang.String cacheKey
protected java.lang.String rootNodeId
private boolean channelsAdded
private boolean isFragment
Constructor Detail |
---|
public DistributedLayoutManager(IPerson owner, UserProfile profile, IUserLayoutStore store) throws PortalException
PortalException
Method Detail |
---|
private void setUserLayoutDOM(org.w3c.dom.Document doc)
public org.w3c.dom.Document getUserLayoutDOM()
getUserLayoutDOM
in interface IUserLayoutManager
public void getUserLayout(org.xml.sax.ContentHandler ch) throws PortalException
IUserLayoutManager
ContentHandler
getUserLayout
in interface IUserLayoutManager
ch
- a ContentHandler
value
PortalException
- if an error occurspublic void getUserLayout(java.lang.String nodeId, org.xml.sax.ContentHandler ch) throws PortalException
IUserLayoutManager
ContentHandler
getUserLayout
in interface IUserLayoutManager
nodeId
- a String
a node determining a user layout subtree.ch
- a ContentHandler
value
PortalException
- if an error occursprotected void getUserLayout(org.w3c.dom.Node n, org.xml.sax.ContentHandler ch) throws PortalException
PortalException
public void setLayoutStore(IUserLayoutStore store)
IUserLayoutManager
setLayoutStore
in interface IUserLayoutManager
store
- an IUserLayoutStore
valueprotected IUserLayoutStore getLayoutStore()
public void loadUserLayout() throws PortalException
IUserLayoutManager
loadUserLayout
in interface IUserLayoutManager
PortalException
- if an error occurspublic void saveUserLayout() throws PortalException
IUserLayoutManager
saveUserLayout
in interface IUserLayoutManager
PortalException
- if an error occurspublic IUserLayoutNodeDescription getNode(java.lang.String nodeId) throws PortalException
IUserLayoutManager
getNode
in interface IUserLayoutManager
nodeId
- a String
channel subscribe id or folder id.
UserLayoutNodeDescription
value
PortalException
- if an error occurspublic IUserLayoutNodeDescription addNode(IUserLayoutNodeDescription node, java.lang.String parentId, java.lang.String nextSiblingId) throws PortalException
IUserLayoutManager
addNode
in interface IUserLayoutManager
node
- an UserLayoutNodeDescription
value of a node to be added (Id doesn't have to be set)parentId
- a String
id of a folder to which the new node (channel or folder) should be added.nextSiblingId
- a String
an id of a sibling node (channel or folder) prior to which the new node should be inserted.
UserLayoutNodeDescription
value with a newly determined Id.
PortalException
- if an error occurspublic boolean moveNode(java.lang.String nodeId, java.lang.String parentId, java.lang.String nextSiblingId) throws PortalException
IUserLayoutManager
moveNode
in interface IUserLayoutManager
nodeId
- a String
value of a node Id.parentId
- a String
id of a folder to which the node should be moved.nextSiblingId
- a String
id of a sibling node (folder or channel) prior to which the node should be placed. (null
to append at the end)
boolean
value noting if the operation was successful
PortalException
- if an error occurspublic boolean deleteNode(java.lang.String nodeId) throws PortalException
IUserLayoutManager
deleteNode
in interface IUserLayoutManager
nodeId
- a String
id (channel subscribe id or folder id)
boolean
value noting if the operation was successful
PortalException
- if an error occurspublic boolean updateNode(IUserLayoutNodeDescription node) throws PortalException
IUserLayoutManager
updateNode
in interface IUserLayoutManager
node
- an UserLayoutNodeDescription
value with a valid id.
boolean
value noting if the operation was successful
PortalException
- if an error occursprivate void pushFolderDiffsIntoPlf(org.w3c.dom.Element element, UserLayoutFolderDescription newF, UserLayoutFolderDescription oldF) throws PortalException
PortalException
private void pushChanDiffsIntoPlf(org.w3c.dom.Element element, IUserLayoutChannelDescription newChan, IUserLayoutChannelDescription oldChan) throws PortalException
PortalException
public boolean canAddNode(IUserLayoutNodeDescription node, java.lang.String parentId, java.lang.String nextSiblingId) throws PortalException
IUserLayoutManager
canAddNode
in interface IUserLayoutManager
node
- an UserLayoutNodeDescription
value describing the node to be added.parentId
- a String
id of a parent to which the node to be added.nextSiblingId
- a String
id of a sibling prior to which the node to be inserted. (null
to append at the end)
boolean
value
PortalException
- if an error occursprotected boolean canAddNode(IUserLayoutNodeDescription node, IUserLayoutNodeDescription parent, java.lang.String nextSiblingId) throws PortalException
PortalException
public boolean canMoveNode(java.lang.String nodeId, java.lang.String parentId, java.lang.String nextSiblingId) throws PortalException
IUserLayoutManager
canMoveNode
in interface IUserLayoutManager
nodeId
- a String
id of a node to be moved.parentId
- a String
id of a parent to which the node to be moved.nextSiblingId
- a String
id of a sibling prior to which the node is to be inserted (null
to append at the end)
boolean
value
PortalException
- if an error occursprotected boolean canMoveNode(IUserLayoutNodeDescription node, IUserLayoutNodeDescription parent, java.lang.String nextSiblingId) throws PortalException
PortalException
private boolean canMoveRight(java.lang.String nodeId, java.lang.String targetNextSibId) throws PortalException
PortalException
private boolean canMoveLeft(java.lang.String nodeId, java.lang.String targetNextSibId) throws PortalException
PortalException
public boolean canDeleteNode(java.lang.String nodeId) throws PortalException
IUserLayoutManager
canDeleteNode
in interface IUserLayoutManager
nodeId
- a String
node id.
boolean
value
PortalException
- if an error occursprotected boolean canDeleteNode(IUserLayoutNodeDescription node) throws PortalException
PortalException
public boolean canUpdateNode(java.lang.String nodeId) throws PortalException
PortalException
public boolean canUpdateNode(IUserLayoutNodeDescription node)
canUpdateNode
in interface IUserLayoutManager
node
- a IUserLayoutNodeDescription
node id.
boolean
valuepublic void markAddTargets(IUserLayoutNodeDescription node)
IUserLayoutManager
getUserLayout
method is called.
markAddTargets
in interface IUserLayoutManager
node
- an UserLayoutNodeDescription
value or null
to stop outputting add markings.public void markMoveTargets(java.lang.String nodeId) throws PortalException
IUserLayoutManager
getUserLayout
method is called.
markMoveTargets
in interface IUserLayoutManager
nodeId
- a String
value or null
to stop outputting move markings.
PortalException
- if an error occurspublic java.lang.String getParentId(java.lang.String nodeId) throws PortalException
IUserLayoutManager
IUserLayout.ROOT_NODE_NAME
getParentId
in interface IUserLayoutManager
nodeId
- a String
value
String
value
PortalException
- if an error occurspublic java.lang.String getNextSiblingId(java.lang.String nodeId) throws PortalException
IUserLayoutManager
getNextSiblingId
in interface IUserLayoutManager
nodeId
- a String
value
String
Id value of a next sibling node, or null
if this is the last sibling.
PortalException
- if an error occurspublic java.lang.String getPreviousSiblingId(java.lang.String nodeId) throws PortalException
IUserLayoutManager
getPreviousSiblingId
in interface IUserLayoutManager
nodeId
- a String
value
String
Id value of a previous sibling node, or null
if this is the first sibling.
PortalException
- if an error occurspublic java.util.Enumeration getChildIds(java.lang.String nodeId) throws PortalException
IUserLayoutManager
getChildIds
in interface IUserLayoutManager
nodeId
- a String
value
List
of String
child node Ids.
PortalException
- if an error occursprivate java.util.Enumeration getVisibleChildIds(java.lang.String nodeId) throws PortalException
PortalException
private java.util.Enumeration getChildIds(java.lang.String nodeId, boolean visibleOnly) throws PortalException
PortalException
public java.lang.String getCacheKey()
IUserLayoutManager
getCacheKey
in interface IUserLayoutManager
String
valueprivate void updateCacheKey()
public int getLayoutId()
IUserLayoutManager
getLayoutId
in interface IUserLayoutManager
int
layout Id value;public java.lang.String getSubscribeId(java.lang.String fname)
getSubscribeId
in interface IUserLayoutManager
fname
- the functional name to lookup
String
subscription idpublic boolean addLayoutEventListener(LayoutEventListener l)
IUserLayoutManager
addLayoutEventListener
in interface IUserLayoutManager
l
- a LayoutEventListener
object
boolean
success statuspublic boolean removeLayoutEventListener(LayoutEventListener l)
IUserLayoutManager
removeLayoutEventListener
in interface IUserLayoutManager
l
- a LayoutEventListener
object
boolean
success statuspublic IUserLayout getUserLayout() throws PortalException
IUserLayoutManager
getUserLayout
in interface IUserLayoutManager
PortalException
- if an error occurspublic void setUserLayout(IUserLayout userLayout) throws PortalException
IUserLayoutManager
setUserLayout
in interface IUserLayoutManager
userLayout
- the user layout
PortalException
- if an error occurspublic java.lang.String getRootFolderId()
IUserLayoutManager
getRootFolderId
in interface IUserLayoutManager
String
valuepublic int getDepth(java.lang.String nodeId) throws PortalException
IUserLayoutManager
getDepth
in interface IUserLayoutManager
nodeId
- a String
value
PortalException
- if an error occurspublic IUserLayoutNodeDescription createNodeDescription(int nodeType) throws PortalException
IUserLayoutManager
IUserLayoutNodeDescription
instance
createNodeDescription
in interface IUserLayoutManager
nodeType
- a node type constant from IUserLayoutNodeDescription
interface
IUserLayoutNodeDescription
instance
PortalException
- if the error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |