ARoad0.Gui2
Class ISTreeBaseListenerImpl

java.lang.Object
  extended by ARoad0.Gui2.ISTreeBaseListenerImpl
All Implemented Interfaces:
BaseListener, TreeBaseListener, MVC_Controller, java.beans.PropertyChangeListener, java.util.EventListener

public class ISTreeBaseListenerImpl
extends java.lang.Object
implements TreeBaseListener

This class is responsible for listening the events fired by BaseManagerImpl for updating the JTree which is associated to this TreeBaseListener, managing the tree of the IS Structure. Handles 'OneInformationSystem', 'OneInformationSystemNode', 'OneInformationSystemNodeOpening' change properties. The single source is the single instance of gBase.BaseManagerImpl. The closing and deleting operations are not managed. These operations are handled in Gui1/Gui2, in the gDMak classes ActionClose and ActionOpen, and by TreeManager in Gui2.


Field Summary
static ISTreeBaseListenerImpl EMPTY_INSTANCE
          A reusable empty instance for initialization, to avoid the use of 'new' for temporary values.
private static int INITIAL_CAPACITY
           
private  java.util.List l_eventSources_
          contains only BaseManagerImpl firing PropertyChangeEvents
private  boolean listenEvents_
           
private static int PRIME
           
private  javax.swing.tree.DefaultMutableTreeNode root_
          root node of the JTree, which is not an IS node
private  ImmutableName sourceName_
          name of the source for TreeManager
private  javax.swing.JTree tree_
          the JTree
private  javax.swing.tree.DefaultTreeModel treeModel_
          tree model of the JTree
 
Constructor Summary
ISTreeBaseListenerImpl()
          Public constructor.
ISTreeBaseListenerImpl(javax.swing.JTree _tree, javax.swing.tree.MutableTreeNode _root)
          With this constructor, the ISTreeBaseListenerImpl is registered as a listener for BaseManagerImpl firing PropertyChangeEvents, and is associated to the global structure JTree.
 
Method Summary
private  void changeOneInformationSystem(java.beans.PropertyChangeEvent _evt)
          Process event from BaseManagerImpl about 'OneInformationSystem' updatings.
private  void changeOneInformationSystemNode(java.beans.PropertyChangeEvent _evt)
          Process event from BaseManagerImpl about 'OneInformationSystemNode' updatings.
private  void changeOneInformationSystemNodeOpening(java.beans.PropertyChangeEvent _evt)
          Process event from BaseManagerImpl about 'OneInformationSystemNodeOpening' updatings.
 void finalizeForUser()
          Unregister the instance as a listener for all registered sources.
 ImmutableName getEorMainEventSource()
          Get the main event source associated to the instance in its construction, which is sourceName_.
 javax.swing.tree.MutableTreeNode getEorRoot()
          Get the TreeModel root associated to the instance in its construction.
 javax.swing.tree.DefaultTreeModel getEorTreeModel()
          Get the TreeModel associated to the ACS tree instance in its construction.
 void propertyChange(java.beans.PropertyChangeEvent _evt)
          Receives the source events about property changes on 'OneInformationSystem', 'OneInformationSystemNode', 'OneInformationSystemNodeOpening'.
 boolean setListenEvents(boolean _listen)
          To listen or not the events in propertyChange().
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ARoad0.Gui2.BaseListener
hashCode
 

Field Detail

PRIME

private static final int PRIME
See Also:
Constant Field Values

INITIAL_CAPACITY

private static final int INITIAL_CAPACITY
See Also:
Constant Field Values

l_eventSources_

private java.util.List l_eventSources_
contains only BaseManagerImpl firing PropertyChangeEvents


tree_

private javax.swing.JTree tree_
the JTree


treeModel_

private javax.swing.tree.DefaultTreeModel treeModel_
tree model of the JTree


root_

private javax.swing.tree.DefaultMutableTreeNode root_
root node of the JTree, which is not an IS node


sourceName_

private ImmutableName sourceName_
name of the source for TreeManager


listenEvents_

private boolean listenEvents_

EMPTY_INSTANCE

public static final ISTreeBaseListenerImpl EMPTY_INSTANCE
A reusable empty instance for initialization, to avoid the use of 'new' for temporary values. Caution: never change the state of the returned instance.

Constructor Detail

ISTreeBaseListenerImpl

public ISTreeBaseListenerImpl()
Public constructor.


ISTreeBaseListenerImpl

public ISTreeBaseListenerImpl(javax.swing.JTree _tree,
                              javax.swing.tree.MutableTreeNode _root)
With this constructor, the ISTreeBaseListenerImpl is registered as a listener for BaseManagerImpl firing PropertyChangeEvents, and is associated to the global structure JTree. Called by Gui2.ISTree for the IS structure frame.

Parameters:
_tree - associated to the instance
_root - associated to _source in _tree
Throws:
ProcessError - if _source is null
Method Detail

getEorMainEventSource

public ImmutableName getEorMainEventSource()
Get the main event source associated to the instance in its construction, which is sourceName_.

Specified by:
getEorMainEventSource in interface BaseListener
Returns:
name of the main source for PropertyChangeEvents. May be null.

setListenEvents

public boolean setListenEvents(boolean _listen)
To listen or not the events in propertyChange(). No use.

Specified by:
setListenEvents in interface BaseListener
Parameters:
_listen - true to listen the events in this instance, through propertyChange()
Returns:
true if the previous value was different to this argument

getEorTreeModel

public javax.swing.tree.DefaultTreeModel getEorTreeModel()
Get the TreeModel associated to the ACS tree instance in its construction.

Specified by:
getEorTreeModel in interface TreeBaseListener
Returns:
DefaultTreeModel associated to the instance and to a JTree

getEorRoot

public javax.swing.tree.MutableTreeNode getEorRoot()
Get the TreeModel root associated to the instance in its construction.

Specified by:
getEorRoot in interface TreeBaseListener
Returns:
MutableTreeNode associated to the instance in the TreeModel

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent _evt)
Receives the source events about property changes on 'OneInformationSystem', 'OneInformationSystemNode', 'OneInformationSystemNodeOpening'. Throw InternalError if both the old and the new values are non null, or if the two are null. Calls the appropriate private method.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
_evt - PropertyChangeEvent

changeOneInformationSystem

private void changeOneInformationSystem(java.beans.PropertyChangeEvent _evt)
Process event from BaseManagerImpl about 'OneInformationSystem' updatings. Doesn't control the value of a new IS. No action if it is not a registered IS. For removing, the IS name in _evt is a clone, and the IS has been already unregistered in BaseManagerImpl.

Parameters:
_evt - PropertyChangeEvent

changeOneInformationSystemNode

private void changeOneInformationSystemNode(java.beans.PropertyChangeEvent _evt)
Process event from BaseManagerImpl about 'OneInformationSystemNode' updatings. For adding, the IS node may have already children. For removing, the name in _evt is a clone, and the IS node has been already unregistered in BaseManagerImpl. Repaints the 'IS structure' tree and updates the displayed properties

Parameters:
_evt - PropertyChangeEvent

changeOneInformationSystemNodeOpening

private void changeOneInformationSystemNodeOpening(java.beans.PropertyChangeEvent _evt)
Process event from BaseManagerImpl about 'OneInformationSystemNodeOpening' updatings. Repaints the 'IS structure' tree and updates the displayed properties.

Parameters:
_evt - PropertyChangeEvent

finalizeForUser

public void finalizeForUser()
Unregister the instance as a listener for all registered sources. Set the variables to null.

Specified by:
finalizeForUser in interface BaseListener

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
String