Procedure – Supporting Graphical Attributes in a Configurable Table
Most tables in the Windchill UI are configurable tables and support graphical attributes automatically out of the box with no additional work required.
Any table that implements the ConfigurableTableBuilder interface (generally done by extending AbstractConfigurableTableBuilder) is a configurable table.
See Graphical Attributes Example Configurable Table section in Customization Sample Code for details on a provided example of a configurable table.
Procedure – Supporting Graphical Attributes in a Non-Configurable Table
If a table does not implement ConfigurableTableBuilder, then it is a non-configurable table and an extra step is required to enable it to contain graphical attributes.
To enable graphical attribute support in a non-configurable table, you must specify the types that are displayed in that table in your table builder using the setTypes API on the TableConfig.
ComponentConfigFactory factory = getComponentConfigFactory();
TableConfig table = factory.newTableConfig();
table.setTypes("org.example.FakeLiterature", "org.example.FakeNovel");
This single line of code is all that is required to enable the table to display attributes as graphical attributes. Graphical attributes are added to the TableConfig in exactly the same way as any other attribute.
Be as thorough as possible in creating the type list. All types that are in the table should be included in the type list. All subtypes should be listed out separately and individually as in the example above. FakeNovel is a sub type of FakeLiterature, but both must be listed explicitly. Listing only the supertypes will not be sufficient when the graphical attribute is actually on a sub type. Even if not all types have graphical attributes when you are creating the list, later those types may have graphical attributes and then they will not work if the type is not in the list. It is best to make a comprehensive list from the beginning.
If a graphical attribute is added to a non-configurable table that has not been updated to support graphical attributes (or a non-configurable table that does not contain the right type in its’ type list), then the attribute behaves as though it is not graphical in that table. For example, a traffic light attribute would show as an integer 0, 1, 2 or 3 rather than as the correct image or blank.
See Graphical Attributes Example Non-Configurable Table section in Customization Sample Code for details on a provided example of non-configurable table.
Было ли это полезно?