Expresso 5-5-0

com.jcorporate.expresso.core.controller
Class Output

java.lang.Object
  extended bycom.jcorporate.expresso.core.controller.ControllerElement
      extended bycom.jcorporate.expresso.core.controller.Output
All Implemented Interfaces:
Cacheable, Cloneable, Serializable

public class Output
extends ControllerElement
implements Cloneable, Cacheable, Serializable

An item returned from a controller to provide output/feedback to the client.
An Output object is one of the three types of object that can be returned by a Controller moving to a new state. The other two are Input and Action items.
An Output item can be a single item, or a list of items, using the "nested" methods in the ControllerElement class.

See Also:
Serialized Form

Constructor Summary
Output()
          Default constructor
Output(String c)
          Convenience constructor for creating an output with a specific string as it's contents in one step
Output(String name, String c)
          Convenience constructor for creating an output with a specific string as it's contents and a name in one step
 
Method Summary
 void addNested(Output o)
          Add a new nested output item to this item
 void clearUsedCount()
          Clears the used count
 Object clone()
          Deep copy clone the object
static ControllerElement fromXML(org.w3c.dom.Node n)
          Return a controller element based upon the xml fragment
 String getAlignment()
          Get the suggested alignment for this item
 String getContent()
          Get the "contents" of this Output, the string value that this Output object represents
 String getKey()
          Get the name of this output element
 String getStyle()
          /** Return the suggested "style" for displaying this Output item
 long getUsedCount()
           
 boolean hasNested(String nestedName)
          Does this output have a nested item with the given name?
 void incrementUsedCount()
           
 void setAlignment(String newAlignment)
          Method used by the Controller to specify a suggested alignment for this Output item
 void setContent(String newContent)
          Used by the Controller to specify the contents string of this Output
 void setKey(String newKey)
           
 void setStyle(String newStyle)
          Used by the Controller to set a suggested "style" for displaying this Output item
 FastStringBuffer toXML(FastStringBuffer stream)
          Concert the object to an xml fragment.
 
Methods inherited from class com.jcorporate.expresso.core.controller.ControllerElement
addNested, allNested, fromXML, getAttribute, getAttributes, getAttributesOrNull, getContent, getContents, getControllerResponse, getDescription, getDisplayLength, getLabel, getLines, getName, getNested, getNested, getNestedCount, getNestedIterator, getNestedMap, getNestedOrNull, getParent, getTitle, getType, remove, removeNested, setAttribute, setControllerResponse, setDescription, setDisplayLength, setLabel, setLines, setName, setParent, setType
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Output

public Output()
Default constructor


Output

public Output(String c)
Convenience constructor for creating an output with a specific string as it's contents in one step

Parameters:
c - The string contents of this Output item

Output

public Output(String name,
              String c)
       throws ControllerException
Convenience constructor for creating an output with a specific string as it's contents and a name in one step

Parameters:
name - The name of this new Output item
c - The string contents of the Output item
Throws:
ControllerException
Method Detail

addNested

public void addNested(Output o)
Add a new nested output item to this item

Parameters:
o - The new Output item to be nested into this one

clearUsedCount

public void clearUsedCount()
Clears the used count


clone

public Object clone()
             throws CloneNotSupportedException
Deep copy clone the object

Overrides:
clone in class ControllerElement
Returns:
Copy of this current output
Throws:
CloneNotSupportedException

getAlignment

public String getAlignment()
Get the suggested alignment for this item

Returns:
The suggested alignment for this Output item

getContent

public String getContent()
Get the "contents" of this Output, the string value that this Output object represents

Returns:
A String value for the contents of this Output

getKey

public String getKey()
Get the name of this output element

Specified by:
getKey in interface Cacheable
Returns:
the key of the output Element

getStyle

public String getStyle()
/** Return the suggested "style" for displaying this Output item

Returns:
A "style" string as suggested by the Controller

getUsedCount

public long getUsedCount()
Returns:
the number of times this output has been used

hasNested

public boolean hasNested(String nestedName)
                  throws ControllerException
Does this output have a nested item with the given name?

Parameters:
nestedName - The name to check against
Returns:
true if there is such an element, else false
Throws:
ControllerException - upon error

incrementUsedCount

public void incrementUsedCount()

setAlignment

public void setAlignment(String newAlignment)
Method used by the Controller to specify a suggested alignment for this Output item

Parameters:
newAlignment - A String suggesting an alignment to the client when displaying this Output item

setContent

public void setContent(String newContent)
Used by the Controller to specify the contents string of this Output

Parameters:
newContent - The new contents string

setKey

public void setKey(String newKey)
Parameters:
newKey - The new Key for the output

setStyle

public void setStyle(String newStyle)
Used by the Controller to set a suggested "style" for displaying this Output item

Parameters:
newStyle - The new "style" to set for this output object

toXML

public FastStringBuffer toXML(FastStringBuffer stream)
Concert the object to an xml fragment.

Overrides:
toXML in class ControllerElement
Parameters:
stream - The fastStringBuffer to append to
Returns:
a FastStingBuffer object that represents this output in an xml fragment

fromXML

public static ControllerElement fromXML(org.w3c.dom.Node n)
                                 throws ControllerException
Return a controller element based upon the xml fragment

Parameters:
n - a DOM node
Returns:
a built ControllerElement
Throws:
ControllerException - if the nodes do not match what we expect

Expresso 5-5-0

Please see www.jcorporate.com for information about new Expresso releases.