edu.ucsb.nceas.morpho.plugins.metadisplay
Class MetaDisplay

java.lang.Object
  |
  +--edu.ucsb.nceas.morpho.plugins.metadisplay.MetaDisplay

public class MetaDisplay
extends java.lang.Object
implements MetaDisplayInterface, EditingCompleteListener

Top-level controller/Mediator class for an instance of a metadata display panel.


Field Summary
static java.lang.String BLANK_HTML_PAGE
           
 
Fields inherited from interface edu.ucsb.nceas.morpho.plugins.MetaDisplayInterface
CLOSE_EVENT, EDIT_BEGIN_EVENT, HISTORY_BACK_EVENT, NAVIGATION_EVENT
 
Constructor Summary
MetaDisplay()
          constructor
 
Method Summary
 void addActionListener(java.awt.event.ActionListener listener)
          Register a java.awt.event.ActionListener to listen for events
 void addEditingCompleteListener(EditingCompleteListener listener)
          Register an EditingCompleteListener to listen for editor events
 void display(java.lang.String identifier)
          method to display metadata in an existing instance of a visual component (metadata identified by the identifier parameter).
 void display(java.lang.String identifier, java.io.Reader XMLDocument)
          method to display metadata in an existing instance of a visual component (metadata is provided as a Reader (the "XMLDocument" parameter), and a required corresponding unique identifier parameter) that can subsequently be used by this component to get the latest instance of the same "XMLDocument" from the XMLFactoryInterface.
 void displayPrevious()
          method to redisplay the previous metadata document from History, by re-obtaining the latest instance of the XML document from the XMLFactoryInterface and re-styling it
 void editingCanceled(java.lang.String xmlString, java.lang.String id, java.lang.String location)
          Required by EditingCompleteListener Interface: this method handles canceled editing
 void editingCompleted(java.lang.String xmlString, java.lang.String id, java.lang.String location)
          Required by EditingCompleteListener Interface: This method is called when editing is complete
