Personalización avanzada > Business Logic Customization > Report Generation > Report Selection List Customization
  
Report Selection List Customization
PSB Ribbon Customization
Right Click Menu Customization
PSB Ribbon Customization
You can add custom reports to the PSB ribbon toolbar under the “Reports” menu.
This applies only to the “Reports” menu of the Part information page, Structure tab (PSB); it is not supported in other structures.
There is a maximum of 25 custom reports possible
The custom reports must be added to the end of the existing OOTB reports
there is no ability to insert custom reports within the list of OOTB reports
there is no ability to re-order the existing OOTB reports
It is possible to hide the OOTB reports and only display the custom reports
Customization Steps
1. Create resource bundle Java file. For example:
a. Create a <Windchill>\src\com\customReports\psb\ directory and create a file named psbCustomActionsRB.java (see example source code below).
b. In a Windchill shell, go to <Windchill>\src directory and compile the java file (replace <Windchill> as appropriate):
javac -cp <Windchill>\codebase;<Windchill>\codebase\WEB-INF\lib\*;<Windchill>\lib\* com\customReports\psb\psbActionsRB.java -d <Windchill>\codebase
For example:
javac -cp C:\ptc\Windchill\codebase;C:\ptc\Windchill\codebase\WEB-INF\lib\*;C:\ptc\Windchill\lib\* com\customReports\psb\psbActionsRB.java -d C:\ptc\Windchill\codebase
This will compile the RB info file to the <Windchill>\codebase\com\customReports\psb directory.
2. Add action definition entries to <Windchill>\codebase\config\actions\custom-actions.xml (see example source code below).
a. The url parameter for each action must be changed to point to the custom report url.
b. Note: the resourceBundle specified in the <objecttype name="psb" resourceBundle="com. customReports.psb.psbActionsRB"> element must match the java class name of the resource bundle created in step 1 above.
3. Add the action model definition to <Windchill>\codebase\config\actions\custom-actionModels.xml (see example source code below).
a. Note: this is overriding the toolbar action model definition for the PSB found in <Windchill>\codebase\config\actions\psb-actionModels.xml. If other patches are installed that modify psb-actionModels.xml, those changes must be merged into the custom-actionModels.xml file.
b. Uncomment the number of custom reports needed in the section highlighted in yellow.
c. The “separator” entries are optional and can be placed between any of the custom report entries.
d. Do not change the name of the actions.
e. OOTB report entries can be commented out
Sample Code : psbCustomActionsRB.java
* 
Sample code for custom reports 02 through 25 removed for readability.
package com.customReports.psb;

import wt.util.resource.RBComment;
import wt.util.resource.RBEntry;
import wt.util.resource.RBPseudo;
import wt.util.resource.RBUUID;
import wt.util.resource.WTListResourceBundle;

@RBUUID("com.customReports.psb.psbCustomActionsRB")
public final class psbCustomActionsRB extends WTListResourceBundle {

/********
* Custom Report 01
*/
@RBEntry("Custom Report 01 Description")
// this is what is displayed in the menu
public static final String PSB_CUSTOMREPORTGWT01_DESCRIPTION
= "psb.psbCustomReportGWT01.description";

@RBEntry("Custom Report 01")
// not used, but is here for completeness in case used in the future
public static final String PSB_CUSTOMREPORTGWT01_TITLE
= "psb.psbCustomReportGWT01.title";

@RBEntry("Custom Report 01 Tooltip")
// not used, but is here for completeness in case used in the future
public static final String PSB_CUSTOMREPORTGWT01_TOOLTIP
= "psb.psbCustomReportGWT01.tooltip";

@RBEntry("height=900,width=1000")
// specifies the size in pixels of the report window
@RBPseudo(false)
@RBComment("DO NOT TRANSLATE")
public static final String PSB_CUSTOMREPORTGWT01_MOREURLINFO
= "psb.psbCustomReportGWT01.moreurlinfo";

@RBEntry("report_view.png")
// the name of the icon file, as found in <Windchill>/netmarkets/images
@RBPseudo(false)
@RBComment("DO NOT TRANSLATE")
public static final String PSB_CUSTOMREPORTGWT01_ICON
= "psb.psbCustomReportGWT01.icon";



[ Sample code for custom reports 02 through 25 removed for readability ]

} // end class
package com.customReports.psb;

