com.rubecula.util
Class Presentation

java.lang.Object
  extended bycom.rubecula.util.Presentation
All Implemented Interfaces:
Auditable, Identifiable
Direct Known Subclasses:
JQuantityPresentation, MutablePresentation, NumberPresentation, StringPresentation, SymbolicPresentation

public abstract class Presentation
extends java.lang.Object
implements Auditable

This is the base class for presentations to the user, particularly in situations where room for the presentation is limited, such as in a spreadsheet cell.

Note: this class is a co-class with the interface Presentable (each depends on the other).

Important Note: in addition to the contract defined below, it is expected that a concrete instance of Presentation can be constructed with a constructor which takes one String argument.

Version:
$Revision: 1.6 $
Author:
Robin Hillyard

Field Summary
 java.lang.String _Appearance
          This string is purely for debugging purposes.
static java.lang.String $empty
          Empty string constant.
static java.lang.String $Stars
          A long string of stars.
 
Constructor Summary
Presentation()
           
 
Method Summary
 java.lang.String audit()
          Method to return a detailed (unlabeled) string from an arithmetical object for debugging purposes.
 void audit(java.io.PrintStream out, java.lang.String label)
          Method to output a string from an arithmetical object for debugging purposes.
abstract  AttrMap getAttributes()
          Return the attributes with which this presentation was created, or at least the best guess.
abstract  java.lang.String getPresentableClass()
          Method to get the name of the corresponding Presentable class for this Presentation.
 Presentable parse()
          Convert this Presentation into a Presentable object.
 java.lang.String toString()
          Render this Presentation as a String with no width limitation.
abstract  java.lang.String toString(int width)
          Render this Presentation as a String within the width specified.
 void updateAppearance()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rubecula.util.Auditable
audit
 
Methods inherited from interface com.rubecula.util.Identifiable
getIdentifier
 

Field Detail

$empty

public static final java.lang.String $empty
Empty string constant.

See Also:
Constant Field Values

$Stars

public static final java.lang.String $Stars
A long string of stars.

See Also:
Constant Field Values

_Appearance

public java.lang.String _Appearance
This string is purely for debugging purposes.

Constructor Detail

Presentation

public Presentation()
Method Detail

parse

public Presentable parse()
                  throws PresentationException
Convert this Presentation into a Presentable object.

Returns:
an appropriate instance of Presentable and of Class determined by the value of getPresentableClass().
Throws:
PresentationException - if the presentation cannot be parsed.

getPresentableClass

public abstract java.lang.String getPresentableClass()
Method to get the name of the corresponding Presentable class for this Presentation.

Returns:
the presentable class as a String.

getAttributes

public abstract AttrMap getAttributes()
                               throws PresentationException
Return the attributes with which this presentation was created, or at least the best guess.

Returns:
a map of attributes used to render this Presentation.
Throws:
PresentationException

toString

public abstract java.lang.String toString(int width)
                                   throws PresentationException
Render this Presentation as a String within the width specified.

Parameters:
width - the max. number of characters within which to output the presentation.
Returns:
a representation (rendering) of this Presentation.
Throws:
PresentationException - if the presentation cannot be rendered within the given width.

toString

public java.lang.String toString()
Render this Presentation as a String with no width limitation.

Returns:
a representation (rendering) of this Presentation.

audit

public java.lang.String audit()
Method to return a detailed (unlabeled) string from an arithmetical object for debugging purposes.

Specified by:
audit in interface Auditable
Returns:
the detailed string.

audit

public void audit(java.io.PrintStream out,
                  java.lang.String label)
Method to output a string from an arithmetical object for debugging purposes.

Specified by:
audit in interface Auditable
Parameters:
out - the print stream to which audit string is to be sent.
label - the label to attach to the data.

updateAppearance

public void updateAppearance()