org.hd.d.pg2k.webSvr.util
Class Breadcrumbs

java.lang.Object
  extended by org.hd.d.pg2k.webSvr.util.Breadcrumbs
All Implemented Interfaces:
java.io.Serializable

public final class Breadcrumbs
extends java.lang.Object
implements java.io.Serializable

Holds the data corresponding to a breadcrumbs navigation aid on a Web page. This consists of a list of text/hyperlink pairs, running from the largest/outermost part of the Website first, to the innermost part (corresponding to that nearest the current page) last.

It is possible to insert items at start or end, though most efficient to insert at the end.

It is possible to insert items with no link, but not with no text.

This can export a read-only view of its content as a List.

This is thread-safe and Serializable so as to be able to be stored in a servlet session; nothing especially long-lived or sensitive.

See Also:
Serialized Form

Nested Class Summary
static class Breadcrumbs.Breadcrumb
          One item in the breadcrumbs.
 
Field Summary
private  java.util.List<Breadcrumbs.Breadcrumb> crumbs
          This is our list of breadcrumbs, in order.
private static long serialVersionUID
          Unique Serialisation class ID generated by http://random.hd.org/.
 
Constructor Summary
Breadcrumbs()
           
 
Method Summary
 void append(Breadcrumbs.Breadcrumb crumbForEnd)
          Appends crumb (to end of list).
 void clear()
          Removes all of the crumbs.
 Breadcrumbs.Breadcrumb getCrumb(int index)
          Get specified crumb by its index.
 boolean isEmpty()
          Returns true if there are no breadcrumbs.
 void prepend(Breadcrumbs.Breadcrumb crumbForStart)
          Prepends crumb (to start of list).
 int size()
          Returns the number of crumbs.
 java.util.List<Breadcrumbs.Breadcrumb> viewAsList()
          Returns read-only view of the crumbs as a List.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

crumbs

private final java.util.List<Breadcrumbs.Breadcrumb> crumbs
This is our list of breadcrumbs, in order. We use a Vector so as to be inherently thread-safe.

We expect that usually we will have no more than about four crumbs, and so default to that size.


serialVersionUID

private static final long serialVersionUID
Unique Serialisation class ID generated by http://random.hd.org/.

See Also:
Constant Field Values
Constructor Detail

Breadcrumbs

public Breadcrumbs()
Method Detail

viewAsList

public java.util.List<Breadcrumbs.Breadcrumb> viewAsList()
Returns read-only view of the crumbs as a List.


isEmpty

public boolean isEmpty()
Returns true if there are no breadcrumbs.


size

public int size()
Returns the number of crumbs.


clear

public void clear()
Removes all of the crumbs.


append

public void append(Breadcrumbs.Breadcrumb crumbForEnd)
Appends crumb (to end of list). Crumb must not be null.


prepend

public void prepend(Breadcrumbs.Breadcrumb crumbForStart)
Prepends crumb (to start of list). Crumb must not be null.


getCrumb

public Breadcrumbs.Breadcrumb getCrumb(int index)
                                throws java.lang.IndexOutOfBoundsException
Get specified crumb by its index.

Throws:
java.lang.IndexOutOfBoundsException - if the index is invalid

DHD Multimedia Gallery V1.53.0

Copyright (c) 1996-2009, Damon Hart-Davis. All rights reserved.