org.ceryle.ui
Class EditorPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.ceryle.ui.EditorPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class EditorPanel
extends JPanel

A subclass of JPanel providing an editing view of text content, specifically used for editing document and database Node (ie., record) contents, including some basic node metadata such as creation and modification timestamps, etc.

Note that because some metadata fields are auto-filled, some are entered by hand, and they vary in how they are stored, entified, and used entified. Their get() methods are not consistent in how they return "empty" values, i.e., some return null, some perform whitespace trimming or normalization.

Since:
JDK1.4
Version:
$Id: EditorPanel.java,v 3.34 2007-06-20 01:28:16 altheim Exp $
Author:
Murray Altheim
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  JButton btn_meta_viz
          The corner maximize/minimize button.
static boolean canUndo
          If true (the default) the Undo/Redo features will be active.
protected  Document doc
          The javax.swing.text.Document content of the editor window.
protected  EventListenerList listenerList
          List of edit event listeners.
protected  CompoundEdit m_compoundEdit
          The CompoundEdit object, used only during multiple edits.
protected  org.ceryle.ui.EditorPanel.RedoAction redoAction
          Handles redo edits.
 boolean suppressDirtyStateChange
          When true, suppresses changes to the editor dirtiness state.
static int TAB_CONTENT
          An int constant indicating the content tab.
static int TAB_METADATA
          An int constant indicating the metadata tab.
static int TAB_REVISIONS
          An int constant indicating the revisions tab.
protected  JTabbedPane tabbedpane
           
protected  org.ceryle.ui.EditorPanel.UndoAction undoAction
          Handles undo edits.
protected  UndoableEditListener undoHandler
          Listener for edits on current document.
protected  UndoManager undoManager
          UndoManager to which are added edits.
protected  boolean useCornerButton
          When true, the corner maximize/minimize button is included.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
EditorPanel(DocumentView documentview)
          Constructor with the parent DocumentView documentView.
 
Method Summary
 void addDirtyListener(DirtyListener listener)
          Add a listener for changes to the dirty state.
 void beginCompoundEdit()
          Begins a compound edit session.
 void clearAll(boolean clearTextArea)
          Clears all metadata fields.
 void copy()
          Copies the text area's selection to the system clipboard.
 void cut()
          Deletes the text area's current selection, placing it into the system clipboard.
 void endCompoundEdit()
          Ends a compound edit session.
protected  void fireDirtyStateChanged()
          Notify all listeners that have registered interest for notification on this event type.
 String getCID()
          Returns the collection ID.
 String getContributor()
          Returns the contributor.
 String getCreated()
          Returns the creation date.
 String getCreator()
          Returns the creator.
 String getDescription()
          Returns the description.
protected  DocumentView getDocumentView()
          Return the parent DocumentView.
 Document getEditorDocument()
          Returns the javax.swing.text.Document (currently, a PlainDocument) used as the content storage for this DocumentView's editor text area.
 String getEditorSelectedText()
          Returns the selected text of the editor text area.
 String getFormat()
          Returns the format (MIME type).
 String getHarmonizedNid()
          Returns the node ID, harmonized with the Node ID list in DocumentView.
 String getIsMetadataReference()
          Returns the isMetadataReference.
 MetadataPanel getMetadataPanel()
          Returns the metadata panel.
 String getModified()
          Returns the modified date.
 String getNID()
          Returns the node ID.
protected  org.ceryle.ui.EditorPanel.RedoAction getRedoAction()
          Returns the current RedoAction.
 String getReferences()
          Returns the DCTERMS.references as a WS-delimited String.
 String getRevision()
          Returns the revision number.
 XNodeRevisionManagerPanel getRevisionManagerPanel()
          Returns the third XNodeRevisionManagerPanel tab panel.
 HorizontalRuler getRuler()
          Return the horizontal ruler.
 int getSelectedTab()
          Returns the int indicating which tab is currently selected.
 String getSource()
          Returns the source.
 String getSubject()
          Returns the subject.
 String getSystemId()
          Returns the systemId.
 String getText()
          Returns the content of the JTextArea as a String.
 EditorArea getTextArea()
          Returns the node content JTextArea.
 String getTitle()
          Returns the document title.
