net.sf.wfnm
Class NavigationManagerImpl

java.lang.Object
  extended bynet.sf.wfnm.NavigationManagerImpl
All Implemented Interfaces:
NavigationManager, ObjectSetOwner, OwnershipConst, Serializable

public class NavigationManagerImpl
extends Object
implements NavigationManager, ObjectSetOwner

The navigation manager default implementation.

Version:
1.0.6
Author:
Maurizio Albari
See Also:
Serialized Form

Field Summary
protected static String DEFAULT_WEBFLOW_NAME
          The default webflow name.
protected  Object lock
          The synchronization lock.
protected  Set noOwnershipSet
          The no ownership set.
protected  Map object2owner
          A map that bind the object key with the owner of the object.
protected  Map url2webflow
          A map that bind an url with a webflow witch contains a page with that url.
protected  Stack webflowStack
          The stack of webflow.
 
Fields inherited from interface net.sf.wfnm.OwnershipConst
GLOBAL_OWNERSHIP, NO_OWNERSHIP, OWNERSHIP_DESC, PAGE_OWNERSHIP, PREVIOUS_OWNERSHIP, WEBFLOW_OWNERSHIP, WORKING_OWNERSHIP
 
Constructor Summary
protected NavigationManagerImpl()
          Creates a new NavigationManager object.
 
Method Summary
protected  void addObjectSet(Set objectKeySet)
          Add an object to the navigation manager.
protected  void backToWebflow(String webflowName, Set objectSetToRemove, AttributeContainer container)
          Back to a specified webflow (if different from the current).
protected  int findWebflowIndex(String webflowName)
          Find the index of a named webflow.
 String getCurrentPage()
          Gets the url of the current page.
 String getCurrentWebflow()
          Gets the current webflow name.
 Object getLock()
          Gets the synchronization lock.
protected  ObjectSetOwner getObjectOwnership(int ownership)
          Gets the object set owner.
 Set getOwnedObjectSet()
          Gets the object set owned (with no ownership).
 String getPreviousPage()
          Gets the url of the previous page.
 String getPreviousWebflow()
          Gets the url of the previous webflow top page.
 String getPreviousWebflow(String webflowName)
          Gets the url of a webflow top page.
protected  Webflow getPreviousWebflowOrTop()
          Gets the previous webflow, or the top webflow if there is only one webflow
protected  Page getTopPage()
          Returns the top page.
protected  Webflow getTopWebflow()
          Gets the top webflow (null=no webflow opened).
protected  Webflow getWebflowByIndex(int index)
          Gets a webflow given its index.
 Stack getWebflowStack()
          Returns the webflow stack.
 boolean isPageVisited(String url)
          Returns true if the page has been visited.
 boolean isWebflowVisited(String webflowName)
          Returns true if the webflow has been visited.
 void notifyPage(AttributeContainer container, String url, Set addedObjectSet, Set removedObjectSet)
          Notify that the navigation has reached a page.
 void notifyPage(AttributeContainer container, String url, String webflowName, int defaultWebflowOwnership, Set addedObjectSet, Set removedObjectSet)
          Notify that the navigation has reached a page of a specific webflow.
protected  void removeObjectSet(Set objectKeySet)
          Removes an object form the navigation manager.
protected static void removeObjectSetFromContainer(AttributeContainer container, Set objectSet)
          Removes from a container a set of object.
 void resetFramework(AttributeContainer container)
          Reset the navigation manager.
 void setLock(Object lock)
          Sets the synchronization lock.
 void setObjectOwnership(String objectKey, int objectOwnership)
          Sets the object owner.
 void setPageChangedListener(PageChangedListener pageChangedListener)
          Sets the page changed listener.
 void setWebflowChangedListener(WebflowChangedListener webflowChangedListener)
          Sets the webflow changed listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WEBFLOW_NAME

protected static final String DEFAULT_WEBFLOW_NAME
The default webflow name.

See Also:
Constant Field Values

object2owner

protected Map object2owner
A map that bind the object key with the owner of the object.


url2webflow

protected Map url2webflow
A map that bind an url with a webflow witch contains a page with that url.


lock

protected transient Object lock
The synchronization lock.


noOwnershipSet

protected Set noOwnershipSet
The no ownership set.


webflowStack

protected Stack webflowStack
The stack of webflow.

Constructor Detail

NavigationManagerImpl

protected NavigationManagerImpl()
Creates a new NavigationManager object.

Method Detail

getCurrentPage

public String getCurrentPage()
Gets the url of the current page.

Specified by:
getCurrentPage in interface NavigationManager
Returns:
the url of the current page (null=no visited page)

getCurrentWebflow

public String getCurrentWebflow()
Gets the current webflow name.

Specified by:
getCurrentWebflow in interface NavigationManager
Returns:
the current webflow name

setLock

public void setLock(Object lock)
Sets the synchronization lock.

Specified by:
setLock in interface NavigationManager
Parameters:
lock - the synchronization lock

getLock

public Object getLock()
Gets the synchronization lock.

Specified by:
getLock in interface NavigationManager
Returns:
the synchronization lock.

setObjectOwnership

public void setObjectOwnership(String objectKey,
                               int objectOwnership)
Sets the object owner.

