Personalización básica > User Interface Customization > User Interface Technology Overview > Windchill Client Architecture Overview > Java Builders
  
Java Builders
This approach presents several advantages over the older JSP and Tags based approach. By separating the model and controller from the JSP, we enable a more flexible and maintainable system. For example, several different JSPs can now take advantage of the same java builder. And, because, builders are now written in java, they can share attributes through inheritance. The basic steps to produce many components (table, tree, attribute panel, etc) are:
Describe the component (Component Config Builder)
Acquire the necessary data (Component Data Builder)
Render the component (JSP)
Controller – ComponentController
Requests for JCA components are routed to a centralized ComponentController. This controller derives the component ID from the request parameters, and then uses Spring configuration to look up builder implementations. SeeMVC Components for more information.
Model – Component Config and Data Builders
The model for your UI is made up of the component configuration information and the data. These are created by a class or classes that implement the ComponentConfigBuilder and ComponentDataBuilder interfaces.
ComponentConfigBuilder
You control the rendering of your UI through a Java Class that implements the ComponentConfigBuilder Interface. This interface contains one method buildComponentConfig. This method should contain all the configuration information needed for the UI you are building. One example of a ComponentConfigBuilder might look like the following:
public ComponentConfig buildComponentConfig(ComponentParams params) throws WTException {
ComponentConfigFactory factory = getComponentConfigFactory();
TableConfig table = factory.newTableConfig();

table.setLabel("My Table");
table.setSelectable(true);
table.setType("wt.pdmlink.PDMLinkProduct");
table.setActionModel("my_toolbar_actions");
table.setShowCustomViewLink(true);

table.addComponent(factory.newColumnConfig(ICON, true));
table.addComponent(factory.newColumnConfig(NAME, true);
table.addComponent(factory.newColumnConfig(INFO_ACTION, false));
return table;
}
ComponentDataBuilder
The data for your UI is created by a Java Class that implements the ComponentDataBuilder Interface. This interface contains one method buildComponentData. The object returned from this method should represent the Model for the UI and can take multiple forms. Some examples of what this method might return are ComponentData, a Persistable, a QuerySpec, any custom Java Object, etc. One example of a ComponentDataBuilder might look like the following:
public Object buildComponentData(ComponentConfig config,
ComponentParams params)
throws Exception {
String tableId="netmarkets.product.list";
return ProductListCommand.getProducts(tableId);
}
Data Sources
Table and Tree components are able to make use of a new feature called DataSources. DataSources provide improved perceived table and tree performance through features like the ability to asynchronously load data and the ability to sort and scroll data on the client. To make use of this new asynchronous feature, your Component Data Builder should implement ComponentDataBuilderAsync for table components and TreeDataBuilderAsync for Tree components.
View — JSP
In this approach, the JSP is simply a “view”, rather than a combination of all three, as it is in the JSP and Tags approach. Each component has a default view (JSP) to render out the component, however if you wish to override the default view you can call the setView() on the ComponentConfig that your ComponentConfigBuilder returns. All the view jsps should be located in codebase\WEB-INF\jsp base location.
Basic Elements of the JSP
When Creating a JSP view for a Java Builder, you will need to be aware of a few important jsp fragment files. The first and most important is the begin_comp.jspf. This files exists in codebase/netmarkets/jsp/util/. The purpose of this jspf is to setup the model data information required by the view.
Another jspf that is included is the end_comp.jspf also located in codebase/netmarkets/jsp/util/. The purpose of this file is to: Mark that the page load is complete to allow proper functioning of the javascript within the page. An example of a jsp view might look like:
<%@ taglib uri="http://www.ptc.com/windchill/taglib/jcaMvc" prefix="mvc"%>

<%@include file="/netmarkets/jsp/util/begin_comp.jspf"%>
<mvc:table setPageTitle="true"/>
<%@ include file="/netmarkets/jsp/util/end_comp.jspf"%>
Supported Components
Table
Tree
Information Page
Attribute Panel
Attribute Table
Property Panel
Related Customization Documentation
MVC Components
Attribute Tables
Windchill Client Architecture Tree
Information Pages
Windchill Client Architecture Overview