protected  org.ceryle.ui.EditorPanel.UndoAction getUndoAction()
          Returns the current UndoAction.
protected  UndoManager getUndoManager()
          Returns the UndoManager used by this EditorPanel.
 boolean isDirty()
          Returns true if the current document has been edited.
 boolean isMetadataVisible()
          Returns the current visibility of the metadata panel.
 boolean isTitleVisible()
          Returns the current visibility of the title panel.
 void paste()
          Pastes the system clipboard to either the text area's selection or its current caret 'dot' position.
 void redo()
          Reverses the previous undo action.
 void removeDirtyListener(DirtyListener listener)
          Remove a listener for changes to the dirty state.
 void requestFocus()
          Sets the current focus to the editor text area.
protected  void resetUndoManager()
          Resets the undo manager.
 void scrollToLine(int line)
          Scrolls the document content to line line of the document.
 void selectAll()
          Selects the entire content of the text area.
 void setCID(String cid, boolean strict)
          Sets the collection ID.
 void setContributor(String contributor)
          Sets the contributor.
 void setCreated(String created)
          Sets the creation date.
 void setCreator(String creator)
          Sets the creator.
 void setDescription(String description)
          Sets the description.
protected  void setDirty(boolean dirty)
          Sets the state indicating that the current document has been edited.
 void setEditorDocument(Document document)
          Set the Document of the editor text area to the doc.
 void setEditorText(String content)
          Sets the content of the editor text area to the provided String content, to an empty String if s is null.
 void setFormat(String format)
          Sets the format (MIME type).
 void setIsMetadataReference(String source)
          Sets the isMetadataReference.
 void setMetadataVisible(boolean visible)
          Shows or hides the metadata panels surrounding the text area.
 void setModified(String modified)
          Sets the modified date.
 void setNID(String nid, boolean strict)
          Sets the node ID.
 void setReferences(String references)
          Sets the DCTERMS.references value.
 void setRevision(String revision)
          Sets the revision number.
protected  void setScrollBarPolicy(boolean always)
          Sets the editor's scrollbar policy to either always present or only as needed.
protected  void setSelectedTab(int tab)
          Set the selected tab to the indicated tab.
 void setSource(String source)
          Sets the source.
 void setSubject(String subject)
          Sets the subject.
 void setSystemId(String systemId)
          Sets the systemId.
 void setTitle(String title)
          Sets the document title.
 void setTitleVisible(boolean visible)
          Sets the visibility of the title panel to the boolean visible.
 void setXID(XNodeID xid, boolean strict)
          Sets the Collection and Node IDs from the provided XNodeID.
 void undo()
          Reverses the previous edit action.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TAB_CONTENT

public static final int TAB_CONTENT
An int constant indicating the content tab.

See Also:
Constant Field Values

TAB_METADATA

public static final int TAB_METADATA
An int constant indicating the metadata tab.

See Also:
Constant Field Values

TAB_REVISIONS

public static final int TAB_REVISIONS
An int constant indicating the revisions tab.

See Also:
Constant Field Values

canUndo

public static boolean canUndo
If true (the default) the Undo/Redo features will be active.


doc

protected Document doc
The javax.swing.text.Document content of the editor window.


useCornerButton

protected boolean useCornerButton
When true, the corner maximize/minimize button is included.


suppressDirtyStateChange

public boolean suppressDirtyStateChange
When true, suppresses changes to the editor dirtiness state.


btn_meta_viz

protected JButton btn_meta_viz
The corner maximize/minimize button.


undoAction

protected org.ceryle.ui.EditorPanel.UndoAction undoAction
Handles undo edits.


redoAction