protected  void fireActionEvent(int descriptionInt, java.lang.String commandStr)
          Does callback to actionPerformed() method of each java.awt.event.ActionListener in the list of registered listeners.
 java.awt.Component getDisplayComponent(java.lang.String identifier, XMLFactoryInterface factory, java.awt.event.ActionListener listener)
          method used to obtain a visual component (a descendent of java.awt.Component, which will display the XML resource identified by the identifier parameter.
 java.awt.Component getDisplayComponent(XMLFactoryInterface factory, java.awt.event.ActionListener listener)
          method used to obtain a visual component (a descendent of java.awt.Component, which will subsequently display the XML resources identified by unique string IDs.
 XMLFactoryInterface getFactory()
          Get the current XML factory, used to resolve IDs into XML documents
protected  History getHistory()
           
 java.lang.String getIdentifier()
          Get the String identifier associated with the currently-displayed metadata
protected  MetaDisplayUI getMetaDisplayUI()
           
 java.lang.String getTransformerProperty(java.lang.String key)
          method to get the transformer property value corresponding to the passed key
 void redisplay()
          method to redisplay the current metadata, by re-obtaining the latest instance of the XML document from the XMLFactoryInterface and re-styling it
 void removeActionListener(java.awt.event.ActionListener listener)
          Remove this java.awt.event.ActionListener from the list of registered listeners
 void removeEditingCompleteListener(EditingCompleteListener listener)
          Remove this EditingCompleteListener from the list of registered listeners
 void setFactory(XMLFactoryInterface factory)
          Set the current XML factory, used to resolve IDs into XML documents
 void setTitle(java.lang.String title)
          Set the title in the titlebar
 void useTransformerProperty(java.lang.String key, java.lang.String value)
          method to add a key/value transformer property pair to the properties that will be passed onto the XSL Transformation Engine, and will then be made available to the actual XSL stylesheets as values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLANK_HTML_PAGE

public static final java.lang.String BLANK_HTML_PAGE
Constructor Detail

MetaDisplay

public MetaDisplay()
constructor
Method Detail

getDisplayComponent

public java.awt.Component getDisplayComponent(java.lang.String identifier,
                                              XMLFactoryInterface factory,
                                              java.awt.event.ActionListener listener)
                                       throws NullArgumentException,
                                              DocumentNotFoundException
method used to obtain a visual component (a descendent of java.awt.Component, which will display the XML resource identified by the identifier parameter.
Specified by:
getDisplayComponent in interface MetaDisplayInterface
Parameters:
identifier - a unique identifier used to determine what resource to return
factory - an instance of a class that implements XMLFactoryInterface to enable this obj to obtain the actual XML document to display, given the identifier parameter
listener - an ActionListener to be notified of all events generated by this obj
Returns:
a visual component (a descendent of java.awt.Component, which will display the XML resource identified by the identifier parameter.
Throws:
DocumentNotFoundException - if id does not point to a document, or if requested document exists but cannot be accessed.
NullArgumentException - if XML Factory is null.

getDisplayComponent

public java.awt.Component getDisplayComponent(XMLFactoryInterface factory,
                                              java.awt.event.ActionListener listener)
                                       throws NullArgumentException
method used to obtain a visual component (a descendent of java.awt.Component, which will subsequently display the XML resources identified by unique string IDs. However, the initial instance of the component returned by this method will be blank.
Specified by:
getDisplayComponent in interface MetaDisplayInterface
Parameters:
factory - an instance of a class that implements XMLFactoryInterface to enable this obj to obtain the actual XML document to display, given unique identifier parameters
listener - an ActionListener to be notified of all events generated by this obj
Returns:
a visual component (a descendent of java.awt.Component, which is currently blank, but can subsequently be used to display the XML resources identified by unique identifier parameters.
Throws:
NullArgumentException - if XML Factory is null.

display

public void display(java.lang.String identifier)
             throws DocumentNotFoundException
method to display metadata in an existing instance of a visual component (metadata identified by the identifier parameter).
Specified by:
display in interface MetaDisplayInterface
Parameters:
identifier - a unique identifier used to determine what resource to return
Throws:
DocumentNotFoundException - if id does not point to a document, or if requested document exists but cannot be accessed.

display

public void display(java.lang.String identifier,
                    java.io.Reader XMLDocument)
             throws NullArgumentException,
                    DocumentNotFoundException
method to display metadata in an existing instance of a visual component (metadata is provided as a Reader (the "XMLDocument" parameter), and a required corresponding unique identifier parameter) that can subsequently be used by this component to get the latest instance of the same "XMLDocument" from the XMLFactoryInterface.
Specified by:
display in interface MetaDisplayInterface
Parameters:
identifier - a unique identifier that can subsequently be used by this component to get the latest instance of the same "XMLDocument" from the XMLFactoryInterface
XMLDocument - a Reader for the character-based XML document
Throws:
NullArgumentException - if id not provided.
DocumentNotFoundException - if Reader isn't null but can't be read

displayPrevious

public void displayPrevious()
                     throws DocumentNotFoundException
method to redisplay the previous metadata document from History, by re-obtaining the latest instance of the XML document from the XMLFactoryInterface and re-styling it
Specified by:
displayPrevious in interface MetaDisplayInterface
Throws:
DocumentNotFoundException - if id for previous metadata document does not point to an actual document or document cannot be accessed.

redisplay

public void redisplay()
               throws DocumentNotFoundException
method to redisplay the current metadata, by re-obtaining the latest instance of the XML document from the XMLFactoryInterface and re-styling it
Specified by:
redisplay in interface MetaDisplayInterface
Throws:
DocumentNotFoundException - if id does not point to a document, or if requested document exists but cannot be accessed.

addActionListener

public void addActionListener(java.awt.event.ActionListener listener)
Register a java.awt.event.ActionListener to listen for events
Specified by:
addActionListener in interface MetaDisplayInterface
Parameters:
listener -  

removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
Remove this java.awt.event.ActionListener from the list of registered listeners
Specified by:
removeActionListener in interface MetaDisplayInterface
Parameters:
listener -  

fireActionEvent

protected void fireActionEvent(int descriptionInt,
                               java.lang.String commandStr)
Does callback to actionPerformed() method of each java.awt.event.ActionListener in the list of registered listeners.
Parameters:
descriptionInt - integer describing the type of event; eg:
  • MetaDisplayInterface.NAVIGATION_EVENT
  • MetaDisplayInterface.CLOSE_EVENT
  • MetaDisplayInterface.EDIT_BEGIN_EVENT
  • ...etc
descriptionInt - String description of the event that will allow listeners to determine specific information about the action and act accordingly. Could be any unique string identifier
See Also:
MetaDisplayInterface

addEditingCompleteListener

public void addEditingCompleteListener(EditingCompleteListener listener)
Register an EditingCompleteListener to listen for editor events
Specified by:
addEditingCompleteListener in interface MetaDisplayInterface
Parameters:
listener -  

removeEditingCompleteListener

public void removeEditingCompleteListener(EditingCompleteListener listener)
Remove this EditingCompleteListener from the list of registered listeners
Specified by:
removeEditingCompleteListener in interface MetaDisplayInterface
Parameters:
listener -  

editingCompleted

public void editingCompleted(java.lang.String xmlString,
                             java.lang.String id,
                             java.lang.String location)
Required by EditingCompleteListener Interface: This method is called when editing is complete
Specified by:
editingCompleted in interface EditingCompleteListener
Parameters:
xmlString - is the edited XML in String format

editingCanceled

public void editingCanceled(java.lang.String xmlString,
                            java.lang.String id,
                            java.lang.String location)
Required by EditingCompleteListener Interface: this method handles canceled editing
Specified by:
editingCanceled in interface EditingCompleteListener

getFactory

public XMLFactoryInterface getFactory()
Get the current XML factory, used to resolve IDs into XML documents
Returns:
factory an instance of a class that implements XMLFactoryInterface to enable this obj to obtain the actual XML document to display, given the identifier parameter

setFactory

public void setFactory(XMLFactoryInterface factory)
                throws NullArgumentException
Set the current XML factory, used to resolve IDs into XML documents
Parameters:
factory - an instance of a class that implements XMLFactoryInterface to enable this obj to obtain the actual XML document to display, given the identifier parameter
Throws:
NullArgumentException - if factory not provided.

getHistory

protected History getHistory()

getIdentifier

public java.lang.String getIdentifier()
Get the String identifier associated with the currently-displayed metadata
Specified by:
getIdentifier in interface MetaDisplayInterface
Returns:
identifier String identifier associated with the currently-displayed metadata

useTransformerProperty

public void useTransformerProperty(java.lang.String key,
                                   java.lang.String value)
method to add a key/value transformer property pair to the properties that will be passed onto the XSL Transformation Engine, and will then be made available to the actual XSL stylesheets as values
Specified by:
useTransformerProperty in interface MetaDisplayInterface
Parameters:
key -  
value -  

getTransformerProperty

public java.lang.String getTransformerProperty(java.lang.String key)
method to get the transformer property value corresponding to the passed key
Specified by:
getTransformerProperty in interface MetaDisplayInterface
Parameters:
key -  
Returns:
value String value associated with the passed key

getMetaDisplayUI

protected MetaDisplayUI getMetaDisplayUI()

setTitle

public void setTitle(java.lang.String title)
Set the title in the titlebar
Specified by:
setTitle in interface MetaDisplayInterface
Parameters:
identifier - String title to be set in the titlebar


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.