Class SlaveText

java.lang.Object
  |
  +--SlaveText
All Implemented Interfaces:
ContentOwner, MultipleViews

public class SlaveText
extends java.lang.Object
implements ContentOwner, MultipleViews

This class represents a text that is the "slave" of a "master" text. (How Hegelian, no?) Within Arboreal, slave texts are laid out horizontally in the lower portion of the same ArborPanel as their master.

Version:
$2007-05-01 03:22:59 mdh$
Author:
Malcolm D. Hyman

Constructor Summary
SlaveText(ArborPanel panel, java.net.URL slaveURL, java.net.URL mapURL)
           
 
Method Summary
 void acquireEditLock()
          Acquires an edit lock, preventing other views from editing the content.
 void addContentUpdateListener(ContentUpdateListener listener)
          Registers an object to receive ContentUpdateEvents.
 void exposeEditRegister(java.util.List editRegister)
          Exposes the editRegister, so that clients may examine it.
 void exposeNodeRemapping(java.util.Map nodeRemapping)
          Make a node remapping table available to clients.
 void fireContentUpdateEvent(int eventID)
          Sends a ContentUpdateEvent to all listeners.
 ArborPanel getArborPanel()
          Returns the parent ArborPanel.
 java.lang.String getAuthor()
          Returns the author specified in the document metadata.
 ContentRenderPane getContent()
          Returns the associated ContentRenderPane.
 java.net.URL getDocBase()
          Returns the base URL for loading documents.
 DocSpec getDocSpec()
          Returns the DocSpec.
 org.w3c.dom.Document getDocument()
          Returns the already-parsed document.
 java.util.List getEditRegister()
          Retrieves the exposed editRegister.
 EntityHelper getEntityHelper()
          Returns the EntityHelper associated with the document.
 java.lang.String getLanguage()
          Returns the primary language for the document.
 java.lang.String getLocator()
          Returns the locator for this document.
 TextMapping getMapping()
          Returns the TextMapping for this text.
 void getMetadata(org.w3c.dom.Document doc, java.lang.String xmlFilename)
          Extracts metadata from the XML document.
 org.w3c.dom.Node[] getNodes()
          Returns the displayed nodes.
 QueryTable getQueryTable()
          Returns the QueryTable associated with the slave document.
 java.io.File getSaveFile()
          Returns the File to which the DOM should be saved.
 java.net.URL getScriptBase()
          Returns the base URL for running scripts.
 java.lang.String getTitle()
          Returns the title specified in the document metadata.
 UndoState getUndoState()
          Returns a saved UndoState.
 java.lang.String getXMLFilename()
          Returns the filename for the XML document.
 boolean hasEditLock()
          Returns true if an edit lock has been acquired on the content.
 boolean isDirty()
          Returns true if the document (DOM) is "dirty" -- that is, if any changes have been made.
 void makeNewPathWindow()
          Spawns a new frame displaying the selected content.
 void mapNodes(java.util.List sources)
          Sets nodes to show from a list of elements that get mapped through a TextMapping.
 org.w3c.dom.Document parseDocument()
          Parse the XML document.
 void releaseEditLock()
          Releases an edit lock, allowing other views to acquire a lock.
 org.w3c.dom.Node remapNode(org.w3c.dom.Node source)
          Allows clients to obtain the remapping for a node.
 void removeContentUpdateListener(ContentUpdateListener listener)
          Unregisters an object for receiving ContentUpdateEvents.
 void renderContent()
           
 void setDirty(boolean value)
          Sets the "dirty" propery -- that is, whether unsaved changes have been made.
 void setSaveFile(java.io.File file)
          Sets the File to which the DOM should be saved.
 void setUndoState(UndoState undoState)
          Stores an UndoState.
 void showNodes(org.w3c.dom.Node[] nodes)
          Sets the nodes to show.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SlaveText

public SlaveText(ArborPanel panel,
                 java.net.URL slaveURL,
                 java.net.URL mapURL)
          throws TextParseException,
                 MappingParseException
Method Detail

parseDocument

public org.w3c.dom.Document parseDocument()
                                   throws TextParseException
Parse the XML document.
Returns:
parsed XML document

getDocument

public org.w3c.dom.Document getDocument()
Returns the already-parsed document.
Specified by:
getDocument in interface ContentOwner
Returns:
parsed XML document

getMetadata

public void getMetadata(org.w3c.dom.Document doc,
                        java.lang.String xmlFilename)
Extracts metadata from the XML document.
Parameters:
doc - XML document
xmlFilename - filename for XML document

getContent

public ContentRenderPane getContent()
Returns the associated ContentRenderPane.
Specified by:
getContent in interface ContentOwner
Returns:
content pane

renderContent

public void renderContent()

showNodes

public void showNodes(org.w3c.dom.Node[] nodes)
Sets the nodes to show.
Parameters:
nodes - nodes to show

mapNodes

public void mapNodes(java.util.List sources)
Sets nodes to show from a list of elements that get mapped through a TextMapping.
Parameters:
sources - source nodes to be mapped

getMapping

public TextMapping getMapping()
Returns the TextMapping for this text.
Returns:
mapping

getNodes

public org.w3c.dom.Node[] getNodes()
Returns the displayed nodes.
Returns:
displayed nodes

getDocBase

public java.net.URL getDocBase()
Returns the base URL for loading documents.
Specified by:
getDocBase in interface ContentOwner
Returns:
document base URL

getDocSpec