import wt.util.resource.RBComment;
import wt.util.resource.RBEntry;
import wt.util.resource.RBPseudo;
import wt.util.resource.RBUUID;
import wt.util.resource.WTListResourceBundle;

@RBUUID("com.customReports.psb.psbCustomActionsRB")
public final class psbCustomActionsRB extends WTListResourceBundle {

/********
* Custom Report 01
*/
@RBEntry("Custom Report 01 Description")
// this is what is displayed in the menu
public static final String PSB_CUSTOMREPORTGWT01_DESCRIPTION
= "psb.psbCustomReportGWT01.description";

@RBEntry("Custom Report 01")
// not used, but is here for completeness in case used in the future
public static final String PSB_CUSTOMREPORTGWT01_TITLE
= "psb.psbCustomReportGWT01.title";

@RBEntry("Custom Report 01 Tooltip")
// not used, but is here for completeness in case used in the future
public static final String PSB_CUSTOMREPORTGWT01_TOOLTIP
= "psb.psbCustomReportGWT01.tooltip";

@RBEntry("height=900,width=1000")
// specifies the size in pixels of the report window
@RBPseudo(false)
@RBComment("DO NOT TRANSLATE")
public static final String PSB_CUSTOMREPORTGWT01_MOREURLINFO
= "psb.psbCustomReportGWT01.moreurlinfo";

@RBEntry("report_view.png")
// the name of the icon file, as found in <Windchill>/netmarkets/images
@RBPseudo(false)
@RBComment("DO NOT TRANSLATE")
public static final String PSB_CUSTOMREPORTGWT01_ICON
= "psb.psbCustomReportGWT01.icon";



[ Sample code for custom reports 02 through 25 removed for readability ]

} // end class
Sample Code : custom-actions.xml
Make sure resourceBundle parameter is set correctly with the Java class name of the resource bundle.
* 
Sample code for custom reports 02 through 25 removed for readability.
<listofactions>

<objecttype name="psb"
resourceBundle="com.customReports.psb.psbCustomActionsRB">

<action name="psbCustomReportGWT01" ajax="component">
<command class="com.ptc.cat.ui.client.action.LaunchURLAction"
method="execute" url="/ptc1/psb/customAction" windowType="popup"/>
<supportedTypes>
<type value="wt.part.WTPart"/>
<type value="wt.part.WTPartUsageLink"/>
<type value="wt.part.PartUsesOccurrence"/>
<type value="wt.part.RTPartPathOccurrence"/>
</supportedTypes>
</action>

[ Sample code for custom reports 02 through 25 removed for readability ]

</objecttype>

</listofactions>
Sample Code : custom-actionModels.xml
Uncomment the number of custom reports needed in the section highlighted below in yellow. The “separator” entries are optional and can be placed between any of the custom report entries. Do not change the name of the actions.
* 
Uncomment the number of custom reports needed in the section of code with the psbCustomReportGWT action names.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE actionmodels SYSTEM "actionmodels.dtd">
<actionmodels>

<model name="psbRelatedPartsTreeToolBar">
<action name="editingGroupGWT" type="psb" />
<action name="insertExistingPartStructureGWT" type="psb" />
<action name="removeGWT" type="psb" />
<action name="insertNewPartStructureSplitGWT" type="psb" />
<action name="insertNewPartStructureGWT" type="psb" />
<action name="insertMultiNewPartStructureGWT" type="psb" />
<action name="editSplitGWT" type="psb" />
<action name="editGWT" type="psb" />
<action name="editUsageLinkTreeGWT" type="psb" />
<action name="editCommonAttrsGWT" type="psb" />
<action name="separator" type="separator" />
<action name="renameGWT" type="psb" />
<action name="createOccurrencesGWT" type="psb" />

<action name="checkInOutGroupGWT" type="psb" />
<action name="checkoutGWT" type="psb" />
<action name="undocheckoutGWT" type="psb" />
<action name="checkinGWT" type="psb" />
<action name="findCheckoutItemsGWT" type="psb" />

