org.dspace.app.xmlui.wing.element
Class List

java.lang.Object
  extended by org.dspace.app.xmlui.wing.element.AbstractWingElement
      extended by org.dspace.app.xmlui.wing.element.List
All Implemented Interfaces:
StructuralElement, WingElement, WingMergeableElement

public class List
extends AbstractWingElement
implements WingMergeableElement, StructuralElement


Field Summary
static String A_TYPE
          The name of the type attribute
static String E_LIST
          The name of the list element
static String TYPE_BULLETED
           
static String TYPE_DSO_LIST
           
static String TYPE_FORM
           
static String TYPE_GLOSS
           
static String TYPE_ORDERED
           
static String TYPE_PROGRESS
           
static String TYPE_SIMPLE
          The possible list types *
static String[] TYPES
          All the possible list types collected into one array
 
Fields inherited from class org.dspace.app.xmlui.wing.element.AbstractWingElement
context
 
Fields inherited from interface org.dspace.app.xmlui.wing.element.StructuralElement
A_ID, A_NAME, A_RENDER
 
Constructor Summary
protected List(WingContext context, String name, String type, String rend)
          Construct a new list.
 
Method Summary
 Item addItem()
          Add an empty unnamed item.
 void addItem(Message key)
          Add an item element that contains only translated content.
 void addItem(String characters)
          Add an item element that contains only character content.
 Item addItem(String name, String rend)
          Add an item element, which serves a dual purpose.
 void addItemXref(String target, Message key)
          Add an item to the list that contains a link.
 void addItemXref(String target, String characters)
          Add an item to the list that contains a link.
 void addLabel()
          Add a label element, they are associated with an item and annotates that item with a number, a textual description of some sort, or a simple bullet.
 void addLabel(Message key)
          Add a label element, they are associated with an item and annotates that item with a number, a textual description of some sort, or a simple bullet.
 void addLabel(String characters)
          Add a label element, they are associated with an item and annotates that item with a number, a textual description of some sort, or a simple bullet.
 Label addLabel(String name, String rend)
          Add a label element, they are associated with an item and annotates that item with a number, a textual description of some sort, or a simple bullet.
 List addList(String name)
          Add a new sublist to this list.
 List addList(String name, String type)
          Add a new sublist to this list.
 List addList(String name, String type, String rend)
          Add a new sublist to this list.
 void dispose()
          dispose
 Attributes merge(Attributes attributes)
          Inform this list that it is being merged with an existing element.
 WingMergeableElement mergeChild(String namespace, String localName, String qName, Attributes attributes)
          Merge the given SAX startElement event into this list's child.
 boolean mergeEqual(String namespace, String localName, String qName, Attributes attributes)
          Determine if the given SAX startElement event is equivalent to this list.
 Head setHead()
          Set the head element which is the label associated with this list.
 void setHead(Message key)
          Set the head element which is the label associated with this list.
 void setHead(String characters)
          Set the head element which is the label associated with this list.
 void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, NamespaceSupport namespaces)
          Translate this element and all contained elements into SAX events.
 
Methods inherited from class org.dspace.app.xmlui.wing.element.AbstractWingElement
endElement, endElement, getWingContext, greater, lesser, require, require, requireFalse, requireTrue, restrict, sendCharacters, setWingContext, startElement, startElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

E_LIST

public static final String E_LIST
The name of the list element

See Also:
Constant Field Values

A_TYPE

public static final String A_TYPE
The name of the type attribute

See Also:
Constant Field Values

TYPE_SIMPLE

public static final String TYPE_SIMPLE
The possible list types *

See Also:
Constant Field Values

TYPE_ORDERED

public static final String TYPE_ORDERED
See Also:
Constant Field Values

TYPE_BULLETED

public static final String TYPE_BULLETED
See Also:
Constant Field Values

TYPE_GLOSS

public static final String TYPE_GLOSS
See Also:
Constant Field Values

TYPE_PROGRESS

public static final String TYPE_PROGRESS
See Also:
Constant Field Values

TYPE_FORM

public static final String TYPE_FORM
See Also:
Constant Field Values

TYPE_DSO_LIST

public static final String TYPE_DSO_LIST
See Also:
Constant Field Values

TYPES

public static final String[] TYPES
All the possible list types collected into one array

Constructor Detail

List

protected List(WingContext context,
               String name,
               String type,
               String rend)
        throws WingException
Construct a new list.

Parameters:
context - (Required) The context this element is contained in, such as where to route SAX events and what i18n catalogue to use.
name - (Required) a local identifier used to differentiate the element from its siblings.
type - (May be null) determines the list type. If this is blank the list type is inferred from the context and use.
rend - (May be null) a rendering hint used to override the default display of the element. There are a set of predefined rendering values, see the class documentation above.
Throws:
WingException
Method Detail

setHead

public Head setHead()
             throws WingException
Set the head element which is the label associated with this list. This method should be called before any other elements have been added to the list.

Throws:
WingException

setHead

public void setHead(String characters)
             throws WingException
Set the head element which is the label associated with this list. This method should be called before any other elements have been added to the list.

Parameters:
characters - (Required) Untranslated character data to be included as the list's head.
Throws:
WingException

setHead

public void setHead(Message key)
             throws WingException
Set the head element which is the label associated with this list. This method should be called before any other elements have been added to the list.

Parameters:
key - (Required) Key to the i18n catalogue to translate the content into the language preferred by the user.
Throws:
WingException

addLabel

public Label addLabel(String name,
                      String rend)
               throws WingException
Add a label element, they are associated with an item and annotates that item with a number, a textual description of some sort, or a simple bullet.

Parameters:
name - (May be null) a local identifier used to differentiate the element from its siblings.
rend - (May be null) a rendering hint used to override the default display of the element.
Throws:
WingException

