org.argouml.uml.ui
Class UMLPlainTextDocument

java.lang.Object
  extended byjavax.swing.text.AbstractDocument
      extended byjavax.swing.text.PlainDocument
          extended byorg.argouml.uml.ui.UMLPlainTextDocument
All Implemented Interfaces:
Document, EventListener, PropertyChangeListener, Serializable, TargetListener, UMLDocument
Direct Known Subclasses:
UMLDiagramNameDocument, UMLDiscriminatorNameDocument, UMLExtensionPointLocationDocument, UMLModelElementCommentDocument, UMLModelElementNameDocument, UMLModelElementTaggedValueDocument, UMLOperationSpecificationDocument, UMLReceptionSpecificationDocument, UMLSynchStateBoundDocument

public abstract class UMLPlainTextDocument
extends PlainDocument
implements UMLDocument

Model for a text property on a model element. It listens to property change events for the given property name so that changes made to the underlying UML model are reflected here.

NOTE: If you override the insertString() or remove() methods be sure to preserve the flushEvents() calls to keep things synchronized. Events caused by updates are delivered asynchronously to the actual update calls.

Since:
Oct 6, 2002
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.text.AbstractDocument
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement
 
Field Summary
 
Fields inherited from class javax.swing.text.PlainDocument
lineLimitAttribute, tabSizeAttribute
 
Fields inherited from class javax.swing.text.AbstractDocument
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
UMLPlainTextDocument(String name)
          Constructor for UMLPlainTextDocument.
 
Method Summary
 String getEventName()
          Returns the eventName.
protected abstract  String getProperty()
           
 Object getTarget()
          Returns the target.
 void insertString(int offset, String str, AttributeSet a)
           
 boolean isEditing()
          Returns the editing.
 void propertyChange(PropertyChangeEvent evt)
           
 void remove(int offs, int len)
           
 void setEditing(boolean ed)
          Sets the editing.
protected  void setEventName(String en)
          Sets the eventName.
protected abstract  void setProperty(String text)
           
 void setTarget(Object target)
          Sets the target.
 void targetAdded(TargetEvent e)
          Fired when a target is added to the list of targets.
 void targetRemoved(TargetEvent e)
          Fired when a target is removed from the list of targets
 void targetSet(TargetEvent e)
          Fired when a total new set of targets is set
 
Methods inherited from class javax.swing.text.PlainDocument
createDefaultRoot, getDefaultRootElement, getParagraphElement, insertUpdate, removeUpdate
 
Methods inherited from class javax.swing.text.AbstractDocument
addDocumentListener, addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.text.Document
addDocumentListener, addUndoableEditListener, createPosition, getDefaultRootElement, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, putProperty, removeDocumentListener, removeUndoableEditListener, render
 

Constructor Detail

UMLPlainTextDocument

public UMLPlainTextDocument(String name)
Constructor for UMLPlainTextDocument. This takes a panel to set the thirdpartyeventlistener to the given list of events to listen to.

Parameters:
name - the event
Method Detail

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Specified by:
propertyChange in interface PropertyChangeListener
See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)

getTarget

public final Object getTarget()
Returns the target.

Returns:
Object

setTarget

public final void setTarget(Object target)
Sets the target.

Parameters:
target - The target to set

insertString

public void insertString(int offset,
                         String str,
                         AttributeSet a)
                  throws BadLocationException
Specified by:
insertString in interface Document
Throws:
BadLocationException
See Also:
Document.insertString( int, java.lang.String, javax.swing.text.AttributeSet)

remove

public void remove(int offs,
                   int len)
            throws BadLocationException
Specified by:
remove in interface Document
Throws:
BadLocationException
See Also:
Document.remove(int, int)

setProperty

protected abstract void setProperty(String text)
Parameters:
text - the value of the property

getProperty

protected abstract String getProperty()
Returns:
the value of the property

isEditing

public boolean isEditing()
Returns the editing.

Returns:
boolean

setEditing

public void setEditing(boolean ed)
Sets the editing.

Parameters:
ed - The editing to set

getEventName

public String getEventName()
Returns the eventName.

Returns:
String

setEventName

protected void setEventName(String en)
Sets the eventName.

Parameters:
en - The eventName to set

targetAdded

public void targetAdded(TargetEvent e)
Description copied from interface: TargetListener
Fired when a target is added to the list of targets.

Specified by:
targetAdded in interface TargetListener
Parameters:
e - The targetevent, name will be TARGET_ADDED
See Also:
TargetListener.targetAdded(org.argouml.ui.targetmanager.TargetEvent)

targetRemoved

public void targetRemoved(TargetEvent e)
Description copied from interface: TargetListener
Fired when a target is removed from the list of targets

Specified by:
targetRemoved in interface TargetListener
Parameters:
e - The targetevent, name will be TARGET_REMOVED
See Also:
TargetListener.targetRemoved(org.argouml.ui.targetmanager.TargetEvent)

targetSet

public void targetSet(TargetEvent e)
Description copied from interface: TargetListener
Fired when a total new set of targets is set

Specified by:
targetSet in interface TargetListener
Parameters:
e - The targetevent, name will be TARGET_SET
See Also:
TargetListener.targetSet(org.argouml.ui.targetmanager.TargetEvent)


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook