com.partnersoft.gui
Class TreeField<T>

java.lang.Object
  extended by com.partnersoft.gui.TreeField<T>
All Implemented Interfaces:
GUIField<T>

public class TreeField<T>
extends java.lang.Object
implements GUIField<T>

A Field implemented with a JTree.

Copyright 2007 Partner Software, Inc.

Version:
$Id: TreeField.java 1979 2009-07-23 14:49:55Z paul $
Author:
Paul Reavis

Constructor Summary
TreeField(javax.swing.tree.TreeModel model)
           
 
Method Summary
 void doAction()
          Subclasses should override this to take action whenever an action should occur (generally when the user hits return in the field).
 javax.swing.JComponent getGUI()
          Returns the GUI component for this field.
 javax.swing.JTree getJTree()
           
 T getValue()
          Returns the current value for this field.
 void managePreferences(java.lang.String path)
          Manages the expanded/contracted and other user state in user preferences, using the given named path to distinguish this from other TreeFields.
 void refreshContents()
           
 void setModel(javax.swing.tree.TreeModel newModel)
           
 void setValue(T newItem)
          Sets the current value for this field.
 void unmanagePreferences()
          Unmanages the preference tracking of expanded/contracted and other user state.
 void valueChanged(T newValue)
          Subclasses should override this to take action whenever the selection changes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeField

public TreeField(javax.swing.tree.TreeModel model)
Method Detail

setModel

public void setModel(javax.swing.tree.TreeModel newModel)

getValue

public T getValue()
Description copied from interface: GUIField
Returns the current value for this field.

Specified by:
getValue in interface GUIField<T>

setValue

public void setValue(T newItem)
Description copied from interface: GUIField
Sets the current value for this field.

Specified by:
setValue in interface GUIField<T>

getJTree

public javax.swing.JTree getJTree()

refreshContents

public void refreshContents()

getGUI

public javax.swing.JComponent getGUI()
Description copied from interface: GUIField
Returns the GUI component for this field.

Specified by:
getGUI in interface GUIField<T>

managePreferences

public void managePreferences(java.lang.String path)
Manages the expanded/contracted and other user state in user preferences, using the given named path to distinguish this from other TreeFields. Separate subpaths with slashes; e.g. "mapsets/Blargle/BlargleTree" should sufficiently identify a TreeField used in a mapset.

Parameters:
path - preference node path for this particular TreeField

unmanagePreferences

public void unmanagePreferences()
Unmanages the preference tracking of expanded/contracted and other user state.

Use this before modifying the tree or its expansion or selection programmatically.


valueChanged

public void valueChanged(T newValue)
Subclasses should override this to take action whenever the selection changes.

Specified by:
valueChanged in interface GUIField<T>

doAction

public void doAction()
Subclasses should override this to take action whenever an action should occur (generally when the user hits return in the field).

Specified by:
doAction in interface GUIField<T>