Advanced Customization > Business Logic Customization > Customizing the Product Structure Explorer (PSE) > Customizing PSE for Subtypes
  
Customizing PSE for Subtypes
Objective
You have used the Type and Attribute Management utility to define subtypes of WTPart and possibly added attributes to WTPartUsageLink. Although these types and attributes typically appear in PSE without customization, you wish to control the display of these attributes in the PSE explorer.
Background
The selection of a type of Part in PSE typically automatically detects if subtypes have been defined with the Type and Attribute Management utility. Attributes will automatically be prompted for, and displayed. This is achieved in the PSE XML files by entries referencing attribute definitions with id’s of:
ALL_SOFT_SCHEMA_ATTRIBUTES
ALL_SOFT_CLASSIFICATION_ATTRIBUTES
ALL_SOFT_USAGE_LINK_SCHEMA_ATTRIBUTES
Although these entries are useful, it is not possible to control the order of display. Also, some values may get set programmatically on the server, and so the user should not be allowed to specify values.
Consider the simple example where WTPart has had a reusable attribute myDescription added to the base definition. A myMechanical Part has been defined in the Type and Attribute Management utility with attributes of myCost and myWeight, WTPartUsageLink has been extended to have a reusable attribute of myColor.
The steps to insert a new myMechanical Part into an assembly would result in these screens.
The Insert New wizard would present a drop down of instantiable types. The user selects “myMechanical” part.
After the Name and other properties have been specified, the last step in the wizard will prompt for the reusable attribute’s, although the Attribute column can be sorted, the default order is not controlled.
The Information tab for myMechanical Part presents all attributes, but not in any sort of order. The attributes in the upper part of the display represent the fixed set applicable to identify that object; some of these may not be relevant. The attributes in the lower editable table include attributes inherited from WTPart and are in no controlled order.
The myColor attribute would not appear in the Uses Tab, but it might be useful for the user to see the value with the other UsageLink attributes.
By customizing the PSE XML files, it is possible to explicitly define those attributes to be presented to the user. This typically impacts the Information Tab, and Part Creation and Insert wizards.
Scope/Applicability/Assumptions
As these changes are being made to the PSE XML files, they will apply to all users of PSE.
Intended Outcome
Considering the example described above.
When specifying the attributes of the New Part, the attributes in the last step of the wizard appear in the order defined in the PSE XML. files.
The attributes in the lower table of the Information tab can also be ordered.
The Uses BOM Table can be configured to show the Usage Link attribute.
Solution
For the dataType, defined a new ExplorerElementGroup with the context application of “ptc.wnc.StructureExplorer”. Within this element define the contents of the Attribute Tables.
It is likely that if you are doing this customization you have many types of WTPart defined. Although these element definitions can be added to the file
<Windchill>/codebase/config/logicrepository/xml/explorer/structureexplorer/Explorer ForTablesAndPanels.xml
This file is getting large, and it is difficult to identify customer extensions. So the suggestion is to create a file per soft part type to hold the customization.
The AttributeTables with id’s ptc.wnc.exp.CreatPartTab3, ptc.wnc.exp.CreatePartNoUsageLinkTab3 and ptc.wnc.exp.EditPropertiesTable would be defined for each dataType.
The addition of the attributes in the Uses Tab is achieved by including the appropriate CellDefinition for the table with id ptc.wnc.exp.PartUsesLinkTable in ExplorerForTablesAndPanels.xml
Prerequisite knowledge
To achieve this objective, you need to have an understanding of the following:
The management of XML file customizations
Solution Elements
Element
Type
Description
ExplorerForTableAn dPanels.xml
XML file
Holds the definition of the PSE Tables and panels
Located in:
<Windchill>/codebase/config/logicreposi
tory/xml/structureexplore
LogicContext
XML element
Specifies the application and data type that the definition is to be applied
AttributeTable
XML element
Defined the attribute table and contents
CellDefinition
XML element
The attribute with its appropriate behavior to be displayed in the AttributeTable.
Placement remove=”true”
XML element
Remove=true is used to stop a property from appearing due to inheritance.
Procedure
Either create a new file representing the Soft Part (myMechanical.xml) in the directory:
Windchill>/codebase/config/logicrepository/xml/explorer/structureexplorer
and insert the following lines, or add the ExplorerElementGroup to
Windchill>/codebase/config/logicrepository/xml/explorer/structure
explorer/ExplorerForTablesAndPanels.xml

