Example 8: Tables
If you can't play the video, make sure that you are logged in at Wex Solutions.
-
What will we do? - Learn the basics of tables with WEX
-
What do you need? - Site access to a non-production Windchill
-
How long will it take - 8 minutes
This example sheds some light on the fundamentals of how to add a table and data utility (e.g. a column) to Windchill.
You can find the code for this example in our GitHub repository.
Implementation
This example uses standard JCA Windchill table-generating procedures. The output looks like this:
However, as we are using the WEX Framework, we must use slightly different techniques to normal in order to make the resulting Windchill Extension hot-loadable. The implementation consists of the two following classes:
Class | Extends | Description |
---|---|---|
WexTableBuilder | AbstractConfigurableTableBuilder | This is the builder that constructs the table. It must be annotated to that is becomes visible as a feature outside the extension |
WexTableRow | The is a POJO that is interrogated by reflection to create a row |
The WexTableBuilder
implementation has a ComponentBuilder
annotation:
@WexBean("com.wincomplm.wex-example-tables.wextable")
@WexComponent(uid = "com.wincomplm.wex-example-tables.wextable", description = "Wex Example Table")
@ComponentBuilder("com.wincomplm.wex-example-tables.wextable")
public class WexTableBuilder extends AbstractConfigurableTableBuilder {
This class uses a wex-default-du
ID for the Data Utility:
@Override
public ComponentConfig buildComponentConfig(ComponentParams cp) throws WTException {
logger.trace("=>buildComponentConfig {0}", cp);
ComponentConfigFactory factory = getComponentConfigFactory();
JcaTableConfig table = (JcaTableConfig) factory.newTableConfig();
table.setSelectable(false);
table.setConfigurable(false);
table.setLabel("Title");
addColumn(factory, "data", "wex-default-du", "Example Data", 200, table);
logger.trace("<=buildComponentConfig");
return table;
}//buildComponentConfig
The WexTableRow
implementation has a POJO with getters, like the getData
:
public String getData() {
These methods can also return objects that inherit from the com.ptc.core.components.rendering.guicomponents.HTMLGuiComponent
class.
Execution
Access the Table Example entry in the Quick Links menu after having deployed the WEX: