Class ArborPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--ArborPanel
All Implemented Interfaces:
javax.accessibility.Accessible, ContentOwner, java.util.EventListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.MenuContainer, MultipleViews, java.io.Serializable, javax.swing.event.TreeExpansionListener, javax.swing.event.TreeSelectionListener

public class ArborPanel
extends javax.swing.JPanel
implements javax.swing.event.TreeExpansionListener, javax.swing.event.TreeSelectionListener, ContentOwner, MultipleViews, java.awt.event.FocusListener

This is the main panel (consisting of a split pane with a tree view and a flattened view of a part of the XML document -- the so-called ContentRenderPane) used by both the application and applet versions of "Arboreal."

Version:
$2007-05-01 03:21:36 mdh$
Author:
Malcolm D. Hyman
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static java.awt.Font defaultFont
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ArborPanel(int initWidth, int initHeight, int split)
          Constructor.
 
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 addToCatalog()
          Adds the master text to the catalog (and to the catalog DOM, which can be serialized).
 void addToView(javax.swing.tree.TreePath[] newPaths)
          Adds newPaths to the current selection in the JTree.
 void addToView(javax.swing.tree.TreePath[] newPaths, boolean keepHighlight)
          Adds newPaths to the current selection in the JTree.
 void adjustTree(int level, boolean render)
          Sets the number of levels shown in the tree.
 void cleanup()
          Cleans up, when it's time for us to give up the ghost.
 void clearLinked()
          Clears the mode where linked texts are displayed in a split pane.
 void commitEdits()
          Commits edits on any clients with active edits.
 void copyLink()
          Copies xlinks for the selected nodes to the system clipboard.
 void copyToClipboard()
          This method makes the current selection available to the system clipboard.
 void doWindowLayout()
          Makes necessary changes to the layout of the bottom pane when a slave text is opened or dropped.
 void dropSlaveText(SlaveText slave)
          Drops a slave text and its associated ContentRenderPane.
 void expandPaths(java.util.Enumeration expandPaths)
          Expands the enumerated paths in the tree.
 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.
 void fireContentUpdateEventIfLocatorPresent(java.lang.String locator)
          Fires a ContentUpdateEvent if locator is represented either as the master text or as a slave text.
 void focusGained(java.awt.event.FocusEvent e)
          This method is part of the FocusListener interface.
 void focusLost(java.awt.event.FocusEvent e)
          This method is part of the FocusListener interface.
 void forceRedraw()
          Forces redraw.
 void gc()
          Forces garbage collection and displays memory diagnostics.
 ArborAgent getArborAgent()
          Returns the ArborAgent (ArborApplication or ArborApplet) responsible for this ArborPanel.
 ArborPanel getArborPanel()
          This method is part of the ContentOwner interface.
 java.lang.String getAuthor()
          Returns the author specified in the document metadata.
 java.awt.datatransfer.Clipboard getClipboard()
          Returns the system clipboard.
 ContentRenderPane getContent()
          Returns the primary ContentRenderPane.
static java.awt.Font getDefaultFont()
          Returns the default font.
 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.
 ContentRenderPane getFocusedContent()
          Returns the focused content pane (or null).
 java.lang.String getLanguage()
          Returns the primary language for the document.
 javax.swing.tree.TreePath getLeadPath()
          Returns the lead path.
static java.lang.String getLinksForPaths(ContentOwner text, javax.swing.tree.TreePath[] pathArray)
          Returns a string containing links for a set of paths.
 java.lang.String getLocator()
          Returns the locator for this document.
 void getMetadata(org.w3c.dom.Document doc, java.lang.String xmlFilename)
          Extracts metadata from the XML document.
 org.apache.oro.text.perl.Perl5Util getPerlRE()
          Returns our instance of the ORO Perl5 regular expression utility class.
 QueryTable getQueryTable()
          Returns the QueryTable associated with the main document.
 DOMTreeCellRenderer getRenderer()
          Returns the DOMTreeCellRenderer.
 int[] getRowsForPaths(javax.swing.tree.TreePath[] paths)
          Returns an array of rows corresponding to the TreePaths paths.
 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.
 SearchTool getSearchTool()
          Returns the SearchTool.
 javax.swing.tree.TreePath[] getSelectedPaths()
          Returns the selected paths.
 java.util.List getSlaves()
          Returns the list of slave texts.
 int getSplit()
          Returns the direction of the main split.
 java.lang.String getTitle()
          Returns the title specified in the document metadata.
 javax.swing.JTree getTree()
          Returns the JTree in this ArborPanel.
 DOMTreeModel getTreeModel()
          Returns the JTree model.
 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.
 void initDocument(org.w3c.dom.Document doc, java.net.URL docBase, java.lang.String xmlFilename)
          Initializes a loaded document.
 void invertSelection()
          Inverts the selection, i.e.
 boolean isDirty()
          Returns true if the document (DOM) is "dirty" -- that is, if any changes have been made.
 void levelDialog()
          This method displays the "Show levels" dialog, which allows the user to expand the tree up to depth d, where 0 < d <= DocSpec.MAX_LEVEL.
 void loadDocument(org.w3c.dom.Document doc, java.net.URL docBase, java.lang.String xmlFilename)
          Imports a document and displays its contents in the JTree.
 void loadDocument(org.w3c.dom.Document doc, java.net.URL docBase, java.lang.String xmlFilename, java.util.Map entityMap)
          Imports a document and displays its contents in the JTree.
 void loadLinked()
          Sets up the mode where linked texts are displayed in a split pane.
 void loadSlaveText()
          Allows the user to load a slave text.
 void loadText(java.net.URL docBase, java.lang.String xmlFilename)
          Parses a master text from a URL.
 void makeNewPathWindow()
          Spawns a new frame displaying the selected content.
static javax.swing.tree.TreePath makePath(org.w3c.dom.Node n)
          Returns a path that specifies the location of a given DOM node for the JTree.
 void makeVisible(javax.swing.tree.TreePath path)
          Ensures that a particular path in the tree is visible.
 void openLinks()
          Allows the users to view the targets of all links present in the selection in the corresponding JTree(s).
 void redrawTree()
          Destroys all information cached by the JTree.
 void refresh()
          Refreshes the master text and related content.
 void registerEdit()
          Registers a client with active edits.
 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(ContentRenderPane c)
          Renders the current paths in the ContentRenderPane.
 void renderContent(ContentRenderPane c, javax.swing.tree.TreePath[] paths, HighlightState highlightState)
          Renders paths in the ContentRenderPane.
 void repaintHighlights()
          Repaints highlights in all content panes.
 void selectParent()
          Selects the parent of all paths in the current selection; this selection method is additive.
 void selectSubtree()
          Selects the subtree below all paths in the current selection; this selection method is additive.
 void selectXPath()
          Allows the user to select part of the tree with an XPath expression.
 void setDirty(boolean value)
          Sets the "dirty" propery -- that is, whether unsaved changes have been made.
 void setDisplay()
          Allows the user to set the display filter options.
 void setDisplayingHit(boolean value)
          Sets whether the panel is displaying a search hit.
 void setFontSize(int size)
          This method sets the font size in the various rendering panes.
 void setSaveFile(java.io.File file)
          Sets the File to which the DOM should be saved.
 void setUndoState(UndoState undoState)
          Stores an UndoState.
 void setView(javax.swing.tree.TreePath[] newPaths)
          Selects newPaths in the JTree.
 void setView(javax.swing.tree.TreePath[] newPaths, boolean keepHighlight)
          Selects newPaths in the JTree.
 void setView(javax.swing.tree.TreePath[] newPaths, ContentRenderPane newContent)
          Selects newPaths in the JTree and inserts newContent as the primary ContentRenderPane.
 void setViewAndPreserveExpansionState(javax.swing.tree.TreePath[] newPaths)
          Selects newPaths in the JTree.
 void showInfo(ContentOwner owner, java.awt.Container parent)
          Displays information for the main text.
 javax.swing.tree.TreePath[] sortPaths(javax.swing.tree.TreePath[] unsortedPaths)
          Sorts an array of paths in the order in which they appear in the tree rows.
 void status(java.lang.String message, int priority)
          Displays a status message.
 void switchSplit(int split)
          Switches the main split direction (vertical or horizontal).
 void synchronizeShowTags()
          Ensures that the tag state of all panes is synchronized.
 void toggleShowTags()
          Toggles show-tags mode for the main view of the master and all slaves.
 void toggleTreeView()
          Toggles the tree view (XML or rendered).
 java.lang.String toString()
           
 void treeCollapsed(javax.swing.event.TreeExpansionEvent evt)
          This method is part of the TreeExpansionListener interface.
 void treeExpanded(javax.swing.event.TreeExpansionEvent evt)
          This method is part of the TreeExpansionListener interface.
 void undoEdits()
          Requests an "undo" on any clients with active edits.
 void unregisterEdit()
          Unregisters a client with active edits.
 void updatePaths(org.w3c.dom.Node source, org.w3c.dom.Node target)
          Updates the path information when a DOM node has been changed.
 void valueChanged(javax.swing.event.TreeSelectionEvent evt)
          This method is part of the TreeSelectionListener interface.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

defaultFont

public static java.awt.Font defaultFont
Constructor Detail

ArborPanel

public ArborPanel(int initWidth,
                  int initHeight,
                  int split)
Constructor.
Parameters:
initHeight - initial height for this panel
Method Detail

switchSplit

public void switchSplit(int split)
Switches the main split direction (vertical or horizontal).
Parameters:
split - VERTICAL or HORIZONTAL

getSplit

public int getSplit()
Returns the direction of the main split.
Returns:
VERTICAL or HORIZONTAL

getDefaultFont

public static java.awt.Font getDefaultFont()
Returns the default font.
Returns:
default font

forceRedraw

public void forceRedraw()
Forces redraw.

loadText

public void loadText(java.net.URL docBase,
                     java.lang.String xmlFilename)
              throws java.lang.Exception
Parses a master text from a URL.
Parameters:
docBase - the base URL for fetching documents
xmlFilename - filename for the master XML text

loadDocument

public void loadDocument(org.w3c.dom.Document doc,
                         java.net.URL docBase,
                         java.lang.String xmlFilename)
Imports a document and displays its contents in the JTree.
Parameters:
doc - DOM
docBase - the base URL for fetching documents
xmlFilename - filename for the master XML text

loadDocument

public void loadDocument(org.w3c.dom.Document doc,
                         java.net.URL docBase,
                         java.lang.String xmlFilename,
                         java.util.Map entityMap)
Imports a document and displays its contents in the JTree.
Parameters:
doc - DOM
docBase - the base URL for fetching documents
xmlFilename - filename for the master XML text
entityMap - entity substitution map

initDocument

public void initDocument(org.w3c.dom.Document doc,
                         java.net.URL docBase,
                         java.lang.String xmlFilename)
Initializes a loaded document.
Parameters:
doc - DOM
docBase - the base URL for fetching documents
xmlFilename - filename for the master XML text

refresh

public void refresh()
Refreshes the master text and related content.

getXMLFilename

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

getDocument

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

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

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

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

treeExpanded

public void treeExpanded(javax.swing.event.TreeExpansionEvent evt)
This method is part of the TreeExpansionListener interface.
Specified by:
treeExpanded in interface javax.swing.event.TreeExpansionListener

treeCollapsed

public void treeCollapsed(javax.swing.event.TreeExpansionEvent evt)
This method is part of the TreeExpansionListener interface.
Specified by:
treeCollapsed in interface javax.swing.event.TreeExpansionListener

valueChanged

public void valueChanged(javax.swing.event.TreeSelectionEvent evt)
This method is part of the TreeSelectionListener interface.

Note to self: should I add some to logic to shorten the rendering operation in the case that we're merely adding paths?

Specified by:
valueChanged in interface javax.swing.event.TreeSelectionListener

sortPaths

public javax.swing.tree.TreePath[] sortPaths(javax.swing.tree.TreePath[] unsortedPaths)
Sorts an array of paths in the order in which they appear in the tree rows.
Parameters:
unsortedPaths - array of paths to sort

invertSelection

public void invertSelection()
Inverts the selection, i.e. expands those nodes that are NOT expanded.

focusGained

public void focusGained(java.awt.event.FocusEvent e)
This method is part of the FocusListener interface.
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
This method is part of the FocusListener interface.
Specified by:
focusLost in interface java.awt.event.FocusListener

getFocusedContent

public ContentRenderPane getFocusedContent()
Returns the focused content pane (or null).
Returns:
focused content pane (or null)

renderContent

public void renderContent(ContentRenderPane c,
                          javax.swing.tree.TreePath[] paths,
                          HighlightState highlightState)
Renders paths in the ContentRenderPane.
Parameters:
c - a content pane
paths - array of paths to render
highlightState - a highlight state to apply

renderContent

public void renderContent(ContentRenderPane c)
Renders the current paths in the ContentRenderPane.
Parameters:
c - a content pane

setFontSize