<action name="clipboardGroupGWT" type="psb" />
<action name="pasteFromClipboardToTreeWithLargeIconGWT" type="psb" />
<action name="copyToWindchillWithLargeIconGWT" type="cat" />
<action name="pasteFromClipboardToTreeGWT" type="psb" />
<action name="pasteSelectToTreeGWT" type="psb" />

<action name="viewingGroupGWT" type="psb" />
<action name="relatedObjectsWithLargeIconGWT" type="psb" />
<action name="configurableTableViewGWT" type="cat" />
<action name="configurableTableViewListGWT" type="cat" />
<action name="separator" type="separator" />
<action name="saveStructureViewGWT" type="cat" />
<action name="configurableTableViewManagerGWT" type="cat" />
<action name="separator" type="cat" />
<action name="sourcingContextGWT" type="psb" />
<action name="sourcingContextListGWT" type="psb" />
<action name="separator" type="cat" />
<action name="findSourcingContextGWT" type="psb" />
<action name="displayGWT" type="cat" />
<action name="displayOccurrencesGWT" type="psb" />
<action name="separator" type="separator" />
<action name="selectAllGWT" type="cat" />
<action name="separator" type="separator" />
<action name="expandAllLevelsFromRootGWT" type="cat" />
<action name="psbExpandSubmenuGWT" type="psb" />
<action name="expandOneLevelGWT" type="cat" />
<action name="expandTwoLevelsGWT" type="cat" />
<action name="expandThreeLevelsGWT" type="cat" />
<action name="expandFourLevelsGWT" type="cat" />
<action name="expandFiveLevelsGWT" type="cat" />
<action name="separator" type="separator" />
<action name="expandAllSelectedLevelsGWT" type="cat" />
<action name="expandNLevelsGWT" type="cat" />
<action name="collapseAllLevelsGWT" type="cat" />
<action name="psbEndExpandSubmenuGWT" type="psb" />
<action name="separator" type="separator" />
<action name="viewLayout2Panel" type="cat" />
<action name="viewLayout3Panel" type="cat" />
<action name="separator" type="separator" />
<action name="refreshGWT" type="cat" />

<action name="newAddToGroupGWT" type="psb" />
<action name="newActionsGWT" type="psb" />
<action name="saveAsGWT" type="psb" />
<action name="separator" type="separator" />
<action name="newPromotionRequestTreeGWT" type="psb" />
<action name="newPartConfigGWT" type="psb" />
<action name="newRepresentationTreeGWT" type="psb" />
<action name="newPARGWT" type="psb"/>
<action name="addToActionsGWT" type="psb" />
<action name="addToBaselineGWT" type="cat" />
<action name="addToPackageGWT" type="cat" />
<action name="SBAddToPrj" type="cat" />

<action name="filterGroupGWT" type="ec" />
<action name="editFilterWithLargeIconGWT" type="ec" />
<action name="filterPropertiesGWT" type="ec" />
<action name="savedFiltersGWT" type="ec" />

<action name="toolsGroupGWT" type="psb" />
<action name="compareActionsGWT" type="psb" />
<action name="launchStructureCompareGWT" type="psb" />
<action name="launchCompareToCADGWT" type="dsv" />
<action name="openActionsGWT" type="psb" />
<action name="openInProductViewGWT" type="psb" />
<action name="openInPSEGWT" type="psb" />
<action name="openInMPSEGWT" type="psb" />
<action name="openInSPSEGWT" type="psb" />

<action name="psbReportsGroupGWT" type="psb" />
<action name="psbReportsGWT" type="psb" />
<action name="psbReportMultiLevelCompListGWT" type="psb" />
<action name="separator" type="separator" />
<action name="psbReportSingleLevelConsolBOMGWT" type="psb" />
<action name="psbReportSingleLevelBOMGWT" type="psb" />
<action name="psbReportSingleLevelBOMWithNotesGWT" type="psb" />
<action name="separator" type="separator" />
<action name="psbReportMultiLevelBOMGWT" type="psb" />
<action name="psbReportMultiLevelBOMWithReplacementsGWT" type="psb" />
<action name="psbReportMultiLevelBOMWithAMLAVLGWT" type="psb" />
<action name="psbReportMultiLevelBOMWithAMLGWT" type="psb" />
<action name="separator" type="separator" />
<action name="singleSourceOEMPartsGWT" type="psb" />
<action name="uniqueManufacturerPartsGWT" type="psb" />
<action name="separator" type="separator" />
<action name="changeBaselineReportGWT" type="change" />


