Search this API

y.view
Class ViewControl

java.lang.Object
  extended by y.view.ViewControl
All Implemented Interfaces:
ViewChangeListener

public class ViewControl
extends java.lang.Object
implements ViewChangeListener

This class manages the ViewModes on a collection of views. There is always one active view. There is one active view mode for the active view. If the active view is changed, then the active view mode is transferred to newly activated view.

The active view mode can be changed in two ways:

 
Your browser does not support SVG content.

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)
           
 void add(ViewMode mode)
          Registers a mode in this control.
 void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Adds a property change listener to this ViewControl.
 void currentViewChanged(View v)
          Transfers the current view mode to the specified, newly activated view.
protected static void deactivateMode(Graph2DView v, ViewMode vl)
           
 void dropViewContainer()
          Remove the ViewControl from the ViewContainer.
 ViewMode getCurrentMode()
          Returns the currently activated mode of this view control.
 YCursor getModes()
          Returns a cursor for all modes in this control.
 ViewContainer getViewContainer()
          Returns the ViewContainer of this ViewControl.
 void popMode()
          Makes the view mode on the top of the view mode stack active.
 void pushMode(ViewMode l)
          Pushes the current view mode onto the top of the view mode stack and activates the specified, new view mode.
 void remove(ViewMode mode)
          Removes this mode from this control.
 void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Removes a property change listener from this ViewControl.
 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)
          Sets 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()
Returns the ViewContainer of this ViewControl.

Returns:
The ViewContainer on which this instance works or null if there is no container.

setViewContainer

public void setViewContainer(ViewContainer vc)
Sets 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 view mode on the top of the view mode stack active.


pushMode

public void pushMode(ViewMode l)
Pushes the current view mode onto the top of the view mode stack and activates the specified, new view 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 mode 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()
Returns a cursor for all modes in this control.

Returns:
a cursor for all modes in this control.

currentViewChanged

public void currentViewChanged(View v)
Transfers the current view mode to the specified, newly activated view.

Specified by:
currentViewChanged in interface ViewChangeListener
Parameters:
v - the newly activated view.

activateMode

protected static void activateMode(Graph2DView v,
                                   ViewMode vl)

deactivateMode

protected static void deactivateMode(Graph2DView v,
                                     ViewMode vl)

addPropertyChangeListener

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

Parameters:
pcl - the PropertyChangeListener to add

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
Removes a property change listener from this ViewControl.

Parameters:
pcl - the PropertyChangeListener to remove.

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