com.plumtree.portalpages.common.mediator
Class CListURLTemplateMediator

java.lang.Object
  extended by com.plumtree.portalpages.common.mediator.CListURLTemplateMediator
All Implemented Interfaces:
ICPListIterator
Direct Known Subclasses:
CListURLTemplateLinkMediator

public class CListURLTemplateMediator
extends java.lang.Object
implements ICPListIterator

Created on Oct 29, 2002 Mediator for ASCompoundList, takes values from ASCompoundList and returns URL Templates, comma separated String with the type of URL and its parameters. A CommunityPage URL would look like 'C,201,-201' where C stands for Community Template, 201 for the community id and -201 for page id. URL Templates are used to lessen the data being sent down to the client. The full URL is constructed by calling the buildURLFromTemplate javascript function (use the NavigationCommonHelpers.JSCRIPT_FUNC_BUILD_URL_FROM_TEMPL constant). The templateURLRedirect javascript function (use the NavigationCommonHelpers.URLTEMPLATE_REDIRECT_JSFUNCNAME) to construct the full url and redirect to it. This mediator is for menus with their own onclick event handling. Use the CListURLTemplateLinkMediator to get an HTMLAnchor elements that redirects to the url in the template. Example use: ICPListIterator mediator = new CListURLTemplateMediator(m_asOwner, cpList1); mediator.SetLabelMaxLength(50); //set the maximum label length to 50 characters while (mediator.Next()) { String[] arURLTempl = (String[]) mediator.GetEntry(); String strLabel = arURLTempl[CListURLTemplateMediator.TEMPLATEARR_INDEX_LABEL]; String strURL = arURLTempl[CListURLTemplateMediator.TEMPLATEARR_INDEX_URL]; String strImageURL = arURLTempl[CListURLTemplateMediator.TEMPLATEARR_INDEX_IMGURL]; ... }

Author:
robertz

Field Summary
static int ACTIONIMAGE_SPACE_WIDTH
           
static int IMAGE_SPACE_WIDTH
          The constant amount of space in pixels images should take up.
protected  java.lang.String m_strImageAlign
           
static int TEMPLATEARR_INDEX_IMGURL
           
static int TEMPLATEARR_INDEX_LABEL
          Index constants for the elements in the array generated by this mediator
static int TEMPLATEARR_INDEX_URL
           
 
Constructor Summary
CListURLTemplateMediator(AActivitySpace aspace, ICPListEntryIterator list)
          Constructor for CompoundListASURLMediator.
 
Method Summary
protected  java.lang.String[] CreateCommPageURLTemplate(ListEntry entry)
          Creates a Template URL for Community pages
protected  java.lang.String[] CreateDirPageURLTemplate(ListEntry entry)
          Create a Template URL for Directory pages
protected  java.lang.String[] CreateDocURL(ListEntry entry)
          Creates a Template URL for document pages
protected  java.lang.String[] CreateEditorURLTemplate(ListEntry entry)
          Create a Template URL for editor pages
protected  java.lang.String[] CreateFullInternalURL(ListEntry entry)
           
protected  java.lang.String[] CreateFullURL(ListEntry entry)
          Creates a full url with associated label and image if one
protected  java.lang.String[] CreateGenericURL(ListEntry entry)
          Creates a generic Plumtree Portal 50 URL
protected  java.lang.String[] CreateMyPageURLTemplate(ListEntry entry)
          Creates a Template URL for mypages
protected  java.lang.String[] CreatePrefsURL(ListEntry entry)
          Creates a Template URL for users preferences
protected  java.lang.String[] CreateSiteMapRootURLTemplate(ListEntry entry)
          Creates a Template URL for Community Knowledge Directory Root
protected  java.lang.String[] CreateStringLabel(ListEntry entry)
          Creates an array with just a label without url but possible image
protected  java.lang.String[] CreateUserURL(ListEntry entry)
          Creates a Template URL for user profile pages
 java.lang.Object GetEntry()
          Get the current entry in the list.
 java.lang.Object GetEntryAtIndex(int nIndex)
          Get the entry at a specific index
 java.lang.String GetEntryOrigLabel()
          Late added method, get the untruncated label of the current entry.
 java.lang.String GetImageSource()
          Creates a string containing the image source for the assigned image
