org.argouml.uml.diagram.ui
Class DiagramNameDocument

java.lang.Object
  extended byorg.argouml.uml.diagram.ui.DiagramNameDocument
All Implemented Interfaces:
DocumentListener, EventListener, TargetListener

class DiagramNameDocument
extends Object
implements DocumentListener, TargetListener

This is the model for the diagram name text box (JTextField) shown on the property panel of a Diagram.

It handles changes by the user in the text-entry field, by updating the name of the diagram. And it handles target changes (i.e. when the user selects another diagram) by updating the name shown in the namefield.


Field Summary
private  JTextField field
           
private  boolean stopEvents
           
 
Constructor Summary
DiagramNameDocument(JTextField theField)
          The constructor.
 
Method Summary
 void changedUpdate(DocumentEvent e)
           
 void insertUpdate(DocumentEvent e)
           
 void removeUpdate(DocumentEvent e)
           
private  void setTarget(Object t)
          If the currently selected object is a diagram, then update the name-field.
 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
private  void update(DocumentEvent e)
          If a new name has been typed by the user, then let's update the name of the diagram.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

field

private JTextField field

stopEvents

private boolean stopEvents
Constructor Detail

DiagramNameDocument

public DiagramNameDocument(JTextField theField)
The constructor.

Method Detail

setTarget

private void setTarget(Object t)
If the currently selected object is a diagram, then update the name-field.

MVW: I added the stopEvents mechanism, because otherwise updating the field causes the UML model to be adapted!

Parameters:
t - the currently selected object

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)

insertUpdate

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

removeUpdate

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

changedUpdate

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

update

private void update(DocumentEvent e)
If a new name has been typed by the user, then let's update the name of the diagram.

Parameters:
e - the documentevent from the Documentlistener interface


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook