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

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

public class Division
extends AbstractWingElement
implements StructuralElement, WingMergeableElement


Field Summary
static String A_ACTION
          The name of the action attribute
static String A_BEHAVIOR
          The name of the method attribute
static String A_BEHVIOR_SENSITIVE_FIELDS
          The name of the continuation name attribute.
static String A_CURRENT_PAGE
          The name of the current page attribute
static String A_FIRST_ITEM_INDEX
          The name of the first item index attribute
static String A_INTERACTIVE
          The name of the interactive attribute
static String A_ITEMS_TOTAL
          The name of the items total attribute
static String A_LAST_ITEM_INDEX
          The name of the last item index attribute
static String A_METHOD
          The name of the method attribute
static String A_NEXT_PAGE
          The name of the next page attribute
static String A_PAGE_URL_MASK
          The name of the page url mask attribute
static String A_PAGES_TOTAL
          The name of the pages total attribute
static String A_PAGINATION
          The name of the pagination attribute
static String A_PREVIOUS_PAGE
          The name of the previous page attribute
static String E_DIVISION
          The name of the division element
static String METHOD_GET
          The possible interactive division methods: get, post, or multipart.
static String METHOD_MULTIPART
           
static String METHOD_POST
           
static String[] METHODS
          The possible interactive division methods names collected into one array
static String PAGINATION_MASKED
           
static String PAGINATION_SIMPLE
          The possible pagination types: simple & masked
static String[] PAGINATION_TYPES
          The possible pagination division 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 Division(WingContext context, String name, String rend)
          Construct a non-interactive division.
protected Division(WingContext context, String name, String action, String method, String rend)
          Construct an interactive division.
 
Method Summary
 void addBehaviorSensitiveField(String fieldName)
          Add to the list of behavior sensitive fields, these fields should be updated each time a request partial page is submitted.
 Division addDivision(String name)
          Add a sub division for further logical grouping of content.
 Division addDivision(String name, String rend)
          Add a sub division for further logical grouping of content.
 Hidden addHidden(String name)
          Add a hidden field to the division, this is a common operation that is not directly supported by DRI.
 Division addInteractiveDivision(String name, String action, String method)
          Add an interactive sub division for further logical grouping of content without specifying special rendering instructions.
 Division addInteractiveDivision(String name, String action, String method, String rend)
          Add an interactive sub division for further logical grouping of content.
 List addList(String name)
          Append a list to the division.
 List addList(String name, String type)
          Append a list to the division.
 List addList(String name, String type, String rend)
          append a list to the division.
 Para addPara()
          Append an unnamed paragraph to the division
 void addPara(Message message)
          Append a paragraph to the division and set the content of the paragraph.
 void addPara(String characters)
          Append a paragraph to the division and set the content of the paragraph.
 Para addPara(String name, String rend)
          Append a paragraph to the division
 ReferenceSet addReferenceSet(String name, String type)
          Add a reference set for metadata references.
 ReferenceSet addReferenceSet(String name, String type, String orderBy, String rend)
          Add a reference set for metadata references.
 void addSimpleHTMLFragment(boolean blankLines, String HTML)
          Add a section of translated HTML to the DRI document.
 Table addTable(String name, int rows, int cols)
          Append a table to the division.
 Table addTable(String name, int rows, int cols, String rend)
          Append a table to the division.
 void dispose()
          dispose
 void enableAJAX()
          Enable AJAX behaviors on this interactive division.
 Attributes merge(Attributes attributes)
          Notify this element that it is being merged.
 WingMergeableElement mergeChild(String namespace, String localName, String qName, Attributes attributes)
          Merge the given sub-domain of metadata elements.
 boolean mergeEqual(String namespace, String localName, String qName, Attributes attributes)
          Determine if the given SAX event is the same division element.
 Head setHead()
          Set the head element which is the label associated with this division.
 void setHead(Message message)
          Set the head element which is the label associated with this division.
 void setHead(String characters)
          Set the head element which is the label associated with this division.
 void setMaskedPagination(int itemsTotal, int firstItemIndex, int lastItemIndex, int currentPage, int pagesTotal, String pageURLMask)
          Make this div paginated ( a div that spans multiple pages ) using the masked page paradigm.
 void setSimplePagination(int itemsTotal, int firstItemIndex, int lastItemIndex, String previousPage, String nextPage)
          Make this div paginated ( a div that spans multiple pages ) using the simple page paradigm.
 void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, NamespaceSupport namespaces)
          Translate this division to SAX
 
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_DIVISION

public static final String E_DIVISION
The name of the division element

See Also:
Constant Field Values

A_INTERACTIVE

public static final String A_INTERACTIVE
The name of the interactive attribute

See Also:
Constant Field Values

A_ACTION

public static final String A_ACTION
The name of the action attribute

See Also:
Constant Field Values

A_METHOD

public static final String A_METHOD
The name of the method attribute

See Also:
Constant Field Values

A_BEHAVIOR

public static final String A_BEHAVIOR
The name of the method attribute

See Also:
Constant Field Values

A_BEHVIOR_SENSITIVE_FIELDS

public static final String A_BEHVIOR_SENSITIVE_FIELDS
The name of the continuation name attribute.

See Also:
Constant Field Values

A_PAGINATION

public static final String A_PAGINATION
The name of the pagination attribute

See Also:
Constant Field Values

A_PREVIOUS_PAGE

public static final String A_PREVIOUS_PAGE
The name of the previous page attribute

See Also:
Constant Field Values

A_NEXT_PAGE

public static final String A_NEXT_PAGE
The name of the next page attribute

See Also:
Constant Field Values

A_ITEMS_TOTAL

public static final String A_ITEMS_TOTAL
The name of the items total attribute

See Also:
Constant Field Values

A_FIRST_ITEM_INDEX

public static final String A_FIRST_ITEM_INDEX
The name of the first item index attribute

See Also:
Constant Field Values

A_LAST_ITEM_INDEX

public static final String A_LAST_ITEM_INDEX
The name of the last item index attribute

See Also:
Constant Field Values

A_CURRENT_PAGE

public static final String A_CURRENT_PAGE
The name of the current page attribute

See Also:
Constant Field Values

A_PAGES_TOTAL

public static final String A_PAGES_TOTAL
The name of the pages total attribute

See Also:
Constant Field Values

A_PAGE_URL_MASK

public static final String A_PAGE_URL_MASK
The name of the page url mask attribute

See Also:
Constant Field Values

METHOD_GET

public static final String METHOD_GET
The possible interactive division methods: get, post, or multipart.

See Also:
Constant Field Values

METHOD_POST

public static final String METHOD_POST
See Also:
Constant Field Values

METHOD_MULTIPART

public static final String METHOD_MULTIPART
See Also:
Constant Field Values

METHODS

public static final String[] METHODS
The possible interactive division methods names collected into one array


PAGINATION_SIMPLE

public static final String PAGINATION_SIMPLE
The possible pagination types: simple & masked

See Also:
Constant Field Values

PAGINATION_MASKED

public static final String PAGINATION_MASKED
See Also:
Constant Field Values

PAGINATION_TYPES

public static final String[] PAGINATION_TYPES
The possible pagination division types collected into one array

Constructor Detail

Division

protected Division(WingContext context,
                   String name,
                   String rend)
            throws WingException
Construct a non-interactive division.

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.
rend - (May be null) a rendering hint used to override the default display of the element.
Throws:
WingException

Division

protected Division(WingContext context,
                   String name,
                   String action,
                   String method,
                   String rend)
            throws WingException
Construct an interactive division. Interactive divisions must be accompanied by both an action and method to determine how to process form data. The valid values for method may be found in the static variable METHODS.

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.
action - (Required) The form action attribute determines where the form information should be sent for processing.
method - (Required) Accepted values are "get", "post", and "multipart". Determines the method used to pass gathered field values to the handler specified by the action attribute. The multipart method should be used if there are any file fields used within the division.
rend - (May be null) a rendering hint used to override the default display of the element.
Throws:
WingException
Method Detail

enableAJAX

public void enableAJAX()
Enable AJAX behaviors on this interactive division.


addBehaviorSensitiveField

public void addBehaviorSensitiveField(String fieldName)
                               throws WingException
Add to the list of behavior sensitive fields, these fields should be updated each time a request partial page is submitted.