public DocSpec getDocSpec()
Returns the DocSpec.
Specified by:
getDocSpec in interface ContentOwner
Returns:
docspec

getScriptBase

public java.net.URL getScriptBase()
Returns the base URL for running scripts.
Specified by:
getScriptBase in interface ContentOwner
Returns:
script base URL

getXMLFilename

public java.lang.String getXMLFilename()
Returns the filename for the XML document.
Specified by:
getXMLFilename in interface ContentOwner
Returns:
XML document filename

getLanguage

public java.lang.String getLanguage()
Returns the primary language for the document.
Specified by:
getLanguage in interface ContentOwner
Returns:
language identifier for document

getAuthor

public java.lang.String getAuthor()
Returns the author specified in the document metadata.
Specified by:
getAuthor in interface ContentOwner
Returns:
document author

getTitle

public java.lang.String getTitle()
Returns the title specified in the document metadata.
Specified by:
getTitle in interface ContentOwner
Returns:
document title

getLocator

public java.lang.String getLocator()
Returns the locator for this document.
Specified by:
getLocator in interface ContentOwner
Returns:
document title

getArborPanel

public ArborPanel getArborPanel()
Returns the parent ArborPanel.
Specified by:
getArborPanel in interface ContentOwner
Returns:
parent ArborPanel

getQueryTable

public QueryTable getQueryTable()
Returns the QueryTable associated with the slave document.
Specified by:
getQueryTable in interface ContentOwner
Returns:
query table

getEntityHelper

public EntityHelper getEntityHelper()
Returns the EntityHelper associated with the document.
Specified by:
getEntityHelper in interface ContentOwner
Returns:
entity helper

setDirty

public void setDirty(boolean value)
Sets the "dirty" propery -- that is, whether unsaved changes have been made.
Specified by:
setDirty in interface ContentOwner
Parameters:
value - true if changes made

isDirty

public boolean isDirty()
Returns true if the document (DOM) is "dirty" -- that is, if any changes have been made.
Specified by:
isDirty in interface ContentOwner
Returns:
true if changes made

getSaveFile

public java.io.File getSaveFile()
Returns the File to which the DOM should be saved.
Specified by:
getSaveFile in interface ContentOwner
Returns:
save file

setSaveFile

public void setSaveFile(java.io.File file)
Sets the File to which the DOM should be saved.
Specified by:
setSaveFile in interface ContentOwner
Parameters:
file - save file

addContentUpdateListener

public void addContentUpdateListener(ContentUpdateListener listener)
Registers an object to receive ContentUpdateEvents.
Specified by:
addContentUpdateListener in interface MultipleViews
Parameters:
listener - listener for ContentUpdateEvents

removeContentUpdateListener

public void removeContentUpdateListener(ContentUpdateListener listener)
Unregisters an object for receiving ContentUpdateEvents.
Specified by:
removeContentUpdateListener in interface MultipleViews
Parameters:
listener - listener for ContentUpdateEvents

fireContentUpdateEvent

public void fireContentUpdateEvent(int eventID)
Sends a ContentUpdateEvent to all listeners. This method is part of the MultipleViews interface.
Specified by:
fireContentUpdateEvent in interface MultipleViews
Parameters:
eventID - see constants in ContentUpdateEvent

makeNewPathWindow

public void makeNewPathWindow()
Spawns a new frame displaying the selected content. This method is part of the MultipleViews interface.
Specified by:
makeNewPathWindow in interface MultipleViews

exposeNodeRemapping

public void exposeNodeRemapping(java.util.Map nodeRemapping)
Make a node remapping table available to clients. If a node in the DOM is substituted, render panes will need to update their displayed nodes. Clients update in response to a ContentUpdateEvent. This method is part of the MultipleViews interface.
Specified by:
exposeNodeRemapping in interface MultipleViews
Parameters:
nodeRemapping - node to node mapping

remapNode

public org.w3c.dom.Node remapNode(org.w3c.dom.Node source)
Allows clients to obtain the remapping for a node. This method is part of the MultipleViews interface.
Specified by:
remapNode in interface MultipleViews
Parameters:
source - source node
Returns:
target node

acquireEditLock

public void acquireEditLock()
                     throws IllegalEditException
Acquires an edit lock, preventing other views from editing the content. This method is part of the MultipleViews interface.
Specified by:
acquireEditLock in interface MultipleViews

releaseEditLock

public void releaseEditLock()
                     throws IllegalEditException
Releases an edit lock, allowing other views to acquire a lock. This method is part of the MultipleViews interface.
Specified by:
releaseEditLock in interface MultipleViews

hasEditLock

public boolean hasEditLock()
Returns true if an edit lock has been acquired on the content. This method is part of the MultipleViews interface.
Specified by:
hasEditLock in interface MultipleViews

exposeEditRegister

public void exposeEditRegister(java.util.List editRegister)
Exposes the editRegister, so that clients may examine it. This method is part of the MultipleViews interface.
Specified by:
exposeEditRegister in interface MultipleViews
Parameters:
editRegister - edit register

getEditRegister

public java.util.List getEditRegister()
Retrieves the exposed editRegister. This method is part of the MultipleViews interface.
Specified by:
getEditRegister in interface MultipleViews

setUndoState

public void setUndoState(UndoState undoState)
Stores an UndoState.
Specified by:
setUndoState in interface ContentOwner
Parameters:
undoState - undo state information

getUndoState

public UndoState getUndoState()
Returns a saved UndoState.
Specified by:
getUndoState in interface ContentOwner
Returns:
undo state information

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object