Parameters contain values associated with a symbol. A
parameter is bound to a graphic element to cause a transformation,
that is, a change in the elements aspect to represent a change in
data. For example, an icon that changes color to show an alert.
Parameters are set on a symbol using instances of
IlvPaletteSymbolParameter. This class contains the definition of one parameter.
You add a parameter to a symbol by calling:
//Create a new palette
IlvPalette palette = new IlvPalette();
palette.setName(name);
palette.setDescription(french, descr);
//Create a root category for the palette
String categoryID = "root";
IlvPaletteCategory rootCategory = new IlvPaletteCategory(categoryID);
palette.setRoot(rootCategory);
rootCategory.setName(categoryID);
//Create a new symbol
String symbolID = "symbol1";
IlvPaletteSymbol s = palette.addSymbol(rootCategory, symbolID);
s.setName(symbolID);
//Create a new parameter
IlvPaletteSymbolParameter p2 = new IlvPaletteSymbolParameter();
p.setID("progress");
p.setName("progress");
p.setValue(new Integer(0));
//Add the parameter to a symbol
s.addParameter(p);
Parameters can accept any value or only an allowed set
of values, such as “wait”, “attention”,
“go”, or 1, 2, 3. The description of the allowed values
for a parameter is set using the
IlvPaletteSymbolParameterValueSet class. You set allowed values for a class by calling:
//Create a new value set
String vsetID = "vset1";
IlvPaletteSymbolParameterValueSet vset = new
IlvPaletteSymbolParameterValueSet(vsetID);
vset.setName(vsetID);
vset.setType("Integer");
vset.setValues(new int[] { 1, 2, 3 });
vset.setValueName(0, "one");
vset.setValueName(1, "two");
vset.setValueName(2, "three");
//Add the value set to a palette
palette.setValueSet(vset);
//Create a new parameter
IlvPaletteSymbolParameter p = new IlvPaletteSymbolParameter();
p.setID("progress");
p.setName("progress");
p.setValue(null);
//Add the value set to a parameter
p.setType("set");
p.setValueSet(vset);
Please note that the CSS of the symbol must be consistent
with the parameters of the symbol. For example, if you wanted to
use the file Dial.css (in ilog/views/palettes/shared/symbols/Dial.css
),
you would need to define the parameters name
and value
for
the symbol, as Dial.css refers to these parameters:
s.addParameter(
new IlvPaletteSymbolParameter("value", new Double(0), "double", null));
s.addParameter(
new IlvPaletteSymbolParameter("name", "DefaultName", "string", null));
...
The parameters constitute the visible interface of the
symbol. They hide the internals of the CSS, so that it is only through
the parameters that you can modify the symbol.