com.plumtree.uiinfrastructure.tree
Class ATreeModel

java.lang.Object
  extended by com.plumtree.uiinfrastructure.tree.ATreeModel
All Implemented Interfaces:
IManagedObject, IModel, IModelRO, IMVCObject, IRepostModel, ITreeModel, ITreeModelRO
Direct Known Subclasses:
ActivityRightsTreeModel, AObjectTreeModel, CredVaultTreeModel, GlobalObjsTreeModel, ServerTreeModel, UserInfoTreeModel

public abstract class ATreeModel
extends java.lang.Object
implements ITreeModel, ITreeModelRO, IRepostModel

This model handles generating a tree for admin objects.

Author:
Don Hayler

Field Summary
protected  AActivitySpace m_asOwner
           
protected  boolean m_bAllChecked
           
protected  boolean m_bAllowEmptyTreeSubmission
           
protected  boolean m_bEmptyList
           
protected  boolean m_bFlatList
           
protected  boolean m_bHelpEnabled
           
protected  boolean m_bMultiSelect
           
protected  boolean m_bShowRoot
           
protected  int m_nLastExpandedNodeID
           
protected  int m_nSelectMode
           
protected  int m_nSelectOptions
           
protected  int m_nSubmitMode
           
protected  TreeCompositeNode m_Root
           
protected  java.lang.String m_strActionSubTitle
           
protected  java.lang.String m_strOnClickFunction
           
protected  java.lang.String m_strParentFormItems
           
protected  java.lang.String m_strParentFormName
           
protected  java.lang.String m_strParentFormSpaceID
           
protected  java.lang.String m_strParentFormSubmit
           
protected  java.lang.String m_strTitle
           
protected  XPHashtable m_xpmSelectedItems
           
 
Constructor Summary
ATreeModel()
           
 
Method Summary
 void CleanupAllData()
          This method is called when an ActivitySpace is removed from the cache.
 void CleanupTempData()
          This method is called at the end of every HTTP request by the Interpreter.
 void ClearSelectedItems()
           
abstract  java.lang.Object Create()
          This method is used by the ASManager to return new instances of managed objects.
 void ExpandNode(boolean bExpand, int nNodeID)
          Expand or collapse a node in the tree.
 void Finish()
          Implement some code to execute when the user clicks on "Finish".
 java.lang.String GetActionSubTitle()
          Get the action sub-title for the tree popup I.E.
 boolean GetAllChecked()
          This method returns whether or not the check all box in the tree should be pre-selected or not.
 boolean GetAllowEmptySubmission()
          Whether or not users are allowed to click finish on trees without selecting anything.
protected  TreeCompositeNode GetCompositeIfAlreadySelected(java.lang.String strKey)
           
 boolean GetDisplayingFlatList()
          This method returns whether or not the tree is displaying as a flat list, or as a tree.
 boolean GetHelpEnabled()
          Gets whether or not help is enabled
protected  java.lang.String GetKeyFromNode(TreeLeafNode node)
          This function creates a unique key given a node.
 int GetLastExpandedNodeID()
          Returns the most recently expanded or collapsed node in the tree.
protected  TreeLeafNode GetLeafIfAlreadySelected(java.lang.String strKey)
           
 boolean GetMultipleSelect()
           
abstract  java.lang.String GetName()
          Return the name of the MVC object.
 int GetNextUniqueID()
          Accessor for managed series of unique tree ids.
 java.lang.String GetOnClickFunction()
           
 java.lang.String GetParentFormName()
           
 java.lang.String GetParentFormSpaceID()
           
 java.lang.String GetParentFormSubmitFunction()
           
 Redirect GetRedirectAfterFinish()
          Returns the Redirect object (this is were we need to go at the end of the Editor).
 TreeCompositeIterator GetRootTreeIterator()
           
 XPArrayList GetSelectedItems()
          This returns an array of the currently selected objects/folders in the tree.
 int GetSelectMode()
           
 int GetSelectOptions()
           
 boolean GetShowRoot()
          This method returns whether or not to show the root folder.
 int GetSubmitMode()
           
 java.lang.String GetTitle()
          Get the title for the tree popup
 boolean GetTreeIsEmpty()
           
 void Init(AActivitySpace parent)
          This method initializes the model.
 void RefreshTree()
          This method goes through the selected items list and makes sure that all nodes (including multiply instanced nodes) are correctly selected.
 void RemoveFromSelection(int classID, int objectID)
          Removes an object from the selected items if it exists and is selected.
 void ResetTree()
          This method initializes tree variables.
 void ResetUniqueIDs()
          This resets the unique tree ids.
 int SavePage(java.lang.String _sPageName, XPHashtable _htFormData)
          Calls the right save function according to the page name passed in argument.
 void SetActionSubTitle(java.lang.String strSubTitle)
          Set the action sub-title for the tree popup I.E.
 void SetAllowEmptySubmission(boolean bAllow)
          Allow users to click finish on trees without selecting anything.