<!--<action name="separator" type="separator" />
<action name="psbCustomReportGWT01" type="psb" />
<action name="psbCustomReportGWT02" type="psb" />
<action name="psbCustomReportGWT03" type="psb" />
<action name="psbCustomReportGWT04" type="psb" />
<action name="psbCustomReportGWT05" type="psb" />
<action name="separator" type="separator" />
<action name="psbCustomReportGWT06" type="psb" />
<action name="psbCustomReportGWT07" type="psb" />
<action name="psbCustomReportGWT08" type="psb" />
<action name="psbCustomReportGWT09" type="psb" />
<action name="separator" type="separator" />
<action name="psbCustomReportGWT10" type="psb" />
<action name="psbCustomReportGWT11" type="psb" />
<action name="psbCustomReportGWT12" type="psb" />
<action name="psbCustomReportGWT13" type="psb" />
<action name="psbCustomReportGWT14" type="psb" />
<action name="separator" type="separator" />
<action name="psbCustomReportGWT15" type="psb" />
<action name="psbCustomReportGWT16" type="psb" />
<action name="psbCustomReportGWT17" type="psb" />
<action name="separator" type="separator" />
<action name="psbCustomReportGWT18" type="psb" />
<action name="separator" type="separator" />
<action name="psbCustomReportGWT19" type="psb" />
<action name="psbCustomReportGWT20" type="psb" />
<action name="separator" type="separator" />
<action name="psbCustomReportGWT21" type="psb" />
<action name="psbCustomReportGWT22" type="psb" />
<action name="psbCustomReportGWT23" type="psb" />
<action name="psbCustomReportGWT24" type="psb" />
<action name="separator" type="separator" />
<action name="psbCustomReportGWT25" type="psb" />-->

<action name="exportActionsGWT" type="cat"/>
<action name="exportCsvGWT" type="cat" />
<action name="exportHtmlGWT" type="cat" />
<action name="exportPdfGWT" type="cat" />
<action name="exportTextGWT" type="cat" />
<action name="exportXlsGWT" type="cat" />
<action name="exportXlsxGWT" type="cat" />
<action name="exportXlsReportGWT" type="cat" />
<action name="exportXmlGWT" type="cat" />
</model>

</actionmodels>
Right Click Menu Customization
However, it is possible to add a menu item to the right-click context menus in the structure that can launch actions or other jsp pages (e.g., reports). There is an example action that can be used as a basis for creating custom actions or reports.
Perform the following steps see the example action.
1. There is an example jsp file installed in the following location: <Windchill>/codebase/netmarkets/jsp/part/custom/customAction.jsp.
2. In <Windchill>/codebase/config/actions/psb-actionmodels.xml, find the psbRelatedPartsTreeContextMenu model and uncomment the "customActionGWT" action by removing the <!-- and --> delimiters.
<model name="psbRelatedPartsTreeContextMenu">
...<snip>...
<!-- <action name="customActionGWT" type="psb"/> -->
</model>
The customActionGWT is defined in the <Windchill>/codebase/config/actions/psb-actions.xml file:
<action name="customActionGWT" ajax="component">
<command class="com.ptc.cat.ui.client.action.LaunchURLAction"
method="execute" url="/ptc1/psb/customAction" windowType="popup"/>
<supportedTypes>
<type value="wt.part.WTPart" />
<type value="wt.part.WTPartUsageLink" />
<type value="wt.part.PartUsesOccurrence" />
<type value="wt.part.RTPartPathOccurrence" />
</supportedTypes>
</action>
3. Restart the MethodServer and navigate to the Structure tab of a Part information page.
4. Right-click on any part in the structure and select Custom Action in the menu. This launches a window as defined by customAction.jsp.
5. To create custom actions or report, define the action in the appropriate *-actions.xml file (e.g., psb-actions.xml) using the customActionGWT as an example.
Change the name of the action, the url parameter and supportedTypes as needed.
Add the resourceBundle parameter to specify the file that contains the label of the action (see “Resource Info (.rbInfo) Files” section).
Then update the model definition in the appropriate *-actionmodels.xml file to include the action defined.