View Parameters
A view parameter is a parameter that is local to that view and whose value can therefore change from one view to the other. Each time a new view is opened, it receives view parameters that can alter its representation.
The Server/Views component uses two predefined view parameters: a Server data source and a panel. These parameters are referred to as reserved parameters.
This section explains the meaning of these parameters and the different ways to pass them.
Meaning of the Reserved View Parameters
If you open a new view with a panel specified among the view parameters, the new representation adds itself in this panel. The .ilv file is then read again and the new objects are added without giving any other consideration to the panel.
-
Server data source (index 1)
If you open a new view by specifying a Server data source as one of the view parameters, that Server data source is used in the new representation. This means that all the Views data sources ( IliMemoryDataSource objects) are reused. The panel for this new representation is infered from the supplied Server data source.
However, the .ilv file is not read again and no new gadgets are created. The default behavior is to close the previous representation, thereby emptying all the data sources that were created for this previous representation. The gadgets are emptied, then populated again with the new data sources.
If you do not want to close the representation, you should redefine the function onNewRpInSDS and give it an empty body. This way, the new values add themselves to the existing data sources, causing the contents of the gadgets to grow. For example, a table gadget will receive more rows each time this representation is opened.
Specifying View Parameters
When a new view is opened for an IlsSwRepresentation object, it receives an array of objects as view parameters. The first two items of this array are reserved for the panel (index 0 in the array) and the Server data source (index 1 in the array), as mentioned in Meaning of the Reserved View Parameters above.
The following cases may arise:
-
Both parameters are null.
The component creates an IlvGadgetContainer object (or one of its subclasses since the factory is used), and reads the .ilv file in it. Then, it looks for a Server data source within this panel and subsequently uses it.
-
The panel parameter (index 0) is non-null.
The representation creates no IlvGadgetContainer object and ignores the IlsSwTableGadgetFactory if it was set. It uses the supplied panel to read the .ilv file. Then it looks for a Server data source within this panel and subsequently uses it.
-
The SDS parameter (index 1) is non-null.
The representation creates no IlvGadgetContainer object and ignores the IlsSwTableGadgetFactory if it was set. The panel is retrieved from the Server data source (because it is an IlvGadget and it has a holder) and subsequently uses it.
-
Both parameters (indexes 0 and 1) are non-null.
The panel parameter is ignored in this case. The panel is retrieved from the Server data source (because it is an IlvGadget and it has a holder).
The panel parameter is not very useful because if you provide the Server data source, Server automatically deduces the panel. Most of the time, this parameter is not used, and you just have to provide the Server data source if you want to open a view on an existing panel.