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

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

public class Body
extends AbstractWingElement
implements WingMergeableElement

A class representing the page division. The body contains any number of divisions (div elements) which group content into interactive and non interactive display blocks.

Author:
Scott Phillips

Field Summary
static String E_BODY
          The name of the body element
 
Fields inherited from class org.dspace.app.xmlui.wing.element.AbstractWingElement
context
 
Constructor Summary
protected Body(WingContext context)
          Generate a new Body framework element.
 
Method Summary
 Division addDivision(String name)
          Append a new division (div element) to the document's body.
 Division addDivision(String name, String rend)
          Append a new division (div element) to the document's body.
 Division addInteractiveDivision(String name, String action, String method, String rend)
          Append a new interactive division (div element) to the document's body.
 void dispose()
          dispose
 Attributes merge(Attributes attributes)
          Inform this element that it is being merged with an existing body.
 WingMergeableElement mergeChild(String namespace, String localName, String qName, Attributes attributes)
          Merge this SAX event into the body.
 boolean mergeEqual(String namespace, String localName, String qName, Attributes attributes)
          Is this SAX event equivalent to this body?
 void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, NamespaceSupport namespaces)
          Translate into 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_BODY

public static final String E_BODY
The name of the body element

See Also:
Constant Field Values
Constructor Detail

Body

protected Body(WingContext context)
        throws WingException
Generate a new Body framework element. This method will NOT open or close a body element instead it expects that those events are being handled by the caller. It is important to note that other divisions (div elements) may precede or follow the divisions created through this object.

Parameters:
context - (Required) The context this element is contained in.
Throws:
WingException
Method Detail

addDivision

public Division addDivision(String name,
                            String rend)
                     throws WingException
Append a new division (div element) to the document's body. The division created is not interactive meaning that it may not contain any form elements, to create an interactive division use addInteractiveDivision().

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

addDivision

public Division addDivision(String name)
                     throws WingException
Append a new division (div element) to the document's body. This is a short cut method for divisions without special rendering instructions. The division created is not interactive meaning that it may not contain any form elements, to create an interactive division use addInteractiveDivision().

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

addInteractiveDivision

public Division addInteractiveDivision(String name,
                                       String action,
                                       String method,
                                       String rend)
                                throws WingException
Append a new interactive division (div element) to the document's body. An interactive division is able to contain form elements as. The extra parameters required such as action and method dictate where and how the form data should be processed.

Parameters:
name - (Required) a local identifier used to differentiate the element from its siblings.
action - (Required) determines where the form information should be sent for processing.
method - (Required) 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 division.
Throws:
WingException

mergeEqual

public boolean mergeEqual(String namespace,
                          String localName,
                          String qName,
                          Attributes attributes)
                   throws SAXException,
                          WingException
Is this SAX event equivalent to this body?

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 it is equivalent.
Throws:
SAXException
WingException

mergeChild

public WingMergeableElement mergeChild(String namespace,
                                       String localName,
                                       String qName,
                                       Attributes attributes)
                                throws SAXException,
                                       WingException
Merge this SAX event into the body.

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:
Throws:
SAXException
WingException

merge

public Attributes merge(Attributes attributes)
                 throws SAXException,
                        WingException
Inform this element that it is being merged with an existing body.

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

toSAX

public void toSAX(ContentHandler contentHandler,
                  LexicalHandler lexicalHandler,
                  NamespaceSupport namespaces)
           throws SAXException
Translate into 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.