ARoad0.Gui2
Class ViewTreeBaseListenerImpl

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

public class ViewTreeBaseListenerImpl
extends java.lang.Object
implements TreeBaseListener

This class manages one tree view in the explorer. It is responsible for listening the events:

- 'OpenViews' fired BaseManager when the view is closed,

- 'ConnectedACS' fired by the ViewInBase when an implied ACS is closing,

- events fired by the changing ViewInBase objects, through the ViewInBase, for updating the JTree which displays them in the explorer

Each event source is registered only one time. The automatic closing of views are managed only by them, but this class detects the closing by the base, and call ActionClose to call the relevant GUI objects.


Field Summary
private static int INITIAL_CAPACITY
           
private  boolean listenEvents_
           
private static int PRIME
           
private  javax.swing.tree.DefaultMutableTreeNode root_
           
private  javax.swing.tree.DefaultTreeModel treeModel_
           
private  ViewInBase view_
           
private  ImmutableName viewName_
           
 
Constructor Summary
ViewTreeBaseListenerImpl()
          Public constructor.
ViewTreeBaseListenerImpl(ViewInBase _source)
          With this constructor, the ViewTreeBaseListenerImpl is registered as a listener for the view.
 
Method Summary
private  void changeViewTree()
          Update the view tree in the explorer.
 void finalizeForUser()
          Unregister the instance as a listener for the view.
 ImmutableName getEorMainEventSource()
          Get the main event source associated to the instance in its construction.
 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 instance in its construction.
 void propertyChange(java.beans.PropertyChangeEvent _evt)
          Receive the source events about property changes.
 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

view_

private ViewInBase view_

viewName_

private ImmutableName viewName_

root_

private javax.swing.tree.DefaultMutableTreeNode root_

treeModel_

private javax.swing.tree.DefaultTreeModel treeModel_

listenEvents_

private boolean listenEvents_
Constructor Detail

ViewTreeBaseListenerImpl

public ViewTreeBaseListenerImpl()
Public constructor.


ViewTreeBaseListenerImpl

public ViewTreeBaseListenerImpl(ViewInBase _source)
With this constructor, the ViewTreeBaseListenerImpl is registered as a listener for the view. It is associated to the TreeModel of the explorer.

Parameters:
_source - is the view
Method Detail

getEorMainEventSource

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

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 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)
Receive the source events about property changes. Listen 'OpenViews' from the base manager, 'ConnectedACS' and 'OneBaseObjectInView' from the ViewInBase, and 'FirstAccessTarget' from the NoThanViewInBase. When the view fires a 'ConnectedACS' event with a null value, since this means that the view closing by the base is the next step, inform the user and call ActionClose.closeInGUI().

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

changeViewTree

private void changeViewTree()
Update the view tree in the explorer. Call ViewTree.fillViewNodeInExplorer().


finalizeForUser

public void finalizeForUser()
Unregister the instance as a listener for the view. 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