<?xml version="1.0" standalone="no" ?>
<!DOCTYPE LogicRepository SYSTEM
"/config/logicrepository/dtd/LogicRepository.dtd">
<LogicRepository>

<ExplorerElementGroup>
<LogicContext application="ptc.wnc.StructureExplorer"
dataType="com.aprilia.www.myMechanical"/>

<AttributeTable id="ptc.wnc.exp.CreatePartTab3">
<Table id="Table" displayMode="edit">
<!-- These 3 entries remove the inherited entries from WTPart -->
<CellDefinition id="ALL_SOFT_SCHEMA_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>
<CellDefinition id="ALL_SOFT_CLASSIFICATION_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>
<CellDefinition
id="ALL_SOFT_USAGE_LINK_SCHEMA_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>

<!-- Add the entries for attributes on Parts and UsageLink in
the specific order -->
<CellDefinition id="myDescription">
<AttributeDefinition
attributeId="com.aprilia.www.myDescription"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myColor">
<AttributeDefinition
attributeId="com.aprilia.www.myColor"
imageName="com/ptc/windchill/explorer/config/images/uses
Tab.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myCost">
<AttributeDefinition
attributeId="com.aprilia.www.myCost"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myWeight">
<AttributeDefinition
attributeId="com.aprilia.www.myWeight"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
</Table>
<Import id="ptc.wnc.exp.NewObjectAttrTableAA"/>
</AttributeTable>

<AttributeTable
id="ptc.wnc.exp.CreatePartNoUsageLinkTab3">
<Table id="Table" displayMode="edit">

<!-- These 2 entries remove the inherited entries from WTPart -->
<CellDefinition id="ALL_SOFT_SCHEMA_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>
<CellDefinition id="ALL_SOFT_CLASSIFICATION_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>

<!-- Add the entries for attributes on Parts in the specific order -->
<CellDefinition id="myDescription">
<AttributeDefinition attributeId="com.aprilia.www.myDescription"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myCost">
<AttributeDefinition
attributeId="com.aprilia.www.myCost"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myWeight">
<AttributeDefinition
attributeId="com.aprilia.www.myWeight"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
</Table>
<Import id="ptc.wnc.exp.NewObjectAttrTableAA"/>
</AttributeTable>

<AttributeTable id="ptc.wnc.exp.EditPropertiesTable">
<Table id="Table" displayMode="edit">

<!-- These 3 entries remove the inherited entries from WTPart -->
<CellDefinition id="source">
<Placement remove="true"/>
</CellDefinition>
<CellDefinition id="partType">
<Placement remove="true"/>
</CellDefinition>
<CellDefinition id="ALL_SOFT_SCHEMA_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>
<CellDefinition id="ALL_SOFT_CLASSIFICATION_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>
<CellDefinition>
id="ALL_SOFT_USAGE_LINK_SCHEMA_ATTRIBUTES">
<Placement remove="true"/>
</CellDefinition>

<!-- Add the entries for attributes on Parts and UsageLink in the
specific order -->
<CellDefinition id="myDescription">
<AttributeDefinition
attributeId="com.aprilia.www.myDescription"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myColor">
<AttributeDefinition
attributeId="com.aprilia.www.myColor"
imageName="com/ptc/windchill/explorer/config/images/usesTab.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myCost">
<AttributeDefinition
attributeId="com.aprilia.www.myCost"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
<CellDefinition id="myWeight">
<AttributeDefinition
attributeId="com.aprilia.www.myWeight"
imageName="wtcore/images/part.gif">
<Import id="ptc.wnc.exp.CreatePanelAttrAction"/>
</AttributeDefinition>
</CellDefinition>
</Table>
<Import id="ptc.wnc.exp.EditPropertiesTableAA"/>
</AttributeTable>