protected  java.lang.String GetImageString(ListEntry entry)
          Creates a string containing the html for the assigned images
 ICPListEntryIterator GetList()
          Get an iterator, the index is set to before the first element, call Next() to advance to first entry.
 java.lang.String GetNonEncodedEntryOrigLabel()
          Late added method, get the untruncated label of the current entry (non encoded).
 boolean IsImageEntry(java.lang.String[] entry)
          Checks if an entry has image assigned.
 boolean Next()
          Advances the iterator to next element.
 void SetLabelMaxLength(int nMax)
          Set the truncation width for all subsequent entries, can be altered between entries during an iteration
protected  java.lang.String SetListEntryImage(ListEntry entry)
          Get the image string for the specified entry
 void SetShowImages(boolean bShow)
          Set to display images for subsequent entries in the list, can be altered between entries during an iteration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPLATEARR_INDEX_LABEL

public static final int TEMPLATEARR_INDEX_LABEL
Index constants for the elements in the array generated by this mediator

See Also:
Constant Field Values

TEMPLATEARR_INDEX_URL

public static final int TEMPLATEARR_INDEX_URL
See Also:
Constant Field Values

TEMPLATEARR_INDEX_IMGURL

public static final int TEMPLATEARR_INDEX_IMGURL
See Also:
Constant Field Values

IMAGE_SPACE_WIDTH

public static final int IMAGE_SPACE_WIDTH
The constant amount of space in pixels images should take up. A spacer image will be added as padding if images doesn't fill up the entire space.

See Also:
Constant Field Values

ACTIONIMAGE_SPACE_WIDTH

public static final int ACTIONIMAGE_SPACE_WIDTH
See Also:
Constant Field Values

m_strImageAlign

protected java.lang.String m_strImageAlign
Constructor Detail

CListURLTemplateMediator

public CListURLTemplateMediator(AActivitySpace aspace,
                                ICPListEntryIterator list)
Constructor for CompoundListASURLMediator. Get the iterator interface for the list

Parameters:
aspace - Current Activityspace
list - ICPListEntryIterator to wrap
Method Detail

GetEntryOrigLabel

public java.lang.String GetEntryOrigLabel()
Late added method, get the untruncated label of the current entry.


GetNonEncodedEntryOrigLabel

public java.lang.String GetNonEncodedEntryOrigLabel()
Late added method, get the untruncated label of the current entry (non encoded).


GetEntry

public java.lang.Object GetEntry()
Description copied from interface: ICPListIterator
Get the current entry in the list. Doesn't advance the iterator

Specified by:
GetEntry in interface ICPListIterator
Returns:
A String array. First element with the label of the link. Second element with the URL Template String, a comma separated string with the link type and parameters for link. Third (optional), HTML string with image or images.
See Also:
ICPListIterator.GetEntry()

GetEntryAtIndex

public java.lang.Object GetEntryAtIndex(int nIndex)
Description copied from interface: ICPListIterator
Get the entry at a specific index

Specified by:
GetEntryAtIndex in interface ICPListIterator
Parameters:
nIndex - Index of the entry
Returns:
Entry at specified index
See Also:
ICPListIterator.GetEntryAtIndex(int)

GetList

public ICPListEntryIterator GetList()
Description copied from interface: ICPListIterator
Get an iterator, the index is set to before the first element, call Next() to advance to first entry.

Specified by:
GetList in interface ICPListIterator
Returns:
Iterator for current list
See Also:
ICPListIterator.GetList()

Next

public boolean Next()
Description copied from interface: ICPListIterator
Advances the iterator to next element.

Specified by:
Next in interface ICPListIterator
Returns:
false if no more elements exist, true otherwise
See Also:
ICPListIterator.Next()

SetLabelMaxLength

public void SetLabelMaxLength(int nMax)
Description copied from interface: ICPListIterator
Set the truncation width for all subsequent entries, can be altered between entries during an iteration

Specified by:
SetLabelMaxLength in interface ICPListIterator
Parameters:
nMax - Character position to truncate at
See Also:
ICPListIterator.SetLabelMaxLength(int)

SetShowImages

public void SetShowImages(boolean bShow)
Description copied from interface: ICPListIterator
Set to display images for subsequent entries in the list, can be altered between entries during an iteration

Specified by:
SetShowImages in interface ICPListIterator
Parameters:
bShow - true to show images (default), false to no show images in entries
See Also:
ICPListIterator.SetShowImages(boolean)

CreateCommPageURLTemplate

protected java.lang.String[] CreateCommPageURLTemplate(ListEntry entry)
Creates a Template URL for Community pages

Parameters:
entry - Current listentry element
Returns:
String array with string label, url template string and image string if assigned

CreateSiteMapRootURLTemplate

protected java.lang.String[] CreateSiteMapRootURLTemplate(ListEntry entry)
Creates a Template URL for Community Knowledge Directory Root

Parameters:
entry - Current listentry element
Returns:
String array with string label, url template string and image string if assigned

CreateDirPageURLTemplate

protected java.lang.String[] CreateDirPageURLTemplate(ListEntry entry)
Create a Template URL for Directory pages

Parameters:
entry - Current listentry element
Returns:
String array with string label, url template string and image string if assigned

CreateDocURL

protected java.lang.String[] CreateDocURL(ListEntry entry)
Creates a Template URL for document pages

Parameters:
entry - Current listentry element
Returns:
String array with string label, url template string and image string if assigned

CreateEditorURLTemplate

protected java.lang.String[] CreateEditorURLTemplate(ListEntry entry)
Create a Template URL for editor pages

Parameters:
entry - Current listentry element
Returns:
String array with string label, url template string and image string if assigned

CreateFullInternalURL

protected java.lang.String[] CreateFullInternalURL(ListEntry entry)
Parameters:
entry -
Returns:

CreateFullURL

protected java.lang.String[] CreateFullURL(ListEntry entry)
Creates a full url with associated label and image if one

Parameters:
entry - Current listentry element
Returns:
String array with string label, full url string and image string if assigned

CreateGenericURL

protected java.lang.String[] CreateGenericURL(ListEntry entry)
Creates a generic Plumtree Portal 50 URL

Parameters:
entry - Current listentry element
Returns:
String array with string label, url template string and image string if assigned

CreateMyPageURLTemplate

protected java.lang.String[] CreateMyPageURLTemplate(ListEntry entry)
Creates a Template URL for mypages

Parameters:
entry - Current listentry element
Returns:
String array with string label, url template string and image string if assigned

CreatePrefsURL

protected java.lang.String[] CreatePrefsURL(ListEntry entry)
Creates a Template URL for users preferences

Parameters:
entry - Current listentry element
Returns:
String array with string label, url template string and image string if assigned

CreateStringLabel

protected java.lang.String[] CreateStringLabel(ListEntry entry)
Creates an array with just a label without url but possible image

Parameters:
entry - Current listentry element
Returns:
String array with string label, url template string and image string if assigned

CreateUserURL

protected java.lang.String[] CreateUserURL(ListEntry entry)
Creates a Template URL for user profile pages

Parameters:
entry - Current listentry element
Returns:
String array with string label, url template string and image string if assigned

GetImageString

protected java.lang.String GetImageString(ListEntry entry)
Creates a string containing the html for the assigned images

Parameters:
entry - Current listentry element
Returns:
String with the html for the assigned images

GetImageSource

public java.lang.String GetImageSource()
Creates a string containing the image source for the assigned image

Returns:
String with the image source for the assigned images

IsImageEntry

public boolean IsImageEntry(java.lang.String[] entry)
Checks if an entry has image assigned.

Parameters:
entry - Template entry from this mediator.
Returns:
true if image(s) exist, false otherwise

SetListEntryImage

protected java.lang.String SetListEntryImage(ListEntry entry)
Get the image string for the specified entry

Parameters:
entry -
Returns:
Image HTML String



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