com.plumtree.portalpages.common.mediator
Interface ICPListIterator

All Known Implementing Classes:
CListURLFullLinkMediator, CListURLFullMediator, CListURLMediator, CListURLTemplateLinkMediator, CListURLTemplateMediator

public interface ICPListIterator

Iterator interface for iterating through entries This iterator interface uses the .net style iterator where the index of the iterator starts at -1. A call to Next() is required to advance to the first element. Example use: while (iter.Next()) { Object entry = iter.GetEntry(); } The interface is implemented by two different types of classes. First, ASCompoundList, which is used by the NavigationModel when creating lists of links. These are the same lists that are returneed from methods on the different NavigationPages. They are populated by ListEntry object, objects that store different parts of a link, such as page id, community id, label or image. Cast the result from GetEntry or GetEntryAtIndex to ListEntry. Example: Getting the Community ID from every community a user is member of CommunityNavPage commP = (CommunityNavPage)m_model.GetPageSpecificMethods(); ICPListIterator cpList = commP.GetMyCommunities(false); // only communities, no actions while ( cpList.Next() ) { ListEntry entry = (ListEntry)cpList.GetEntry(); int nCommunityID = entry.GetCommunityID() ... } The second type of classes are the mediators. Mediators are simply helper classes that formats an ListEntry objects from an ICPListIterator list to a specific format. For example, CListURLFullLinkMediator creates HTMLAnchor objects with image, label and url for each link. Example: CommunityNavPage commP = (CommunityNavPage)m_model.GetPageSpecificMethods(); ICPListIterator cpList = commP.GetMyCommunities(true); // both actions and communities ICPListIterator mediator = new CListURLFullLinkMediator(m_asOwner, cpList); mediator.SetLabelMaxLength(50); //set the maximum label length to 50 characters while (mediator.Next()) { HTMLAnchor anchor = (HTMLAnchor) mediator.GetEntry(); ... }

Author:
robertz
See Also:
ASCompoundList, NavigationPage, ListEntry, CListURLTemplateLinkMediator, CListURLFullLinkMediator

Method Summary
 java.lang.Object GetEntry()
          Get the current entry in the list.
 java.lang.Object GetEntryAtIndex(int nIndex)
          Get the entry at a specific index
 ICPListEntryIterator GetList()
          Get an iterator, the index is set to before the first element, call Next() to advance to first entry.
 boolean Next()
          Advances the iterator to next element.
 void SetLabelMaxLength(int nMaxLength)
          Set the truncation width for all subsequent entries, can be altered between entries during an iteration
 void SetShowImages(boolean bShow)
          Set to display images for subsequent entries in the list, can be altered between entries during an iteration
 

Method Detail

GetEntry

java.lang.Object GetEntry()
Get the current entry in the list. Doesn't advance the iterator

Returns:
Current entry

GetEntryAtIndex

java.lang.Object GetEntryAtIndex(int nIndex)
Get the entry at a specific index

Parameters:
nIndex - Index of the entry
Returns:
Entry at specified index

GetList

ICPListEntryIterator GetList()
Get an iterator, the index is set to before the first element, call Next() to advance to first entry.

Returns:
Iterator for current list

Next

boolean Next()
Advances the iterator to next element.

Returns:
false if no more elements exist, true otherwise

SetLabelMaxLength

void SetLabelMaxLength(int nMaxLength)
Set the truncation width for all subsequent entries, can be altered between entries during an iteration

Parameters:
nMaxLength - Character position to truncate at

SetShowImages

void SetShowImages(boolean bShow)
Set to display images for subsequent entries in the list, can be altered between entries during an iteration

Parameters:
bShow - true to show images (default), false to no show images in entries



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