DataUtility Customization
Day-3
Date: 05 SEP 2024
Version – 1.0
1
Introduction - Recap
Most of Windchill pages are constructed using GUI component which are table, tree or
attributes panel, etc.
Sometimes, we need to change part of UI Elements on GUI component like following.
• Need to change one item column style on the table.
• When creating some object, one input column want to be controlled by other field
on wizard page.
• Want to change from select box to check box design on create wizard.
• Want to show calculated value of special attributes on info page
• Data utilities are java classes that can be used for customizations that cannot be accomplished using the
available configuration points
• A data utility is used to get the data and meta-data of an attribute and create the UI component which will
be used to render the attribute in the UI
• DataUtilities are used to change part of the UI Elements on GUI Components
2
Basic Concepts (1/4)
What is GUI Component?
• Java Object that carries information about an UI Element, that is necessary to
appropriately render the element on a page
• One of the key information is the default renderer class
• The default renderer class knows how to generate the appropriate display based
on the other information in the GUI Component
3
Basic Concepts (2/4)
GUI Components
• These components will generally be constructed in the Method Server and then returned to the servlet container for
rendering
• The GUI Component interface has one method that needs to be implemented
public void draw (Writer out, RenderingContext renderContext) throws Rendering Exception
Following is the OOTB lists of GUI Components
1. AttributeDisplayComponentCheckBox 15. Label
2. LocationInputComponent 16. NumericInputComponent
3. ComboBox 17. PushButton
4. AttributeGuiComponent 18. TextArea
5. DateDisplayComponent 19. RadioButton
6. AttributeInputComponent 20. TextBox
7. DateInputComponent 21. RevisionInputComponent
8. AttributeInputComponent 22. TextDisplayComponent
9. EnumInputComponent 23. StringInputComponent
10. BooleanInputComponent 24. PickerInputComponent
11. UrlInputComponent
12. NumberInputComponent
13. IconComponent
14. NumericDisplayComponent
4
Basic Concepts (3/4)
5
Basic Concepts (4/4)
What is Component Descriptor?
• Encapsulates metadata about a UI Component
• Component Descriptor objects can be nested
• It is by convention that a table, tree, info page, attribute panel component descriptor has children that
correspond to column or properties
Primary Properties are:
• Unique ID Key
• Label – Display text associated with the UI Element
• Mode – VIEW, EDIT, SEARCH, CREATE
• Type – INFO, PICKER, SEARCH, TABLE, WIZARD, WIZARD_TABLE
What is Component Model?
The ComponentModel encapsulates three other Models:
• An NmHTMLActionModel that contains the actions for this component (Toolbar for a table, third
level navigation actions for an info page)
• A ComponentViewModel that defines the view related information for the component, if any
• A InfoEngine Group that defines the actual data to be displayed in the component
6
Procedure for Creating DataUtility
7
Example - DataUtility
8
DataUtility Implementation
9
Registration of DataUtility
• Customized data utility class cannot be used directly on GUI Component.
• All GUI Component can read service Identification which is registered in MethodServer services cache – generally registered
in “service.properties”
<Service context="default" name="com.ptc.core.components.descriptor.DataUtility“ targetFile="codebase/service.properties">
<Option serviceClass="ext.csc.training.datautility.CSCPartNameDataUtility" selector=" partNameDataUtility"
requestor="java.lang.Object" cardinality="duplicate" />
</Service>
10
Register DataUtility on the Attribute
1. Open Site > Utilities > Type and Attribute Management
2. Select Manage Types tab and select Part object
3. Select action menu on part detail page and select Edit menu
4. Select Layout tab and select ―Primary Attributes Info Page Layout‖ of Layouts menu.
5. Select detail button of name attributes
6. Set data utility ID named ― partNameDataUtility on the editing window of name
11
Result
• Restart the Method Server
• Open part information and check name attribute
12
Problem Statement – Suggestion Box
When user enter some value on
“suggestTextBox”, this class will be
called and the resultant data will be
shown in the suggestion box as
shown in the image
Primary Steps:
• Create Class with the name:
PartNameSuggest
• Implement the interface:
Suggestable
• Method to override is:
getSuggestions()
13
Implementation of Suggestion Box
14
Registration of DataUtility
Register the datautility class in the Training.xconf file as given below
15
Creation of View JSP
16