abstract  void SetClassIDsToDisplay(int[] nIDs)
          This method will set the class IDs to be displayed.
 void SetHelpTopic(java.lang.String strHelpTopic)
          Set the help topic for the tree popup
 void SetMultipleSelect(boolean bMultiSelect)
           
abstract  void SetObjectIDsToDisplay(int[] nIDs)
          This method will display only the given objects.
abstract  void SetObjectIDsToHide(int[] nIDs)
          This method will hide the given objects.
abstract  void SetObjectIDsToSelect(int[] nIDs)
          This method will select the given objects.
 void SetOnClickFunction(java.lang.String name)
           
 void SetParentFormName(java.lang.String name)
           
 void SetParentFormSpaceID(java.lang.String name)
           
 void SetParentFormSubmitFunction(java.lang.String name)
           
 void SetSelectMode(int nSelectMode)
           
 void SetSelectOptions(int nSelectOptions)
           
 void SetShowRoot(boolean bShowRoot)
          This method sets whether or not to show the root folder.
 void SetSubmitMode(int nMode)
           
 void SetTitle(java.lang.String strTitle)
          Set the title for the tree popup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_asOwner

protected AActivitySpace m_asOwner

m_strActionSubTitle

protected java.lang.String m_strActionSubTitle

m_strOnClickFunction

protected java.lang.String m_strOnClickFunction

m_strParentFormItems

protected java.lang.String m_strParentFormItems

m_strParentFormName

protected java.lang.String m_strParentFormName

m_strParentFormSpaceID

protected java.lang.String m_strParentFormSpaceID

m_strParentFormSubmit

protected java.lang.String m_strParentFormSubmit

m_strTitle

protected java.lang.String m_strTitle

m_Root

protected TreeCompositeNode m_Root

m_xpmSelectedItems

protected XPHashtable m_xpmSelectedItems

m_bFlatList

protected boolean m_bFlatList

m_bAllChecked

protected boolean m_bAllChecked

m_bMultiSelect

protected boolean m_bMultiSelect

m_bShowRoot

protected boolean m_bShowRoot

m_bEmptyList

protected boolean m_bEmptyList

m_bAllowEmptyTreeSubmission

protected boolean m_bAllowEmptyTreeSubmission

m_bHelpEnabled

protected boolean m_bHelpEnabled

m_nSelectMode

protected int m_nSelectMode

m_nSelectOptions

protected int m_nSelectOptions

m_nSubmitMode

protected int m_nSubmitMode

m_nLastExpandedNodeID

protected int m_nLastExpandedNodeID
Constructor Detail

ATreeModel

public ATreeModel()
Method Detail

ClearSelectedItems

public void ClearSelectedItems()

ExpandNode

public void ExpandNode(boolean bExpand,
                       int nNodeID)
Expand or collapse a node in the tree. This method is responsible for updating the last expanded node member (m_nLastExpandedNodeID).

Specified by:
ExpandNode in interface ITreeModel
Parameters:
boolean - bExpand
int - nNodeID the unique node of the ID in the tree

GetLastExpandedNodeID

public int GetLastExpandedNodeID()
Returns the most recently expanded or collapsed node in the tree.

Specified by:
GetLastExpandedNodeID in interface ITreeModelRO
Parameters:
int - nNodeID the unique node of the ID in the tree that was most recently expanded or collapsed. -1 implies no node was expanded or collapsed in the last repost.
Returns:

CleanupTempData

public void CleanupTempData()
Description copied from interface: IModel
This method is called at the end of every HTTP request by the Interpreter. The Interpreter calls AActivitySpace.CleanupTempData(), which calls this method on all IModels registered using AActivitySpace.RegisterModel(). This method is intended for cleaning up temporary data that is only used for the lifetime of a single request, like DB query results.

