The default data source implementation,
IltDefaultDataSource, provides methods to
add and remove business objects. Once a business object is added
into a data source that is connected to a graphic component, it
can be automatically displayed by the graphic component.
If you want to add your business objects to the data source
without having their graphic representation created, you need to
use an
IlpFilter and apply it to the
IlpAbstractAdapter in charge. In this way,
the objects are filtered out and not included in the graphic
representation model. No graphic representation will be created
at rendering time. You can, at a later stage, change the filter
to make more objects visible as needed.
Note
The filter must be set on the
IlpAbstractAdapter before the business
objects are added to the data source.
Such filters allow the business objects to
be managed by the data source and still not be represented
graphically.
The following methods are available to add
business objects to a data source:
void
addObject. Adds a single object to the
data source
void
addObjects Adds a collection of objects
to the data source.
Whenever possible, large series of
IlpObject instances should be added as
collections instead of one by one. This is typically the case
when you initialize the application.
For example, the code sample below:
for (...) {
parent = new IltNetworkElement("ROOT");
dataSource.addObject(parent);
for (...) {
child = new IltNetworkElement("NE");
dataSource.setParent(child, parent);
dataSource.addObject(child);
}
}
Could be improved to:
List objects = new ArrayList();
for (...) {
parent = new IltNetworkElement("ROOT");
objects.add(parent);
for (...) {
child = new IltNetworkElement("NE");
dataSource.setParent(child, parent);
objects.add(child);
}
}
dataSource.addObjects(objects);