org.argouml.uml.ui
Class UMLModelElementTaggedValueProxy

java.lang.Object
  extended byorg.argouml.uml.ui.UMLModelElementTaggedValueProxy
All Implemented Interfaces:
Document, EventListener, PropertyChangeListener, TargetListener, UMLDocument

public class UMLModelElementTaggedValueProxy
extends Object
implements UMLDocument

This class provides a text field that can be used to access tagged values of a ModelElement object. Because TaggedValues are separated ModelElements themselves, it acts as a proxy intermediary to an instance of UMLPlainTextDocument and handles the indirection. UMLModelElementTaggedValueDocument is especially useful when using LabelledLayout.

Since:
15 Feb 2006

Field Summary
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
UMLModelElementTaggedValueProxy(String taggedValue)
          Creates a UMLPlainTextDocument object that represents a tagged value of an ModelElement object.
 
Method Summary
 void addDocumentListener(DocumentListener listener)
           
 void addUndoableEditListener(UndoableEditListener listener)
           
 Position createPosition(int offs)
           
 Element getDefaultRootElement()
           
 Position getEndPosition()
           
 int getLength()
           
protected  String getProperty()
           
 Object getProperty(Object key)
           
 Element[] getRootElements()
           
 Position getStartPosition()
           
 Object getTarget()
          Returns the target.
 String getText(int offset, int length)
           
 void getText(int offset, int length, Segment txt)
           
 void insertString(int offset, String str, AttributeSet a)
           
 void propertyChange(PropertyChangeEvent evt)
           
 void putProperty(Object key, Object value)
           
 void remove(int offs, int len)
           
 void removeDocumentListener(DocumentListener listener)
           
 void removeUndoableEditListener(UndoableEditListener listener)
           
 void render(Runnable r)
           
protected  void setProperty(String text)
          Sets the tagged value to given String.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UMLModelElementTaggedValueProxy

public UMLModelElementTaggedValueProxy(String taggedValue)
Creates a UMLPlainTextDocument object that represents a tagged value of an ModelElement object.

Parameters:
taggedValue - the tagged value
Method Detail

propertyChange

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

setProperty

protected void setProperty(String text)
Sets the tagged value to given String.

Parameters:
text - the property

getProperty

protected String getProperty()
Returns:
the value of the tagged value

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

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)

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)

getDefaultRootElement

public Element getDefaultRootElement()
Specified by:
getDefaultRootElement in interface Document
See Also:
Document.getDefaultRootElement()

getLength

public int getLength()
Specified by:
getLength in interface Document
See Also:
Document.getLength()

render

public void render(Runnable r)
Specified by:
render in interface Document
See Also:
Document.render(Runnable r)

getText

public String getText(int offset,
                      int length)
               throws BadLocationException
Specified by:
getText in interface Document
Throws:
BadLocationException
See Also:
Document.getText(int, int)

addDocumentListener

public void addDocumentListener(DocumentListener listener)
Specified by:
addDocumentListener in interface Document

removeDocumentListener

public void removeDocumentListener(DocumentListener listener)
Specified by:
removeDocumentListener in interface Document

addUndoableEditListener

public void addUndoableEditListener(UndoableEditListener listener)
Specified by:
addUndoableEditListener in interface Document

removeUndoableEditListener

public void removeUndoableEditListener(UndoableEditListener listener)
Specified by:
removeUndoableEditListener in interface Document

getRootElements

public Element[] getRootElements()
Specified by:
getRootElements in interface Document

getEndPosition

public Position getEndPosition()
Specified by:
getEndPosition in interface Document

getStartPosition

public Position getStartPosition()
Specified by:
getStartPosition in interface Document

createPosition

public Position createPosition(int offs)
                        throws BadLocationException
Specified by:
createPosition in interface Document
Throws:
BadLocationException

getText

public void getText(int offset,
                    int length,
                    Segment txt)
             throws BadLocationException
Specified by:
getText in interface Document
Throws:
BadLocationException

getProperty

public Object getProperty(Object key)
Specified by:
getProperty in interface Document

putProperty

public void putProperty(Object key,
                        Object value)
Specified by:
putProperty in interface Document


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook