fedora.client.objecteditor
Class TextContentEditor

java.lang.Object
  extended by fedora.client.objecteditor.ContentViewer
      extended by fedora.client.objecteditor.ContentEditor
          extended by fedora.client.objecteditor.TextContentEditor
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.DocumentListener

public class TextContentEditor
extends ContentEditor
implements javax.swing.event.DocumentListener

A general-purpose text editor/viewer with XML pretty-printing.


Field Summary
protected  javax.swing.JScrollPane m_component
           
protected  java.awt.event.ActionListener m_dataChangeListener
           
protected  boolean m_dirty
           
protected  javax.swing.text.JTextComponent m_editor
           
protected  java.lang.String m_origContent
           
protected  boolean m_xml
           
static java.lang.String[] s_types
          This class handles all the common text MIME types by default.
 
Constructor Summary
TextContentEditor()
           
 
Method Summary
 void changedUpdate(javax.swing.event.DocumentEvent e)
           
 void changesSaved()
          Called when the caller wants what is in the view to be considered "not dirty" because it's been saved that way.
 javax.swing.JComponent getComponent()
          Get the JComponent.
 java.io.InputStream getContent()
          Gets the content in its edited state.
 java.lang.String[] getTypes()
          Returns a list of content types that this component can handle.
 void init(java.lang.String type, java.io.InputStream data, boolean viewOnly)
          Initializes the handler.
 void insertUpdate(javax.swing.event.DocumentEvent e)
           
 boolean isDirty()
          Returns true if the content should be considered "dirty" (e.g.
 void removeUpdate(javax.swing.event.DocumentEvent e)
           
 void setContent(java.io.InputStream data)
          Re-initializes the handler given new input data.
 void setContentChangeListener(java.awt.event.ActionListener listener)
          Sets the listener that this ContentEditor will notify via listener.actionPerformed(...) when any content-changing events occur that could potentially affect its "dirty state" (whether going from not dirty to dirty, or dirty to not dirty).
 void setXML(boolean isXML)
           
 void undoChanges()
          Called when the caller wants to update the view back to the data was originally passed in.
 
Methods inherited from class fedora.client.objecteditor.ContentEditor
isEditor
 
Methods inherited from class fedora.client.objecteditor.ContentViewer
newInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s_types

public static java.lang.String[] s_types
This class handles all the common text MIME types by default.


m_dirty

protected boolean m_dirty

m_dataChangeListener

protected java.awt.event.ActionListener m_dataChangeListener

m_editor

protected javax.swing.text.JTextComponent m_editor

m_component

protected javax.swing.JScrollPane m_component

m_xml

protected boolean m_xml

m_origContent

protected java.lang.String m_origContent
Constructor Detail

TextContentEditor

public TextContentEditor()
Method Detail

getTypes

public java.lang.String[] getTypes()
Description copied from class: ContentViewer
Returns a list of content types that this component can handle. This will usually be a list of MIME Types, but may also include other notions of type known to be understood by the users of ContentHandlerFactory.

Specified by:
getTypes in class ContentViewer

init

public void init(java.lang.String type,
                 java.io.InputStream data,
                 boolean viewOnly)
          throws java.io.IOException
Description copied from class: ContentViewer
Initializes the handler. This should only be called once per instance, and is guaranteed to have been called when this component is provided by the ContentHandlerFactory. The viewOnly parameter signals to ContentEditor implementations that editing capabilities are not desired by the caller.

Specified by:
init in class ContentViewer
Throws:
java.io.IOException

setXML

public void setXML(boolean isXML)

setContent

public void setContent(java.io.InputStream data)
                throws java.io.IOException
Description copied from class: ContentViewer
Re-initializes the handler given new input data. The old data can be discarded.

Specified by:
setContent in class ContentViewer
Throws:
java.io.IOException

getComponent

public javax.swing.JComponent getComponent()
Description copied from class: ContentViewer
Get the JComponent.

Specified by:
getComponent in class ContentViewer

changesSaved

public void changesSaved()
Description copied from class: ContentEditor
Called when the caller wants what is in the view to be considered "not dirty" because it's been saved that way.

Specified by:
changesSaved in class ContentEditor

undoChanges

public void undoChanges()
Description copied from class: ContentEditor
Called when the caller wants to update the view back to the data was originally passed in.

Specified by:
undoChanges in class ContentEditor

isDirty

public boolean isDirty()
Description copied from class: ContentEditor
Returns true if the content should be considered "dirty" (e.g. it has changed due to some form of editing).

Specified by:
isDirty in class ContentEditor

setContentChangeListener

public void setContentChangeListener(java.awt.event.ActionListener listener)
Description copied from class: ContentEditor
Sets the listener that this ContentEditor will notify via listener.actionPerformed(...) when any content-changing events occur that could potentially affect its "dirty state" (whether going from not dirty to dirty, or dirty to not dirty).

Specified by:
setContentChangeListener in class ContentEditor

getContent

public java.io.InputStream getContent()
                               throws java.io.IOException
Description copied from class: ContentEditor
Gets the content in its edited state.

Specified by:
getContent in class ContentEditor
Throws:
java.io.IOException

changedUpdate

public void changedUpdate(javax.swing.event.DocumentEvent e)
Specified by:
changedUpdate in interface javax.swing.event.DocumentListener

insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent e)
Specified by:
insertUpdate in interface javax.swing.event.DocumentListener

removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent e)
Specified by:
removeUpdate in interface javax.swing.event.DocumentListener