addLabel

public void addLabel(String characters)
              throws WingException
Add a label element, they are associated with an item and annotates that item with a number, a textual description of some sort, or a simple bullet.

Parameters:
characters - (Required) Untranslated character data to be included.
Throws:
WingException

addLabel

public void addLabel()
              throws WingException
Add a label element, they are associated with an item and annotates that item with a number, a textual description of some sort, or a simple bullet. This version of label provides no textual label but may be used to indicate some implicit labeling such as ordered lists.

Throws:
WingException

addLabel

public void addLabel(Message key)
              throws WingException
Add a label element, they are associated with an item and annotates that item with a number, a textual description of some sort, or a simple bullet.

Parameters:
key - (Required) Key to the i18n catalogue to translate the content into the language preferred by the user.
Throws:
WingException

addItem

public Item addItem()
             throws WingException
Add an empty unnamed item.

Returns:
a new Item
Throws:
WingException

addItem

public Item addItem(String name,
                    String rend)
             throws WingException
Add an item element, which serves a dual purpose. It can contain other lists, allowing for hierarchies and recursive lists. Alternatively it can serve as a character container to display textual data, possibly enhanced with hyperlinks, emphasized blocks of text, images and form fields. An item cannot be both a character container and contain a list.

Parameters:
name - (May be null) a local identifier used to differentiate the element from its siblings.
rend - (May be null) a rendering hint used to override the default display of the element. *
Returns:
a new Item
Throws:
WingException

addItem

public void addItem(String characters)
             throws WingException
Add an item element that contains only character content.

Parameters:
characters - (Required) Untranslated character data to be included.
Throws:
WingException

addItem

public void addItem(Message key)
             throws WingException
Add an item element that contains only translated content.

Parameters:
key - (Required) Key to the i18n catalogue to translate the content into the language preferred by the user.
Throws:
WingException

addItemXref

public void addItemXref(String target,
                        String characters)
                 throws WingException
Add an item to the list that contains a link. The link will consist of the given content and linked to the given target.

Parameters:
target - (Required) The link target.
characters - (Required) Untranslated character data to be included as the link's body.
Throws:
WingException

addItemXref

public void addItemXref(String target,
                        Message key)
                 throws WingException
Add an item to the list that contains a link. The link will consist of the given content and linked to the given target.

Parameters:
target - (Required) The link target.
key - (Required) i18n key for translating content into the user's preferred language.
Throws:
WingException

addList

public List addList(String name,
                    String type,
                    String rend)
             throws WingException
Add a new sublist to this list.

Parameters:
name - (Required) a local identifier used to differentiate the element from its siblings.
type - (May be null) determines the list type. If this is blank the list type is inferred from the context and use.
rend - (May be null) a rendering hint used to override the default display of the element.
Returns:
A new sub list.
Throws:
WingException

addList

public List addList(String name,
                    String type)
             throws WingException
Add a new sublist to this list.

Parameters:
name - (Required) a local identifier used to differentiate the element from its siblings.
type - (May be null) determines the list type. If this is blank the list type is inferred from the context and use.
Returns:
A new sub list.
Throws:
WingException

addList

public List addList(String name)
             throws WingException
Add a new sublist to this list.

Parameters:
name - (Required) a local identifier used to differentiate the element from its siblings.
Returns:
A new sub list.
Throws:
WingException

mergeEqual

public boolean mergeEqual(String namespace,
                          String localName,
                          String qName,
                          Attributes attributes)
Determine if the given SAX startElement event is equivalent to this list.

Specified by:
mergeEqual in interface WingMergeableElement
Parameters:
namespace - The element's name space
localName - The local, unqualified, name for this element
qName - The qualified name for this element
attributes - The element's attributes
Returns:
True if this list is equivalent to the given SAX Event.

mergeChild

public WingMergeableElement mergeChild(String namespace,
                                       String localName,
                                       String qName,
                                       Attributes attributes)
                                throws SAXException,
                                       WingException
Merge the given SAX startElement event into this list's child. If this SAX event matches a child element of this list then it should be removed from the internal book keep of this element and returned. Typically this is accomplished by looping through all children elements and returned the first one that returns true for the mergeEqual method.

Specified by:
mergeChild in interface WingMergeableElement
Parameters:
namespace - The element's name space
localName - The local, unqualified, name for this element *
qName - The qualified name for this element
attributes - The element's attributes
Returns:
The child element
Throws:
SAXException
WingException

merge

public Attributes merge(Attributes attributes)
                 throws SAXException,
                        WingException
Inform this list that it is being merged with an existing element. Practically this means that when this method is being transformed to SAX it should assume that the element's SAX events have already been sent. In this case the element would only need to transform to SAX the children of this element. Furthermore, if the element needs to add any attributes to the SAX startElement event it may modify the attributes object passed to make changes.

Specified by:
merge in interface WingMergeableElement
Returns:
The attributes for this merged element
Throws:
SAXException
WingException

toSAX

public void toSAX(ContentHandler contentHandler,
                  LexicalHandler lexicalHandler,
                  NamespaceSupport namespaces)
           throws SAXException
Translate this element and all contained elements into SAX events. The events should be routed to the contentHandler found in the WingContext.

Specified by:
toSAX in interface WingElement
Parameters:
contentHandler - (Required) The registered contentHandler where SAX events should be routed too.
lexicalHandler - (Required) The registered lexicalHandler where lexical events (such as CDATA, DTD, etc) should be routed too.
namespaces - (Required) SAX Helper class to keep track of namespaces able to determine the correct prefix for a given namespace URI.
Throws:
SAXException

dispose

public void dispose()
dispose

Specified by:
dispose in interface WingElement
Overrides:
dispose in class AbstractWingElement


Copyright © 2012 DuraSpace. All Rights Reserved.