public void setFontSize(int size)
This method sets the font size in the various rendering panes.
Parameters:
size - font size (in points)

copyToClipboard

public void copyToClipboard()
This method makes the current selection available to the system clipboard.

getLinksForPaths

public static java.lang.String getLinksForPaths(ContentOwner text,
                                                javax.swing.tree.TreePath[] pathArray)
Returns a string containing links for a set of paths.
Parameters:
text - content owner
pathArray - array of TreePaths
Returns:
XLinks

copyLink

public void copyLink()
Copies xlinks for the selected nodes to the system clipboard.

openLinks

public void openLinks()
Allows the users to view the targets of all links present in the selection in the corresponding JTree(s).

selectSubtree

public void selectSubtree()
Selects the subtree below all paths in the current selection; this selection method is additive.

selectParent

public void selectParent()
Selects the parent of all paths in the current selection; this selection method is additive.

levelDialog

public void levelDialog()
This method displays the "Show levels" dialog, which allows the user to expand the tree up to depth d, where 0 < d <= DocSpec.MAX_LEVEL.

adjustTree

public void adjustTree(int level,
                       boolean render)
Sets the number of levels shown in the tree.
Parameters:
level - highest level to show (zero-based)
render - true if content should be rendered

expandPaths

public void expandPaths(java.util.Enumeration expandPaths)
Expands the enumerated paths in the tree.
Parameters:
expandPaths - tree paths to be expanded

getContent

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

getSearchTool

public SearchTool getSearchTool()
Returns the SearchTool.
Returns:
search tool

setDisplayingHit

public void setDisplayingHit(boolean value)
Sets whether the panel is displaying a search hit.
Parameters:
value - true if displaying a hit

getSlaves

public java.util.List getSlaves()
Returns the list of slave texts.
Returns:
list of slave texts

getTreeModel

public DOMTreeModel getTreeModel()
Returns the JTree model.
Returns:
JTree model

getTree

public javax.swing.JTree getTree()
Returns the JTree in this ArborPanel.
Returns:
JTree

getSelectedPaths

public javax.swing.tree.TreePath[] getSelectedPaths()
Returns the selected paths.
Returns:
selected paths

getLeadPath

public javax.swing.tree.TreePath getLeadPath()
Returns the lead path.
Returns:
lead path

gc

public void gc()
Forces garbage collection and displays memory diagnostics.

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

loadSlaveText

public void loadSlaveText()
Allows the user to load a slave text.

dropSlaveText

public void dropSlaveText(SlaveText slave)
Drops a slave text and its associated ContentRenderPane.
Parameters:
slave - slave text to be dropped

doWindowLayout

public void doWindowLayout()
Makes necessary changes to the layout of the bottom pane when a slave text is opened or dropped.

toggleShowTags

public void toggleShowTags()
Toggles show-tags mode for the main view of the master and all slaves.

toggleTreeView

public void toggleTreeView()
Toggles the tree view (XML or rendered).

selectXPath

public void selectXPath()
Allows the user to select part of the tree with an XPath expression. If the result of the expression is not a nodelist, then the result is displayed in a messagebox.

getArborPanel

public ArborPanel getArborPanel()
This method is part of the ContentOwner interface.
Specified by:
getArborPanel in interface ContentOwner
Returns:
the current ArborPanel

addContentUpdateListener

public void addContentUpdateListener(ContentUpdateListener listener)
Registers an object to receive ContentUpdateEvents. This method is part of the MultipleViews interface.
Specified by:
addContentUpdateListener in interface MultipleViews
Parameters:
listener - listener for ContentUpdateEvents

removeContentUpdateListener

public void removeContentUpdateListener(ContentUpdateListener listener)
Unregisters an object for receiving ContentUpdateEvents. This method is part of the MultipleViews interface.
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

fireContentUpdateEventIfLocatorPresent

public void fireContentUpdateEventIfLocatorPresent(java.lang.String locator)
Fires a ContentUpdateEvent if locator is represented either as the master text or as a slave text. This method is part of the MultipleViews interface.

TODO: I would love to remove this method!!!

Parameters:
locator - locator for text

repaintHighlights

public void repaintHighlights()
Repaints highlights in all content panes.

setDisplay

public void setDisplay()
Allows the user to set the display filter options.

redrawTree

public void redrawTree()
Destroys all information cached by the JTree. We need this method so that the labels will be resized correctly (although this seems to be done automatically with Aqua). We might do something less radical; that would involve adding some code to DOMTreeModel.

