y.view
Class ViewControl

java.lang.Object
  |
  +--y.view.ViewControl
All Implemented Interfaces:
ViewChangeListener

public class ViewControl
extends Object
implements ViewChangeListener

This class manages the ViewModes on a collection of views. There is always one active View. There is one active Mode for this active View. If a the active View is changed, then the active ViewMode Is transfered to this view.

The active Mode can be changed in two ways:


Field Summary
protected  ViewContainer vc
           
 
Constructor Summary
ViewControl()
          Creates a new ViewControl
ViewControl(ViewContainer vc)
          Creates a new ViewControl for a given ViewContainer.
 
Method Summary
protected static void activateMode(Graph2DView v, ViewMode vl)
          Convinience methods
 void add(ViewMode mode)
          Registers a mode in this control.
 void addPropertyChangeListener(PropertyChangeListener pcl)
          Adds a property change listener to this class.
 void currentViewChanged(View v)
          Current View of the ViewContainer has changed, so transfer the current mode to the new current view
protected static void deactivateMode(Graph2DView v, ViewMode vl)
          Convinience methods
 void dropViewContainer()
          Remove the ViewControl from the ViewContainer.
 ViewMode getCurrentMode()
          Returns the currently activated mode of this view control.
 YCursor getModes()
           
 ViewContainer getViewContainer()
          Get the ViewContainer of this ViewControl
 void popMode()
          Makes the the mode on the top of the stack active
 void pushMode(ViewMode l)
          Pushes the current mode on the top of the Stack and activates a new mode
 void remove(ViewMode mode)
          Removes this mode from this control.
 void setMode(ViewMode viewMode)
          Sets a new active view mode.
protected  void setToCurrent(ViewMode viewMode)
          Sets the given view mode as current view mode.
 void setViewContainer(ViewContainer vc)
          Set the ViewContainer on which this ViewControl works.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vc

protected ViewContainer vc
Constructor Detail

ViewControl

public ViewControl()
Creates a new ViewControl


ViewControl

public ViewControl(ViewContainer vc)
Creates a new ViewControl for a given ViewContainer.

Parameters:
vc - The collection of views which should be controlled
Method Detail

getViewContainer

public ViewContainer getViewContainer()
Get the ViewContainer of this ViewControl

Returns:
The ViewContainer on which this instance works, null if no one is specified.

setViewContainer

public void setViewContainer(ViewContainer vc)
Set the ViewContainer on which this ViewControl works.

Parameters:
vc - A ViewContainer

dropViewContainer

public void dropViewContainer()
Remove the ViewControl from the ViewContainer.


popMode

public void popMode()
Makes the the mode on the top of the stack active


pushMode

public void pushMode(ViewMode l)
Pushes the current mode on the top of the Stack and activates a new mode

Parameters:
l - The mode which should be activated

setMode

public void setMode(ViewMode viewMode)
Sets a new active view mode. Also, this operation clears the stack of formerly pushed modes.

Parameters:
viewMode - a view modeode which replaces the current active mode.

setToCurrent

protected void setToCurrent(ViewMode viewMode)
Sets the given view mode as current view mode.

Parameters:
viewMode - The mode which will become the new current mode

getCurrentMode

public ViewMode getCurrentMode()
Returns the currently activated mode of this view control.


add

public void add(ViewMode mode)
Registers a mode in this control.


remove

public void remove(ViewMode mode)
Removes this mode from this control.


getModes

public YCursor getModes()

currentViewChanged

public void currentViewChanged(View v)
Current View of the ViewContainer has changed, so transfer the current mode to the new current view

Specified by:
currentViewChanged in interface ViewChangeListener

activateMode

protected static void activateMode(Graph2DView v,
                                   ViewMode vl)
Convinience methods


deactivateMode

protected static void deactivateMode(Graph2DView v,
                                     ViewMode vl)
Convinience methods


addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener pcl)
Adds a property change listener to this class. Listeners will be informed when the current view mode of this control changes.


© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003