ilog.views.event.adapter
Class IlvLinkVisibilityHandler

java.lang.Object
  extended by ilog.views.event.adapter.IlvLinkVisibilityHandler
All Implemented Interfaces:
ManagerContentChangedListener, EventListener

public class IlvLinkVisibilityHandler
extends Object
implements ManagerContentChangedListener

The IlvLinkVisibilityHandler ensures that links are only visible if their end nodes are visible. It is a contents changed listener that must be installed at a grapher.

The handler influences only the global visibility of the objects in the managers. It does not influence the layer visibility per manager view, i.e. if the end nodes of a link are visible in the manager but not visible in a layer of a specific manager view, the link is still visible in the manager.

The handler can be installed as manager listener on a flat grapher, or as tree listener on the top level grapher of a nesting hierarchy of graphers.

It is possible to selectively disable the behavior of the manager per object. If an object is marked as managed (see setManaged(ilog.views.IlvGraphic, boolean)), its visibility is only controlled by the handler. If the object is marked as unmanaged, its visibility is not anymore influenced by the handler and can be controlled independently via IlvManager.setVisible(IlvGraphic, boolean, boolean). By default, all objects are managed.

Since:
JViews 7.5
See Also:
IlvManager.addManagerContentChangedListener(ilog.views.event.ManagerContentChangedListener), IlvManager.removeManagerContentChangedListener(ilog.views.event.ManagerContentChangedListener), IlvManager.addManagerTreeContentChangedListener(ilog.views.event.ManagerContentChangedListener), IlvManager.removeManagerTreeContentChangedListener(ilog.views.event.ManagerContentChangedListener)

Constructor Summary
IlvLinkVisibilityHandler()
          Creates a new link visibility handler.
 
Method Summary
 void contentsChanged(ManagerContentChangedEvent evt)
          This method is called by the manager, to notify content modifications.
static void coupleLinkToNodeVisibility(IlvManager grapher, boolean traverse, boolean redraw)
          Ensures that managed links that are currently in the grapher are visible if and only if both end nodes are visible.
static boolean isManaged(IlvGraphic g)
          Returns whether the visibility of the object is managed by a link visibility handler.
static void setManaged(IlvGraphic g, boolean managed)
          Sets whether the visibility of the object is managed by a link visibility handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvLinkVisibilityHandler

public IlvLinkVisibilityHandler()
Creates a new link visibility handler.

Method Detail

contentsChanged

public void contentsChanged(ManagerContentChangedEvent evt)
This method is called by the manager, to notify content modifications.

Specified by:
contentsChanged in interface ManagerContentChangedListener
Parameters:
evt - the "content changed" event.
See Also:
IlvManager.addManagerContentChangedListener(ilog.views.event.ManagerContentChangedListener), IlvManager.removeManagerContentChangedListener(ilog.views.event.ManagerContentChangedListener), IlvManager.addManagerTreeContentChangedListener(ilog.views.event.ManagerContentChangedListener), IlvManager.removeManagerTreeContentChangedListener(ilog.views.event.ManagerContentChangedListener)

setManaged

public static void setManaged(IlvGraphic g,
                              boolean managed)
Sets whether the visibility of the object is managed by a link visibility handler. This has only an effect when a IlvLinkVisibilityHandler is installed as listener on a grapher.

If an object is marked as managed, its visibility is only controlled by the handler. A managed link is invisible if one of its end nodes is invisible, and visible if both end nodes are visible. If the object is marked as unmanaged, its visibility is not anymore influenced by the handler and can be controlled independently. By default, all objects are managed.

Parameters:
g - The graphic object
managed - Whether the visibility of the object is managed or not.
See Also:
isManaged(ilog.views.IlvGraphic)

isManaged

public static boolean isManaged(IlvGraphic g)
Returns whether the visibility of the object is managed by a link visibility handler. This has only an effect when a IlvLinkVisibilityHandler is installed as listener on a grapher.

If an object is marked as managed, its visibility is only controlled by the handler. A managed link is invisible if one of its end nodes is invisible, and visible if both end nodes are visible. If the object is marked as unmanaged, its visibility is not anymore influenced by the handler and can be controlled independently. By default, all objects are managed.

Parameters:
g - The graphic object
See Also:
setManaged(ilog.views.IlvGraphic, boolean)

coupleLinkToNodeVisibility

public static void coupleLinkToNodeVisibility(IlvManager grapher,
                                              boolean traverse,
                                              boolean redraw)
Ensures that managed links that are currently in the grapher are visible if and only if both end nodes are visible. In this sense, it couples the visibility property of links to the visibility property of nodes. It does not influence the visibility of unmanaged links or of any nodes, and it does not install the IlvLinkVisibilityHandler.

The purpose of this method is the following: When a IlvLinkVisibilityHandler is installed at a nonempty grapher, the visibility of links of this grapher does not change right away. The handler affects only subsequent operations when nodes are made visible or invisible. In order to change the link visibility right away to create a situation consistent to the visibility-policy of the handler, this method can be called just after installing the IlvLinkVisibilityHandler.

It is not necessary to call this method when a IlvLinkVisibilityHandler is installed at an empty grapher.

Parameters:
grapher - The grapher whose links should be examined.
traverse - If true, the links of submanager are examined as well.
redraw - Whether to redraw when changing visibility.
See Also:
setManaged(ilog.views.IlvGraphic, boolean)


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.