Acme Part Information Page
Objective
Display the information page of an Acme part when the View information action in the Acme Parts table is clicked.
Solution
1. Create the primary builder for the information page:
package com.acme.wizard.mvc.builders.custompart;

import java.util.List;

import com.ptc.jca.mvc.builders.DefaultInfoComponentBuilder;
import com.ptc.mvc.components.ComponentConfig;
import com.ptc.mvc.components.ComponentParams;
import com.ptc.mvc.components.InfoComponentConfigFactory;
import com.ptc.mvc.components.InfoConfig;
import com.ptc.mvc.components.PropertyConfig;
import com.ptc.mvc.components.TypeBased;

import wt.util.WTException;

/**
* This is a custom info page builder for Acme part.
*/
@TypeBased("WCTYPE|wt.part.WTPart|com.acme.AcmePartType")
public class AcmePartInfoPageBuilder extends DefaultInfoComponentBuilder {

@Override
protected InfoConfig buildInfoConfig(ComponentParams params) throws WTException {
InfoComponentConfigFactory factory = getComponentConfigFactory();
InfoConfig config = factory.newInfoConfig();

List<ComponentConfig> standardConfigList = factory.getStandardStatusConfigs();

//Add Build status glyph
PropertyConfig statusFamily_BuildStatus = factory.newPropertyConfig("statusFamily_BuildStatus");
statusFamily_BuildStatus.setStatusGlyph(true);
standardConfigList.add(statusFamily_BuildStatus);

for(ComponentConfig componentConfig : standardConfigList){
config.addComponent(componentConfig);
}
config.setNavBarName("general");
config.setTabSet("acmePartInfoPageTabSet");
config.setNavBarName("third_level_nav_part");
config.setHelpContext("part.view");
config.setView("/custom/acmeInfoPage.jsp");
return config;
}
}
2. Define the set of tabs acmePartInfoPageTabSet to be displayed on the information page by creating its action model in AcmePartClient-actionmodels.xml. You can define your information page by adding the required tabs or actions.
<model name="acmePartInfoPageTabSet" >
<submodel name="acmePartDetailsTab"/>
<action name="productStructureGWT" type="psb"/>
<submodel name="partInfoContentTab"/>
<submodel name="changesTab"/>
<submodel name="partInfoHistoryTab"/>
<submodel name="partInfoWhereUsedTab"/>
</model>
3. Create a new model acmePartDetailsTab to define the custom details tab structure. Add it as a submodel on the information page acmePartInfoPageTabSet.
<model name="acmePartDetailsTab" resourceBundle="com.acme.custompart.CustomPartResource">
<action name="visualizationAndAttributes" type="object"/>
<action name="attributes" type="object"/>
<action name="viewCustomParts" type="custompart"/>
</model>
4. Add the resource bundle entry for the details tab acmePartDetailsTab in CustomPartResource.java.
@RBEntry("Acme Part Details")
public static final String ACME_PART_DETAILS = "object.acmePartDetailsTab.description";
5. Add a visualization delegate in com.acme.infoPage, if required, to override the visualization component.
package com.acme.infoPage;

import javax.servlet.ServletRequest;

import com.ptc.core.components.rendering.guicomponents.VisualizationComponent;
import com.ptc.core.components.visualization.AbstractVisualizationDelegate;

public class AcmeCustomVisualizationDelegate extends AbstractVisualizationDelegate {
@Override
public VisualizationComponent getVisualizationComponent(Object datum, ServletRequest request) {
String html = "<div id=wvs_pview_div class=vizComponent><IMG src='netmarkets/images/demodata/carambola.jpg'/></div>";
return new VisualizationComponent(html);
}
}
6. Restart Windchill to verify if the information page is displayed on clicking .
Was this helpful?