Specified by:
CleanupTempData in interface IModel
See Also:
IModel.CleanupTempData()

CleanupAllData

public void CleanupAllData()
Description copied from interface: IModel
This method is called when an ActivitySpace is removed from the cache. The Interpreter calls AActivitySpace.CleanupAllData(), which calls this method on all IModels registered using AActivitySpace.RegisterModel(). This method is intended for releasing data stored in the server when the activity space is no longer needed, such as search objects that need to be maintained as long as the user is clicking through the search, but should be freed when the space can no longer be used. This can be used to prevent Java references to COM memory from hanging around in the long lived Java heap without cleaning up the underlying COM memory. The Java reference will still stay in the long lived heap until it gets garbage collected (which could be a while), but the COM memory should get released here. This method will not be called if an HTTPSession times out. CleanupTempData will be called before CleanupAllData.

Specified by:
CleanupAllData in interface IModel
See Also:
IModel.CleanupAllData()

Create

public abstract java.lang.Object Create()
This method is used by the ASManager to return new instances of managed objects.

Specified by:
Create in interface IManagedObject
Returns:
A new instance of the managed class (i.e. return new Foo();)

Finish

public void Finish()
Description copied from interface: IRepostModel
Implement some code to execute when the user clicks on "Finish".

Specified by:
Finish in interface IRepostModel
See Also:
IRepostModel.Finish()

GetActionSubTitle

public java.lang.String GetActionSubTitle()
Description copied from interface: ITreeModelRO
Get the action sub-title for the tree popup I.E. select a user

Specified by:
GetActionSubTitle in interface ITreeModelRO
Returns:
String the non-HTML Encoded action sub-title
See Also:
ITreeModelRO.GetActionSubTitle()

GetHelpEnabled

public boolean GetHelpEnabled()
Description copied from interface: ITreeModelRO
Gets whether or not help is enabled

Specified by:
GetHelpEnabled in interface ITreeModelRO
Returns:
boolean true implies enabled.
See Also:
ITreeModelRO.GetHelpEnabled()

GetAllowEmptySubmission

public boolean GetAllowEmptySubmission()
Description copied from interface: ITreeModelRO
Whether or not users are allowed to click finish on trees without selecting anything.

Specified by:
GetAllowEmptySubmission in interface ITreeModelRO
Returns:
boolean true implies allow
See Also:
ITreeModelRO.GetAllowEmptySubmission()

GetDisplayingFlatList

public boolean GetDisplayingFlatList()
Description copied from interface: ITreeModelRO
This method returns whether or not the tree is displaying as a flat list, or as a tree. Flat lists are displayed for smaller numbers of items.

Specified by:
GetDisplayingFlatList in interface ITreeModelRO
See Also:
ITreeModelRO.GetDisplayingFlatList()

GetAllChecked

public boolean GetAllChecked()
Description copied from interface: ITreeModelRO
This method returns whether or not the check all box in the tree should be pre-selected or not.

Specified by:
GetAllChecked in interface ITreeModelRO
See Also:
ITreeModelRO.GetDisplayingFlatList()

GetMultipleSelect

public boolean GetMultipleSelect()
Specified by:
GetMultipleSelect in interface ITreeModelRO
Returns:

GetName

public abstract java.lang.String GetName()
Description copied from interface: IMVCObject
Return the name of the MVC object.

Specified by:
GetName in interface IMVCObject
Returns:
the name of the object.
See Also:
IMVCObject.GetName()

GetOnClickFunction

public java.lang.String GetOnClickFunction()
Specified by:
GetOnClickFunction in interface ITreeModelRO
Returns:

GetParentFormName

public java.lang.String GetParentFormName()
Specified by:
GetParentFormName in interface ITreeModelRO
Returns:

GetParentFormSpaceID

public java.lang.String GetParentFormSpaceID()
Specified by:
GetParentFormSpaceID in interface ITreeModelRO
Returns:

GetParentFormSubmitFunction

public java.lang.String GetParentFormSubmitFunction()
Specified by:
GetParentFormSubmitFunction in interface ITreeModelRO
Returns:

GetRedirectAfterFinish

public Redirect GetRedirectAfterFinish()
Description copied from interface: IRepostModel
Returns the Redirect object (this is were we need to go at the end of the Editor).

Specified by:
GetRedirectAfterFinish in interface IRepostModel
Returns:
Redirect
See Also:
IRepostModel.GetRedirectAfterFinish()

GetTreeIsEmpty

public boolean GetTreeIsEmpty()
Specified by:
GetTreeIsEmpty in interface ITreeModelRO
Returns:
See Also:
ITreeModelRO.GetTreeIsEmpty()

GetRootTreeIterator

public TreeCompositeIterator GetRootTreeIterator()
Specified by:
GetRootTreeIterator in interface ITreeModelRO
Returns:
See Also:
ITreeModelRO.GetRootTreeIterator()

GetSelectMode

public int GetSelectMode()
Specified by:
GetSelectMode in interface ITreeModelRO
Returns:

GetSelectOptions

public int GetSelectOptions()
Specified by:
GetSelectOptions in interface ITreeModelRO
Returns:

GetSelectedItems

public XPArrayList GetSelectedItems()
Description copied from interface: ITreeModelRO
This returns an array of the currently selected objects/folders in the tree.

Specified by:
GetSelectedItems in interface ITreeModelRO
Returns:
XPArrayList of TreeLeafNode objects
See Also:
ITreeModelRO.GetSelectedItems()

GetShowRoot

public boolean GetShowRoot()
Description copied from interface: ITreeModelRO
This method returns whether or not to show the root folder.

Specified by:
GetShowRoot in interface ITreeModelRO
See Also:
ITreeModelRO.GetShowRoot()

GetSubmitMode

public int GetSubmitMode()
Specified by:
GetSubmitMode in interface ITreeModelRO
Returns:
See Also:
ITreeModelRO.GetSubmitMode()

GetTitle

public java.lang.String GetTitle()
Description copied from interface: ITreeModelRO
Get the title for the tree popup

Specified by:
GetTitle in interface ITreeModelRO
Returns:
String the non-HTML Encoded title
See Also:
ITreeModelRO.GetTitle()

Init

public void Init(AActivitySpace parent)
Description copied from interface: IModel
This method initializes the model. This is called automatically when AActivitySpace.RegisterModel() is called.

Specified by:
Init in interface IModel
Parameters:
parent - the parent Activity Space
See Also:
IModel.Init(AActivitySpace)

RefreshTree

public void RefreshTree()
This method goes through the selected items list and makes sure that all nodes (including multiply instanced nodes) are correctly selected.


ResetTree

public void ResetTree()
Description copied from interface: ITreeModel
This method initializes tree variables. sub-classes can extend this method.

Specified by:
ResetTree in interface ITreeModel

ResetUniqueIDs

public void ResetUniqueIDs()
Description copied from interface: ITreeModel
This resets the unique tree ids. This should only be called when resetting the entire tree.

Specified by:
ResetUniqueIDs in interface ITreeModel

SavePage

public int SavePage(java.lang.String _sPageName,
                    XPHashtable _htFormData)
Description copied from interface: IRepostModel
Calls the right save function according to the page name passed in argument.

Specified by:
SavePage in interface IRepostModel
Returns:
int Page status for server side validation
See Also:
IRepostModel.SavePage(String, XPHashtable)

RemoveFromSelection

public void RemoveFromSelection(int classID,
                                int objectID)
Description copied from interface: ITreeModel
Removes an object from the selected items if it exists and is selected. The pair of classID,objectID uniquely identify each object. This method has no effect if the object does not exist or is not selected. This method does not throw exceptions but does log errors.

Specified by:
RemoveFromSelection in interface ITreeModel
Parameters:
classID - The classID from PT_CLASSIDS of the object to remove
objectID - The objectID of the object to remove
See Also:
ITreeModel.RemoveFromSelection(int classID, int objectID)

SetActionSubTitle

public void SetActionSubTitle(java.lang.String strSubTitle)
Description copied from interface: ITreeModel
Set the action sub-title for the tree popup I.E. select a user

Specified by:
SetActionSubTitle in interface ITreeModel
See Also:
ITreeModel.SetActionSubTitle(String)

SetAllowEmptySubmission

public void SetAllowEmptySubmission(boolean bAllow)
Description copied from interface: ITreeModel
Allow users to click finish on trees without selecting anything.

Specified by:
SetAllowEmptySubmission in interface ITreeModel
See Also:
ITreeModel.SetAllowEmptySubmission(boolean)

SetHelpTopic

public void SetHelpTopic(java.lang.String strHelpTopic)
Description copied from interface: ITreeModel
Set the help topic for the tree popup

Specified by:
SetHelpTopic in interface ITreeModel
See Also:
ITreeModel.SetHelpTopic(String)

SetClassIDsToDisplay

public abstract void SetClassIDsToDisplay(int[] nIDs)
Description copied from interface: ITreeModel
This method will set the class IDs to be displayed. This must be run before SetObjectIDsToHide() and SetObjectIDsToSelect().

Specified by:
SetClassIDsToDisplay in interface ITreeModel
Parameters:
nIDs -

SetMultipleSelect

public void SetMultipleSelect(boolean bMultiSelect)
Specified by:
SetMultipleSelect in interface ITreeModel
Parameters:
bMultiSelect -

SetObjectIDsToDisplay

public abstract void SetObjectIDsToDisplay(int[] nIDs)
Description copied from interface: ITreeModel
This method will display only the given objects. Only this method or SetObjectIDsToHide() can be called, not both.

Specified by:
SetObjectIDsToDisplay in interface ITreeModel
Parameters:
nIDs -

SetObjectIDsToHide

public abstract void SetObjectIDsToHide(int[] nIDs)
Description copied from interface: ITreeModel
This method will hide the given objects. Only this method or SetObjectIDsToDisplay() can be called, not both.

Specified by:
SetObjectIDsToHide in interface ITreeModel
Parameters:
nIDs -

SetObjectIDsToSelect

public abstract void SetObjectIDsToSelect(int[] nIDs)
Description copied from interface: ITreeModel
This method will select the given objects.

Specified by:
SetObjectIDsToSelect in interface ITreeModel
Parameters:
nIDs -

GetNextUniqueID

public int GetNextUniqueID()
Description copied from interface: ITreeModel
Accessor for managed series of unique tree ids. All objects in a folder should have sequential tree ids.

Specified by:
GetNextUniqueID in interface ITreeModel
Returns:

SetOnClickFunction

public void SetOnClickFunction(java.lang.String name)
Specified by:
SetOnClickFunction in interface ITreeModel
Parameters:
name -

SetParentFormName

public void SetParentFormName(java.lang.String name)
Specified by:
SetParentFormName in interface ITreeModel
Parameters:
name -

SetParentFormSpaceID

public void SetParentFormSpaceID(java.lang.String name)
Specified by:
SetParentFormSpaceID in interface ITreeModel
Parameters:
name -

SetParentFormSubmitFunction

public void SetParentFormSubmitFunction(java.lang.String name)
Specified by:
SetParentFormSubmitFunction in interface ITreeModel
Parameters:
name -

SetSelectMode

public void SetSelectMode(int nSelectMode)
Specified by:
SetSelectMode in interface ITreeModel
Parameters:
nSelectMode -

SetSelectOptions

public void SetSelectOptions(int nSelectOptions)
Specified by:
SetSelectOptions in interface ITreeModel
Parameters:
nSelectOptions -

SetShowRoot

public void SetShowRoot(boolean bShowRoot)
Description copied from interface: ITreeModel
This method sets whether or not to show the root folder.

Specified by:
SetShowRoot in interface ITreeModel
See Also:
ITreeModel.SetShowRoot(boolean)

SetSubmitMode

public void SetSubmitMode(int nMode)
Specified by:
SetSubmitMode in interface ITreeModel
See Also:
ITreeModel.SetSubmitMode(int)

SetTitle

public void SetTitle(java.lang.String strTitle)
Description copied from interface: ITreeModel
Set the title for the tree popup

Specified by:
SetTitle in interface ITreeModel
See Also:
ITreeModel.SetTitle(String)

GetCompositeIfAlreadySelected

protected TreeCompositeNode GetCompositeIfAlreadySelected(java.lang.String strKey)
Parameters:
strKey -
Returns:

GetLeafIfAlreadySelected

protected TreeLeafNode GetLeafIfAlreadySelected(java.lang.String strKey)
Parameters:
strKey -
Returns:

GetKeyFromNode

protected java.lang.String GetKeyFromNode(TreeLeafNode node)
This function creates a unique key given a node. It is used to store items in XPHashtables. Override this function if your tree's nodes can't be differentiated by "classid, objectid"

Parameters:
node -
Returns:
String



Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.