We also set a right-to-left orientation for the component, if needed.


getRenderer

public DOMTreeCellRenderer getRenderer()
Returns the DOMTreeCellRenderer.
Returns:
DOMTreeCellRenderer

updatePaths

public void updatePaths(org.w3c.dom.Node source,
                        org.w3c.dom.Node target)
Updates the path information when a DOM node has been changed.
Parameters:
source - node that was changed
target - new node

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

getArborAgent

public ArborAgent getArborAgent()
Returns the ArborAgent (ArborApplication or ArborApplet) responsible for this ArborPanel.
Returns:
controlling ArborAgent

showInfo

public void showInfo(ContentOwner owner,
                     java.awt.Container parent)
Displays information for the main text. Metadata file names are not localized at present!
Parameters:
owner - ContentOwner
parent - parent for this dialog

loadLinked

public void loadLinked()
Sets up the mode where linked texts are displayed in a split pane.

clearLinked

public void clearLinked()
Clears the mode where linked texts are displayed in a split pane.

makePath

public static javax.swing.tree.TreePath makePath(org.w3c.dom.Node n)
Returns a path that specifies the location of a given DOM node for the JTree.
Returns:
path for node n

setView

public void setView(javax.swing.tree.TreePath[] newPaths,
                    ContentRenderPane newContent)
Selects newPaths in the JTree and inserts newContent as the primary ContentRenderPane.
Parameters:
newPaths - tree selection paths
newContent - primary ContentRenderPane

setView

public void setView(javax.swing.tree.TreePath[] newPaths)
Selects newPaths in the JTree. The content of the ContentRenderPane is regenerated.
Parameters:
newPaths - tree selection paths

setViewAndPreserveExpansionState

public void setViewAndPreserveExpansionState(javax.swing.tree.TreePath[] newPaths)
Selects newPaths in the JTree. The content of the ContentRenderPane is regenerated. Branches in the tree that are already expanded are not collapsed.
Parameters:
newPaths - tree selection paths
See Also:
setView(TreePath[] newPaths)

setView

public void setView(javax.swing.tree.TreePath[] newPaths,
                    boolean keepHighlight)
Selects newPaths in the JTree. The content of the ContentRenderPane is regenerated.
Parameters:
newPaths - tree selection paths
keepHighlight - true if highlight should be preserved

addToView

public void addToView(javax.swing.tree.TreePath[] newPaths,
                      boolean keepHighlight)
Adds newPaths to the current selection in the JTree. All content is regenerated.
Parameters:
newPaths - tree selection paths
keepHighlight - true if highlight should be preserved

addToView

public void addToView(javax.swing.tree.TreePath[] newPaths)
Adds newPaths to the current selection in the JTree. All content is regenerated. The highlight is not preserved.
Parameters:
newPaths - tree selection paths

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

makeVisible

public void makeVisible(javax.swing.tree.TreePath path)
Ensures that a particular path in the tree is visible.
Parameters:
path - path to make visible

getQueryTable

public QueryTable getQueryTable()
Returns the QueryTable associated with the main 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

addToCatalog

public void addToCatalog()
Adds the master text to the catalog (and to the catalog DOM, which can be serialized).

status

public void status(java.lang.String message,
                   int priority)
Displays a status message.
Parameters:
message - message
priority - priority level

getPerlRE

public org.apache.oro.text.perl.Perl5Util getPerlRE()
Returns our instance of the ORO Perl5 regular expression utility class. This instance allows for regex caching.
Returns:
Perl5 utility class

getClipboard

public java.awt.datatransfer.Clipboard getClipboard()
Returns the system clipboard.
Returns:
clipboard

getRowsForPaths

public int[] getRowsForPaths(javax.swing.tree.TreePath[] paths)
Returns an array of rows corresponding to the TreePaths paths.
Returns:
array of rows

synchronizeShowTags

public void synchronizeShowTags()
Ensures that the tag state of all panes is synchronized. FIXME? Code below might be rewritten so that content is not re- rendered if unnecessary.

cleanup

public void cleanup()
Cleans up, when it's time for us to give up the ghost.

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

registerEdit

public void registerEdit()
Registers a client with active edits.

unregisterEdit

public void unregisterEdit()
Unregisters a client with active edits.

undoEdits

public void undoEdits()
Requests an "undo" on any clients with active edits.

commitEdits

public void commitEdits()
Commits edits on any clients with active edits.

toString

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