Parameters:
fieldName - (Required) The name of a single field (with no spaces).
Throws:
WingException

setSimplePagination

public void setSimplePagination(int itemsTotal,
                                int firstItemIndex,
                                int lastItemIndex,
                                String previousPage,
                                String nextPage)
Make this div paginated ( a div that spans multiple pages ) using the simple page paradigm.

Parameters:
itemsTotal - (Required) How many items exist across all paginated divs.
firstItemIndex - (Required) The index of the first item included in this div.
lastItemIndex - (Required) The index of the last item included in this div.
previousPage - (May be null) The URL of the previous page of the div, if it exists.
nextPage - (May be null) The URL of the previous page of the div, if it exists.

setMaskedPagination

public void setMaskedPagination(int itemsTotal,
                                int firstItemIndex,
                                int lastItemIndex,
                                int currentPage,
                                int pagesTotal,
                                String pageURLMask)
Make this div paginated ( a div that spans multiple pages ) using the masked page paradigm.

Parameters:
itemsTotal - (Required) How many items exist across all paginated divs.
firstItemIndex - (Required) The index of the first item included in this div.
lastItemIndex - (Required) The index of the last item included in this div.
currentPage - (Required) The index of the page currently displayed for this div.
pagesTotal - (Required) How many pages the paginated div spans.
pageURLMask - (Required) The mask of a URL to a particular within the paginated set. Number of the destination page should replace the {pageNum} string in the URL mask to generate a full URL to that page.

setHead

public Head setHead()
             throws WingException
Set the head element which is the label associated with this division.

Throws:
WingException

setHead

public void setHead(String characters)
             throws WingException
Set the head element which is the label associated with this division.

Parameters:
characters - (May be null) Unprocessed characters to be included
Throws:
WingException

setHead

public void setHead(Message message)
             throws WingException
Set the head element which is the label associated with this division.

Parameters:
message - (Required) A key into the i18n catalogue for translation into the user's preferred language.
Throws:
WingException

addDivision

public Division addDivision(String name,
                            String rend)
                     throws WingException
Add a sub division for further logical grouping of content.

Parameters:
name - (Required) 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 sub Division
Throws:
WingException

addDivision

public Division addDivision(String name)
                     throws WingException
Add a sub division for further logical grouping of content.

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

addInteractiveDivision

public Division addInteractiveDivision(String name,
                                       String action,
                                       String method,
                                       String rend)
                                throws WingException
Add an interactive sub division for further logical grouping of content. The valid values for method may be found in the static variable METHODS.

Parameters:
name - (Required) a local identifier used to differentiate the element from its siblings.
action - (Required) The form action attribute determines where the form information should be sent for processing.
method - (Required) Accepted values are "get", "post", and "multipart". Determines the method used to pass gathered field values to the handler specified by the action attribute. The multipart method should be used if there are any file fields used within the division.
rend - (May be null) a rendering hint used to override the default display of the element.
Returns:
A new interactive sub division
Throws:
WingException

addInteractiveDivision

public Division addInteractiveDivision(String name,
                                       String action,
                                       String method)
                                throws WingException
Add an interactive sub division for further logical grouping of content without specifying special rendering instructions. The valid values for method may be found in the static variable METHODS.

Parameters:
name - (Required) a local identifier used to differentiate the element from its siblings.
action - (Required) The form action attribute determines where the form information should be sent for processing.
method - (Required) Accepted values are "get", "post", and "multipart". Determines the method used to pass gathered field values to the handler specified by the action attribute. The multipart method should be used if there are any file fields used within the division.
Returns:
A new interactive sub division
Throws:
WingException

addPara

public Para addPara(String name,
                    String rend)
             throws WingException
Append a paragraph to the division

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 paragraph.
Throws:
WingException

addPara

public Para addPara()
             throws WingException
Append an unnamed paragraph to the division

Returns:
A new unnamed paragraph.
Throws:
WingException

addPara

public void addPara(String characters)
             throws WingException
Append a paragraph to the division and set the content of the paragraph.

Parameters:
characters - (May be null) Untranslated character data to be included as the contents of this para.
Throws:
WingException

addPara

public void addPara(Message message)
             throws WingException