</ExplorerElementGroup>

</LogicRepository>
This results in the attributes being requested in the Wizard and Information Tab as shown in Section Intended Outcome.
To add the reusable attribute to the Uses Tab, edit:
Windchill>/codebase/config/logicrepository/xml/explorer/structure
explorer/ExplorerForTablesAndPanels.xml
Locate the Table entry with id ptc.wnc.exp.PartUsesLinkTabTable and add:
<CellDefinition id="myColor" displayModeOverride="edit">
<AttributeDefinition attributeId="com.aprilia.www.myColor">
<Import id="ptc.wnc.exp.AssocAttrAction"/>
</AttributeDefinition>
</CellDefinition>
* 
Any <AttributionDefinition> that has been defined on an object other than a WTPart must be referred to either by the full or by using a logical attribute that you have defined.
The method server will need to be re-started in order that these changes are applied.
Further customization
To extend the above example, consider adding the “myDescription” attribute to the Uses Tab. When editing this String attribute, the user may want to specify many characters, however to perform this in the space of the cell in a table is not easy. So, it is possible to associate a different renderer to this attribute that will popup a dialog when editing the value, allow the user to enter many lines of text.
Edit:
Windchill>/codebase/config/logicrepository/xml/explorer/structure
explorer/ExplorerForTablesAndPanels.xml
Locate the Table entry with id ptc.wnc.exp.PartUsedLinkTabTable and add
<CellDefinition id="myDescription" displayModeOverride="edit">
<AttributeDefinition attributeId="com.aprilia.www.myDescription"
rendererClass="com.ptc.windchill.explorer.structureexplorer.renderer.component.
MultilineStringComponent">
<Import id="ptc.wnc.exp.AssocAttrAction"/>
</AttributeDefinition>
</CellDefinition>
Just using the Golf Cart as an example, this will result in the following dialog being presented when the “…” button is selected in the cell.
This renderer could also be applied to the attributes in the Information Tab.
Customization Points
In section Background there are a number of special attributes that are defined in LogicalAttributes.xml that allow PSE to display a number of attributes for a single definition. These include:
Logical Form
Description
ALL_SOFT_ATTRIBUTES
All reusable attributes persisted on the object
ALL_SOFT_CLASSIFICATION_ATT RIBUTES
All reusable attributes associated with the classification of the object.
ALL_SOFT_NON_SCHEMA_ATTRI BUTES
All reusable attributes persisted on the object that are not associated with the type of the object.
ALL_SOFT_SCHEMA_ATTRIBUTES
All reusable attributes associated with the type of the object.
ALL_SOFT_NON_CLASSIFICATION _SCHEMA_ATTRIBUTES
All reusable attributes associated with the type of the object that are not also associated with the classification of the object.
ALL_SOFT_NON_CLASSIFICATION _ATTRIBUTES
All reusable attributes persisted on the object that are not associated with the classification of the object
ALL_SOFT_USAGE_LINK_SCHEMA _ATTRIBUTES
In the context of a part, all reusable attributes on the part usage link(s) that are associated with the type of the part usage link
ALL_SOFT_SCHEMA_ATTRIBUTES _FOR_INPUT_TYPE
All reusable attributes associated with the type specified in the filter, which may be a supertype of the actual object
In Revision 9, PSE uses the following in the definition of Information tab attribute table (and also in the New dialog of the Information tab):
ALL_SOFT_SCHEMA_ATTRIBUTES
ALL_SOFT_CLASSIFICATION_ATTRIBUTES
ALL_SOFT_USAGE_LINK_SCHEMA_ATTRIBUTES
Using “ALL_SOFT_ATTRIBUTES” instead of ALL_SOFT_SCHEMA_ATTRIBUTES or adding an entry for ALL_SOFT_NON_SCHEMA_ATTRIBUTES would allow attributes programmatically populated from CAD to be displayed.