進階自訂 > Business Logic Customization > Customizing Part Structure Browser > Displaying Custom Tables in PSB
  
Displaying Custom Tables in PSB
Custom tables can be displayed on the Attributes tab in PSB. The following procedure serves as an example for displaying custom tables in PSB:
1. For this example, create a folder named customTable in Windchill/codebase/netmarkets/jsp.
2. Copy the sample customTable.jsp and customTable3.jsp in the Windchill/codebase/netmarkets/jsp/customTable folder. The examples of customTable.jsp and customTable3.jsp are provided below.
3. Add the following property in the site.xconf file:
<Property name="displayCustomJSPInAttributesTab" overridable="true" targetFile="codebase/wt.properties" value="customTable/customTable"/>
4. Run the xconfmanager -Fp from Windchill shell.
5. Restart the Method Server.
6. Verify that the custom tables are displaying in the Attributes tab of PSB.
Example
customTable.jsp
<% request.setAttribute(NmAction.SHOW_CONTEXT_INFO, "false"); %>
<%@ page import="wt.part.WTPart,

com.ptc.windchill.enterprise.part.partResource"%>
<%@ include file="/netmarkets/jsp/util/begin.jspf"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.ptc.com/windchill/taglib/components" prefix="jca"%>
<%@ taglib uri="http://www.ptc.com/windchill/taglib/fmt" prefix="fmt"%>

<%--> Get resource bundle. <--%>
<fmt:setLocale value="${localeBean.locale}"/>
<fmt:setBundle basename="com.ptc.windchill.enterprise.part.partResource" />
<%--> Table 1 - Reference Documents <--%>
<fmt:message var="relatedReferenceDocTableLabel" key="<%= partResource.REFERENCES_DOC_TABLE_HEADER %>" />
<jca:describeTable var="relatedRefDocs"
id="part.relatedPartsReferencesDocuments.list"
type="wt.doc.WTDocument"
label="${relatedReferenceDocTableLabel}"
configurable="true" >
<jca:setComponentProperty key="selectable" value="true"/>
<jca:describeColumn id="type_icon" />
<jca:describeColumn id="number"/>
<jca:describeColumn id="version" />
<jca:describeColumn id="infoPageAction" sortable="false" />
<jca:describeColumn id="name" />
<jca:describeColumn id="containerName" />
<jca:describeColumn id="state" />
<jca:describeColumn id="lastModified"/>
<jca:describeColumn id="nmActions">
<jca:setComponentProperty key="actionModel"
value="relatedParts DescRef actions"/>
</jca:describeColumn>
</jca:describeTable>

<%-->Get a component model for our table<--%>
<jca:getModel var="tableModelRefDocs"
descriptor="${relatedRefDocs}"

serviceName="com.ptc.windchill.enterprise.part.commands.PartDocServiceCommand"
methodName="getAssociatedReferenceDocuments" >
<jca:addServiceArgument type="wt.part.WTPart"
value="${param.oid}" />
</jca:getModel>

<%-->Get the NmHTMLTable from the command<--%>
<jca:renderTable model="${tableModelRefDocs}"
helpContext="doc_references" showCount="true" />

<%--> Table 2 - Described by Documents <--%>
<fmt:message var="relatedDescribedDocTableLabel" key="<%= partResource.DESCRIBED_BY_DOC_TABLE_HEADER %>" />
<jca:describeTable var="relatedDescibeDocs"
id="part.relatedPartsDescribedByDocuments.list"
type="wt.doc.WTDocument"
label="${relatedDescribedDocTableLabel}"
configurable="true" >
<jca:setComponentProperty key="selectable" value="true"/>
<jca:describeColumn id="type_icon" />
<jca:describeColumn id="number"/>
<jca:describeColumn id="version" />
<jca:describeColumn id="infoPageAction" sortable="false" />
<jca:describeColumn id="name" />
<jca:describeColumn id="containerName" />
<jca:describeColumn id="state" />
<jca:describeColumn id="lastModified"/>
<jca:describeColumn id="nmActions">
<jca:setComponentProperty key="actionModel" value="relatedParts DescRef actions"/>
</jca:describeColumn>
</jca:describeTable>

<%-->Get a component model for our table<--%>
<jca:getModel var="tableModelDescDocs" descriptor="${relatedDescibeDocs}"

serviceName="com.ptc.windchill.enterprise.part.commands.PartDocServiceCommand"
methodName="getAssociatedDescribeDocuments" >
<jca:addServiceArgument type="wt.part.WTPart" value="${param.oid}" />
value="${param.oid}" />
</jca:getModel>


<%-->Get the NmHTMLTable from the command<--%>
<jca:renderTable model="${tableModelDescDocs}" helpContext="doc_described_by_ref" showCount="true" />

<%@ include file="/netmarkets/jsp/customTable/customTable3.jsp"%>

<%@ include file="/netmarkets/jsp/util/end.jspf"%>
Example
customTable3.jsp
<%-->Get the Described By relation NmHTMLTable from the command<--%>
<jca:describeTable var="described" id="part.relatedPartsDescribedByCADDocuments.list" type="wt.epm.EPMDocument"
label="${describedByCADDocTableHeader}"
configurable="true">
<jca:describeColumn id="type_icon"/>
<jca:describeColumn id="number"/>
<jca:describeColumn id="CADName"/>
<jca:describeColumn id="version" />
<jca:describeColumn id="infoPageAction" />
<jca:describeColumn id="name"/>
<jca:describeColumn id="containerName"/>
<jca:describeColumn id="association"/>
<jca:describeColumn id="state"/>
<jca:describeColumn id="lastModified"/>
<jca:describeColumn id="nmActions">
<jca:setComponentProperty key="actionModel" value="EMPTY_ACTION_MODEL"/>
</jca:describeColumn>
</jca:describeTable>

<%-->Get a component model for our table<--%>
<jca:getModel var="tableModelDesc" descriptor="${described}"

serviceName="com.ptc.windchill.enterprise.part.commands.PartDocServiceCommand"
methodName="getAssociatedCADDocuments" >
<jca:addServiceArgument type="wt.part.WTPart" value="${param.oid}"/>
</jca:getModel>

<%-->Get the NmHTMLTable from the command<--%>
<jca:renderTable model="${tableModelDesc}" pageLimit="0" showCount="true" helpContext="cad_doc_described_by_ref" />