com.arsdigita.acs
Class ContextBarWs

java.lang.Object
  |
  +--com.arsdigita.acs.ContextBarWs

public class ContextBarWs
extends Object

Class that displays a Yahoo-style context navbar for a logged-in user, with "your workspace" at the root.

Elements are added to the context bar in order; each element consists of a path to be used as a relative URL link, and the title to be displayed as a link to that path. The last element added to the context bar is the title of the current page, and a path should not be provided.


Constructor Summary
ContextBarWs()
          Creates a new context bar.
ContextBarWs(PageContext pageContext)
          For group-scoped modules, this constructor can create a context bar that contains the links set up by UserGroupFilter
ContextBarWs(String[][] pairs)
          Creates a new context bar with "Your Workspace" as the root.
ContextBarWs(String path, String title)
          Creates a new context bar, with the given link at the root instead of the "Your Workspace" link.
 
Method Summary
 void add(String title)
          Adds a new element to the context bar with no path, for final element.
 void add(String path, String title)
          Adds a new element to the context bar.
 String getHTML()
          Returns HTML represenation of this context bar.
 String toString()
          Returns HTML represenation of this context bar.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContextBarWs

public ContextBarWs()
Creates a new context bar.

ContextBarWs

public ContextBarWs(String path,
                    String title)
Creates a new context bar, with the given link at the root instead of the "Your Workspace" link.

ContextBarWs

public ContextBarWs(String[][] pairs)
Creates a new context bar with "Your Workspace" as the root.
Parameters:
pairs - an array of pairs, each pair is an array of length two with path and title. If the last pair has a null or emptry string title, it is used as the final element of the Context Bar. For example:
              new ContextBarWs(new String[][] { {return_url, item},
                                                {"Add a comment ][",null} } )

ContextBarWs

public ContextBarWs(PageContext pageContext)
For group-scoped modules, this constructor can create a context bar that contains the links set up by UserGroupFilter
Method Detail

add

public void add(String path,
                String title)
Adds a new element to the context bar.
Parameters:
path - Relative URL to appear in href
title - Title for this page

add

public void add(String title)
Adds a new element to the context bar with no path, for final element.
Parameters:
title - Title for this page

getHTML

public String getHTML()
Returns HTML represenation of this context bar.
Returns:
HTML context bar

toString

public String toString()
Returns HTML represenation of this context bar.
Overrides:
toString in class Object
Returns:
HTML context bar