Append a paragraph to the division and set the content of the paragraph.

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

addList

public List addList(String name,
                    String type,
                    String rend)
             throws WingException
append a list to the division.

Parameters:
name - (Required) a local identifier used to differentiate the element from its siblings.
type - (May be null) an optional attribute to explicitly specify the type of list. In the absence of this attribute, the type of a list will be inferred from the presence and content of labels on its items. Accepted values are found at org.dspace.app.xmlui.xmltool.List.TYPES
rend - (May be null) a rendering hint used to override the default display of the element.
Returns:
A new List
Throws:
WingException

addList

public List addList(String name,
                    String type)
             throws WingException
Append a list to the division.

Parameters:
name - (Required) a local identifier used to differentiate the element from its siblings.
type - (May be null) an optional attribute to explicitly specify the type of list. In the absence of this attribute, the type of a list will be inferred from the presence and content of labels on its items. Accepted values are found at org.dspace.app.xmlui.xmltool.List.TYPES
Returns:
A new List
Throws:
WingException

addList

public List addList(String name)
             throws WingException
Append a list to the division. The list type will be inferred by the presence and contents of labels and items.

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

addTable

public Table addTable(String name,
                      int rows,
                      int cols,
                      String rend)
               throws WingException
Append a table to the division. When creating a table the number of rows and columns contained in the table must be precomputed and provided here.

Parameters:
name - (Required) a local identifier used to differentiate the element from its siblings.
rows - (Required) The number of rows in the table.
cols - (Required) The number of columns in the table.
rend - (May be null) a rendering hint used to override the default display of the element.
Returns:
A new table.
Throws:
WingException

addTable

public Table addTable(String name,
                      int rows,
                      int cols)
               throws WingException
Append a table to the division. When creating a table the number of rows and columns contained in the table must be pre computed and provided here.

Parameters:
name - (Required) a local identifier used to differentiate the element from its siblings.
rows - (Required) The number of rows in the table.
cols - (Required) The number of columns in the table.
Returns:
A new table.
Throws:
WingException

addReferenceSet

public ReferenceSet addReferenceSet(String name,
                                    String type,
                                    String orderBy,
                                    String rend)
                             throws WingException
Add a reference set for metadata references.

Parameters:
name - (Required) a local identifier used to differentiate the element from its siblings.
type - (Required) The include type, see IncludeSet.TYPES
orderBy - (May be null) An statement of ordering within the include set.
rend - (May be null) a rendering hint used to override the default display of the element.
Throws:
WingException

addReferenceSet

public ReferenceSet addReferenceSet(String name,
                                    String type)
                             throws WingException
Add a reference set for metadata references.

Parameters:
name - (Required) a local identifier used to differentiate the element from its siblings.
type - (Required) The include type, see IncludeSet.TYPES
Throws:
WingException

addHidden

public Hidden addHidden(String name)
                 throws WingException
Add a hidden field to the division, this is a common operation that is not directly supported by DRI. To create support for it a new paragraph will be created with the name "hidden-fields" and a render attribute of "hidden".

Parameters:
name - (Required) The hidden fields name.
Returns:
A new hidden field.
Throws:
WingException

addSimpleHTMLFragment

public void addSimpleHTMLFragment(boolean blankLines,
                                  String HTML)
                           throws WingException
Add a section of translated HTML to the DRI document. This will only handle simple transformations such as

, , and tags. Depending on the given HTML this may result in multiple paragraphs being opened and several bold tags being included.

Parameters:
blankLines - (Required) Treat blank lines as paragraphs delimiters.
HTML - (Required) The HTML content
Throws:
WingException

mergeEqual

public boolean mergeEqual(String namespace,
                          String localName,
                          String qName,
                          Attributes attributes)
                   throws SAXException,
                          WingException
Determine if the given SAX event is the same division element. This method will compare interactiveness, and rendering.

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 WingElement is equivalent to the given SAX Event.
Throws:
SAXException
WingException

mergeChild

public WingMergeableElement mergeChild(String namespace,
                                       String localName,
                                       String qName,
                                       Attributes attributes)
                                throws SAXException,
                                       WingException
Merge the given sub-domain of metadata elements.

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
Notify this element that it is being merged.

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 division to SAX

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.