|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.graphlayout.IlvLayoutGraphicFilter
public class IlvLayoutGraphicFilter
This class allows you to perform the layout on a subgraph; that is, on a
subset of the nodes and links of the original grapher (IlvGrapher).
The accept(ilog.views.IlvGraphic) method of the filter is called by the
IlvGrapherAdapter to know for any node and link whether the node
or link must be taken into account or if it must be completely ignored.
To install a filter on an IlvGrapherAdapter instance,
use the method IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter).
Note that all overridden implementations of the method accept(ilog.views.IlvGraphic)
must respect the following rules:
IlvGraphLayout.performLayout() is running, the filter must
always return the same value for the same node or link. In other words,
the structure of the graph must not change while the layout is running.IlvLayoutGraphicFilter):
IlvGraphModel model = getGrapherAdapter(); int type = GraphModelEvent.STRUCTURE_CHANGED; // Version #1: there is a single node (or link) that the filter now // accepts while previously it rejected it type |= GraphModelEvent.NODE_ADDED; // or LINK_ADDED model.fireGraphModelEvent(nodeOrLink, type, false); // Version #2: there is a single node (or link) that the filter now // rejects while previously it accepted it type |= GraphModelEvent.NODE_REMOVED; // or LINK_REMOVED model.fireGraphModelEvent(nodeOrLink, type, false); // Version #3: there are several nodes and links that were previously // rejected and now are accepted and vice-versa // You can either fire a global STRUCTURE_CHANGED event: type |= GraphModelEvent.STRUCTURE_CHANGED; model.fireGraphModelEvent(null, type, false); // or browse each of these nodes or links and throw an individual event // (use the value true for the adjusting flag, and call // model.adjustmentEnd() at the end). grapherAdapter.fireGraphModelEvent(null, GraphModelEvent.STRUCTURE_CHANGED, false);
IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter)| Constructor Summary | |
|---|---|
IlvLayoutGraphicFilter()
Creates a new IlvLayoutGraphicFilter. |
|
IlvLayoutGraphicFilter(IlvGraphLayout layout)
Deprecated. Beginning with JViews 3.0, you should use the constructor without any arguments and specify the filter using the method IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter). |
|
| Method Summary | |
|---|---|
boolean |
accept(IlvGraphic nodeOrLink)
Returns true if the graphic object nodeOrLink is
a node or a link that must be taken into account during the layout. |
IlvGrapherAdapter |
getGrapherAdapter()
Returns the IlvGrapherAdapter with which the filter is associated. |
IlvGraphLayout |
getLayout()
Deprecated. Beginning with JViews 3.0, the filter is no longer associated with a layout instance |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IlvLayoutGraphicFilter()
IlvLayoutGraphicFilter.
To install a filter on an IlvGrapherAdapter instance,
use the method IlvGrapherAdapter.setFilter.
IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter)public IlvLayoutGraphicFilter(IlvGraphLayout layout)
IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter).
IlvLayoutGraphicFilter
This creates a filter for the layout instance layout.
To install a filter on an IlvGrapherAdapter instance,
use the method IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter).
IlvLayoutGraphicFilter()| Method Detail |
|---|
public IlvGrapherAdapter getGrapherAdapter()
IlvGrapherAdapter with which the filter is associated.
public IlvGraphLayout getLayout()
public boolean accept(IlvGraphic nodeOrLink)
true if the graphic object nodeOrLink is
a node or a link that must be taken into account during the layout.
If no layers are specified using the method IlvGrapherAdapter.addLayer(ilog.views.IlvManagerLayer)
on the adapter instance on which the filter is installed,
or if all the layers of the IlvGrapher are specified,
the method returns true for node or link contained in the
grapher encapsulated by the adapter.
Otherwise, it returns true only for objects on the specified layers.
This method can be overridden in order to specify other conditions for filtering the nodes and the links. The overridden implementation should first check if the node or link is accepted in the superclass:
if (!super.accept(nodeOrLink)) return false;Only after that other specific filtering rules should be applied.
Note that any overridden implementation of this method must respect the following rules:
IlvLayoutGraphicFilter):
IlvGraphModel model = getGrapherAdapter(); int type = GraphModelEvent.STRUCTURE_CHANGED; // Version #1: there is a single node (or link) that the filter now // accepts while previously it rejected it type |= GraphModelEvent.NODE_ADDED; // or LINK_ADDED model.fireGraphModelEvent(nodeOrLink, type, false); // Version #2: there is a single node (or link) that the filter now // rejects while previously it accepted it type |= GraphModelEvent.NODE_REMOVED; // or LINK_REMOVED model.fireGraphModelEvent(nodeOrLink, type, false); // Version #3: there are several nodes and links that were previously // rejected and now are accepted and vice-versa // You can either fire a global STRUCTURE_CHANGED event: type |= GraphModelEvent.STRUCTURE_CHANGED; model.fireGraphModelEvent(null, type, false); // or browse each of these nodes or links and throw an individual event // (use the value true for the adjusting flag, and call // model.adjustmentEnd() at the end).
The method throws a RuntimeException if the layout instance has
no attached grapher.
accept in interface IlvGraphicFilter
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||