protected org.ceryle.ui.EditorPanel.RedoAction redoAction
Handles redo edits.


m_compoundEdit

protected CompoundEdit m_compoundEdit
The CompoundEdit object, used only during multiple edits.


undoHandler

protected final UndoableEditListener undoHandler
Listener for edits on current document.


undoManager

protected final UndoManager undoManager
UndoManager to which are added edits.


listenerList

protected EventListenerList listenerList
List of edit event listeners.


tabbedpane

protected JTabbedPane tabbedpane
Constructor Detail

EditorPanel

public EditorPanel(DocumentView documentview)
Constructor with the parent DocumentView documentView.

Method Detail

getDocumentView

protected DocumentView getDocumentView()
Return the parent DocumentView.


setSelectedTab

protected void setSelectedTab(int tab)
Set the selected tab to the indicated tab. The accepted values are:
0
the Document tab
1
the Properties (metadata) tab
2
the References tab


getSelectedTab

public int getSelectedTab()
Returns the int indicating which tab is currently selected. The value will be one of TAB_CONTENT, TAB_METADATA, or TAB_REVISIONS.


getRuler

public HorizontalRuler getRuler()
Return the horizontal ruler.


setScrollBarPolicy

protected void setScrollBarPolicy(boolean always)
Sets the editor's scrollbar policy to either always present or only as needed.


getMetadataPanel

public MetadataPanel getMetadataPanel()
Returns the metadata panel.


setCreated

public void setCreated(String created)
Sets the creation date. For more information on all metadata fields, see MetadataPanel.


getCreated

public String getCreated()
Returns the creation date. For more information on all metadata fields, see MetadataPanel.


setModified

public void setModified(String modified)
Sets the modified date.


getModified

public String getModified()
Returns the modified date.


setTitle

public void setTitle(String title)
Sets the document title.


getTitle

public String getTitle()
Returns the document title.


setSystemId

public void setSystemId(String systemId)
Sets the systemId.


getSystemId

public String getSystemId()
Returns the systemId.


setXID

public void setXID(XNodeID xid,
                   boolean strict)
            throws ProcessException
Sets the Collection and Node IDs from the provided XNodeID.

Throws:
ProcessException
See Also:
MetadataPanel.setCID(String,boolean), MetadataPanel.setNID(String,boolean)

setCID

public void setCID(String cid,
                   boolean strict)
            throws ProcessException
Sets the collection ID. See MetadataPanel.setCID(String,boolean).

Throws:
ProcessException

getCID

public String getCID()
Returns the collection ID.


setNID

public void setNID(String nid,
                   boolean strict)
            throws ProcessException
Sets the node ID. See MetadataPanel.setNID(String,boolean).

Throws:
ProcessException

getNID

public String getNID()
Returns the node ID.


getHarmonizedNid

public String getHarmonizedNid()
                        throws ProcessException
Returns the node ID, harmonized with the Node ID list in DocumentView.

Throws:
ProcessException

setCreator

public void setCreator(String creator)
Sets the creator.


getCreator

public String getCreator()
Returns the creator.


setContributor

public void setContributor(String contributor)
Sets the contributor.


getContributor

public String getContributor()
Returns the contributor.


setRevision

public void setRevision(String revision)
Sets the revision number.


getRevision

public String getRevision()
Returns the revision number.


setFormat

public void setFormat(String format)
Sets the format (MIME type).


getFormat

public String getFormat()
Returns the format (MIME type).


setSource

public void setSource(String source)
Sets the source.


getSource

public String getSource()
Returns the source.


setIsMetadataReference

public void setIsMetadataReference(String source)
Sets the isMetadataReference.


getIsMetadataReference

public String getIsMetadataReference()
Returns the isMetadataReference.


setSubject

public void setSubject(String subject)
Sets the subject.


getSubject

public String getSubject()
Returns the subject.


setDescription

public void setDescription(String description)
Sets the description.


getDescription

public String getDescription()
Returns the description.


setReferences

public void setReferences(