Expand or collapse a subnetwork programmatically

Article ID: 2451
Last updated: 29 May, 2018
Article ID: 2451
Last updated: 29 May, 2018
Revision: 3
Views: 639
Posted: 04 Aug, 2003
by Dean J.
Updated: 29 May, 2018
by Gargani A.

Question

How do I programmatically expand or collapse a subnetwork?

Answer

To expand or collapse a subnetwork, you can simply click the star icon displayed on the subnetwork, or double-click the subnetwork itself.

If you want to trigger this action programatically, you can use the following methods

  • IlpNetworkController.expandObject(IlpRepresentationObject)
  • IlpNetworkController.collapseObject(IlpRepresentationObject).

or

  • IlpNetworkView.expandObject(IlpRepresentationObject)
  • IlpNetworkView.collapseObject(IlpRepresentationObject).

The following code extract shows you how to retrieve the representation object of the subnetwork and how to use the methods from IlpNetworkController class:

IlpNetwork component;
IltDefaultDataSource datasource;
IltNetworkElement paris; // paris is a subnetwork.
// retrieve the representation object of the subnetwork
IlpNetworkAdapter adapter = component.getAdapter();
adapter.setDataSource(dataSource);
IlpRepresentationObject parisObject = adapter.getRepresentationObject(paris);
// collapse or expand the subnetwork
component.getController().collapseObject(parisObject);
component.getController().expandObject(parisObject);

If you want to catch the collapse or expand event to add your own action at this point, you can use the class IlpNetworkHandlerWithDataSource and override its methods handleCollapseObject and handleExpandObject.


The following code extract shows you how to implement this action:

IlpNetwork component;
component.getController().setHandler(     new IlpNetworkHandlerWithDataSource (         component, component.getAdapter(),         (IlpMutableDataSource)component.getDataSource()) {         public void handleCollapseObject (IlpRepresentationObject object) {             // add your code here             super.handleCollapseObject(object);         }         public void handleExpandObject (IlpRepresentationObject object) {             // add your code here             super.handleExpandObject(object);         }     });

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2451
Last updated: 29 May, 2018
Revision: 3
Views: 639
Posted: 04 Aug, 2003 by Dean J.
Updated: 29 May, 2018 by Gargani A.
Also listed in


Others in this category