Sample Code
Example Implementation for InfoPageComponent
This example can be viewed in the Windchill product by navigating to Customization > Component Catalog > Information Page. The Customization tab is hidden out-of-the-box but can be enabled via the “Client Customization” preference available in Site->Utilities->Preferences Manager.
This example shows an info page for an object of the new type “Carambola.”. The Carambola object type is a simple Java class with an icon and various attributes. The example illustrates how to:
create a set of tabs
define a tab customization menu (tab actions)
define an action dropdown menu
display status glyphs next to the object name
add a help topic
construct a custom VisualizationDelegate
use a custom view JSP that adds toggle buttons for commonspace/ workspace and a Go to Latest link.
Two of the tabs displayed on the info page illustrate what happens when the server encounters errors when producing a page. The tab “Error Page With Generic Exception” shows how exception messages are displayed when Java or Scriptlet code executed on a JSP page throws an exception. The tab “404 error” shows how a HTTP 404 response code is displayed when the JSP page specified in an action cannot be found. The action “Action Has Invalid Onclick” in the Actions menu illustrates the message that is provided when the JavaScript mentioned in the “onclick” attribute of an action command sub tag is invalid.
The action “Action Has Complex Onclick” illustrates another action with an invalid “onclick” attribute. Onclick attributes must contain a single JavaScript function call. In this case, the onclick attribute has multiple function calls. The action framework wraps the multiple statements in one function call to prevent the page display from aborting.
The panels and tables available for display on the info page tabs via the Customize link are ones created for other examples in the Customization tab, such as the Attribute Panel, Property Panel, and Table examples.
Files Used in this Example
Action Models Used in this Example
Action Model File
Action Model Names
Name: Carambola-actionModels.xml
Codebase path: codebase/config/actions
CustEx_infoPage_tabset
carambola_details
CustEx_default_myTab
CustEx_error_on_page
CustEx_error_404
CustEx_infoPage_third_level_navigation
CustEx_submodel_simpleTable
CustEx_submodel_advancedTable
CustEx_InfoPage_attributes
carambola_info_page
carambola_sub_model
Actions Used in this Example
Action File
Action Names
Name: Carambola-actions.xml
Codebase path: codebase/config/actions
CustEx_simpleTable1
CustEx_simpleTable2
CustEx_simpleTable3
CustEx_advancedTable1
CustEx_advancedTable_custom_oid_actions
CustEx_error_on_page
CustEx_error_404
propertyPanel
attributePanel
visualizationAndAttributes
primaryAttributes
onclickIsInvalid
onclickToBeWrapped
Files Used in this Example
File
Description
Carambola.jar
Source code examples are in the Carambola-java.jar file in the <Windchill>\Windchill\srclib\wnc directory.
This is the “Carambola” object class.
CarambolaVisualizationDelegate.java
Source code examples are in the Carambola-java.jar file in the <Windchill>\Windchill\srclib\wnc directory.
This is the delegate that creates the content for the VisualizationComponent on the page.
CarambolaInfoBuilder.java
Source code examples are in the Carambola-java.jar file in the <Windchill>\Windchill\srclib\wnc directory.
This is the info page builder class for object type “Carambola”.
CarambolaVizAndAttrBuilder.java
Source code examples are in the Carambola-java.jar file in the <Windchill>\Windchill\srclib\wnc directory.
This is the builder for the Visualization and Attributes panel. You do not have to write a builder for this panel. Such a builder is required only for this example because the “Carambola” object type is not a type that is exposed in the Type Manager.
carambolaInfoPage.jsp
Source code examples are in the Carambola-java.jar file in the <Windchill>\Windchill\srclib\wnc directory.
This is the view (JSP) for the page with JavaScript to produce toggle buttons and Go to Latest link.
<Windchill>\Windchill\codebase\com\ptc\carambola\carambola.service.properties.xconf
This is the VisualizationDelegate service property.
Est-ce que cela a été utile ?