Specified by:
setObjectOwnership in interface NavigationManager
Parameters:
objectKey - the object key
objectOwnership - the object ownership

getOwnedObjectSet

public Set getOwnedObjectSet()
Gets the object set owned (with no ownership).

Specified by:
getOwnedObjectSet in interface ObjectSetOwner
Returns:
the object set owned (with no ownership)

setPageChangedListener

public void setPageChangedListener(PageChangedListener pageChangedListener)
Sets the page changed listener.

Specified by:
setPageChangedListener in interface NavigationManager
Parameters:
pageChangedListener - the page changed listener

isPageVisited

public boolean isPageVisited(String url)
Returns true if the page has been visited.

Specified by:
isPageVisited in interface NavigationManager
Parameters:
url - the url of the page
Returns:
true if the page has been visited

getPreviousPage

public String getPreviousPage()
Gets the url of the previous page.

Specified by:
getPreviousPage in interface NavigationManager
Returns:
the url of the previous page (null=no previous page)

getPreviousWebflow

public String getPreviousWebflow()
Gets the url of the previous webflow top page.

Specified by:
getPreviousWebflow in interface NavigationManager
Returns:
the url of the previous webflow top page (null=no previous webflow top page)

getPreviousWebflow

public String getPreviousWebflow(String webflowName)
Gets the url of a webflow top page.

Specified by:
getPreviousWebflow in interface NavigationManager
Parameters:
webflowName - the webflow name
Returns:
the url of a webflow top page (null=no visited pages in the specified webflow)

setWebflowChangedListener

public void setWebflowChangedListener(WebflowChangedListener webflowChangedListener)
Sets the webflow changed listener.

Specified by:
setWebflowChangedListener in interface NavigationManager
Parameters:
webflowChangedListener - the webflow changed listener

getWebflowStack

public Stack getWebflowStack()
Returns the webflow stack.

Specified by:
getWebflowStack in interface NavigationManager
Returns:
the webflow stack

isWebflowVisited

public boolean isWebflowVisited(String webflowName)
Returns true if the webflow has been visited.

Specified by:
isWebflowVisited in interface NavigationManager
Parameters:
webflowName - the webflow name
Returns:
true if the webflow has been visited

notifyPage

public void notifyPage(AttributeContainer container,
                       String url,
                       Set addedObjectSet,
                       Set removedObjectSet)
Notify that the navigation has reached a page.

Specified by:
notifyPage in interface NavigationManager
Parameters:
container - the attribute container
url - the url of the page
addedObjectSet - the added object set
removedObjectSet - the removed object set

notifyPage

public void notifyPage(AttributeContainer container,
                       String url,
                       String webflowName,
                       int defaultWebflowOwnership,
                       Set addedObjectSet,
                       Set removedObjectSet)
Notify that the navigation has reached a page of a specific webflow.

Specified by:
notifyPage in interface NavigationManager
Parameters:
container - the attribute container
url - the url of the page
webflowName - the webflow name
defaultWebflowOwnership - the default webflow ownership
addedObjectSet - the added object set
removedObjectSet - the removed object set

resetFramework

public void resetFramework(AttributeContainer container)
Reset the navigation manager.

Specified by:
resetFramework in interface NavigationManager
Parameters:
container - the attribute container

getObjectOwnership

protected ObjectSetOwner getObjectOwnership(int ownership)
Gets the object set owner.

Parameters:
ownership - the ownership
Returns:
the object set owner

getPreviousWebflowOrTop

protected Webflow getPreviousWebflowOrTop()
Gets the previous webflow, or the top webflow if there is only one webflow

Returns:
the previous webflow (null=no previous webflow)

getTopPage

protected Page getTopPage()
Returns the top page.

Returns:
the top page (null = no pages in this webflow or no webflows)

getTopWebflow

protected Webflow getTopWebflow()
Gets the top webflow (null=no webflow opened).

Returns:
the top webflow

getWebflowByIndex

protected Webflow getWebflowByIndex(int index)
Gets a webflow given its index. If it does not exists returns the webflow with the minimal index that exists or null if it does not exists.

Parameters:
index - the webflow index
Returns:
the webflow (null=no webflow)

addObjectSet

protected void addObjectSet(Set objectKeySet)
Add an object to the navigation manager.

Parameters:
objectKeySet - the object key

backToWebflow

protected void backToWebflow(String webflowName,
                             Set objectSetToRemove,
                             AttributeContainer container)
Back to a specified webflow (if different from the current).

Parameters:
webflowName - the webflow name
objectSetToRemove - the object set to remove for goinf to the specified webflow
container - the attribute container

findWebflowIndex

protected int findWebflowIndex(String webflowName)
Find the index of a named webflow.

Parameters:
webflowName - the webflow to find
Returns:
the index of the webflow inside the webflowStack (-1=webflow does not exists)

removeObjectSet

protected void removeObjectSet(Set objectKeySet)
Removes an object form the navigation manager.

Parameters:
objectKeySet - the object key set

removeObjectSetFromContainer

protected static void removeObjectSetFromContainer(AttributeContainer container,
                                                   Set objectSet)
Removes from a container a set of object.

Parameters:
container - the container
objectSet - the set of object to be removed


Copyright © 2004-2005 Maurizio Albari@SourceForge.net. All Rights Reserved.