18.104.22.168 Grouping of Properties
The properties displayed in the Bean Property sheet can be categorized into different groups. By default, all the bean properties are displayed under 'All Properties' group and some of the extended bean properties are displayed under 'Extra Properties' group. Instance Name, Bounds, Padding, Modifiers, Initializer are the properties clubbed under 'Extra Properties'.
How to create your own Group
You can create your own group with the list of properties that has to be displayed in it. Consider the Property sheet of the bean 'HCellularGauge', which is taken as an example to explain grouping of properties throughout this topic. See the image below which shows the 'HCellularGauge' bean's property sheet.
Since 'All Properties' group is chosen, it displays all the properties of the bean 'HCellularGauge'. Suppose if you want to group all the 'Color' properties together, it can be done by the following steps:
Create a XML file with the name of the bean for which the properties are going to be grouped. i.e. HCellularGaugeBeanGroup.xml for the Color properties
Enter the new property group name and values corresponding to that group in the xml file. Let the property group name be 'colors' with values 'Background', 'Foreground', 'Cell Background', 'Border Color', 'Initial Color', 'Threshold Color1' and 'Threshold Color2'. See the xml file given below for your reference:
<property name="colors" value="Background,Foreground,Cell Background,Border Color,Initial Color,Threshold Color1,Threshold Color2"/>
<property name="otherProperties" value="Label Name,Label Font,Show Label,Scale Points,Scale Font,Show Scale,No Of Cells,Minimum Value,Maximum Value,Initial Value,Threshold Value1,Threshold Value2,Mark Threshold,"/>
<property name="testgroup" value="Maximum Value,Initial Value,Threshold Value1,Threshold Value2,Mark Threshold,"/>
<property name="testgroup3" value="Maximum Value"/>
Note: Any number entries for user-defined groups with their respective values can be entered in the file. In the above xml file, 'otherProperties', 'testgroup', 'testgroup3' represent other group entries with their corresponding values.
Now update the Jar file in which the bean was present with the XML file. i.e. Update 'AdventNetUIBeanInfo.jar' with 'HCellularGaugeBeanGroup.xml' file such that it is present under the package structure. (AdventNetUIBeanInfo.jar:com/adventnet/beans/gauges/HCellularGaugeBeanGroup.xml)
Viewing the new group in Bean Property Sheet
Load the updated Jar file into the beans palette using the File -->Load Jar option.
Drop the bean 'HCellularGauge' and you could see the new property 'colors' added to the combo box. On choosing the group 'colors', it displays the sorted out color properties separately as shown below:
On modifying a property under the group 'colors', it will be reflected in the corresponding property displayed under 'All Properties' group also.