Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
30 views

Client Customization Programmers Guide

This document provides guidance on customizing Teamcenter clients. It discusses different client interfaces and concepts for customization. The document then covers techniques for enterprise-wide configuration, rich client customization, thin client customization, and more. Examples and references are also included to aid customization work.

Uploaded by

darkangelita
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Client Customization Programmers Guide

This document provides guidance on customizing Teamcenter clients. It discusses different client interfaces and concepts for customization. The document then covers techniques for enterprise-wide configuration, rich client customization, thin client customization, and more. Examples and references are also included to aid customization work.

Uploaded by

darkangelita
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 467

Teamcenter 9.

Client Customization Programmer’s


Guide

Publication Number
PLM00075 H
Proprietary and restricted rights notice

This software and related documentation are proprietary to Siemens Product


Lifecycle Management Software Inc.
© 2012 Siemens Product Lifecycle Management Software Inc. All Rights Reserved.
Siemens and the Siemens logo are registered trademarks of Siemens AG. Teamcenter
is a trademark or registered trademark of Siemens Product Lifecycle Management
Software Inc. or its subsidiaries in the United States and in other countries. All
other trademarks, registered trademarks, or service marks belong to their respective
holders.

2 Client Customization Programmer’s Guide PLM00075 H


Contents

Proprietary and restricted rights notice . . . . . . . . . . . . . . . . . . . . . . . . . 2

Getting started with client customization . . . . . . . . . . . . . . . . . . . . . . . 1-1


Getting started with client customization . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
Before you begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
Client interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Basic concepts about client customization . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7
Basic tasks for client customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8

Enterprise-wide configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1


Enterprise-wide configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Using the Business Modeler IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Suppressing menu commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Using style sheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2

Rich client customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1


Rich client customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
Basic concepts about rich client customization . . . . . . . . . . . . . . . . . . . . . . . . 3-1
Basic tasks for rich client customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8
Sample rich client customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20
Customizing forms and properties display . . . . . . . . . . . . . . . . . . . . . . . . . . 3-131
Performing advanced customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-151
Tips for rich client customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-163
Troubleshooting rich client customization . . . . . . . . . . . . . . . . . . . . . . . . . . 3-165
Rich client customization reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-173

Thin client customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1


Thin client customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
Generating a thin client page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
Basic customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
Customizing forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-18
Customizing Teamcenter with TcScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-27

Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Index-1

Figures

Types of available style sheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4


Properties dialog box in the rich client . . . . . . . . . . . . . . . . . . . . . . . . 2-4

PLM00075 H Client Customization Programmer’s Guide 3


Contents

Properties dialog box in the thin client . . . . . . . . . . . . . . . . . . . . . . . . 2-5


Property style sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
Form in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
Form in the thin client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
Summary tab in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
Overview tab in the thin client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
Summary style sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
Creation dialog box in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11
Creation dialog box in the thin client . . . . . . . . . . . . . . . . . . . . . . . . . 2-12
Create style sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13
Summary tab in the My Teamcenter (2007) perspective . . . . . . . . . . . . 2-14
Summary 2007 style sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15
Starting the search for style sheets . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16
Searching for XMLRenderingStylesheet datasets . . . . . . . . . . . . . . . . . 2-17
Viewing the search results for XMLRenderingStylesheet datasets . . . . . 2-18
Viewing the style sheet contents in the rich client . . . . . . . . . . . . . . . . 2-19
Create a custom style sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-21
Viewing the <dataset_name>.REGISTEREDTO and
<type_name>.RENDERING preferences . . . . . . . . . . . . . . . . . . . . . . 2-22
Viewing the business object type that the style sheet is registered to . . . 2-24
Viewing the style sheet type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-24
Viewing the REGISTEREDTO preferences . . . . . . . . . . . . . . . . . . . . . 2-25
Adding a property to the rich client Summary pane . . . . . . . . . . . . . . . 2-29
Adding a property to the thin client Overview tab . . . . . . . . . . . . . . . . 2-29
Adding a section to the rich client Summary pane using the objectSet
tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-30
Adding a section to the thin client Overview tab using the objectSet
tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-31
Adding a property to the Properties pane on the Summary tab in the rich
client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-33
Adding a property to the Properties pane on the Overview tab in the thin
client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-34
User Data boxes on the Item Master form . . . . . . . . . . . . . . . . . . . . . . 2-35
Item Master Form with User Data boxes removed in the rich client . . . . 2-37
Item Master Form with User Data boxes removed in the thin client . . . . 2-38
Selecting the item master form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-38
Default item master form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-39
Customized layout of the form’s General properties page in the rich
client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-40
Customized layout of the form’s Advanced properties page in the rich
client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-41
Form rendering example in the rich client . . . . . . . . . . . . . . . . . . . . . . 2-43
Form rendering example in the thin client . . . . . . . . . . . . . . . . . . . . . . 2-44
Item properties dialog box in the rich client . . . . . . . . . . . . . . . . . . . . . 2-45
Item properties dialog box in the thin client . . . . . . . . . . . . . . . . . . . . . 2-45
The all element in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-47
The all element in the thin client . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-48
classificationProperties in the rich client . . . . . . . . . . . . . . . . . . . . . . . 2-52
classificationTrace in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . 2-54
command element in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . 2-56
command element in the thin client . . . . . . . . . . . . . . . . . . . . . . . . . . 2-57
No value match in the User Data 1 box . . . . . . . . . . . . . . . . . . . . . . . . 2-59
Value in the User Data 1 box matches the first GoverningProperty
node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-59

4 Client Customization Programmer’s Guide PLM00075 H


Contents

Value in the User Data 1 box matches the second GoverningProperty


node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-60
customPanel example in the rich client . . . . . . . . . . . . . . . . . . . . . . . . 2-63
firstcolumn element in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . 2-65
firstcolumn element in the thin client . . . . . . . . . . . . . . . . . . . . . . . . . 2-66
header element in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-68
header element in the thin client . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-69
image element in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-71
image element in the thin client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-71
Label tag example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-73
style tagging example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-73
URL rendering example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-74
listDisplay element in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . 2-75
listDisplay element in the thin client . . . . . . . . . . . . . . . . . . . . . . . . . 2-76
objectset buttons in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-77
objectset buttons in the thin client . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-77
Object set in the rich client (with table button selected) . . . . . . . . . . . . 2-79
Object set in the thin client (with table button selected) . . . . . . . . . . . . 2-79
page element in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-82
page element in the thin client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-83
Condition is not met for the visibleWhen parameter . . . . . . . . . . . . . . . 2-84
Condition is valid for the visibleWhen parameter . . . . . . . . . . . . . . . . . 2-84
property elements in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . 2-88
property elements in the thin client . . . . . . . . . . . . . . . . . . . . . . . . . . 2-88
secondcolumn element in the rich client . . . . . . . . . . . . . . . . . . . . . . . 2-92
secondcolumn element in the thin client . . . . . . . . . . . . . . . . . . . . . . . 2-93
section elements in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-95
section elements in the thin client . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-96
separator elements in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . 2-97
separator elements in the thin client . . . . . . . . . . . . . . . . . . . . . . . . . . 2-98
tableDisplay element in the rich client . . . . . . . . . . . . . . . . . . . . . . . 2-100
tableDisplay element in the thin client . . . . . . . . . . . . . . . . . . . . . . . 2-100
thumbnailDisplay element in the thin client . . . . . . . . . . . . . . . . . . . 2-101
treeDisplay element in the rich client . . . . . . . . . . . . . . . . . . . . . . . . 2-102
view elements in the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-105
view elements in the thin client . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-106
Headed rendering style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-116
Titled rendering style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-117
Launching the SWT samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
SWT sample projects in Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Available SWT samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Launching the SWT tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
SWT tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
HelloWorldSWT application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8
Custom menu command on the menu bar . . . . . . . . . . . . . . . . . . . . . . 3-21
Custom button on the toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-21
Action launched from the custom menu command or button . . . . . . . . . 3-21
Custom menu command moved to the Tools menu . . . . . . . . . . . . . . . . 3-22
Custom menu command added to the shortcut menu . . . . . . . . . . . . . . 3-26
Custom button on the toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-28
Action launched from the custom button . . . . . . . . . . . . . . . . . . . . . . . 3-28
Custom button location moved on the toolbar . . . . . . . . . . . . . . . . . . . 3-29
Exit command button on the view toolbar . . . . . . . . . . . . . . . . . . . . . . 3-33
Menu button on the view toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-33

PLM00075 H Client Customization Programmer’s Guide 5


Contents

Exit command on the view menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-34


Error Level toggle menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-38
Toggle state dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-39
Custom view in the list of available views . . . . . . . . . . . . . . . . . . . . . . 3-43
Custom menu command displayed when the custom view is open . . . . . 3-44
Custom view in the list of available views . . . . . . . . . . . . . . . . . . . . . . 3-50
Custom view displaying the contents of the selected object . . . . . . . . . . 3-51
Viewer view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-52
Viewer view using the HelloWorldViewer definition . . . . . . . . . . . . . . . 3-56
HelloWorldViewer view specified for another object type . . . . . . . . . . . . 3-57
Viewer view using the MyPropertyViewer definition . . . . . . . . . . . . . . . 3-65
Launching the custom application . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-71
New SendTo application in the navigation pane . . . . . . . . . . . . . . . . . . 3-78
New SendTo application added to the Send To menu . . . . . . . . . . . . . . 3-79
Message box resulting from the command override . . . . . . . . . . . . . . . . 3-83
Choosing the custom menu command in the Spanish user interface . . . . 3-86
Untranslated custom message box . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-87
Translated custom message box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-88
TableViewer menu command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-98
TableViewer button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-98
TableViewer dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-99
TreeViewer menu command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-103
TreeViewer button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-103
Tree viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-104
Adding a new search type to the quick search list . . . . . . . . . . . . . . . . 3-106
Changed color for read-only properties . . . . . . . . . . . . . . . . . . . . . . . 3-109
Assigning a workflow process template . . . . . . . . . . . . . . . . . . . . . . . 3-110
Viewing the assigned workflow process template . . . . . . . . . . . . . . . . 3-111
Custom filtering applied to the assigned workflow process template . . . 3-116
New column for occurrence notes . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-118
Project files for the com.mycom.mpp.perspectives plug-in . . . . . . . . . . 3-123
New Manufacturing Process Planner perspectives . . . . . . . . . . . . . . . 3-124
Manufacturing - MBOM to Product BOP perspective . . . . . . . . . . . . . 3-124
Manufacturing - Process Consumption perspective . . . . . . . . . . . . . . . 3-125
Manufacturing - Product 3D perspective . . . . . . . . . . . . . . . . . . . . . . 3-125
org.eclipse.ui.perspectives extension . . . . . . . . . . . . . . . . . . . . . . . . . 3-127
com.teamcenter.rac.aifrcp.perspectiveDefs extension . . . . . . . . . . . . . 3-128
viewRef element (primary view) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-129
viewRef element for graphics (secondary view) . . . . . . . . . . . . . . . . . . 3-130
viewRef element (secondary view) . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-131
Custom form using JavaBeans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-139
Default form in the item creation wizard . . . . . . . . . . . . . . . . . . . . . . 3-143
Custom form in the item creation wizard . . . . . . . . . . . . . . . . . . . . . . 3-147
Form user interface display panel . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-150
Form displayed in a dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-150
Form displayed in the rich client viewer . . . . . . . . . . . . . . . . . . . . . . 3-151
PropertyNameLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-184
PropertyTextField . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-185
TitledPropertyTextField . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-185
PropertyTextArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-185
TitledPropertyTextArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-186
TitledPropertyLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-186
PropertySlider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-187
TitledPropertySlider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-187

6 Client Customization Programmer’s Guide PLM00075 H


Contents

PropertyCheckbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-188
TitledPropertyCheckbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-189
PropertyRadioButton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-189
TitledPropertyRadioButton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-190
PropertyToggleButton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-190
TitledPropertyToggleButton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-191
LOVPopupButton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-191
TitledPropertyLOVButton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-192
PropertyLOVPopupButton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-193
TitledPropertyLOVCombobox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-193
PropertyCheckboxOptionLov . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-194
TitledPropertyCheckboxOptionLov . . . . . . . . . . . . . . . . . . . . . . . . . . 3-194
PropertyRadioButtonOptionLov . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-194
TitledPropertyRadioButtonOptionLov . . . . . . . . . . . . . . . . . . . . . . . . 3-195
PropertyToggleButtonOptionLov . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-195
TitledPropertyToggleButtonOptionLov . . . . . . . . . . . . . . . . . . . . . . . 3-195
PropertyObjectLink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-196
TitledPropertyObjectLink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-197
PropertyLongText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-198
TitledPropertyLongText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-198
TitledPropertyLogicalPanel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-198
PropertyArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-199
TitledPropertyArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-200
PropertyImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-201
Delete dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-203
Expanded Delete dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-203
Progress indicators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-203
Completion indicators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-204
LOV dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-206
LOV panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-207
LOVPopupButton with no arguments . . . . . . . . . . . . . . . . . . . . . . . . 3-208
LOVPopupButton with arguments and popup window . . . . . . . . . . . . 3-209
OrgSelectionDialog component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-210
Organization dialog box search feature . . . . . . . . . . . . . . . . . . . . . . . 3-211
Referencers panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-212
Referencers reverse horizontal node layout . . . . . . . . . . . . . . . . . . . . 3-212
Referencers tree look node layout . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-213
Referencers vertical node layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-213
Item revision UI component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-214
Role panel in the Organization Selection dialog box . . . . . . . . . . . . . . 3-215
Group panel in the Organization Selection dialog box . . . . . . . . . . . . . 3-216
User panel in the Organization Selection dialog box . . . . . . . . . . . . . . 3-217
Usage of the TCTypeRenderer class . . . . . . . . . . . . . . . . . . . . . . . . . 3-218
Initial state of an AbstractPopupButton component . . . . . . . . . . . . . . 3-219
AbstractPopupButton component popup window . . . . . . . . . . . . . . . . 3-219
Table created using GenericTableModel component . . . . . . . . . . . . . . 3-221
Horizontal button layout with center alignment . . . . . . . . . . . . . . . . . 3-222
Results of resizing the dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-223
Horizontal button layout with left alignment and a 20-unit gap . . . . . . 3-223
Results of resizing the dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-224
Horizontal button layout with right alignment and a 20-unit gap . . . . 3-224
Results of resizing the dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-225
Vertical button layout with center alignment . . . . . . . . . . . . . . . . . . . 3-226
Vertical button layout with top alignment . . . . . . . . . . . . . . . . . . . . . 3-227

PLM00075 H Client Customization Programmer’s Guide 7


Contents

Vertical button layout with bottom alignment . . . . . . . . . . . . . . . . . . 3-227


Horizontal layout with center alignment . . . . . . . . . . . . . . . . . . . . . . 3-229
Results of resizing the dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-229
Horizontal layout with components added . . . . . . . . . . . . . . . . . . . . . 3-230
Horizontal layout with components added . . . . . . . . . . . . . . . . . . . . . 3-231
Horizontal layout with parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 3-232
Vertical layout with components added . . . . . . . . . . . . . . . . . . . . . . . 3-233
Results of resizing the dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-233
Horizontal layout with components added . . . . . . . . . . . . . . . . . . . . . 3-234
Results of resizing the dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-234
Results of resizing the dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-234
Vertical layout with components added . . . . . . . . . . . . . . . . . . . . . . . 3-235
Vertical layout with margin setup . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-235
Property layout with components added . . . . . . . . . . . . . . . . . . . . . . 3-236
Results of resizing the dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-237
Property layout with components added . . . . . . . . . . . . . . . . . . . . . . 3-237
Results of resizing the dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-238
PropertyLayout Manager with margin setup . . . . . . . . . . . . . . . . . . . 3-238
Results of resizing the dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-239
Results of resizing the dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-239
MessageBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-240
MessageBox produced from sample code . . . . . . . . . . . . . . . . . . . . . . 3-240
MLabel component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-241
MLabel component produced from sample code . . . . . . . . . . . . . . . . . 3-242
Hierarchy of the com.teamcenter.rac.util package . . . . . . . . . . . . . . . 3-243
Separator in New Item dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-244
Separator produced from sample code . . . . . . . . . . . . . . . . . . . . . . . . 3-245
SplitPane component used in a dialog box . . . . . . . . . . . . . . . . . . . . . 3-246
StringViewerDialog component . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-246
Validation report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-247
Context Sensitivity object model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-253
New Folder dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Default menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12
Customized menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13
New Connection menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14
Custom business object on the New menu . . . . . . . . . . . . . . . . . . . . . . 4-16
Configuration settings in the user interface . . . . . . . . . . . . . . . . . . . . . 4-17

Tables

My Teamcenter File→New menu commands . . . . . . . . . . . . . . . . . . . 3-247


My Teamcenter File→Edit menu commands . . . . . . . . . . . . . . . . . . . 3-248
Plug-in locations of perspectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-249

8 Client Customization Programmer’s Guide PLM00075 H


Chapter

1 Getting started with client


customization

Getting started with client customization . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1

Before you begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1

Client interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3


Rich client interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Thin client interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6

Basic concepts about client customization . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7


Siemens PLM Software customization support . . . . . . . . . . . . . . . . . . . . . 1-7
Syntax definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8

Basic tasks for client customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8

PLM00075 H Client Customization Programmer’s Guide


Chapter

1 Getting started with client


customization

Getting started with client customization


This manual describes the Teamcenter client extensibility features and how to
extend Teamcenter clients. It describes what you need to set up a customization
environment, develop customizations, and deploy the customizations.
You can perform client customizations in the following ways:
• Enterprise-wide
Make changes that appear on all clients. These include server-side changes.
Increasingly, the framework is being enhanced in Teamcenter to enable these
types of enterprise-wide customizations that can appear in all clients.
For more information, see Enterprise-wide configuration.

• On the rich client only


Make changes that appear only on the rich client.
For more information, see Rich client customization.

• On the thin client only


Make changes that appear only on the thin client.
For more information, see Thin client customization.

Before you begin


Prerequisites • Rich client
You must have the following installed on your machine to
customize the rich client:

o The rich client itself


For more information, see the Installation on UNIX and
Linux Clients Guide or the Installation on Windows
Clients Guide.

o The Java Development Kit (JDK) 6 (Update 26 or later)


For more information, see this Web site:

PLM00075 H Client Customization Programmer’s Guide 1-1


Chapter 1 Getting started with client customization

http://www.oracle.com/technetwork/java/javase/
downloads/index.html

o The Eclipse 3.6 integrated development environment


(IDE)
For more information, see this Web site:

http://archive.eclipse.org/eclipse/downloads/index.php

• Thin client
To successfully customize the thin client, you should be
familiar with the following:

o Integration Toolkit (ITK) programming

o HTTP and Web applications in general

o XML, HTML, and the document object models (DOMs)

o JavaScript

o Asynchronous JavaScript and XML (AJAX)

o Cascading style sheets (CSS)

o Deploying in a Web application server environment


Enable client • Rich client
customization
To enable rich client customization, you must install Eclipse
and configure it to run the rich client.
For more information, see Enable rich client customization.

• Thin client
You do not have to do anything else to enable thin client
customization.
Configure client • Rich client
customization
Once you install the prerequisites and set up the Eclipse
IDE, no additional steps are required to configure rich client
customization.

• Thin client
No additional steps are required to configure thin client
customization.

1-2 Client Customization Programmer’s Guide PLM00075 H


Getting started with client customization

Client interfaces
Teamcenter provides several interfaces, including a rich client interface, a
Web-based thin client interface, a Business Modeler IDE, and Teamcenter Client
for Microsoft Office. Because only the rich client and thin client interfaces have
supported customization methods, these are the only two interfaces that Siemens
PLM Software certifies for customization.
For more information about Teamcenter interfaces, see Getting Started with
Teamcenter.

Rich client interface


The rich client interface has a standard menu bar and toolbar with options that vary
depending on the currently active application perspective. You can place the cursor
over a rich client toolbar button to display a tooltip description.

1 Back and The Back and Forward buttons allow you to move between
Forward loaded Teamcenter applications. The small arrows next
to the buttons let you select from the list of currently
loaded applications.
For more information about moving between loaded
applications, see the Rich Client Interface Guide.

PLM00075 H Client Customization Programmer’s Guide 1-3


Chapter 1 Getting started with client customization

2 Application The application banner shows the name of the active


banner application and lists the current user and role. You can
double-click the user and role to display the User Settings
dialog box in which you can change your current role if
multiple roles are available to your user.
3 Search box The Search box provides predefined quick searches
using dataset, item ID, item name, keyword search, and
advanced search features.
For more information about the search feature in the rich
client, see the Rich Client Interface Guide.
4 Navigation pane The navigation pane provides quick access to the data
you use most. In addition to finding, organizing, and
accessing your data, you can configure the display of the
Teamcenter perspective buttons in the navigation pane to
display only those perspectives that you use regularly to
perform your tasks.
For information about configuring the navigation pane,
see the Rich Client Interface Guide.
5 Application pane The application pane displays the application perspectives
that are open in your Teamcenter session. By default, the
Getting Started application perspective displays a single
Getting Started view.
Note
Application perspectives are composed of views
that can be moved elsewhere in the Teamcenter
window, or can be dragged out to the desktop. Such
detached views remain connected to Teamcenter
and continue to function in concert with other
views.
6 Getting Started Provides access to the Getting Started application.
application
button
7 Primary Primary application buttons provide access to your most
applications frequently used Teamcenter application perspectives.
8 Secondary Secondary application buttons provide access to
applications Teamcenter application perspectives you use infrequently.
9 Clipboard button The clipboard button displays the Clipboard Contents
dialog box, which contains references to objects that have
been cut or copied from your workspace. The total number
of objects on the clipboard is displayed to the right of the
symbol.
For more information about the clipboard in the rich
client, see the Rich Client Interface Guide.

1-4 Client Customization Programmer’s Guide PLM00075 H


Getting started with client customization

Note
On Windows systems, operational status for the rich client interface and the
Teamcenter server is provided by the Teamcenter icon in the system tray.

To display the running status dialog box, click the Teamcenter icon in the
system tray .

The server and user interface condition symbols show the current status of
the rich client interface and the Teamcenter server.
• The server status indicates the state of the Teamcenter server:
o The server is ready, but there is no current communication
between the client and the server.

o The server is busy.

o The server appears to be idle.

o The server appears to be disconnected.

• The client status indicates the condition of the rich client:


o The user interface is responsive.

o The user interface is unresponsive.

PLM00075 H Client Customization Programmer’s Guide 1-5


Chapter 1 Getting started with client customization

Thin client interface

The thin client interface has a standard menu bar and toolbar with options that vary
depending on the currently active application. You can place the cursor over a thin
client toolbar button to display a tooltip description.

1 Menu bar Provides access to menu commands and lists the


current user name, group, role, revision rule, and
server.
2 Navigation pane Provides search functionality, link groups, and
application buttons.
You can expand and collapse the entire pane and
pane groups, select what is displayed in primary
and secondary areas, and configure the display of
applications.
3 Component pane Displays component hierarchies in a tree view. You
can resize this pane to be wider or narrower.
4 Data pane The data pane displays tabbed information.
• Depending on the type of object selected and
the configuration specified in your installation’s
XRT style sheet, you may see tabs such as the
Overview, Related Datasets, Impact Analysis,
Available Revisions, Viewer, and Details tabs.

• Groups of objects within a tab, called object sets,


can be configured in the XRT style sheet. Each
group of information can be configured to display
in table, list, or thumbnail. Each group can also
be supported by action command buttons such as
Cut and Copy.

1-6 Client Customization Programmer’s Guide PLM00075 H


Getting started with client customization

For information about creating object sets, see


objectSet.

• You can configure the columns in the Details tab.

The default layout for thin client applications has a header bar containing menus
and session information above three panes, arranged vertically side-by-side. Some
thin client applications arrange the component pane and the data pane horizontally.
The layout configuration for a thin client application can only be changed by
customization.
Note
If instant messaging is configured, the data pane may also display the current
Microsoft Office Communicator status of the owning and last modified users.
For more information about configuring instant messaging, see the Application
Administration Guide.

Basic concepts about client customization


Teamcenter is based on a client-server architecture. Both the client and server
layers can be customized. The client is the user interface (UI) layer and is built and
customized using the Java language (rich client) or JavaScript (thin client) and other
methods. The server layer can be customized using the Integration Toolkit (ITK) and
the C++ programming language. Client customization means changing how the
client user interface looks as well as how the client behaves.
For information about customizing the server layer, see the Server Customization
Programmer’s Guide.

Siemens PLM Software customization support


Siemens PLM Software is committed to maintaining compatibility between
Teamcenter product releases. If you customize functions and methods using
published APIs and documented extension points, be assured that the next
successive release will honor these interfaces. On occasion, it may become necessary
to make behaviors more usable or to provide better integrity. Our policy is to notify
customers at the time of the release prior to the one that contains a published
interface behavior change.
As Teamcenter evolves and advances, leveraging newly available technologies,
Teamcenter will make the ability to extend and tailor Teamcenter as flexible and
simple as possible. The direction is to fully leverage the developing Eclipse paradigm
to consolidate the thin client and rich client frameworks. A single client framework
allows extending both the thin client and rich client with a single extension. Note
that this consolidation will change the current extension model for the thin client
in the future.
Siemens PLM Software does not support code extensions that use unpublished and
undocumented APIs or extension points. All APIs and other extension points are
unpublished unless documented in the official set of technical manuals and help files
issued by Siemens PLM Software Technical Communications.

PLM00075 H Client Customization Programmer’s Guide 1-7


Chapter 1 Getting started with client customization

The Teamcenter license agreements prohibit reverse engineering, including:


decompiling Teamcenter object code or bytecode to derive any form of the original
source code; the inspection of header files; and the examination of configuration
files, database tables, or other artifacts of implementation. Siemens PLM Software
does not support code extensions made using source code created from such reverse
engineering.
If you have a comment or would like to request additional extensibility, contact
the Siemens PLM Software customer support representatives at GTAC for further
assistance.

Syntax definitions
This manual uses a set of conventions to define the syntax of Teamcenter commands,
functions, and properties. Following is a sample syntax format:
harvester_jt.pl [bookmark-file-name bookmark-file-name ...]
[directory-name directory-name ...]
The conventions are:

Bold Bold text represents words and symbols you must type exactly as
shown.
In the preceding example, you type harvester_jt.pl exactly as
shown.
Italic Italic text represents values that you supply.
In the preceding example, you supply values for bookmark-file-name
and directory-name.
text-text A hyphen separates two words that describe a single value.
In the preceding example, bookmark-file-name is a single value.
[] Brackets represent optional elements.
... An ellipsis indicates that you can repeat the preceding element.

Following are examples of correct syntax for the harvester_jt.pl: command:


harvester_jt.pl
harvester_jt.pl assembly123.bkm
harvester_jt.pl assembly123.bkm assembly124.bkm assembly125.bkm
harvester_jt.pl AssemblyBookmarks

Basic tasks for client customization


Following are some of the basic tasks you perform during client customizations:
• Change the layout of pages in both the rich client and thin client using style
sheets.
For more information, see Using style sheets.

• Set up your environment to perform rich client-only customizations.

1-8 Client Customization Programmer’s Guide PLM00075 H


Getting started with client customization

For more information, see Enable rich client customization.

• Override Teamcenter commands.


For more information, see Suppressing menu commands.

• Create custom forms on the rich client.


For more information, see Methods of form customization.

• Add a command to a menu on the rich client.


For more information, see Adding menu commands to a menu, toolbar, and
shortcut menu.

PLM00075 H Client Customization Programmer’s Guide 1-9


Chapter

2 Enterprise-wide configuration

Enterprise-wide configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1

Using the Business Modeler IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1

Suppressing menu commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1

Using style sheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2


Types of style sheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
Property style sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
Form style sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
Summary style sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
Create style sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
Summary 2007 style sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13
Search for style sheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15
Create a custom style sheet based on an existing style sheet . . . . . . . . . . . 2-19
Create a custom style sheet by importing an XML file . . . . . . . . . . . . . . . 2-22
Registering style sheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-23
Register a style sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-23
Using predefined style sheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-26
Verify the registration of forms in the rich client interface . . . . . . . . . . 2-27
Creating form preferences for new business objects . . . . . . . . . . . . . . 2-27
Sample customizations using style sheets . . . . . . . . . . . . . . . . . . . . . . . . 2-28
Modify the Summary view using style sheets . . . . . . . . . . . . . . . . . . . 2-28
Modify the Properties pane on the Summary view using style sheets . . 2-32
Modify the item create panels in the New Business Object wizard using style
sheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-34
Modify a form’s rendering using style sheets . . . . . . . . . . . . . . . . . . . 2-38
Localizing style sheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-41
Style sheet XML definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-42
Example of XML style sheet definition and rendering . . . . . . . . . . . . . 2-44
XML elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-45
all . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-47
attachments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-49
break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-50
classificationProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-51
classificationTrace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-53
command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-55
conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-58
customPanel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-61
firstcolumn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-64
GoverningProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-67
header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-68
image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-70

PLM00075 H Client Customization Programmer’s Guide


label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-72
listDisplay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-75
objectSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-77
page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-80
parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-85
property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-86
rendering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-89
Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-90
secondColumn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-91
section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-94
separator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-97
tableDisplay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-99
thumbnailDisplay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-101
treeDisplay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-102
view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-104
Rendering hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-106
Standard rendering hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-106
Add a custom rendering hint . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-114
Rendering style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-116
Default renderers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-117
Set properties to be conditionally mandatory or disabled . . . . . . . . . . 2-117

Client Customization Programmer’s Guide PLM00075 H


Chapter

2 Enterprise-wide configuration

Enterprise-wide configuration
You can use the following tools to apply enterprise-wide changes for all clients.
• Business Modeler IDE
For more information, see Using the Business Modeler IDE.

• Style sheets
For more information, see Using style sheets.

• Command suppression
For more information, see Suppressing menu commands.

Using the Business Modeler IDE


The Business Modeler IDE (Integrated Development Environment) is a tool for
configuring and extending the data model of your Teamcenter installation. The data
model objects define the objects and rules used in Teamcenter.
Administrators and business analysts use the IDE to:
• Create new data model objects such as:
o Business objects (for example, items and datasets)

o Properties

o Lists of values (LOVs)

o Rules

• Perform C++ customizations.

For more information about the Business Modeler IDE, see the Business Modeler
IDE Guide.

Suppressing menu commands


Carefully select which menu commands to suppress so end users are not presented
with unnecessary menu commands.

PLM00075 H Client Customization Programmer’s Guide 2-1


Chapter 2 Enterprise-wide configuration

Note
If all commands are removed from a menu, the menu itself is deleted. If
commands are suppressed, redundant dividers are removed.
• Suppressing menu commands in both the thin client and rich client
To suppress menu commands in the thin client, Siemens PLM Software
recommends you use the Command Suppression application in the rich
client. This hides the commands in both the thin client and rich client. The
WEB_menu_entry_suppressions Web-specific preference must have no
values to work correctly. Some commands are unique to the thin client
and do not appear in the standard menu list in the Command Suppression
application. These commands can be found under the dhtml heading.
For more information about command suppression, see the Command
Suppression Guide.

• Suppressing menu commands in the thin client only


To suppress thin client menu commands independently from the rich
client, set the WEB_menu_entry_suppressions preference, which
ignores the command suppression set in the rich client. This
preference can be set at the site, group, or role level. The values are
a list of menu keys found in the *menu.xml files found in the
staging_location\webapp_root\teamcenter\dhtml\common\intl\language
directory. For example:
WEB_menu_entry_suppressions=
whereClassifiedAction
openInUGAction

This example suppresses the View→Where Classified and


View→NX/Manager menu commands and ignores the command
suppressions set in the rich client.

Using style sheets


Style sheets are the easiest way to codelessly customize the rich client and thin
client. You can customize the display by editing the style sheet. The advantages are:
• You can customize using configuration instead of coding.

• The customization affects both the rich client and thin client.

You can use style sheets to change the layout of pages such as forms, the Properties
dialog box, the Summary view, and the creation wizard dialog boxes.
Style sheets are XML documents stored in XMLRenderingStylesheet datasets.
This gives more control to sites regarding how dialog boxes are displayed. The XML
code allows sites to define a subset of properties to display, the display order, the
user interface rendering components to be used, and more. Sites can use XML code
to customize not only forms but also individual fields in the forms. To see all the
available style sheets, search for all the XMLRenderingStylesheet datasets.
When a style sheet is registered for a specific object type or form, it defines the
display of the object or form properties. Registration information is stored in

2-2 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

the <type_name>.RENDERING and <type_name>.FORMRENDERING site


preferences.
For instructions about searching for style sheets, see Search for style sheets. For
sample customizations using style sheets, see Sample customizations using style
sheets.
Note
If you change style sheets, clear the cache to see the style sheet changes in
the clients. For example, to see the changes in the thin client, clear the Web
browser cache. To see the changes in the rich client, exit the rich client and
restart it using the -clean command argument to remove the old configuration
from cache.

Types of style sheets


Following are the available types of style sheets:
• Property
Defines the layout of the Properties dialog box.
For more information, see Property style sheet.

• Form
Defines the layout of forms, such as the Item Master form or the Item
RevisionMaster form.
For more information, see Form style sheet.

• Summary
Defines the layout of the Summary tab.
For more information, see Summary style sheet.

• Create
Defines the layout of dialog boxes used in the creation wizard when you
choose File→New→Other and some portions of dialog boxes when you choose
File→New→object.
For more information, see Create style sheet.

• Summary 2007
Defines the layout used in the My Teamcenter (2007) perspective.
For more information, see Summary 2007 style sheet.

These types are set on a style sheet using the Stylesheet Type box in the rich client.

PLM00075 H Client Customization Programmer’s Guide 2-3


Chapter 2 Enterprise-wide configuration

Types of available style sheets

Property style sheet

The Property style sheet type defines the layout of the Properties dialog box.
To view the Properties dialog box in the rich client, right-click an object and choose
View Properties.

Properties dialog box in the rich client


To view the Properties dialog box in the thin client, click the arrow on an object
and choose Properties.

2-4 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Properties dialog box in the thin client


To set a style sheet to the Property type, in the rich client open the style sheet
dataset in the Viewer tab and select Property in the Stylesheet Type box.

PLM00075 H Client Customization Programmer’s Guide 2-5


Chapter 2 Enterprise-wide configuration

Property style sheet


Notice how this Item style sheet defines the layout of the Properties dialog box for
the selected item.

Form style sheet

The Form style sheet defines the layout of forms, such as the Item Master form or
the Item RevisionMaster form.
To view a form in the rich client, select an instance of a form and click the Viewer tab.

2-6 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Form in the rich client


To view a form in the thin client, click the arrow on a form object and choose Open.

Form in the thin client


To set a style sheet to the Form type, in the rich client, open the style sheet dataset
in the Viewer tab and select Form in the Stylesheet Type box.

PLM00075 H Client Customization Programmer’s Guide 2-7


Chapter 2 Enterprise-wide configuration

Summary style sheet

The Summary style sheet type defines the layout of the Summary tab in the rich
client and the Overview tab in the thin client.

Summary tab in the rich client

2-8 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Overview tab in the thin client


To set a style sheet to the Summary type, in the rich client, open the style sheet
dataset in the Viewer tab and select Summary in the Stylesheet Type box.

PLM00075 H Client Customization Programmer’s Guide 2-9


Chapter 2 Enterprise-wide configuration

Summary style sheet


Notice how this ItemSummary style sheet defines the layout of the Summary tab
in the rich client and the Overview tab in the thin client.
For a sample customization using the Summary style sheet type, see Modify the
Summary view using style sheets.

Create style sheet

The Create style sheet type defines the layout of dialog boxes used in the creation
wizard.
To view creation dialog boxes in the rich client, choose File→New→Other.
Note
Only some portions of dialog boxes are defined with the create style sheet
when you choose File→New→object.

2-10 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Creation dialog box in the rich client


To view creation dialog boxes in the thin client, choose New→object.

PLM00075 H Client Customization Programmer’s Guide 2-11


Chapter 2 Enterprise-wide configuration

Creation dialog box in the thin client


To set a style sheet to the Create type, in the rich client, open the style sheet dataset
in the Viewer tab and select Create in the Stylesheet Type box.

2-12 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Create style sheet


Notice how this ItemCreate style sheet defines the layout of the creation dialog
boxes for the Item business object.
For a sample customization using the Create style sheet type, see Modify the item
create panels in the New Business Object wizard using style sheets.

Summary 2007 style sheet

The Summary 2007 style sheet type defines the layout of the Summary tab
in the My Teamcenter (2007) perspective in the rich client. By default, the
My Teamcenter (2007) perspective is hidden. To view the perspective, remove
MyTeamcenterLegacy from the HiddenPerspectives preference, and choose
Window→Open Perspective→Other→My Teamcenter (2007).

PLM00075 H Client Customization Programmer’s Guide 2-13


Chapter 2 Enterprise-wide configuration

Summary tab in the My Teamcenter (2007) perspective


To set a style sheet to the Summary 2007 type, in the rich client, open the style sheet
dataset in the Viewer tab and select Summary 2007 in the Stylesheet Type box.

2-14 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Summary 2007 style sheet


Notice how this ItemSummary2007 style sheet defines the layout of the Summary
tab for the selected item.

Search for style sheets


To find style sheets in the rich client, search for XMLRenderingStylesheet
datasets.
1. Click the Open Search View button .

2. Click the arrow on the Select a Search button and choose General.

PLM00075 H Client Customization Programmer’s Guide 2-15


Chapter 2 Enterprise-wide configuration

Starting the search for style sheets

3. In the Type box, type XMLRenderingStylesheet.


If you are looking for style sheets for a particular kind of object, enter a string in
the Name box to look for those kinds of style sheets. For example, if you want to
find all style sheets for items or item revisions, type *Item* in the Name box.

2-16 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Searching for XMLRenderingStylesheet datasets

4. Press the Enter key or click the Execute the Search button .
The results are displayed in the Search Results view.

PLM00075 H Client Customization Programmer’s Guide 2-17


Chapter 2 Enterprise-wide configuration

Viewing the search results for XMLRenderingStylesheet datasets

5. In the Search Results tab, select the style sheet you want to view. Click the
Viewer tab to see the style sheet.

2-18 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Viewing the style sheet contents in the rich client

Create a custom style sheet based on an existing style sheet


You can create your own custom style sheet.
For example, you create a custom business object in the Business Modeler IDE
and install it to the rich client, and you want to create a unique style sheet to
display the custom properties. To create the style sheet, in the rich client, search
for XMLRenderingStylesheet datasets, save one as your own custom style sheet
dataset, and then register the custom style sheet for use with the custom business
object.
For more examples of creating a custom style sheet, see Sample customizations
using style sheets.
For other ways to display custom properties in the user interface, see Methods of
form customization.
1. In the rich client, search for a style sheet you can base your new style sheet on.
For more information, see Search for style sheets.

PLM00075 H Client Customization Programmer’s Guide 2-19


Chapter 2 Enterprise-wide configuration

2. In the Search Results view, select the style sheet you want to use, choose
File→Save As, and rename it. For example, if you want to create a style sheet to
be used with a custom A5_MyItem business object, you could name the style
sheet A5_MyItem.
The new style sheet dataset is saved in your Newstuff folder in the Home view
and is still displayed in the Viewer tab.

3. Edit the style sheet.


a. Change the named reference for the file by selecting the style sheet dataset
and choosing View→Named References. In the Name column in the Named
References dialog box, change the old name of the file to the new save as
file name.

b. In the Viewer tab, click the arrow in the Registered Type box and select the
business object type you want to register it to. For example, if you have a
custom A5_MyItem business object added to your server, select A5_MyItem
from the list.

c. Edit the style sheet in the Viewer tab to include the elements you want
displayed in the layout.
For example, if you want to display custom properties, add them where you
want them to appear on the page, like this:
<page title="General" titleKey="General" format="TwoColumn">
<firstcolumn>
<property name="object_string" column="32"/>
<separator/>
<property name="object_name" column="32"/>
<property name="object_desc" />
<separator/>
<property name="owning_user" renderingHint="objectlink"
modifiable="false" />
<property name="owning_group" renderingHint="objectlink"
modifiable="false" />
<property name="last_mod_user" />
<property name="a5_MyDate"/>
<property name="a5_MyDouble"/>
<property name="a5_MyFlag"/>
<property name="a5_MyLongString"/>
<property name="a5_MyLOV"/>
<property name="a5_MyRef"/>
</firstcolumn>
<secondcolumn>
<image/>
</secondcolumn>
</page>

d. To change the style sheet type, click the arrow in the Stylesheet Type box.
You can choose one of the following types:
Property
Form
Summary
Create
Summary 2007

For more information about the style sheet types, see Types of style sheets.

4. When you are done making changes, click the Apply button in the lower right
corner of the view.

2-20 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Create a custom style sheet


Because you used the Registered Type box on the Viewer tab to register
the style sheet with a business object type, two new preferences are created
(a REGISTEREDTO preference and a RENDERING preference). These
preferences apply the style sheet to the business object so that the style sheet is
displayed in the situation you set it for (for example, for display of the business
object’s property, summary, form, or create information).
For more information, see Register a style sheet.

5. To see the two new preferences, choose Edit→Options and at the bottom of the
dialog box, click Search.

PLM00075 H Client Customization Programmer’s Guide 2-21


Chapter 2 Enterprise-wide configuration

Viewing the <dataset_name>.REGISTEREDTO and <type_name>.RENDERING


preferences
Notice how in the Current Values box of the <type_name>.RENDERING
preference there is a number in parentheses after the name of the business object.
That is a GUID number that identifies that unique business object, and that
GUID number is set in the <dataset_name(dataset-UID)>.REGISTEREDTO
preference. This ensures that the style sheet is applied to the correct business
object.

6. To see the style sheet changes in the clients, clear the cache. For example, to see
the changes in the thin client, clear the Web browser cache. To see the changes
in the rich client, exit the rich client and restart it using the -clean command
argument to remove the old configuration from cache.
To make the new style sheets available for quick loading to clients, run the
generate_client_meta_cache utility to add the new style sheets to client
cache, for example:
generate_client_meta_cache stylesheet –u=infodba –p=infodba –g=dba

For more information, see the Utilities Reference.

Create a custom style sheet by importing an XML file


You can create a new style sheet by creating a new dataset and associating it with
an XML file.
1. In the rich client My Teamcenter application, create a new dataset of type
XMLRenderingStylesheet.

2-22 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

2. Import the XML file as a named reference to the dataset as follows:


a. Right-click the dataset in the navigation tree and choose Named References.
Teamcenter displays the Named References dialog box.

b. Click the Import button.


Teamcenter displays the Import File dialog box.

c. Locate and select the XML file in your operating system directory and click
Import.
Teamcenter displays the XML file in the Named References dialog box.

d. Click Close.

3. Register the style sheet by setting the Form.REGISTEREDTO preference.


For more information about setting preferences, see Rich Client Interface Guide.
For more information for this type of preference, see the
<dataset_name>.REGISTEREDTO preference in the Preferences
and Environment Variables Reference.

4. To see the style sheet changes in the clients, clear the cache. For example, to see
the changes in the thin client, clear the Web browser cache. To see the changes
in the rich client, exit the rich client and restart it using the -clean command
argument to remove the old configuration from cache.

Registering style sheets


Style sheets are registered to specific business object types so that they appear when
the object type is selected in the user interface. To register a style sheet using the
rich client, open the style sheet in the Viewer view, select the business object type
in the Registered Type box, and click the Apply button in the lower right corner
of the Viewer view.

Register a style sheet

Each commonly used business object type (such as item, folder, and dataset) has
style sheets that define the layout of its properties in the user interface.
1. To see the business object that a style sheet is registered to, in the rich client,
first search for XMLRenderingStylesheet datasets.
For more information, see Search for style sheets.

2. Select the style sheet, and in the Viewer tab, see the business object listed in the
Registered Type box on the style sheet

PLM00075 H Client Customization Programmer’s Guide 2-23


Chapter 2 Enterprise-wide configuration

Viewing the business object type that the style sheet is registered to

3. To specify how the style sheet is to be used, select it in the Stylesheet Type box
(for example, for properties display, form rendering, Summary view, or creation
dialog boxes).

Viewing the style sheet type

4. When the Registered Type box in the Viewer tab is used to register a new
property type style sheet with a business object type, a new REGISTEREDTO
preference and a new RENDERING preference are created. These preferences
apply the XML rendering style sheet dataset type to the business object type so
that the style sheet is displayed in the situation you set it for (for example, for
display of the business object’s property, summary, form, or create information).
To see preferences, choose Edit→Options and click Search at the bottom of the
dialog box.

2-24 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Viewing the REGISTEREDTO preferences


For example, the
<dataset_name(dataset-UID)>.REGISTEREDTO=<type-name> preference
indicates the business object type that an XML rendering dataset is
registered to for use as a property type style sheet. Therefore, the
Item.REGISTEREDTO=Item preference means that the Item XML
rendering style sheet dataset is registered as a property type style
sheet to the Item business object type.
Similarly, the <type_name>.RENDERING=<dataset_name(dataset-UID)>
preference indicates the XML rendering dataset used to render the
properties shown on a particular business object type. Therefore, the
Item.RENDERING=Item preference means that for Item business objects,
the Item XML rendering style sheet dataset is used to render the properties
in the user interface.
Note
The UID (unique ID) is set in the preferences when custom XML rendering
datasets or custom business objects are used. The UID ensures that the
correct style sheet is applied to the correct business object.

When you register a style sheet, the preferences that are created depend on the
type of style sheet that is registered:

• Property
<dataset_name(dataset-UID)>.REGISTEREDTO=<type-name>
<type_name>.RENDERING=<dataset_name(dataset-UID)>

PLM00075 H Client Customization Programmer’s Guide 2-25


Chapter 2 Enterprise-wide configuration

• Form
<dataset-name(dataset-uid)>.FORM_REGISTEREDTO=<type-name>
<type-name>.FORMRENDERING=<dataset-name(dataset-uid)>

• Summary
<dataset-name(dataset-uid)>.SUMMARY_REGISTEREDTO=<type-name>
<type-name>.SUMMARYRENDERING=<dataset-name(dataset-uid)>

• Create
<dataset-name(dataset-uid)>.CREATE_REGISTEREDTO=<type-name>
<type-name>.CREATERENDERING=<dataset-name(dataset-uid)>
Note
Use the TC_CreateRenderingInheritTypeList preference to define
the children business object types to inherit the create rendering
format.

Using predefined style sheets


The Teamcenter installation provides several predefined style sheets that are
registered to display the properties of the following objects:
EPM job
Folder
Form
Group
Group member
ImanFile
Item
Item revision
Reservation
Role
Site
Tool
User
Volume

The registration information is stored in the preference; each object type has two
entries used to display regular properties, as follows:
• <type_name>.RENDERING
The value of this key is the dataset name or the dataset UID used to display
properties of this type of object.

• <dataset_name>(UID).REGISTEREDTO
The value of this key is the type name for which this dataset is registered.

Therefore, the value for <type_name>.RENDERING is the dataset name/UID and


the value for <dataset_name>(UID).REGISTEREDTO is the business object name.
The following keys are used to display form properties:
business-object-name.FORMRENDERING

2-26 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

dataset-name/uid.FORM_REGISTEREDTO

Verify the registration of forms in the rich client interface


1. In one of the rich client applications, choose Options from the Edit menu.
Teamcenter displays the Options dialog box.

2. Click the Index link in the lower-right portion of the window.


Teamcenter displays the Preferences pane.

3. Type form in the Search on preference name box and click the Search button
.
Teamcenter displays the preferences that begin with form in the Preferences list.

4. Click the Form.REGISTEREDTO entry in the Preferences list.


Teamcenter displays the business objects to which the Form style sheet can be
applied in the right pane of the window.
For more information for this type of preference, see the
<dataset_name>.REGISTEREDTO preference in the Preferences
and Environment Variables Reference.

If no rendering registration is found for the currently selected type, the system
searches the hierarchy to determine if a rendering is registered to any of the parent
classes or parent types. If one is found, that rendering is honored.

Creating form preferences for new business objects


To create a form for a customized business object (in other words, one not provided
by Teamcenter), you must create the following preferences:
• new-business-object-name.RENDERING
For more information for this type of preference, see the
<type_name>.RENDERING preference in the Preferences and
Environment Variables Reference.

• new-business-object-name.REGISTEREDTO
For more information for this type of preference, see the
<dataset_name>.REGISTEREDTO preference in the Preferences
and Environment Variables Reference.

The value of the preferences must be the name of the customized business object.
For example, to create a new business object called MyItem, you must create the
following preferences and set the value of each to MyItem:
• MyItem.RENDERING

• MyItem.REGISTEREDTO

For more information about creating preferences, see Rich Client Interface Guide.
After you create the preferences, either modify a predefined style sheet or create
a new style sheet.

PLM00075 H Client Customization Programmer’s Guide 2-27


Chapter 2 Enterprise-wide configuration

For more information, see Create a custom style sheet by importing an XML file.

Sample customizations using style sheets


Style sheets are the easiest and most powerful way to change the appearance of the
rich client or thin client user interface. Use them to change everything from the
properties that are displayed for a selected object to the layout of the rich client
Summary view and the thin client Overview tab. Sample customizations give you
an idea of what you can customize using style sheets.
For more information about style sheets, see Using style sheets.

Modify the Summary view using style sheets


You can modify what appears in the rich client Summary view and the thin client
Overview panel by codelessly changing the rendering using Teamcenter style sheets.
The Properties dialog box and the item create panes in the New Business Object
wizard also use style sheet rendering and can be similarly customized. You can also
use this technique to create custom renderings for new custom business objects.
For more information about using style sheets, see Using style sheets.
This example adds the checked_out property to the folder summary header
rendering, and a Contents section to the folder summary page.
1. In the rich client, find all XMLRenderingStylesheet datasets using the
search capability by removing all search criteria except for Type and setting it
to XMLRenderingStylesheet.
For more information, see Search for style sheets.

2. Select the FolderSummary dataset and choose File→Save As. Type


MyFolderSummary in the Name box.

3. Select MyFolderSummary and the Viewer pane.


The XML style sheet is displayed in the viewer.

4. In the Registered Type box, select Folder, and in the Stylesheet Type box,
select Summary.

5. Edit the MyFolderSummary style sheet to add the checked_out property to the
header area. The following is an example of the modified header area:
<header>
<image source="type"/>
<property name="owning_user" />
<property name="last_mod_date" />
<property name="checked_out" />
<property name="release_status_list" />
<property name="object_type" />
</header>

6. Click the Apply button.

7. Choose Edit→Options→Index and change the setting of the


Folder.SUMMARYRENDERING preference from FolderSummary to
MyFolderSummary. Click the Modify button.

8. Select a folder and select the Summary pane.

2-28 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

You see the checked_out property displayed as Checked-Out.

Adding a property to the rich client Summary pane


Note
If the change doesn’t appear in the rich client, you can exit the rich client
and restart it using the -clean command argument to remove the old
configuration from cache.

In the thin client, the change appears as follows.

Adding a property to the thin client Overview tab

9. You can configure the folder summary in many other ways. For example, to show
folder contents using the objectSet tag, place the following code highlighted in
bold into the MyFolderSummary style sheet after the properties section,
and click the Apply button:
<section text="properties">
<property name="object_name"/>
<property name="object_desc"/>
<property name="object_type"/>
<separator/>
<property name="owning_user" renderingHint="objectlink" modifiable="false"/>
<property name="owning_group" renderingHint="objectlink" modifiable="false"/>
<property name="last_mod_user"/>
<separator/>
<command commandId="com.teamcenter.rac.properties" text="moreProperties"/>
</section>
<section text="Contents">
<objectSet source="contents.WorkspaceObject" defaultdisplay="thumbnailDisplay"
sortby="object_name" sortdirection="ascending">
<tableDisplay>
<property name="object_string"/>
<property name="object_desc"/>
<property name="object_type"/>
<property name="owning_user"/>
<property name="owning_group"/>
<property name="last_mod_user"/>
</tableDisplay>
<thumbnailDisplay/>
<treeDisplay>
<property name="object_string"/>
<property name="object_desc"/>
<property name="object_type"/>
<property name="owning_user"/>
<property name="owning_group"/>
<property name="last_mod_user"/>
</treeDisplay>
<listDisplay/>
<command actionKey="newBusinessObjectContextualAction"
commandId="com.teamcenter.rac.common.AddNew" renderingHint="commandbutton"/>
<command actionKey="cutAction" commandId="org.eclipse.ui.edit.cut"

PLM00075 H Client Customization Programmer’s Guide 2-29


Chapter 2 Enterprise-wide configuration

renderingHint="commandbutton">
<parameter name="localSelection" value="true"/>
</command>
<command actionKey="copyAction" commandId="com.teamcenter.rac.copy"
renderingHint="commandbutton"/>
<command actionKey="pasteAction"
commandId="com.teamcenter.rac.viewer.pastewithContext" renderingHint="commandbutton"/>
</objectSet>
</section>

When you select a folder and click the Summary tab, the Contents section
is displayed.

Adding a section to the rich client Summary pane using the objectSet tag
In the thin client, the change appears as follows.

2-30 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Adding a section to the thin client Overview tab using the objectSet tag

For more information about the objectSet tag, see objectSet.


Note
Only three <views> elements are supported on the Summary view:
impactanalysis, viewer, and properties.
• impactanalysis is for where-used/referenced information.

• viewer is for an image preview.

• properties is for any combination of properties.

The style sheet contains <page> elements, and each <page> can contain
multiple views. If a user right-clicks the Summary view, a shortcut menu with
the view list is displayed; the user can hide or display views. The viewer view
can be used for items, item revisions, and datasets, but not folders or forms.
The other two views can be used for any object.

PLM00075 H Client Customization Programmer’s Guide 2-31


Chapter 2 Enterprise-wide configuration

Modify the Properties pane on the Summary view using style sheets

You can modify what appears in the Properties pane and its layout by codelessly
changing the rendering using Teamcenter style sheets. This example adds the
protection property to the folder general rendering.
1. In the rich client, find all XMLRenderingStylesheet datasets using the
search capability by removing all search criteria except for Type and setting it
to XMLRenderingStylesheet.
For more information, see Search for style sheets.

2. Select the FolderSummary dataset and choose File→Save As. Type


MyFolderSummary in the Name box.
The MyFolderSummary style sheet is saved in the Newstuff folder.

3. Select MyFolderSummary and the Viewer pane.


The XML style sheet is displayed in the viewer.

4. In the Registered Type box, select Folder, and in the Stylesheet Type box,
select Summary.

5. Edit the MyFolderSummary style sheet to add a separator and the protection
property to the general area. The following is an example of the modified general
area:
<column>
<section text="properties">
<property name="object_name"/>
<property name="object_desc"/>
<property name="object_type"/>
<separator/>
<property name="owning_user" renderingHint="objectlink" modifiable="false"/>
<property name="owning_group" renderingHint="objectlink" modifiable="false"/>
<property name="last_mod_user"/>
<separator/>
<property name="protection" />
<separator/>
<command commandId="com.teamcenter.rac.properties" text="moreProperties"/>
</section>
</column>

6. Click the Apply button.

7. Choose Edit→Options→Index and change the setting of the


Folder.SUMMARYRENDERING preference from Folder to MyFolderSummary.

8. Exit the rich client and restart it using the -clean command argument to remove
the old configuration from cache.

2-32 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Note
If your customizations still do not appear, clear cache by deleting the
Teamcenter subdirectory in the user’s home directory on the client. This
directory is automatically created again when the user starts the rich
client. This directory usually contains RAC and TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
If you delete this directory, the last state of the rich client is lost, and the
user interface appears as it does at initial startup.
For more information, see Ensure your customizations appear.

9. In the rich client, select a folder and click the Summary tab.
The protection property is displayed.

Adding a property to the Properties pane on the Summary tab in the rich client
In the thin client, the change appears as follows.

PLM00075 H Client Customization Programmer’s Guide 2-33


Chapter 2 Enterprise-wide configuration

Adding a property to the Properties pane on the Overview tab in the thin client

For more information about using style sheets, see Using style sheets.

Modify the item create panels in the New Business Object wizard using style
sheets
You can modify what appears in the New Business Object wizard in the rich client
when you choose the File→New→Other menu command by codelessly changing the
rendering using Teamcenter style sheets. This example modifies the item creation
panes by removing the user_data boxes from the Additional Item Information dialog
box (which uses the Item Master form) and the Item Revision Information dialog box
(which uses the ItemRevision Master form).

2-34 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

User Data boxes on the Item Master form


1. In the rich client, find all XMLRenderingStylesheet datasets using the
search capability by removing all search criteria except for Type and setting it
to XMLRenderingStylesheet.
For more information, see Search for style sheets.

2. Select the ItemCreate dataset and choose File→Save As. Type MyItemCreate
in the Name box.
The MyItemCreate style sheet is saved in the Newstuff folder.

3. Select MyItemCreate and the Viewer pane.


The XML style sheet is displayed in the viewer.

4. In the Registered Type box, select Item, and in the Stylesheet Type box, select
Create.

PLM00075 H Client Customization Programmer’s Guide 2-35


Chapter 2 Enterprise-wide configuration

5. Edit the MyItemCreate style sheet to remove the user_data elements shown in
bold in the following sample:
<page title="Additional Item Information" titleKey="AdditionalItemInformation">
<view name="properties">
<property name="IMAN_master_form:project_id" />
<property name="IMAN_master_form:previous_item_id" />
<property name="IMAN_master_form:serial_number" />
<property name="IMAN_master_form:item_comment" />
<property name="IMAN_master_form:user_data_1" />
<property name="IMAN_master_form:user_data_2" />
<property name="IMAN_master_form:user_data_3" />
</view>
</page>
<page title="Item Revision Information" titleKey="ItemRevisionInformation">
<view name="properties">
<property name="revision:IMAN_master_form_rev:project_id" />
<property name="revision:IMAN_master_form_rev:previous_version_id" />
<property name="revision:IMAN_master_form_rev:serial_number" />
<property name="revision:IMAN_master_form_rev:item_comment" />
<property name="revision:IMAN_master_form_rev:user_data_1" />
<property name="revision:IMAN_master_form_rev:user_data_2" />
<property name="revision:IMAN_master_form_rev:user_data_3" />
</view>
</page>

For more information about using compounding (for example,


revision:IMAN_master_form:item_comment in the preceding sample code),
see the property element description.

6. Click the Apply button.

7. Choose Edit→Options→Index and change the setting of the


Item.CREATERENDERING preference from ItemCreate to MyItemCreate.

8. Exit the rich client and restart it using the -clean command argument to remove
the old configuration from cache.
Note
If your customizations still do not appear, clear cache by deleting the
Teamcenter subdirectory in the user’s home directory on the client. This
directory is automatically created again when the user starts the rich
client. This directory usually contains RAC and TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
If you delete this directory, the last state of the rich client is lost, and the
user interface appears as it does at initial startup.
For more information, see Ensure your customizations appear.

9. To test the customization in the rich client, choose File→New→Other and select
Item.
The user_data boxes are removed from the new item create panes.

2-36 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Item Master Form with User Data boxes removed in the rich client
To see the change in the thin client, choose New→Item.

PLM00075 H Client Customization Programmer’s Guide 2-37


Chapter 2 Enterprise-wide configuration

Item Master Form with User Data boxes removed in the thin client

For more information about using style sheets, see Using style sheets.

Modify a form’s rendering using style sheets

You can modify how a Teamcenter-provided form is rendered by codelessly changing


the Teamcenter style sheets. This example modifies the item master form.
1. In the rich client, choose File→New→Item to create a new item.
To see the default item master form, open the form just under the item.

Selecting the item master form


The default item master form appears:

2-38 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Default item master form

2. Find all XMLRenderingStylesheet datasets using the rich client search


capability by removing all search criteria except for Type and setting it to
XMLRenderingStylesheet.
For more information, see Search for style sheets.

3. Select any XMLRenderingStylesheet dataset and choose File→Save As. Type


MyItemMasterRenderer in the Name box.
The MyItemMasterRenderer style sheet is saved in the Newstuff folder.

4. Select MyItemMasterRenderer and the Viewer pane.


The XML style sheet is displayed in the viewer.

5. In the Registered Type box, select Item Master, and in the Stylesheet Type
box, select Property.

6. Replace the rendering tag contents of the MyItemMasterRenderer style sheet


with the following sample code:
<rendering>
<page format="OneColumn" title="general" titleKey="general">
<property name="project_id" />
<property name="serial_number" renderingHint="textfield" column="25" />
<property name="item_comment" renderingHint="textarea" column="10"
row="5" />
<property name="owning_user" />
</page>

PLM00075 H Client Customization Programmer’s Guide 2-39


Chapter 2 Enterprise-wide configuration

<page title="Advanced" format="TwoColumn">


<firstcolumn>
<property name="user_data_1" renderingHint="lovbutton"
renderingStyle="titled" border="true" />
<separator />
<property name="user_data_2" renderingStyle="titled" />
</firstcolumn>
<secondcolumn>
<property name="user_data_3" renderingStyle="titled"
border="true" />
<property name="previous_item_id" renderingStyle="titled" />
</secondcolumn>
</page>
</rendering>

Note
Notice how this code adds an Advanced link to the form.

7. Click the Apply button.

8. Choose Edit→Options→Index→New, add the Item Master.FORMRENDERING


preference as a site preference, and set its value to MyItemMasterRenderer.

9. Open the item master form to see the new layout.

Customized layout of the form’s General properties page in the rich client
Click the Advanced link at the bottom of the form to open the additional
properties on the form.

2-40 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Customized layout of the form’s Advanced properties page in the rich client
Note
To see the change in the rich client, you may need to exit the rich client
and restart it using the -clean command argument to remove the old
configuration from cache.
If your customizations still do not appear in the rich client, clear cache
by deleting the Teamcenter subdirectory in the user’s home directory on
the client. This directory is automatically created again when the user
starts the rich client. This directory usually contains RAC and TAO
subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
If you delete this directory, the last state of the rich client is lost, and the
user interface appears as it does at initial startup.
For more information, see Ensure your customizations appear.

For more information about using style sheets, see Using style sheets.

Localizing style sheets


Localizing is translation of text into the local language. Typically, any values entered
to text or name style sheet attributes must have a corresponding localized text
string, for example:

PLM00075 H Client Customization Programmer’s Guide 2-41


Chapter 2 Enterprise-wide configuration

<header>
<image source="thumbnail"/>
<classificationTrace/>
<property name="owning_user"/>
<property name="last_mod_date"/>
<property name="release_status_list"/>
<property name="object_type"/>
</header>
<page text="Overview" format="TwoColumn">
<firstcolumn>
<section text="MyText">

The localized text strings are kept in xmlstylesheet_locale.properties files for the
rich client or in the locale\webstrings.xml file for the thin client.
When you customize a style sheet with new text, you must enter the text in the
different languages to be displayed in the user interface. If you do not enter localized
text strings, the unlocalized text appears in the user interface between exclamation
marks, for example: !MyText!.
Use the following methods to localize custom text in style sheets:
• Rich client
Open the TC_ROOT\portal\plugins\com.teamcenter.rac.viewer_version
plug-in and extract the
stylesheet\xmlstylesheet\xmlstylesheet_locale.properties file. Add the
text strings in this file, and distribute the revised JAR file on client machines.
For example, assume that the following code in a style sheet:
<section text="MyText">

Place the following into the xmlstylesheet_locale.properties file:


MyText=This is My Text

• Thin client
In the thin client installation location, open the
staging_location\webapp_root\teamcenter\dhtml\common\intl\en_US\
webstrings.xml file and create a new entry for the text you want to localize, for
example:
<web_string>
<name>web_xrt_MyText</name><string>This Is My Text</string>
</web_string>

Then save the revised webstrings.xml file, regenerate and redeploy the .ear
file, and clear the browser cache.

For information about localizing custom rich client plug-ins, see Localize your
customizations.

Style sheet XML definition


The following code illustrates an example of the XML definition.
<?xml version="1.0" encoding="UTF-8"?>
<rendering>
<page format="OneColumn" title="General" titleKey="general">
<property name="project_id" />
<property name="serial_number" renderingHint="textfield" column="25" />
<separator />
<property name="item_comment" renderingHint="textarea" column="10" row="5" />
<property name="owning_user" />
</page>
<page title="Advanced" format="TwoColumn">

2-42 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

<firstcolumn>
<property name="user_data_1" renderingHint="lovbutton" renderingStyle="titled"
border="true" />
<separator />
<property name="user_data_2" renderingStyle="titled" />
</firstcolumn>
<secondcolumn>
<property name="user_data_3" renderingStyle="titled" border="true" />
<property name="previous_item_id" renderingStyle="titled" />
</secondcolumn>
</page>
</rendering>

Each page in the XML is a tab. The tab uses OneColumn format, meaning that each
row has only one property. There is no rendering hint defined for the project_id
property; therefore, the default is used.
The following two figures illustrate how the XML code is rendered in the rich client
and the thin client.

Form rendering example in the rich client

PLM00075 H Client Customization Programmer’s Guide 2-43


Chapter 2 Enterprise-wide configuration

Form rendering example in the thin client

Example of XML style sheet definition and rendering

The following code shows an example of an XML definition for item properties:
<?xml version="1.0" encoding="UTF-8"?>
<rendering>
<page title="General" titleKey="General" format="TwoColumn">
<firstcolumn>
<property name="object_string" column="32"/>
<separator/>
<property name="object_name" column="32"/>
<property name="object_desc" />
<separator/>
<property name="owning_user" />
<property name="owning_group" />
<property name="last_mod_user" />
</firstcolumn>
<secondcolumn>
<image/>
</secondcolumn>
</page>
<page title="Reservation" titleKey="Reservation">
<property name="checked_out" />
<property name="checked_out_user" />
<separator/>
<property name="checked_out_date" />
<property name="checked_out_change_id" />
<separator/>
<property name="reservation" />
</page>
<page title="Project" titleKey="Project">
<property name="proj_assign_mod_date" />
<property name="project_ids" />
<separator/>
<property name="project_list" />
</page>
<page title="All" titleKey="All">
<all type="property"/>
</page>
</rendering>

The following figures show the resulting item properties dialog box in the rich client
and thin client.

2-44 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Item properties dialog box in the rich client

Item properties dialog box in the thin client

XML elements
The XML file used to define the property display must include certain elements and
attributes, as shown in the following sample code from the ItemRevision.xml file:

PLM00075 H Client Customization Programmer’s Guide 2-45


Chapter 2 Enterprise-wide configuration

<rendering>
<page title="General" titleKey="General" format="TwoColumn">
<firstcolumn>
<property name="object_string" column="32"/>
<separator/>
<property name="object_name" column="32"/>
<property name="item_id" column="32"/>
<property name="item_revision_id" column="32"/>
<property name="object_desc" />
<property name="items_tag" />
<separator/>
<property name="owning_user" renderingHint="objectlink" modifiable="false" />
<property name="owning_group" renderingHint="objectlink" modifiable="false" />
<property name="last_mod_user" />
</firstcolumn>
<secondcolumn>
<image/>
</secondcolumn>
</page>
<page title="Reservation" titleKey="Reservation">
<property name="checked_out" />
<property name="checked_out_user" />
<separator/>
<property name="checked_out_date" />
<property name="checked_out_change_id" />
<separator/>
<property name="reservation" />
</page>
<page title="Project" titleKey="Project">
<property name="proj_assign_mod_date" />
<property name="project_ids" />
<separator/>
<property name="project_list" />
</page>
<page title="All" titleKey="All">
<all type="property"/>
</page>
</rendering>

2-46 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

all
Lists all properties of the defined object.
ATTRIBUTES
type
Indicates whether to list all the object properties or only form properties. The valid
values for this attribute are property and form.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the following types of style sheets (but not the New Business
Object wizard):
Property
Summary
Form

EXAMPLE
Following is sample code from the Folder.xml XML rendering style sheet showing
the all element:
<page title="All" titleKey="All">
<all type="property"/>
</page>

The all element in the rich client

PLM00075 H Client Customization Programmer’s Guide 2-47


Chapter 2 Enterprise-wide configuration

The all element in the thin client

2-48 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

attachments
Specifies which objects attached to an item revision should appear in the attachments
list. The format for the element value is:
relation.type

For example:
<attachments>
IMAN_reference.MSExcel
</attachments>

The example displays all attachments to the item revision with a MSExcel type and
an IMAN_reference relation. Separate multiple entries with commas.
ATTRIBUTES
None.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the Summary style sheets.
EXAMPLE
Following is sample code from the ItemRevSummary2007.xml XML rendering
style sheet showing the attachments element:
<view name="attachments">
<attachments>IMAN_specification.UGMASTER, IMAN_reference.MSExcel,
IMAN_Rendering.DirectModel, SimplifiedRendering.JtSimplification</attachments>
</view>

PLM00075 H Client Customization Programmer’s Guide 2-49


Chapter 2 Enterprise-wide configuration

break
Inserts a break in the pane.
ATTRIBUTES
None.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the following types of style sheets:
Property
Summary
Form
Create

EXAMPLE
<page titleKey=”general” title=”General” format=”OneColumn”>
<property name="project_id" icon=”images/group.gif”/>
<property name="serial_number" renderingHint="textfield" renderingStyle=”headed”/>
<property name="item_comment" renderingHint="textarea" column=”30” row=”5”/>
<property name="user_data_1" renderingHint="lovcombobox" renderingStyle=”titled”
border=”true” />
<separator />
<property name=”user_data_1” />
<property name=”user_data_2” />
<break />
</page>

2-50 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

classificationProperties
Specifies that the classification properties of the current object should be displayed.
Properties and their values are rendered as name/value pairs in static text.
For information about adding classification properties to an object, see the
Classification Guide.
ATTRIBUTES
None.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used only on Summary style sheets.
EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the classificationProperties element:
<page text="Overview" format="TwoColumn">
<firstcolumn>
<section text="AvailableRevisions">
<objectSet source="revision_list.ItemRevision" defaultdisplay="thumbnailDisplay"
sortdirection="descending" sortby="item_revision_id">
<tableDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</tableDisplay>
<thumbnailDisplay/>
<treeDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</treeDisplay>
<listDisplay/>
</objectSet>
</section>
<section text="ItemProperties">
<property name="object_desc"/>
<separator/>
<property name="owning_user" renderingHint="objectlink" modifiable="false"/>
<property name="owning_group" renderingHint="objectlink" modifiable="false"/>
<property name="last_mod_user"/>
<separator/>
<property name="checked_out"/>
<property name="checked_out_user"/>
<separator/>
<command commandId="com.teamcenter.rac.properties" text="moreProperties"/>
</section>
<section text="ClassificationProperties">
<classificationProperties/>
</section>
</firstcolumn>

Following is how classification properties are rendered in the rich client.

PLM00075 H Client Customization Programmer’s Guide 2-51


Chapter 2 Enterprise-wide configuration

classificationProperties in the rich client

2-52 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

classificationTrace
Specifies that the classification traces of the item should be displayed, for example,
Home Care > Cleaners > Detergents.
For information about classification, see the Classification Guide.
ATTRIBUTES
None.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used only on Summary style sheets.
EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the classificationTrace element:
<header>
<image source="thumbnail"/>
<classificationTrace/>
<property name="owning_user"/>
<property name="last_mod_date"/>
<property name="release_status_list"/>
<property name="object_type"/>
</header>

Following is how the classification trace is rendered in the rich client.

PLM00075 H Client Customization Programmer’s Guide 2-53


Chapter 2 Enterprise-wide configuration

classificationTrace in the rich client

2-54 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

command
Specifies a command representation to be displayed.
ATTRIBUTES
actionKey
Specifies the action key that presents the command in the thin client. (If you do not
want to present the command in the thin client, you can omit this attribute.)
commandId
Specifies the command to be executed. This attribute is used only by the rich client.
The attribute value must be a key into a property file and must be a valid command
ID defined in the rich client. This is a string attribute that is required.
defaultTitle
Specifies the string to be displayed if a key is not found in the property file. This
is an optional attribute.
icon
Specifies the icon to be displayed before the command label. The attribute value
must be a key into a property file. This is an optional attribute.
renderingHint
Specifies whether the command is rendered as a hyperlink or as a button. Valid
values are hyperlink and commandbutton. This attribute is optional. If the
attribute is not specified, the command is rendered as a hyperlink.
text
Specifies the text to display. The attribute value must be a key into a property file. If
the key is not found, the attribute value itself is displayed as static text. If neither
the text or icon attributes are specified, the value of the commandId attribute
is rendered. This attribute is optional.
title
Specifies the default string of the title for this user interface element. This attribute
is used when the string in the titleKey attribute is not found in the locale file.
This is an optional attribute.
titleKey
Specifies the key used to search for the title in the locale file. If it is not defined, the
string defined by the title attribute is used. This is an optional attribute.
tooltip
Specifies the tooltip for the command. The attribute value must be a key into a
property file. This attribute is optional but is required if the icon attribute is
specified.

PLM00075 H Client Customization Programmer’s Guide 2-55


Chapter 2 Enterprise-wide configuration

SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used only on the Summary style sheets.
EXAMPLE
Following is sample code using the command element on an object set:
<objectSet source="contents.WorkspaceObject" defaultdisplay="thumbnailDisplay"
sortby="object_name" sortdirection="ascending">
<tableDisplay>
<property name="object_string"/>
<property name="object_desc"/>
<property name="object_type"/>
<property name="owning_user"/>
<property name="owning_group"/>
<property name="last_mod_user"/>
</tableDisplay>
<thumbnailDisplay/>
<treeDisplay>
<property name="object_string"/>
<property name="object_desc"/>
<property name="object_type"/>
<property name="owning_user"/>
<property name="owning_group"/>
<property name="last_mod_user"/>
</treeDisplay>
<listDisplay/>
<command actionKey="newBusinessObjectContextualAction"
commandId="com.teamcenter.rac.common.AddNew" renderingHint="commandbutton"/>
<command actionKey="cutAction" commandId="org.eclipse.ui.edit.cut"
renderingHint="commandbutton">
<parameter name="localSelection" value="true"/>
</command>
<command actionKey="copyAction" commandId="com.teamcenter.rac.copy"
renderingHint="commandbutton"/>
<command actionKey="pasteAction"
commandId="com.teamcenter.rac.viewer.pastewithContext" renderingHint="commandbutton"/>
</objectSet>

In this example, the command element adds the Add New, Cut, Copy, and Paste
buttons in the user interface.

command element in the rich client

2-56 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

command element in the thin client


For a customization example that uses the command element, see Modify the
Summary view using style sheets.

PLM00075 H Client Customization Programmer’s Guide 2-57


Chapter 2 Enterprise-wide configuration

conditions
Indicates that rules are specified for a property.
The GoverningProperty and Rule elements are used within the conditions
element. The GoverningProperty tag defines the property to apply the condition
to, and the Rule tag defines the state of the property. If multiple properties within a
single form are to be tracked, there are multiple entries of the GoverningProperty
tag within the conditions tag. Combining entries for a different form types within a
single stylesheet is not permitted.
Note
The conditions and GoverningProperty tags do not work in the Viewer
view if the style sheet is registered for properties display.

ATTRIBUTES
None.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the following types of style sheets:
Property
Form

EXAMPLE
Following is sample style sheet code showing the conditions element:
<rendering>
<property name = "user_data_1"/>
<property name = "user_data_2"/>
<property name = "user_data_3"/>
<conditions>
<GoverningProperty propertyname = "user_data_1" propertyvalue = "Mine1">
<Rule propertyname = "user_data_2" state = "required"/>
<Rule propertyname = "user_data_3" state = "disabled"/>
</GoverningProperty>
<GoverningProperty propertyname = "user_data_1" propertyvalue = "Do IM">
<Rule propertyname = "user_data_2" state = "disabled"/>
<Rule propertyname = "user_data_3" state = "required"/>
</GoverningProperty>
</conditions>
</rendering>

The first GoverningProperty node in the sample states that if the User Data 1
box contains a value of Mine1, then the User Data 2 box is required and the User
Data 3 box is disabled. The second GoverningProperty node in the sample states
that if the User Data 1 box contains a value of Do IM, then the User Data 2 box is
disabled and the User Data 3 box is required.
Following is the resulting user interface.

2-58 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

No value match in the User Data 1 box

Value in the User Data 1 box matches the first GoverningProperty node

PLM00075 H Client Customization Programmer’s Guide 2-59


Chapter 2 Enterprise-wide configuration

Value in the User Data 1 box matches the second GoverningProperty node
For another example, see Set properties to be conditionally mandatory or disabled.

2-60 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

customPanel
Embeds a custom panel in the New Business Object wizard, which is run when you
choose File→New→Other in the rich client.
ATTRIBUTES
java
Specifies the fully qualified Java implementation class name responsible for building
the custom user interface (for example, com.teamcenter.rac.MyCustomPanel).
This is supported in the rich client only.
js
Specifies the path and name of the JavaScript file responsible for building the
custom user interface (for example, custom/MyCustomPanel.js). This is supported
in the thin client only.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the Create style sheets.
EXAMPLE
Following is a custom style sheet that uses the customPanel element. (This
example works in the rich client only.)
<?xml version="1.0" encoding="UTF-8"?>
<rendering>
<views>properties</views>
<page title="Item Information" titleKey="ItemInformation">
<view name="properties">
<property name="item_id" />
<property name="revision:item_revision_id" />
<property name="object_name" />
<property name="object_desc" />
<separator/>
<property name="uom_tag" />
<separator/>
<customPanel java="com.teamcenter.rac.ui.commands.newbo.mypanel.MyPanel" />
</view>
</page>
<page title="Additional Item Information" titleKey="AdditionalItemInformation">
<view name="properties">
<property name="IMAN_master_form:project_id" />
<property name="IMAN_master_form:previous_item_id" />
<property name="IMAN_master_form:serial_number" />
<property name="IMAN_master_form:item_comment" />
<property name="IMAN_master_form:user_data_1" />
<property name="IMAN_master_form:user_data_2" />
<property name="IMAN_master_form:user_data_3" />
</view>
</page>
<page title="Item Revision Information" titleKey="ItemRevisionInformation">
<view name="properties">
<property name="revision:IMAN_master_form_rev:project_id" />
<property name="revision:IMAN_master_form_rev:previous_version_id" />
<property name="revision:IMAN_master_form_rev:serial_number" />
<property name="revision:IMAN_master_form_rev:item_comment" />
<property name="revision:IMAN_master_form_rev:user_data_1" />
<property name="revision:IMAN_master_form_rev:user_data_2" />
<property name="revision:IMAN_master_form_rev:user_data_3" />
</view>
</page>
</rendering>

You must create your own custom panel to pass to the customPanel tag. Following
is the MyPanel.java file that defines the custom panel:

PLM00075 H Client Customization Programmer’s Guide 2-61


Chapter 2 Enterprise-wide configuration

package com.teamcenter.rac.ui.commands.newbo.mypanel;
import com.teamcenter.rac.ui.commands.create.bo.NewBOWizard;
import com.teamcenter.rac.util.AbstractCustomPanel;
import com.teamcenter.rac.util.IPageComplete;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.FormToolkit;
public class MyPanel extends AbstractCustomPanel implements IPageComplete
{
private Composite composite;
private Text text;
public MyPanel()
{
}
public MyPanel( Composite parent )
{
super( parent );
}
@Override
public void createPanel()
{
FormToolkit toolkit = new FormToolkit( parent.getDisplay() );
composite = toolkit.createComposite( parent );
GridLayout gl = new GridLayout( 2, false );
composite.setLayout( gl );
GridData gd = new GridData( GridData.FILL_HORIZONTAL );
gd.grabExcessHorizontalSpace = true;
composite.setLayoutData( gd );
GridData labelGD = new GridData( GridData.HORIZONTAL_ALIGN_END );
Label label = toolkit.createLabel( composite, "Object_Name: " );
label.setLayoutData( labelGD );
GridData typeTextGd = new GridData( GridData.FILL_HORIZONTAL );
text = toolkit.createText( composite, "" );
text.setText( "This is my own panel" );
text.setLayoutData( typeTextGd );
}
public boolean isPageComplete()
{
String txt = text.getText();
return txt.length() == 0 ? false : true;
}
@Override
public Composite getComposite()
{
return composite;
}
@Override
public void updatePanel()
{
if( input != null )
{
NewBOWizard wizard = (NewBOWizard) input;
String msg = "";
if( wizard.model.getTargetArray()!= null )
{
try
{
msg = wizard.model.getTargetArray()[0].getProperty(
"object_name" ).toString();
}
catch( Exception e )
{
e.printStackTrace();
}
}
else
{
msg = "Nothing is selected";
}
text.setText( msg );
}
}
@Override
public Object getUserInput()
{
return null;

2-62 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

}
}

Following is the resulting custom panel added to the New Business Object wizard,
which is run when you choose File→New→Other in the rich client.

customPanel example in the rich client

PLM00075 H Client Customization Programmer’s Guide 2-63


Chapter 2 Enterprise-wide configuration

firstcolumn
Defines the layout of the first column defined on a page. The secondcolumn
element defines the layout of the second column on a page.
This element applies only if the TwoColumn format is set in the format attribute
on the page element.
ATTRIBUTES
None.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the following types of style sheets (but not the New Business
Object wizard):
Property
Summary
Form
EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the firstcolumn element:
<page text="Overview" format="TwoColumn">
<firstcolumn>
<section text="AvailableRevisions">
<objectSet source="revision_list.ItemRevision"
defaultdisplay="thumbnailDisplay" sortdirection="descending"
sortby="item_revision_id">
<tableDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</tableDisplay>
<thumbnailDisplay/>
<treeDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</treeDisplay>
<listDisplay/>
</objectSet>
</section>
<section text="ItemProperties">
<property name="object_desc"/>
<separator/>
<property name="owning_user" renderingHint="objectlink" modifiable="false"/>
<property name="owning_group" renderingHint="objectlink" modifiable="false"/>
<property name="last_mod_user"/>
<separator/>
<property name="checked_out"/>
<property name="checked_out_user"/>
<separator/>
<command commandId="com.teamcenter.rac.properties" text="moreProperties"/>
</section>
<section text="ClassificationProperties">
<classificationProperties/>
</section>
</firstcolumn>
<secondcolumn>

2-64 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

<view name="viewer"/>
<view name="actions">
<command actionKey="copyAction" commandId="com.teamcenter.rac.copy" />
<command actionKey="saveAsAction" commandId="org.eclipse.ui.file.saveAs" />
<command actionKey="newProcessAction"
commandId="com.teamcenter.rac.newProcess" text="newProc" />
</view>
</secondcolumn>
</page>

firstcolumn element in the rich client

PLM00075 H Client Customization Programmer’s Guide 2-65


Chapter 2 Enterprise-wide configuration

firstcolumn element in the thin client

2-66 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

GoverningProperty
Specifies the name and value of the field that initiates the Rule element. The
GoverningProperty tag must be contained within a condition tag and used in
conjunction with a rule tag.
Note
The conditions and GoverningProperty tags do not work in the Viewer
view if the style sheet is registered for properties display.

ATTRIBUTES
propertyname
Specifies the name of the field that triggers the rule if its value matches.
propertyvalue
Specifies the property value that triggers the rule.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the following types of style sheets:
Property
Form

EXAMPLE
<rendering>
<property name = "user_data_1"/>
<property name = "user_data_2"/>
<property name = "user_data_3"/>
<conditions>
<GoverningProperty propertyname = "user_data_1" propertyvalue = "Mine1">
<Rule propertyname = "user_data_2" state = "required"/>
<Rule propertyname = "user_data_3" state = "disabled"/>
</GoverningProperty>
<GoverningProperty propertyname = "user_data_1" propertyvalue = "Do IM">
<Rule propertyname = "user_data_2" state = "disabled"/>
<Rule propertyname = "user_data_3" state = "required"/>
</GoverningProperty>
</conditions>
</rendering>

For more information, including a user interface example, see conditions.


For another example, see Set properties to be conditionally mandatory or disabled.

PLM00075 H Client Customization Programmer’s Guide 2-67


Chapter 2 Enterprise-wide configuration

header
Specifies that a header area must be displayed in the page.
ATTRIBUTES
None.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the Summary style sheets.
EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the header element:
<rendering xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="XMLRenderingStylesheet_Schema.xsd">
<header>
<image source="thumbnail"/>
<classificationTrace/>
<property name="owning_user"/>
<property name="last_mod_date"/>
<property name="release_status_list"/>
<property name="object_type"/>
</header>
<page text="Overview" format="TwoColumn">

header element in the rich client

2-68 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

header element in the thin client

PLM00075 H Client Customization Programmer’s Guide 2-69


Chapter 2 Enterprise-wide configuration

image
Specifies that an image is to be rendered. Image dimensions are always kept
proportional when being scaled or resized.
ATTRIBUTES
maxheight
Specifies the maximum height in pixels to which the image should be scaled. This is
a string attribute that is optional.

maxwidth
Specifies the maximum width in pixels to which the image should be scaled. This is
a string attribute that is optional.

source
Specifies the source of the image to display. The attribute value can be a thumbnail,
preview, or type keyword. This is a string attribute that is optional.

tooltip
Specifies the tooltip associated with the image. The attribute value must be a key
into a property file. This is a string attribute that is optional.

Note
For backward compatibility, if no attributes are specified and the current object
type is an Item, ItemRevision, or Dataset business object, an attempt is
made to find and render any preview image that is associated with the object.

SUPPORTED
CLIENTS
Rich client

Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the following types of style sheets:

Property
Summary
Form

EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the image element:
<rendering xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="XMLRenderingStylesheet_Schema.xsd">
<header>
<image source="thumbnail"/>
<classificationTrace/>
<property name="owning_user"/>
<property name="last_mod_date"/>
<property name="release_status_list"/>
<property name="object_type"/>
</header>

2-70 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

image element in the rich client

image element in the thin client

PLM00075 H Client Customization Programmer’s Guide 2-71


Chapter 2 Enterprise-wide configuration

label
Specifies a label to be rendered.
ATTRIBUTES
class
Defines the cascading style sheet (CSS) class used to provide the style for the label
text. The CSS class must be an existing thin client CSS.
label text="Sample text."
class="textCSSClass"

style
Controls font style for the label text, including font size, weight, name, and style
(such as italic). The format follows the CSS guideline, for example:
style="font-size:14pt;font-style:plain;
font-family:Tahoma;font-weight:bold"

text
Specifies the text to use for the label. The attribute value must be a key into a
property file. If the key is not found, the attribute value itself is displayed as static
text. This attribute is required.
Support is provided for localized values. For example, the tagging <label
text="Hello World" /> displays text on the property page, and <label
textKey="k_version_name" /> displays the localized text in the provided property.
URL addresses in the label text and property tags are automatically rendered.
(In the rich client, URL addresses are also automatically rendered for textfield
and textarea rendering hints.)
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the Summary style sheets.
EXAMPLES
• Text
Following is sample code for the label text element:
<label text="This is a raining day!" />

The following figure shows the text on the page.

2-72 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Label tag example

• style attribute
The property style sheet page tagging includes the style attribute
within the label text and property tags to control font
style. Support is provided for font size, weight, name, and style
(such as italic). The format follows the CSS guideline, for example,
style="font-size:14pt;font-style:plain;font-family:Tahoma;font-weight:bold".
For example:
<page title="Reservation" titleKey="Reservation"
visibleWhen="object_desc==Testing*">
<label text="The object is checked out? or not ...."
style="font-size:14pt; font-style:plain;font-family:Tahoma; font-weight:bold" />
...
</page>

This results in the font style shown in the following figure.

style tagging example

• URL rendering

PLM00075 H Client Customization Programmer’s Guide 2-73


Chapter 2 Enterprise-wide configuration

URL addresses included in the label and property tag are automatically
rendered.
For example:
<label text="Press www.abcnews.com to view the latest headlines!"
style=" font-size:14pt;font-style:plain;font-family:Tahoma;font-weight:normal" />

Consider the following code:


<label text="***My Header Info http://www.siemens.com ***" />

Because a URL is included in the label tag, it is automatically rendered on the


page, as shown in the following figure.

URL rendering example

2-74 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

listDisplay
Displays a set of objects in a list format.
ATTRIBUTES
None.
SUPPORTED
CLIENTS
Rich client

Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on Summary style sheets.
EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the listDisplay element:
<section text="AvailableRevisions">
<objectSet source="revision_list.ItemRevision" defaultdisplay="thumbnailDisplay"
sortdirection="descending" sortby="item_revision_id">
<tableDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</tableDisplay>
<thumbnailDisplay/>
<treeDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</treeDisplay>
<listDisplay/>
</objectSet>
</section>

listDisplay element in the rich client

PLM00075 H Client Customization Programmer’s Guide 2-75


Chapter 2 Enterprise-wide configuration

listDisplay element in the thin client

2-76 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

objectSet
Provides a set of display options for the selected object. This element is a replacement
for the attachments element.
Click the appropriate button to view the object’s characteristics in a table, list, or tree.

objectset buttons in the rich client


Note that in the thin client, the tree option is rendered as a thumbnail display.

objectset buttons in the thin client


ATTRIBUTES
defaultdisplay
Specifies the default format to use when displaying the set of objects. Valid values
are treeDisplay, tableDisplay, listDisplay, or thumbnailDisplay. The default
value is listDisplay. This is a string attribute that is optional.
sortby
Specifies the object property to sort the set of objects by prior to rendering. The
default value is object_string. This is a string attribute that is optional.
sortdirection
Specifies the direction in which the set of objects should be sorted. Valid values
are ascending or descending. The default value is ascending. This is a string
attribute that is optional.
source
Specifies the comma-delimited set of run-time properties or relations that return
the desired set of objects. The format for the attribute value is property.type,
where property is the name of a relation, run-time, or reference property,
and type represents the type of objects to be included. Multiple property.type
values can be specified as a comma-separated list, such as contents.Item or
contents.ItemRevision. This is a string attribute that is required.

PLM00075 H Client Customization Programmer’s Guide 2-77


Chapter 2 Enterprise-wide configuration

SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the Summary style sheets.
EXAMPLE
Following is sample code using the objectSet tag:
<objectSet source="contents.WorkspaceObject" defaultdisplay="thumbnailDisplay"
sortby="object_name" sortdirection="ascending">
<tableDisplay>
<property name="object_string"/>
<property name="object_desc"/>
<property name="object_type"/>
<property name="owning_user"/>
<property name="owning_group"/>
<property name="last_mod_user"/>
</tableDisplay>
<thumbnailDisplay/>
<treeDisplay>
<property name="object_string"/>
<property name="object_desc"/>
<property name="object_type"/>
<property name="owning_user"/>
<property name="owning_group"/>
<property name="last_mod_user"/>
</treeDisplay>
<listDisplay/>
<command actionKey="newBusinessObjectContextualAction"
commandId="com.teamcenter.rac.common.AddNew" renderingHint="commandbutton"/>
<command actionKey="cutAction" commandId="org.eclipse.ui.edit.cut"
renderingHint="commandbutton">
<parameter name="localSelection" value="true"/>
</command>
<command actionKey="copyAction" commandId="com.teamcenter.rac.copy"
renderingHint="commandbutton"/>
<command actionKey="pasteAction"
commandId="com.teamcenter.rac.viewer.pastewithContext" renderingHint="commandbutton"/>
</objectSet>

Note
In an object set, you can use the command tag to add buttons for
existing menu commands. For example, you can place cut, copy, and paste
buttons on the object set. When you add command buttons, you must
add the actionKey argument to make the buttons appear in the thin
client. The action key value to use for each command can be found in the
staging-location\webapp_root\teamcenter\dhtml\common\intl\
language\wsomenu.xml file.
If the localSelection parameter is set to true for any command action, the
action is performed on the object selected in the object set. For example, In
case of the cut action, if the localSelection parameter is true, the cut action
operates on the object selected in the object set list. If the localSelection
parameter is false (or not set), the cut action operates on the object for which
the summary is being shown and not on an object selected in the object set.

Following is how the sample code is rendered in the user interface. This object set
shows the contents of a folder.

2-78 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Object set in the rich client (with table button selected)


Following is the same object set rendered in the thin client.

Object set in the thin client (with table button selected)


For a customization example that includes an object set, see Modify the Summary
view using style sheets.

PLM00075 H Client Customization Programmer’s Guide 2-79


Chapter 2 Enterprise-wide configuration

page
Presents a tab panel in a dialog box or view. If the page element is not defined in
the XML file, a default page is created.
ATTRIBUTES
format
Specifies the format to be used for this page. This attribute can have one of these
values: OneColumn or TwoColumn. The default value is OneColumn. This
attribute is optional.
The firstcolumn tag defines the layout of the first column, and the secondcolumn
tag defines the layout of the second column.
For more information, see firstcolumn and secondColumn.
text
Specifies the title to be displayed for the page. The attribute value must be a key
into a property file. If the key is not found, the attribute value itself is displayed as
static text. This is a required attribute.
title
Specifies the default string of the title for this tab. This attribute is used when the
string in the titleKey attribute is not found in the locale file. This is an optional
attribute.
titleKey
Specifies the key used to search for the title in the locale file. If it is not defined, the
string defined by the title attribute is used. This is an optional attribute.
visibleWhen
Defines conditional display of a tab based on an object’s properties. For example:
<page title="Reservation"
titleKey="Reservation"
visibleWhen="object_desc==Testing*">
...
</Page>

The sample code states that if the word Testing is used in the object_desc property,
the Reservation page appears.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the following types of style sheets:
Property
Summary
Form
Create
EXAMPLES
• page element

2-80 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Following is sample code from the ItemSummary.xml XML rendering style


sheet showing the page element:
<page text="Overview" format="TwoColumn">
<firstcolumn>
<section text="AvailableRevisions">
<objectSet source="revision_list.ItemRevision" defaultdisplay="thumbnailDisplay"
sortdirection="descending" sortby="item_revision_id">
<tableDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</tableDisplay>
<thumbnailDisplay/>
<treeDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</treeDisplay>
<listDisplay/>
</objectSet>
</section>
<section text="ItemProperties">
<property name="object_desc"/>
<separator/>
<property name="owning_user" renderingHint="objectlink" modifiable="false"/>
<property name="owning_group" renderingHint="objectlink" modifiable="false"/>
<property name="last_mod_user"/>
<separator/>
<property name="checked_out"/>
<property name="checked_out_user"/>
<separator/>
<command commandId="com.teamcenter.rac.properties" text="moreProperties"/>
</section>
<section text="ClassificationProperties">
<classificationProperties/>
</section>
</firstcolumn>
<secondcolumn>
<view name="viewer"/>
<view name="actions">
<command actionKey="copyAction" commandId="com.teamcenter.rac.copy" />
<command actionKey="saveAsAction" commandId="org.eclipse.ui.file.saveAs" />
<command actionKey="newProcessAction" commandId="com.teamcenter.rac.newProcess"
text="newProc" />
</view>
</secondcolumn>
</page>

PLM00075 H Client Customization Programmer’s Guide 2-81


Chapter 2 Enterprise-wide configuration

page element in the rich client

2-82 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

page element in the thin client

• visibleWhen attribute
To specify a single conditional evaluation for the component property, include
the visibleWhen parameter on the property style sheet page, for example,
visibleWhen="object_desc!=abc".
Consider the following code:
<page title="Reservation" titleKey="Reservation"
visibleWhen="object_desc==Testing*">
...
</Page>

If the word Testing is used in the object_desc property, the Reservation link
appears. In the following example, the object_desc property is blank, and
therefore the Reservation link does not appear.

PLM00075 H Client Customization Programmer’s Guide 2-83


Chapter 2 Enterprise-wide configuration

Condition is not met for the visibleWhen parameter


Now change the description value to Testing my code; the Reservation link
appears after you save your changes, as shown in the following figure.

Condition is valid for the visibleWhen parameter

2-84 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

parameter
Passes in the name/value parameters to the parent command. It launches a specific
named search when users choose the Add Existing menu command. This is a child
element of the command element. An example of a parameter is localSelection.
For more information about the localSelection parameter, see objectSet.
ATTRIBUTES
name
Specifies the parameter name, for example, searchName. This is a required
attribute.
value
Specifies the parameter value, for example, CustomSearch. This is a required
attribute.
SUPPORTED
CLIENTS
Rich client
SUPPORTED
STYLE
SHEETS
This tag can be used on Summary style sheets.
EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the paramter element:
<command actionKey="newBusinessObjectContextualAction"
commandId="com.teamcenter.rac.common.AddNew" renderingHint="commandbutton"/>
<command actionKey="cutAction" commandId="org.eclipse.ui.edit.cut"
renderingHint="commandbutton">
<parameter name="localSelection" value="true"/>
</command>
<command actionKey="copyAction" commandId="com.teamcenter.rac.copy"
renderingHint="commandbutton"/>
<command actionKey="pasteAction"
commandId="com.teamcenter.rac.viewer.pastewithContext" renderingHint="commandbutton"/>

PLM00075 H Client Customization Programmer’s Guide 2-85


Chapter 2 Enterprise-wide configuration

property
Specifies the property of the form or object. You must include at least one property in
the XML definition; otherwise, the system displays an empty panel.
ATTRIBUTES
border
Determines whether the border is displayed. Valid values are true and false. This
works only with the titled style. This is supported in both the rich client and thin
client.
column
Applies only to the textfield and textarea rendering hints. It sets the number of
columns. This is supported in both the rich client and thin client.
modifiable
Specifies if the owning_user or owning_group property can be modified (true or
false). For all other properties, use a property rule instead.
name
Specifies the display name of the property. This is a required attribute. This is
supported in both the rich client and thin client.
In the New Business Object wizard, you can use compounding to specify a property
with revision, IMAN_master_form, and IMAN_master_form_rev contexts on
style sheets registered to any object.
• For example, if the style sheet is registered on an item, name=
revision:item_revision_id displays the item_revision_id property from the
item’s revision.

• Similarly, name= IMAN_master_form:project_id displays the project_id


property from the item master form.

• Also, name= revision:IMAN_master_form_rev: serial_number displays the


serial_number property from the item revision master form.

renderingHint
Specifies the component used to render this property. This is an optional attribute. If
not defined, the default renderer is used based on the property type.
For more information, see Rendering hints. For a complete list of available rendering
hints, see Standard rendering hints. To add a custom rendering hint, see Add a
custom rendering hint.
renderingStyle
Defines the rendering style used in the rendering component. There are three styles:
headed, headless, and titled.
• Headed
This is the default rendering style. The property name is displayed on the left
followed by the property value renderer. This is supported in both the rich
client and thin client.

2-86 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

• Headless
This style renders only the property value without displaying the property name
in front of it. This is supported in both the rich client and thin client.

• Titled
The property name is displayed on the top of the property value renderer. This
is supported in both the rich client and thin client.

For more information, see Standard rendering hints.


row
Applies only to textarea elements. It sets the number of the rows for the element.
This is supported in both the rich client and thin client.
style
Controls font style for the label text, including font size, weight, name, and style
(such as italic). The format follows the CSS guideline, for example:
style="font-size:14pt;font-style:plain;
font-family:Tahoma;font-weight:bold"

SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the following types of style sheets:
Property
Summary
Form
Create

EXAMPLES
• property element
Following is sample code from the ItemSummary.xml XML rendering style
sheet showing the property element:
<rendering xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="XMLRenderingStylesheet_Schema.xsd">
<header>
<image source="thumbnail"/>
<classificationTrace/>
<property name="owning_user"/>
<property name="last_mod_date"/>
<property name="release_status_list"/>
<property name="object_type"/>
</header>

PLM00075 H Client Customization Programmer’s Guide 2-87


Chapter 2 Enterprise-wide configuration

property elements in the rich client

property elements in the thin client

• URL rendering
URL addresses in the label text and property tags are automatically rendered.
(In the rich client, URL addresses are also automatically rendered for textfield
and textarea rendering hints.)
For an example, see label.

2-88 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

rendering
Root element
ATTRIBUTES
Version
Specifies the version of the XML schema. When an older version is detected, the
program automatically converts the old scheme to the new one.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag is required on all types of style sheets:
Property
Summary
Form
Create

EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the rendering element:
<rendering xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="XMLRenderingStylesheet_Schema.xsd">
<header>
<image source="thumbnail"/>
<classificationTrace/>
<property name="owning_user"/>
<property name="last_mod_date"/>
<property name="release_status_list"/>
<property name="object_type"/>
</header>
<page text="Overview" format="TwoColumn">
.
.
.
</rendering>

PLM00075 H Client Customization Programmer’s Guide 2-89


Chapter 2 Enterprise-wide configuration

Rule
Applies the rule to the field if the GoverningProperty element matches its
conditions. The Rule tag must be contained within a conditions tag and used in
conjunction with a GoverningProperty tag.
ATTRIBUTES
propertyname
Specifies the name of the field to require or disable.
state
Indicates whether to make the field required or disabled. The valid values for this
attribute are required and disabled.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the following types of style sheets:
Property
Form

EXAMPLE
<rendering>
<property name = "user_data_1"/>
<property name = "user_data_2"/>
<property name = "user_data_3"/>
<conditions>
<GoverningProperty propertyname = "user_data_1" propertyvalue = "Mine1">
<Rule propertyname = "user_data_2" state = "required"/>
<Rule propertyname = "user_data_3" state = "disabled"/>
</GoverningProperty>
<GoverningProperty propertyname = "user_data_1" propertyvalue = "Do IM">
<Rule propertyname = "user_data_2" state = "disabled"/>
<Rule propertyname = "user_data_3" state = "required"/>
</GoverningProperty>
</conditions>
</rendering>

For more information, including a user interface example, see conditions.


For another example, see Set properties to be conditionally mandatory or disabled.

2-90 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

secondColumn
Defines the layout of the second column defined on a page. The firstcolumn element
defines the layout of the first column on a page.
This element applies only if the TwoColumn format has been set in the format
attribute on the page element.
ATTRIBUTES
None.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the following types of style sheets (but not the New Business
Object wizard):
Property
Summary
Form
EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the secondcolumn element:
<page text="Overview" format="TwoColumn">
<firstcolumn>
<section text="AvailableRevisions">
<objectSet source="revision_list.ItemRevision" defaultdisplay="thumbnailDisplay"
sortdirection="descending" sortby="item_revision_id">
<tableDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</tableDisplay>
<thumbnailDisplay/>
<treeDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</treeDisplay>
<listDisplay/>
</objectSet>
</section>
<section text="ItemProperties">
<property name="object_desc"/>
<separator/>
<property name="owning_user" renderingHint="objectlink" modifiable="false"/>
<property name="owning_group" renderingHint="objectlink" modifiable="false"/>
<property name="last_mod_user"/>
<separator/>
<property name="checked_out"/>
<property name="checked_out_user"/>
<separator/>
<command commandId="com.teamcenter.rac.properties" text="moreProperties"/>
</section>
<section text="ClassificationProperties">
<classificationProperties/>
</section>
</firstcolumn>
<secondcolumn>
<view name="viewer"/>

PLM00075 H Client Customization Programmer’s Guide 2-91


Chapter 2 Enterprise-wide configuration

<view name="actions">
<command actionKey="copyAction" commandId="com.teamcenter.rac.copy" />
<command actionKey="saveAsAction" commandId="org.eclipse.ui.file.saveAs" />
<command actionKey="newProcessAction" commandId="com.teamcenter.rac.newProcess"
text="newProc" />
</view>
</secondcolumn>
</page>

secondcolumn element in the rich client

2-92 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

secondcolumn element in the thin client

PLM00075 H Client Customization Programmer’s Guide 2-93


Chapter 2 Enterprise-wide configuration

section
Defines a group of elements to be displayed together within a named section.
Note
This element is a replacement for the view element.

ATTRIBUTES
initialstate
Specifies whether the view or section should be expanded or collapsed on initial
rendering. Valid values are expanded or collapsed. The default value is
expanded. This attribute is optional.
Note
The initialstate tag is not supported on the thin client.

text
Specifies the title to be displayed on the section header. The attribute value must
be a key into a property file. If the key is not found, the attribute value itself is
displayed as static text. This attribute is required.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the Summary style sheets.
EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the section element:
<page text="Overview" format="TwoColumn">
<firstcolumn>
<section text="AvailableRevisions">
<objectSet source="revision_list.ItemRevision" defaultdisplay="thumbnailDisplay"
sortdirection="descending" sortby="item_revision_id">
<tableDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</tableDisplay>
<thumbnailDisplay/>
<treeDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</treeDisplay>
<listDisplay/>
</objectSet>
</section>
<section text="ItemProperties">
<property name="object_desc"/>
<separator/>
<property name="owning_user" renderingHint="objectlink" modifiable="false"/>
<property name="owning_group" renderingHint="objectlink" modifiable="false"/>

2-94 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

<property name="last_mod_user"/>
<separator/>
<property name="checked_out"/>
<property name="checked_out_user"/>
<separator/>
<command commandId="com.teamcenter.rac.properties" text="moreProperties"/>
</section>
<section text="ClassificationProperties">
<classificationProperties/>
</section>
</firstcolumn>
<secondcolumn>
<view name="viewer"/>
<view name="actions">
<command actionKey="copyAction" commandId="com.teamcenter.rac.copy" />
<command actionKey="saveAsAction" commandId="org.eclipse.ui.file.saveAs" />
<command actionKey="newProcessAction" commandId="com.teamcenter.rac.newProcess"
text="newProc" />
</view>
</secondcolumn>
</page>

section elements in the rich client

PLM00075 H Client Customization Programmer’s Guide 2-95


Chapter 2 Enterprise-wide configuration

section elements in the thin client

2-96 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

separator
Adds a separator in the pane.
ATTRIBUTES
None.
SUPPORTED
CLIENTS
Rich client

Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the following types of style sheets and the New Business
Object wizard:

Property
Summary
Form
Create

EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the separator element:
<section text="ItemProperties">
<property name="object_desc"/>
<separator/>
<property name="owning_user" renderingHint="objectlink" modifiable="false"/>
<property name="owning_group" renderingHint="objectlink" modifiable="false"/>
<property name="last_mod_user"/>
<separator/>
<property name="checked_out"/>
<property name="checked_out_user"/>
<separator/>
<command commandId="com.teamcenter.rac.properties" text="moreProperties"/>
</section>

separator elements in the rich client

PLM00075 H Client Customization Programmer’s Guide 2-97


Chapter 2 Enterprise-wide configuration

separator elements in the thin client

2-98 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

tableDisplay
Displays a set of objects in a table format.
ATTRIBUTES
None.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the Summary style sheets.
EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the tableDisplay element:
<section text="AvailableRevisions">
<objectSet source="revision_list.ItemRevision" defaultdisplay="thumbnailDisplay"
sortdirection="descending" sortby="item_revision_id">
<tableDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</tableDisplay>
<thumbnailDisplay/>
<treeDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</treeDisplay>
<listDisplay/>
</objectSet>
</section>

PLM00075 H Client Customization Programmer’s Guide 2-99


Chapter 2 Enterprise-wide configuration

tableDisplay element in the rich client

tableDisplay element in the thin client

2-100 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

thumbnailDisplay
Displays a set of objects using thumbnails arranged in a grid.
ATTRIBUTES
None.
SUPPORTED
CLIENTS
Rich client
SUPPORTED
STYLE
SHEETS
This tag can be used on Summary style sheets.
EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the thumbnailDisplay element:
<section text="AvailableRevisions">
<objectSet source="revision_list.ItemRevision" defaultdisplay="thumbnailDisplay"
sortdirection="descending" sortby="item_revision_id">
<tableDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</tableDisplay>
<thumbnailDisplay/>
<treeDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</treeDisplay>
<listDisplay/>
</objectSet>
</section>

thumbnailDisplay element in the thin client


The thumbnailDisplay element is not supported in the thin client. The
treeDisplay element is rendered instead.

PLM00075 H Client Customization Programmer’s Guide 2-101


Chapter 2 Enterprise-wide configuration

treeDisplay
Displays a set of objects in a tree format.
ATTRIBUTES
None.
SUPPORTED
CLIENTS
Rich client
SUPPORTED
STYLE
SHEETS
This tag can be used on Summary style sheets.
EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the treeDisplay element:
<section text="AvailableRevisions">
<objectSet source="revision_list.ItemRevision" defaultdisplay="thumbnailDisplay"
sortdirection="descending" sortby="item_revision_id">
<tableDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</tableDisplay>
<thumbnailDisplay/>
<treeDisplay>
<property name="object_string"/>
<property name="item_revision_id"/>
<property name="release_status_list"/>
<property name="last_mod_date"/>
<property name="last_mod_user"/>
<property name="checked_out_user"/>
</treeDisplay>
<listDisplay/>
</objectSet>
</section>

treeDisplay element in the rich client

2-102 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

The treeDisplay element is not supported in the thin client. The


thumbnailDisplay element is rendered instead.

PLM00075 H Client Customization Programmer’s Guide 2-103


Chapter 2 Enterprise-wide configuration

view
Defines a group of properties to be displayed together. If there are firstcolumn and
secondcolumn elements, this element must be within them.
ATTRIBUTES
name
Specifies the display name of the view. This name can be localized in the textserver
files. This is a required attribute. The following view names are valid: properties,
viewer, impactanalysis, actions, and attachments.
SUPPORTED
CLIENTS
Rich client
Thin client
SUPPORTED
STYLE
SHEETS
This tag can be used on the following types of style sheets and the New Business
Object wizard:
Property
Summary
Form
Create

EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the view element:
<secondcolumn>
<view name="viewer"/>
<view name="actions">
<command actionKey="copyAction" commandId="com.teamcenter.rac.copy" />
<command actionKey="saveAsAction" commandId="org.eclipse.ui.file.saveAs" />
<command actionKey="newProcessAction" commandId="com.teamcenter.rac.newProcess"
text="newProc" />
</view>
</secondcolumn>

2-104 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

view elements in the rich client

PLM00075 H Client Customization Programmer’s Guide 2-105


Chapter 2 Enterprise-wide configuration

view elements in the thin client

Rendering hints

The renderingHint tag is an attribute on a <property> tag that allows you to


specify which user interface widget to use to present the corresponding property. It
is an optional attribute, and if not defined, the default rendering is used based on
the property type.
For more information about XML rendering tags, see XML elements.

Standard rendering hints


The JavaBeans used depend on the specified rendering hint and rendering style. The
following table lists the JavaBeans used based on the hint and style definition. All
rendering hints are supported in the rich client. If the rendering style is not defined,
the default style is headed. There is no titled style for SWT.
For standard rendering hints, see the com.teamcenter.rac.viewer/plugin.xml
file for the SWT version of rendering hints, and see the
com.teamcenter.rac.common/plugin.xml file for the Swing version of rendering
hints. Siemens PLM Software recommends you use SWT rather than Swing,
because Swing is being phased out in favor of SWT.

2-106 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Use on Supported
property in thin
Rendering hint types client? JavaBeans
array Used for Yes – date, Headed or headless
array only: string
character, date, (text area), • SWT:
double, float, string Not applicable. (Currently using
integer, logical, LOV, LegacyPropertyBridgeBean.)
short, string, typed
note, typed reference • Swing:
reference, (UID) PropertyArray
typed relation. LOV are
supported Titled (Swing only)
• TitledPropertyArray
checkbox Character, Yes Headed or headless
date, double,
float, integer, • SWT:
logic, short, Not applicable. (Currently using
string, note. LegacyPropertyBridgeBean.)

• Swing:
PropertyCheckbox

Titled (Swing only)


• TitledPropertyCheckbox
checkboxoptionlov Used with Yes – Headed or headless
LOV only: Rendered
character, date, using • SWT:
double, float, same Not applicable. (Currently using
integer, short, component LegacyPropertyBridgeBean.)
string, note, as string
typed ref, typed LOV array • Swing:
relation. PropertyCheckboxOptionLov

Titled (Swing only)


• TitledPropertyCheckboxOptionLov
datebutton Date. Yes – Headed or headless
Rendered
as • SWT:
calendar DateControlPropertyBean
button.
• Swing:
PropertyDateButton

Titled (Swing only)


• TitledPropertyDateButton

PLM00075 H Client Customization Programmer’s Guide 2-107


Chapter 2 Enterprise-wide configuration

Use on Supported
property in thin
Rendering hint types client? JavaBeans
label All types. Used Yes Headed or headless
for display
Note only; you • SWT:
cannot change LabelPropertyBean
As of Teamcenter
9.1, the button the value.
• Swing:
rendering PropertyLabel
hint and the
PropertyButton Titled (Swing only)
bean and
TitledPropertyButton • TitledPropertyLabel
bean are
deprecated and
are no longer
supported. Use the
label hint instead.
localizablearray String. No Headed or headless
• SWT:
Not applicable. (Currently using
LegacyPropertyBridgeBean.)

• Swing:
PropertyLocalizableArray

Titled (Swing only)


• Not applicable.
localizablelovuicomp String. No Headed or headless
• SWT:
LocalizedLOVUICompPropertyBean

• Swing:
PropertyLocalizableLOVUIComponent

Titled (Swing only)


• TitledPropertyLOVUIComponent

2-108 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Use on Supported
property in thin
Rendering hint types client? JavaBeans
localizabletextarea String. No Headed or headless
• SWT:
LocalizedTextAreaPropertyBean

• Swing:
PropertyLocalizableTextArea

Titled (Swing only)


• Not applicable.
localizabletextfield String. No Headed or headless
• SWT:
LocalizedTextfieldPropertyBean

• Swing:
PropertyLocalizableTextField

Titled (Swing only)


• Not applicable.
localizablelongtextpanel String, note. Yes – Headed or headless
Rendered
as text • SWT:
area Not applicable. (Currently using
LegacyPropertyBridgeBean.)

• Swing:
PropertyLocalizableLongTextPanel

Titled (Swing only)


• Not applicable.
logical Logical. No Headed or headless
• SWT:
LogicalPropertyBean

• Swing:
PropertyLogicalPanel

Titled (Swing only)


• TitledPropertyLogicalPanel

PLM00075 H Client Customization Programmer’s Guide 2-109


Chapter 2 Enterprise-wide configuration

Use on Supported
property in thin
Rendering hint types client? JavaBeans
longtext Use only for Yes – Headed or headless
string type Rendered
when the as • SWT:
maximum textarea. Not applicable. (Currently using
length is bigger LegacyPropertyBridgeBean.)
than 2500.
• Swing:
PropertyLongText

Titled (Swing only)


• TitledPropertyLongText
lovbutton Used with Yes – Headed or headless
LOV only: Rendered
character, date, as regular • SWT:
double, float, LOV Not applicable. (Currently using
integer, logical, LegacyPropertyBridgeBean.)
short, string,
note, typed ref, • Swing:
typed relation. PropertyLOVButton

Titled (Swing only)


• TitledPropertyLOVButton
lovcombobox Used with Yes – Headed or headless
LOV only: Rendered
character, date, as regular • SWT:
double, float, LOV LOVComboBoxPropertyBean
integer, logical,
short, string, • Swing:
note, typed ref, PropertyLOVCombobox
typed relation.
Titled (Swing only)
The
column="name" • TitledPropertyLOVCombobox
argument
does not
apply for the
lovcombobox
rendering hint.

2-110 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Use on Supported
property in thin
Rendering hint types client? JavaBeans
lovuicomp Used with No Headed or headless
LOV only:
character, date, • SWT:
double, float, LOVUIComponentPropertyBean
integer, logical,
short, string, • Swing:
note, typed ref, PropertyLOVUIComponent
typed relation.
Titled (Swing only)
• TitledPropertyLOVUIComponent
objectlink Typed ref, Yes – Headed or headless
typed relation. Rendered
as a text • SWT:
field ObjectLinkPropertyBean

• Swing:
PropertyObjectLink

Titled (Swing only)


• TitledPropertyObjectLink
panel Unused. Yes – Headed or headless
Rendered
using • SWT:
separators Not applicable.

• Swing:
PropertyPanel

Titled (Swing only)


• TitledPropertyPanel
radiobutton Character, Yes Headed or headless
date, double,
float, integer, • SWT:
logic, short, Not applicable. (Currently using
string, note. LegacyPropertyBridgeBean.)

• Swing:
PropertyRadioButton

Titled (Swing only)


• TitledPropertyRadioButton

PLM00075 H Client Customization Programmer’s Guide 2-111


Chapter 2 Enterprise-wide configuration

Use on Supported
property in thin
Rendering hint types client? JavaBeans
radiobuttonoptionlov Used with Yes – Headed or headless
LOV only: Rendered
character, date, using • SWT:
double, float, same Not applicable. (Currently using
integer, short, component LegacyPropertyBridgeBean.)
string, note, as string
typed ref, typed LOV array • Swing:
relation. PropertyRadioButtonOptionLov

Titled (Swing only)


• TitledPropertyRadioButtonOptionLov
slider Character, No Headed or headless
double, float,
integer, short, • SWT:
note, string. SliderPropertyBean

For types • Swing:


except integer PropertySlider
and short,
this attribute Titled (Swing only)
converts the
property value • TitledPropetySlider
to an integer.
The value
defaults to 0
if any errors
occur.
styledtextarea Character, Yes Headed or headless
date, double,
float, integer, • SWT:
logic, short, StyledTextAreaPropertyBean
string, note.
• Swing:
PropertyStyledTextArea

Titled (Swing only)


• TitledPropertyStyledTextArea

2-112 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Use on Supported
property in thin
Rendering hint types client? JavaBeans
styledtextfield Character, No Headed or headless
date, double,
float, integer, • SWT:
logic, short, StyledTextfieldPropertyBean
string, note.
• Swing:
PropertyStyledTextField

Titled (Swing only)


• TitledPropertyStyledTextField
textarea Character, Yes Headed or headless
date, double,
float, integer, • SWT:
logic, short, TextAreaPropertyBean
string, note.
• Swing:
PropertyTextArea

Titled (Swing only)


• TitledPropertyTextArea
textfield Character, Yes Headed or headless
date, double,
float, integer, • SWT:
logic, short, TextfieldPropertyBean
string, note.
• Swing:
PropertyTextField

Titled (Swing only)


• TitledPropertyTextField
togglebutton Character, No – Headed or headless
date, double, Rendered
float, integer, as • SWT:
logic, short, checkbox Not applicable. (Currently using
string, note. LegacyPropertyBridgeBean.)

• Swing:
PropertyToggleButton

Titled (Swing only)


• TitledPropertyToggleButton

PLM00075 H Client Customization Programmer’s Guide 2-113


Chapter 2 Enterprise-wide configuration

Use on Supported
property in thin
Rendering hint types client? JavaBeans
togglebuttonoptionlov Used with Yes – Headed or headless
LOV only: Rendered
character, date, using • SWT:
double, float, same Not applicable. (Currently using
integer, short, component LegacyPropertyBridgeBean.)
string, note, as string
typed ref, typed LOV array • Swing:
relation. PropertyToggleButtonOptionLov

Titled (Swing only)


• TitledPropertyToggleButtonOptionLov

Add a custom rendering hint


The renderingHint attribute on the property tag allows you to specify which user
interface widget to use to present the corresponding property. In addition to the
supported standard rendering hints, you can also add your own custom rendering
hints.
For the standard rendering hints, see the com.teamcenter.rac.viewer/plugin.xml
file for the SWT version of rendering hints, and see the
com.teamcenter.rac.common/plugin.xml file for the Swing version of rendering
hints.
For a listing of standard rendering hints, see Standard rendering hints.
The method of adding a custom rendering hint is different depending on whether
you are using the SWT or Swing property bean.
• SWT
The SWT property bean is used by the Summary view, the New→Other wizard,
and the Viewer view.

1. Create a custom plug-in that uses the


com.teamcenter.rac.common.renderingHint extension point.

2. Create a Java class by extending from the AbstractPropertyBean bean.


Following is a simple example of custom property bean:
<extension point="com.teamcenter.rac.common.renderingHint">
<renderingHint
id="mytextfield" priority="0">
<propertyBean
class="com.teamcenter.rac.viewer.stylesheet.beans.MyTextfieldPropertyBean">
</propertyBean>
</renderingHint>
</extension>

• Swing
The Swing property bean is used by the Properties dialog box and the Viewer
view. There are two ways you can implement the Swing property bean:
o Add the new rendering hint definition to a custom stylesheet_user.property
file.

2-114 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

Each rendering hint has a key for the class path of the Java bean defined
in the com\teamcenter\rac\stylesheet.properties file, found in the
com.teamcenter.rac.common JAR file. You can plug in your own bean by
overwriting the entry in the properties file to replace the default Java bean,
or you can add new entries for custom Java beans.
For more information about overriding the properties file, see Customize
the rich client properties files.
The key has the following format for headed or headless beans:
rendering-hint.DEFINITION

The following format is for titled beans.


rendering-hint_titled.DEFINITION

For example:
textfield.DEFINITION=com.teamcenter.rac.stylesheet.
PropertyTextField
textfield_titled.DEFINITION=com.teamcenter.rac.stylesheet.
TitledPropertyTextField

o Use the com.teamcenter.rac.common.renderingHint extension point.


1. Create a custom plug-in that uses the
com.teamcenter.rac.common.renderingHint extension point.

2. Create a Java class by extending from the


InterfacePropertyComponent component.
Note the difference from the SWT version, because it is using the
legacyPropertyBean element for the class in the extension definition:
<extension point="com.teamcenter.rac.common.renderingHint">
<renderingHint id="mytextfield" priority="0">
<legacyPropertyBean
class="com.teamcenter.rac.stylesheet.MyPropertyTextField"/>
</renderingHint>
</extension>

After you finish creating the Java code, add the new package or class to your
custom plug-in export-package list in the MANIFEST.MF file, for example:
Export-Package: com.teamcenter.rac.viewer.customplugin.bean

Following is an example Java class that creates a custom SWT rendering hint:
package com.teamcenter.rac.viewer.customplugin.beans;
import com.teamcenter.rac.common.controls.LOVComboBox;
import com.teamcenter.rac.kernel.TCPropertyDescriptor;
import com.teamcenter.rac.viewer.stylesheet.beans.LOVComboBoxPropertyBean;
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;
/**
*/
public class MyLOVComboBoxPropertyBean
extends LOVComboBoxPropertyBean implements IExecutableExtension
{
/**
*
* Constructor
*
* @param lovCombo
*/
public MyLOVComboBoxPropertyBean( LOVComboBox lovCombo )
{
super( lovCombo );
}
/**
* Constructor

PLM00075 H Client Customization Programmer’s Guide 2-115


Chapter 2 Enterprise-wide configuration

*
* @param toolkit FormToolkit to use to create UI widgets
* @param parent composite
* @param renderFlat Flag indicating it’s read only or modifiable
* @param paramTable Map of attributes which in stylesheet file.
* @published
*/
public MyLOVComboBoxPropertyBean( FormToolkit toolkit, Composite parent,
boolean renderFlat, Map paramTable )
{
super(toolkit, parent, renderFlat, paramTable);
}
@Override
public void load( TCPropertyDescriptor desc )
throws Exception
{
super.load( desc );
System.out.println("This is mylovcombobox.");
// force it to load the LOVs
lovComboBox.initializeData(false);
}
@Override
public void setUIFValue( final Object value )
{
lovComboBox.getDisplay().asyncExec( new Runnable()
{
public void run()
{
if ( value != null )
{
lovComboBox.setSelectedItem( value );
}
else
{
lovComboBox.setText(""); //$NON-NLS-1$
}
}
} );
}
@Override
public void setInitializationData( IConfigurationElement config,
String propertyName, Object data )
throws CoreException
{
//
}
}

Rendering style
Each type of renderer supports three styles: headed, headless, and titled.
• Headed
Displays the property name on the left followed by the property value renderer.
This is the default rendering style.
This style has two components, the PropertyNameLabel JavaBean for the
property name and the PropertyrenderingHint JavaBean for the renderer (for
example, PropertyTextField or PropertyTextArea).

Headed rendering style

• Headless
Renders only the property value without displaying the property name.
This style contains only one JavaBean, PropertyrenderingHint.

• Titled
Displays the property name above the property value renderer.

2-116 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

This style uses only the TitledPropertyrenderingHint JavaBean, for example


TitledPropertyTextField or TitledPropertyTextArea.

Titled rendering style

Default renderers

The following table displays the default renderer for each type. If the rendering hint
is not provided, the default renderer is used.

Type Default renderer


string textfield if size < 60
textarea if 60 < size < 2500
longtext if size >= 2500
char textfield
double textfield
float textfield
int textfield
short textfield
long textfield
date datebutton
logical logical
note textfield if size < 60
textarea if size > 60
TypedReference/ objectlink
UntypedReference
All array types array
Any property with an LOV lovuicomp
attached
In turn, the lovuicomp renderer uses the
lovcombox renderer if the number of list of
values does not exceed 500, and if there are
more, the lovpopupbutton renderer is used.

Set properties to be conditionally mandatory or disabled

You can use the conditions tag to configure rules on forms to make properties be
conditionally mandatory or disabled on the rich client and thin client. Teamcenter
clients implement specified rules locally using XML rendering style sheets without
modifying the underlying server side metamodel.
For more information about the conditions tag, see conditions.

PLM00075 H Client Customization Programmer’s Guide 2-117


Chapter 2 Enterprise-wide configuration

Note
Style sheets are inherited by form types even where they have not been set.

1. Create a new XMLRenderingStylesheet dataset using the rich client.


Note
If you create a style sheet manually that uses conditions tags and attach
it to the XMLRenderingStylesheet dataset as a named reference, the
style sheet must use UTF-8 encoding. If you use the style sheet viewer to
create your dataset, it automatically uses UTF-8.

2. Select the Viewer pane.


The XML style sheet is displayed in the viewer.

3. Edit the style sheet to add your conditions between the rendering tags. You
must include rendering tags in the style sheet. If you use conditions, you cannot
use default rendering.
The following example makes the user_data_2 property required if the
user_data_1 property is set to axle and disabled if the object_desc property is
set to part:
<conditions>
<GoverningProperty propertyname = "user_data_1" propertyvalue = "axle">
<Rule propertyname = "user_data_2" state = "required"/>
</GoverningProperty>
<GoverningProperty propertyname = "object_desc" propertyvalue = "part">
<Rule propertyname = "user_data_2" state = "disabled"/>
</GoverningProperty>
</conditions>

The following rules apply to the XML code:


• You can add more than one Rule tag to a GoverningProperty tag. If the
GoverningProperty is true, all of its Rule tags are applied.
Caution
The GoverningProperty tag is not supported in the create style
sheet or the summary style sheet.

• If there is a data or format error in the XML code, no error message


is displayed, the conditions are not applied, and the form uses default
functionality.

• If you specify conflicting or circular rules, Teamcenter does not resolve the
problem. The rules are applied, and no error message is displayed.
A circular rule specifies that field 1 makes field 2 disabled and field 2 makes
field 1 disabled. A conflicting rule specifies that a field is both required and
disabled.

For more information about the tags and their properties, see XML elements.

4. Select Form in the Stylesheet Type list and select the appropriate object from
the Registered Type list.

5. Click the Apply button.

2-118 Client Customization Programmer’s Guide PLM00075 H


Enterprise-wide configuration

6. Select the form and select the Viewer pane.


The conditions are applied to the form. If you set a property that triggers the
rule, the rule is applied after you move out of the property field (in other words,
click or tab outside the field).

PLM00075 H Client Customization Programmer’s Guide 2-119


Chapter

3 Rich client customization

Rich client customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1

Basic concepts about rich client customization . . . . . . . . . . . . . . . . . . . . . . . . 3-1


Rich client perspectives and views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
Understanding the Eclipse rich client platform framework . . . . . . . . . . . . 3-2
Adding menus and toolbars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Menu contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
Introduction to SWT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4

Basic tasks for rich client customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8


Enable rich client customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
Install Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
Set the project preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
Run the rich client from Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
Export your custom plug-in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11
Export your custom plug-in to the rich client . . . . . . . . . . . . . . . . . . . 3-11
Export your custom plug-in to a shared directory . . . . . . . . . . . . . . . . 3-12
Ensure your customizations appear . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12
Distributing rich client customizations . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
Distributing customizations to four-tier rich clients . . . . . . . . . . . . . . 3-14
Creating a solution file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
Distribute a solution file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15
Distributing customizations to two-tier rich clients . . . . . . . . . . . . . . . 3-16
Package custom files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17
Install the customized files with Updates Manager . . . . . . . . . . . . 3-17
Install new client-side only customized files with a feature file and
Configuration Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17
Install new client and server customized files with a feature file and
Configuration Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19

Sample rich client customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20


Common rich client customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20
Adding menu commands to a menu, toolbar, and shortcut menu . . . . . 3-20
Add a menu command to a menu . . . . . . . . . . . . . . . . . . . . . . . . . 3-20
Add a menu command to the shortcut menu . . . . . . . . . . . . . . . . . 3-23
Add a button to the toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27
Add a command to a menu or toolbar in a view . . . . . . . . . . . . . . . 3-30
Add a toggle menu item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-34
Adding views and applications to the rich client . . . . . . . . . . . . . . . . . 3-39
Add a view to the rich client . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-39
Create a view that uses the Selection Service . . . . . . . . . . . . . . . . 3-45

PLM00075 H Client Customization Programmer’s Guide


Create a custom Viewer view . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-51
Add a new rich client application . . . . . . . . . . . . . . . . . . . . . . . . 3-66
Add an application to the Teamcenter Send To menu . . . . . . . . . . 3-72
Override Teamcenter commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-80
Localize your customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-83
Customize the rich client properties files . . . . . . . . . . . . . . . . . . . . . . 3-89
Infrequent rich client customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-92
Add a table viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-92
Add a tree viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-99
Add a quick search item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-104
Change the display color of read-only properties . . . . . . . . . . . . . . . . 3-106
Customize the workflow template filter list . . . . . . . . . . . . . . . . . . . 3-110
Add a column to view occurrence notes . . . . . . . . . . . . . . . . . . . . . . 3-117
Add perspectives to Manufacturing Process Planner . . . . . . . . . . . . . 3-118

Customizing forms and properties display . . . . . . . . . . . . . . . . . . . . . . . . . . 3-131


Methods of form customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-132
Developing automatic forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-133
Developing forms using JavaBeans . . . . . . . . . . . . . . . . . . . . . . . . . 3-133
Create a sample custom form using JavaBeans . . . . . . . . . . . . . 3-134
Using the Teamcenter property beans . . . . . . . . . . . . . . . . . . . . 3-139
Developing custom property beans . . . . . . . . . . . . . . . . . . . . . . 3-140
Developing forms by extending the abstract class . . . . . . . . . . . . . . . 3-141
Create a sample custom form by extending the abstract class . . . 3-141
General comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-147
Form performance issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-148
Form events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-149
Form user interface display components . . . . . . . . . . . . . . . . . . . . . . . . 3-149
Displaying a form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-150

Performing advanced customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-151


Customizing Command Suppression . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-152
Using the Command Suppression expression in the plugin.xml file . . 3-152
Command Suppression constraints . . . . . . . . . . . . . . . . . . . . . . . . . 3-154
Naming convention for extensions and Command Suppression . . . . . 3-154
Registering user service functions on the server side . . . . . . . . . . . . . . . 3-155
Displaying files in the viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-155
Display Word, Excel, PowerPoint, PDF, and text files in the viewer . . 3-155
Display Web files in the viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-156
Display QAF files in the viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-156
Disable the toolbar in the viewer . . . . . . . . . . . . . . . . . . . . . . . . . . 3-156
Customizing the data tabs display . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-156
Edit a custom properties file to display tabs . . . . . . . . . . . . . . . . . . . 3-157
Sample tab customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-158
Customizing the rich client to perform additional validations on a file . . . 3-159
Customize the Launch Pad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-161

Tips for rich client customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-163


Localization of rich client customizations . . . . . . . . . . . . . . . . . . . . . . . 3-163
Updating your rich client customizations from previous versions . . . . . . . 3-164
Hide perspectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-164
Adding a third-party JAR file to your plug-in . . . . . . . . . . . . . . . . . . . . . 3-164

Troubleshooting rich client customization . . . . . . . . . . . . . . . . . . . . . . . . . . 3-165

Client Customization Programmer’s Guide PLM00075 H


Common problems in rich client customization . . . . ... . . . . . . . . . . . . 3-165
Eclipse startup error . . . . . . . . . . . . . . . . . . . . ... . . . . . . . . . . . . 3-165
Customizations from a new plug-in do not appear .. . . . . . . . . . . . . 3-166
Unable to load application error . . . . . . . . . . . . ... . . . . . . . . . . . . 3-166
Rich client debugging tools . . . . . . . . . . . . . . . . . . . ... . . . . . . . . . . . . 3-166
Debug using the Print Object view . . . . . . . . . . ... . . . . . . . . . . . . 3-167
Debug using the Communication Monitor view . ... . . . . . . . . . . . . 3-168
Debug using the Performance Monitor tool . . . . ... . . . . . . . . . . . . 3-168
Debug using Eclipse views . . . . . . . . . . . . . . . . ... . . . . . . . . . . . . 3-169
Enabling client-side logging . . . . . . . . . . . . . . . . . . ... . . . . . . . . . . . . 3-169
Changing the logging level and location . . . . . . . ... . . . . . . . . . . . . 3-169
Adding appenders . . . . . . . . . . . . . . . . . . . . . . ... . . . . . . . . . . . . 3-170
Pattern layouts . . . . . . . . . . . . . . . . . . . . . . . . ... . . . . . . . . . . . . 3-170
Add logging to your code . . . . . . . . . . . . . . . . . ... . . . . . . . . . . . . 3-172
Listener leaks . . . . . . . . . . . . . . . . . . . . . . . . . . . . ... . . . . . . . . . . . . 3-172
Classes and operations . . . . . . . . . . . . . . . . . . ... . . . . . . . . . . . . 3-173
InterfaceSignalOnClose . . . . . . . . . . . . . . . ... . . . . . . . . . . . . 3-173
SignalOnClose . . . . . . . . . . . . . . . . . . . . . . ... . . . . . . . . . . . . 3-173

Rich client customization reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-173


Teamcenter extension points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-173
Command line options for rich client startup . . . . . . . . . . . . . . . . . . . . . 3-178
Coding standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-181
File organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-181
Naming conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-182
Property conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-182
Source code conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-182
Dialog box standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-183
Property beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-183
Rich client Javadoc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-201
User interface components documented in Javadoc . . . . . . . . . . . . . . 3-202
User interface components in the com.teamcenter.rac.common
package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-202
User interface components in the com.teamcenter.rac.util
package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-218
Common Teamcenter command IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-247
Plug-in locations of perspectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-248
Application Integration Framework (AIF) . . . . . . . . . . . . . . . . . . . . . . . 3-250
AIF customization and development . . . . . . . . . . . . . . . . . . . . . . . . 3-251
Integrating the Application Integration Framework (AIF) desktop with the
Eclipse workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-251
Context sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-252
Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-253
Write a handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-253

PLM00075 H Client Customization Programmer’s Guide


Chapter

3 Rich client customization

Rich client customization


The Teamcenter rich client is based on a client-server architecture. Both the client
and server layers can be customized. The rich client is the user interface (UI) layer
and is built and customized using the Java language. The server layer can be
customized using the Integration Toolkit (ITK) and the C++ programming language.
Because the rich client is based on Eclipse, your customizations have access to all
Eclipse extension points and OSGi services. They can also use Teamcenter-developed
customization techniques. To customize the rich client, you can use:
• Base Eclipse extension points and services (for example, the
org.eclipse.ui.menus extension point).

• Teamcenter extension points and services (for example, the application extension
points).

• Teamcenter customization mechanisms (for example, style sheets).

The basic customization technique is to create a plug-in that contains the


customizations and deploy the custom plug-in to the rich client install. To effectively
customize the rich client, you must be comfortable working with Eclipse.

Basic concepts about rich client customization


Before customizing the rich client, you should review some basic concepts about
customizing the rich client environment. This includes knowing the Siemens PLM
Software customization support standards, Eclipse concepts such as perspectives
and views, basics about the Eclipse framework, how to use style sheets, and how to
work with the Standard Widget Toolkit (SWT).

Rich client perspectives and views


Within the Teamcenter rich client user interface, application functionality is
provided in perspectives and views. Some applications use perspectives and views to
arrange how functionality is presented. Other applications use a single perspective
and view to present information.

PLM00075 H Client Customization Programmer’s Guide 3-1


Chapter 3 Rich client customization

Note
Your administrator can use the HiddenPerspectives preference to prevent
the display of some Teamcenter perspectives in the rich client.
For information about editing preference values, see the Preferences and
Environment Variables Reference.

If your site has online help installed, you can access application and view help from
the rich client Help menu or by pressing F1.
For more information about rich client perspectives and views, see the Rich Client
Interface Guide.

Understanding the Eclipse rich client platform framework


When the rich client is installed, Java archive (JAR) files are installed that are
Eclipse plug-in files. They are located in the TC_ROOT\portal\plugins directory,
and the file names start with com.teamcenter. These files comprise rich client and
the resources required to run it. When you add a new custom plug-in, you deploy it
into this directory.
The Teamcenter rich client is hosted within the Eclipse rich client platform (RCP)
framework. The RCP is a general purpose application framework which provides
strong support for modular and extensible component-based development through
the use of plug-ins.
You can find more information about the RCP’s features, advantages, and use at the
Eclipse Web site:
http://www.eclipse.org/
For more information about using Eclipse, see the Platform Plug-in Developer Guide,
which can be found at the following location:
http://help.eclipse.org/helios/index.jsp
To customize the RCP, you need to use the Eclipse IDE.
For more information about the IDE, see Enable rich client customization.

Adding menus and toolbars


To add menu bars, toolbars, and shortcut menus, use the declarative approach
provided by Eclipse. The definition of the menu bar, toolbar, and context menus
are provided in the individual plug-in’s plugin.xml file. Menus and the resulting
application logic they call can be placed in a Model-View-Controller (MVC) paradigm.
The three parts to the MVC paradigm are:
• Command

• Menu contributions

• Handler

For more information and full examples about how to use the Eclipse declarative
approach to menus and toolbars, see the following links:
• http://wiki.eclipse.org/Menu_Contributions

3-2 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

• http://wiki.eclipse.org/Platform_Command_Framework

• http://wiki.eclipse.org/Command_Core_Expressions

• http://www.vogella.de/articles/EclipseCommands/article.html

For examples about how to use the Eclipse approach to add menus and toolbar items,
see Adding menu commands to a menu, toolbar, and shortcut menu.

Command
Command has a globally unique ID and represents the abstract semantic concept of
a behavior, such as copy, paste, and save. A command is not the implementation of
that behavior nor is it the visual representation of that behavior.
<command id="com.teamcenter.rac.command"
name="%com.teamcenter.rac.command.name">
</command>

Menu contributions
Menu contributions represent a particular view or visual representation of a
command. The menu contributions create the menu and toolbar structures and
insert them into the correct Eclipse location. The location is specified as an Uniform
Resource Identifier (URI) and can be any one of the following:
• Main menu

• Main toolbar

• View toolbar

• View menu

• Context (popup) menu

• Trim area

The menu contribution can define a menu label, mnemonic, or icon. It contains
visual references to already defined commands. The visual representations of
commands may include labels, icons, and mnemonics. Menu contributions also may
include separators. Separators are only visible if there are visible commands before
and after a separator. The menu contribution can define when it will be visible
with a visibleWhen clause. The visibleWhen clause refers to all standard Eclipse
expressions. This expression can be very simple or very complex and evaluates to
either true or false which determines whether a menu is visible or not.
<menuContribution locationURI="menu:org.eclipse.ui.main.menu">
<menu id="file" label="%menu.file.label" mnemonic="%menu.file.mnemonic">
<command commandId="org.eclipse.ui.file.refresh"
mnemonic="%command.refresh.mnemonic"
style="push">
</command>
<separator name="sep1" visible="true"/>
<command commandId="org.eclipse.ui.file.exit"
mnemonic="%command.exit.mnemonic"
style="push">
</command>
</menu>
</menuContribution>

PLM00075 H Client Customization Programmer’s Guide 3-3


Chapter 3 Rich client customization

Note
You can define the icon for a menu toolbar item by specifying a URL. The URL
is case sensitive (for example, icon.PNG is not the same as icon.png). If you
give an incorrect icon URL, a warning is logged to the log file and the Console
view, if displayed. The menu or toolbar item with the incorrect URL definition
is not visible until it is corrected and the rich client is restarted.
If you run in development mode inside the IDE and pull the icon files from a
source folder, Windows is not case sensitive and finds the icons. However, once
you run the rich client from the command line where the icons are packaged
in the plug-in’s JAR file, the Java API does not find the icons since those
APIs are case sensitive.
Always verify the case is correct for image icons.

A command can also be bound to a key sequence using the org.eclipse.ui.bindings


extension point.

Handler

A handler implements one particular behavior for a given command. For any given
command, there can be zero or several handlers defined. However only none or
one handler may be active for a given command. The active handler controls the
command’s enabled state.
Handlers most commonly extend the AbstractHandler class. Handlers are
provided an application context in their execute(*) method. If a command has no
active handlers defined, any menu contributions defined for a command are not
visible. A command can also define a default handler ensuring that a command
always has an active handler. The handler can be declaratively activated via the
ActiveWhen clause or programmatically activated. The handler also defines
declaratively when a command appears enabled in any menu contribution with the
enabledWhen expression for the handler.

Introduction to SWT
The Standard Widget Toolkit (SWT) is a graphical toolkit for use with the Java
platform, and is maintained by the Eclipse Foundation. It is an alternative to the
Abstract Window Toolkit (AWT) and Swing Java toolkits.
For more information about SWT, see the following URL:
http://www.eclipse.org/swt/
Because the rich client already uses SWT, the necessary files are already loaded into
your Eclipse environment from TC_ROOT\portal\plugins when you defined the
target platform. Therefore, when you create a Java file, you can use the import
org.eclipse.swt.widgets command to include SWT in your coding.
For instructions about how to define the target platform, see Set the project
preferences.

3-4 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Note
Teamcenter is moving toward SWT/JFace as the user interface toolkit and
moving away from AWT and Swing. Siemens PLM Software encourages you to
customize Teamcenter using SWT/Jface components. Siemens PLM Software
will discontinue Swing/AWT support in a future version.
For more information, see User interface components documented in Javadoc.

To become familiar with SWT, you can download SWT samples and run the SWT
tutorial in Eclipse:
1. Download Eclipse Classic 3.6 from the following URL:
http://www.eclipse.org/downloads/

2. Run the SWT samples:


a. Click Samples on the Welcome page, and under SWT select Workbench
views and standalone applications.

Launching the SWT samples


The SWT sample projects are installed in Eclipse.

PLM00075 H Client Customization Programmer’s Guide 3-5


Chapter 3 Rich client customization

SWT sample projects in Eclipse

b. To see the samples in action, right-click the org.eclipse.swt.examples


project, choose Run As→Java Application, and select samples from the
dialog box.

Available SWT samples

3. Run the SWT tutorial:

3-6 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

a. Choose Help→Welcome. On the Welcome page, click Tutorials and choose


Create a Hello World SWT application tutorial.

Launching the SWT tutorial


The tutorial is displayed.

SWT tutorial

b. Run the tutorial.

PLM00075 H Client Customization Programmer’s Guide 3-7


Chapter 3 Rich client customization

Note
In the Download SWT standalone step of the tutorial, go to the
following URL:
http://download.eclipse.org/eclipse/downloads/
Select the latest release build, and find the SWT Binary and Source
download.

c. To run your application, right-click the HelloWorldSWT project in the


Package Explorer and choose Run As→Java Application.
A new empty window should appear with the title Hello world!.

HelloWorldSWT application

Basic tasks for rich client customizations


When you create a rich client customization, follow this general process to create,
test, and distribute the customization:
1. Set up your Eclipse environment for rich client customization.
For more information, see Enable rich client customization.

2. Create the desired customization.


For sample customizations, see Sample rich client customizations.

3. If you create a custom rich client plug-in, export the plug-in to the
TC_ROOT\portal\plugins directory or a shared directory.
For more information, see Export your custom plug-in.

3-8 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

4. Clear cache and register any new plug-in to ensure the customization appears
in the rich client.
For more information, see Ensure your customizations appear.

5. Run the rich client to verify the customization.

6. After testing is successful, distribute the customization to your organization.


For more information, see Distributing rich client customizations.

Enable rich client customization


To enable rich client customization, you must install Eclipse and configure it to
run the rich client.
Note
The Teamcenter rich client must be installed on your machine first.

The following steps are required to customize the rich client with Eclipse for the
first time:
1. Install Eclipse.

2. Set the project preferences.

3. Run the rich client from Eclipse.

Install Eclipse
1. If you have not already downloaded and installed the Java Development Kit
(JDK) version 6 (Update 26 or later), do so before proceeding further. You can
download the JDK from the following Web site:
http://www.oracle.com/technetwork/java/javase/downloads/index.html

2. Download the Eclipse 3.6 Software Development Kit (SDK) kit for your platform
from the following Web site:
http://archive.eclipse.org/eclipse/downloads/index.php

3. After you download the kit, extract the ZIP file to a directory on your machine.
The eclipse directory is automatically created below the installation directory.

4. Create a batch file that sets the environment, starts the server, and launches
Eclipse using the JDK command line parameters. Use the following template to
create your batch file:
set FMS_HOME=TC_ROOT\tccs
set JAVA_HOME=TC_ROOT\portal\jre
set JRE_HOME=TC_ROOT\portal\jre
set CLASSPATH=TC_ROOT\portal
set PATH=%FMS_HOME%\bin;%FMS_HOME%\lib;TC_ROOT\portal;%PATH%
start "TAO ImR" /min cmd /c "TC_ROOT\iiopservers\start_imr.bat"
Eclipse-install-directory\eclipse.exe -vm jdk-install-directory\bin\javaw

Note
You can use the portal.bat file as template for this batch file.

PLM00075 H Client Customization Programmer’s Guide 3-9


Chapter 3 Rich client customization

5. Run the batch file you just created.


Eclipse displays the Workspace Launcher dialog box.

6. Use the default location for the workspace. This location is used by Eclipse to
store the project related information. Click OK.
Eclipse displays the welcome window. You can close it.

Set the project preferences


1. In Eclipse, choose Window→Preferences to open the Preferences dialog box.
In the tree on the left, double-click the Java node, then select the Installed JREs
node.
Verify that the correct Java Runtime Environment (JRE) version is listed and
checked. If the correct version is not listed, follow these steps:

a. Next to the Installed JREs list, click the Add button.

b. In the JRE Type dialog box, select Standard VM and click Next.

c. In the JRE Definition dialog box, type the JRE directory in the JRE home
box. It is the jre directory under the Java SDK installation directory.

d. Type the name of the JRE in the JRE name box.

e. Click Finish to save the new definition and close the dialog box.

f. In the Preferences dialog box, select the new JRE.

2. In the Preferences dialog box, double-click the Plug-in Development node, then
select the Target Platform node.

3. In the Target Platform dialog box, click Add.

4. In the Target Definition box, ensure Nothing is selected and click Next.

5. In the Target Content dialog box, click Add.

6. In the Add Content dialog box, select Directory and click Next.

7. Navigate to the TC_ROOT\portal directory and click Finish.


The target platform is loaded.

8. Click the Finish button.


The Target Platform dialog box appears.

9. In the Target Platform dialog box, select the target you just set and click OK.

Run the rich client from Eclipse


1. In Eclipse, choose Run→Debug Configurations.

3-10 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

2. In the tree on the left of the Create, manage, and run configurations dialog box,
double-click Eclipse Application, then select the New_configuration node.

3. In the Name box, type RichClient.

4. In the Main tab, perform the following:


a. Select the Clear check box to clear the workspace before running the
application.

b. Ensure that Run a product is selected and that the product is


com.teamcenter.rac.aifrcp.product.

c. Ensure the correct JRE appears in the Runtime JRE box.

5. Click the Arguments tab and type the following in the VM arguments box:
-Xms256m -Xmx1024m

6. Click the Debug button in the bottom right of the dialog box.
Ensure that the rich client logon dialog box appears. When it does, either click
Cancel or log on the rich client.

Export your custom plug-in


A typical customization involves creating a new rich client plug-in using Eclipse.
To test your custom plug-in, you must first export it as a JAR file to the rich client
TC_ROOT\portal\plugins directory or to a shared directory.

Export your custom plug-in to the rich client


To test your custom plug-in, export it as a JAR file to the rich client
TC_ROOT\portal\plugins directory.
1. In Eclipse, right-click the customization project and choose Export.

2. In the Export dialog box, choose Plug-in Development→Deployable plug-ins


and fragments.

3. Click Next.

4. Click the Browse button to the right of the Directory dialog box and browse to
the TC_ROOT\portal directory.

5. Click Finish.
The JAR file is automatically generated into the TC_ROOT\portal\plugins
directory.

Before running the rich client to verify the customization, run the
TC_ROOT\portal\registry\genregxml file to register the plug-in with the rich
client, and clear the rich client cache.
For more information, see Ensure your customizations appear.

PLM00075 H Client Customization Programmer’s Guide 3-11


Chapter 3 Rich client customization

Export your custom plug-in to a shared directory

If you want to store custom plug-ins in a shared directory on an external machine to


be referenced by rich client installations, you can export the custom plug-in to the
shared directory instead of the TC_ROOT\portal\plugins directory. Use a .link
file on the rich client installations to point to the shared directory:
1. Create the shared directory.
a. Create a directory (for example, shared) to hold the custom plug-ins, and
share it so it can be accessed by outside machines as a mapped directory.

b. Place within the shared directory an eclipse\features subdirectory and a


eclipse\plugins subdirectory, for example:
z:\shared\eclipse\features
z:\shared\eclipse\plugins

c. Export the custom plug-ins from Eclipse to the eclipse\plugins


subdirectory on the shared directory.

2. Link to the shared directory from the rich client installations.


a. In each rich client installation that requires access to the shared directory,
add a links folder inside the TC_ROOT\portal\ directory.

b. In the links folder, create a plain text file with a .link file extension (for
example, custom.link) that points to the shared directory, for example:
path=\\z:\\shared

Or:
path=/z:/shared

The slash is either one (/) or two (\\) depending on direction. Leading
slashes (/ or \\) are required to tell Eclipse that this is an absolute path.
Otherwise, it converts it to a relative path and does not support referencing
another drive.

c. Run the TC_ROOT\portal\registry\genregxml file to register the


plug-ins in the shared directory with the rich client.
For more information, see Ensure your customizations appear.

Ensure your customizations appear


You can run the rich client from Eclipse, and thereby test if your customizations
appear in the rich client.
For more information, see Run the rich client from Eclipse.
But running your customization from Eclipse is not a true test of whether your
customizations will work in an end user’s rich client installation. After you create a
customization, you must perform the following steps to ensure it appears in the rich
client when it is run outside the Eclipse IDE.

3-12 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Note
You must perform these steps whenever you create a new plug-in to add to
the rich client, which should be in most cases of rich client customization
(with the exception of style sheets). You must always wrap your rich client
customizations in a plug-in to ensure that the out-of-the-box rich client is
unchanged, thereby maintaining its integrity the next time you upgrade to a
newer version of Teamcenter. If you customize the out-of-the-box rich client
files, you can lose those customizations the next time you upgrade.

1. Export your custom plug-in from Eclipse to the rich client.


For more information, see Export your custom plug-in to the rich client.

2. Run the TC_ROOT\portal\registry\genregxml.bat file to register new


plug-ins and other changes with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.
Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml script
to ensure your changes are included when the rich client starts. This
enhances performance because it caches the properties so they can
be loaded at startup. The script takes no arguments and generates a
RegistryLoader file for each locale in the portal\Registry directory.

3. Ensure that the -clean and -initialize arguments are added to the portal.bat
file (between the start Teamcenter.exe command and %*).
Run the portal.bat file to launch the rich client to verify that your
customizations appear.
Note
To confirm that the plug-in is registered in the rich client, choose
Help→About→Installation Details and search the list to see the registered
plug-ins.

4. If your customizations still do not appear, to clear cache, delete the Teamcenter\
subdirectory in the user’s home directory on the client. This directory is
automatically created again when the user starts the rich client. This directory
usually contains RAC and TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX client,
it is typically the $HOME/Teamcenter/ directory.
If you delete this directory, the last state of the rich client is lost, and the user
interface appears as it does at initial startup.

PLM00075 H Client Customization Programmer’s Guide 3-13


Chapter 3 Rich client customization

Distributing rich client customizations


There are two different methods you use to distribute rich client customizations,
depending if the rich client is a two-tier or four-tier client.
• For four-tier clients, use a solution file and the Web Application Manager
(insweb).
For more information, see Distributing customizations to four-tier rich clients.

• For two-tier clients, use Teamcenter Environment Manager (TEM) Updates


Manager.
For more information, see Distributing customizations to two-tier rich clients.

Distributing customizations to four-tier rich clients


If you used Over-the-Web Installer (OTW) to initially install a rich client, you can
use OTW to distribute your customized files to it.
1. Package your customized files into a JAR file.

2. Create an installable component descriptor (ICD) file that defines your custom
solution.
For more information creating a solution file, see Creating a solution file.

3. Run the Web Application Manager (insweb) to create a distribution instance for
your custom solution.
For more information, see Distribute a solution file.

Creating a solution file


The following code shows a sample solution file named sample.icd. This file deploys
the sample.jar file to the RC_ROOT\plugins directory on the rich client machine.
#The name of the solution. It appears on the solution list in the Web
#Application Manager.
[NAME]
Sample Solution for Rich Client 4-Tier
#The description of the solution that appears in a tooltip when the user
#hovers the mouse over the solution name in the solution list. You can use
#HTML code to format the text.
[DESCRIPTION]
This installs the sample.jar file.
#Specify the jar file. If you have more than one jars, you need to repeat
#this section for each file like this:
#[COPYFILE]
#{
# [FROM]
# sample.jar
#
# [TO]
# plugins
#}
#[COPYFILE]
#{
# [FROM]
# sample2.jar
#
# [TO]
# plugins
#}
#[COPYFILE]
#{
# [FROM]
# sample3.jar
#
# [TO]
# plugins
#}
[COPYFILE]

3-14 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

{
[FROM]
sample.jar
[TO]
plugins
}
#The version of this Sample Solution.
[VERSION]
11
#Requires Teamcenter rich client install.
[PREREQUISITE_SOLUTIONS]
rac4t:11
#This file defines a Solution.
[SOLUTION]
Y
#It’s a Distribution Instance Solution.
[SOLUTION_TYPE]
DS_INSTANCE
#Install information
[MANIFEST_INFO]
{
#This is the RC_ROOT.
[SUBDIR]
rac
[TARGETS]
<target name="file_download_unix">
</target>
<target name="new_solution_unix">
</target>
<target name="file_download_win">
</target>
<target name="new_solution_win">
</target>
[DOWNLOAD_FILES]
{
#This section tells the OTW installer to download the jar.
#The location is subfolder to [SUBDIR] from above.
#If you have more than one jar, you need to list them here like this:
#[COMMON]
#plugins/sample.jar:1.0
#plugins/sample2.jar:1.0
#plugins/sample3.jar:1.0
[COMMON]
plugins/sample.jar:1.0
[SOLARIS]
[HPUX]
[AIX]
[NT_INTEL]
}
[PACKAGED_FILES]
{
[SOLARIS]
[HPUX]
[AIX]
[NT_INTEL]
}
}

Distribute a solution file


1. Launch the Web Application Manager:
a. Open the WEB_ROOT directory.
This is the directory in which you installed the Web Application Manager on
your hard drive.

b. In Windows, double-click the insweb.bat file. In UNIX, type the following


command:
insweb

The Web Application Manager displays the Teamcenter Web Application


Manager dialog box.

2. Click Copy ICDs.


The Web Application Manager displays the Copy ICD Files dialog box.

3. Enter the path to your solution file and click OK.

PLM00075 H Client Customization Programmer’s Guide 3-15


Chapter 3 Rich client customization

The Web Application Manager displays a Progress dialog box and copies the
ICD file.

4. When copying is complete, click OK.


The Web Application Manager displays the Teamcenter Web Application
Manager dialog box.

5. In the Web Applications list, select the rich client instance and click Modify.
The Web Application Manager displays the Modify Web Application dialog box.

6. Click Modify Disk Locations.


The Web Application Manager displays the Modify Disk Locations dialog box.

7. Ensure the path to your solution files is listed in the Disk Locations for Install
Images box. If it is not, click Add.

8. Click Add Solutions.


The Web Application Manager displays the Add Solutions dialog box.

9. Select your solution and click OK.


The Web Application Manager begins installation of the solutions and displays a
Progress dialog box.

10. When installation is complete, click OK to close the Progress dialog box.
The Web Application Manager displays the Modify Web Application dialog box.

11. Click OK.

12. Deploy the distribution instance as described in the appropriate Teamcenter


server installation guide (either the Installation on UNIX and Linux Servers
Guide or the Installation on Windows Servers Guide).

13. Launch the Over-the-Web-installed rich client or the local otw.bat file
to download and use the sample.jar file. You can verify the JAR file
was downloaded to the designated installation location by looking in the
RC_ROOT\plugins directory.

Note
Once you install a customization using a solution file, you cannot remove it
using Over-the-Web Installer.

Distributing customizations to two-tier rich clients


1. Package your customized files.

2. Use one of the following methods to install your files:


• If your customized files modify rich client files that have been already
installed, use Updates Manager to install them.

3-16 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

• If your customization includes one or more files that are not already on the
rich client, you must create a feature file using XML code to install the
custom files.

Package custom files


1. To create a plug-in JAR file of your customization, in Eclipse right-click the
project and choose Export→Plug-in Development→Deployable plug-ins and
fragments.

2. Zip your custom JAR file into a rac_feature-name.zip file (for example,
rac_samplecust.zip) with the root path for the JAR file set to \plugins.
The use of rac_ in the name signifies that the ZIP file contains a rich client
feature. For examples of these files, see the portal\compressed_files directory
on the Teamcenter installation source.

3. Create a directory structure to hold the ZIP files, for example,


portal\compressed_files\.
You can use any directory structure you want. For convenience, this structure is
the same used on the Teamcenter installation source.

4. Copy your ZIP files to the portal\compressed_files\ directory.

Install the customized files with Updates Manager


Note
If you created a feature file and installed the custom files, you do not need to
follow these steps. Your files are already installed.

1. Open the TC_ROOT\install directory and run Teamcenter Environment


Manager (TEM).

2. Click Updates Manager and click Next.

3. Click the browse button in the Update kit location box, navigate to the directory
that contains your ZIP file, select it, and click Select.

4. In the Confirm Selections panel, click Next.

Install new client-side only customized files with a feature file and Configuration
Manager
If your customization includes one or more files that are not already on the rich
client and customize the client only, you must create a feature file using XML code
to install the custom files. If your customized files modify rich client files that have
been already installed, do not create the feature file; see Install the customized files
with Updates Manager instead.
1. In a text editor, create an XML file with the following code:
<?xml version="1.0" encoding="UTF-8"?>
<feature>
<name value="New Customization Files"/>
<size value="21"/>
<os value="windows" version="5.1"/>
<os value="sunos" version="5.10"/>

PLM00075 H Client Customization Programmer’s Guide 3-17


Chapter 3 Rich client customization

<os value="hp-ux" version="11.11"/>


<root value="true"/>
<group value="clientadd"/>
<singular value="true"/>
<guid value="7560C67ED5B01B65C39B8DF7364066C8"/>
<relation>
<depends>
<or value="FF18D25DA73019F880BCFFBC0029CA28"/>
<or value="E2564104E1B964BB23D78078DBA34EEA"/>
<or value="A2564824E1B434AC23D70178DBA34BCA"/>
</depends>
</relation>
<files>
<code>
<unzip file="portal/compressed_files/rac_samplecust.zip"
todir="portal"/>
</code>
</files>
</feature>

2. In the file, change the following lines:


• In the size tag, change the value text to the approximate size (in megabytes)
of your customization files.

• Add or remove os tags to match the platforms where you use rich client.

• In the guid tag, change the value text to a unique value exactly 32
characters in length and composed of any combination of the numbers 0–9
and the letters A–F.

• In the unzip tag, change the file text to the name of the ZIP file that
contains your customizations.
To ensure that the todir="portal" line correctly unzips to the
portal\plugins directory, ensure that \plugins is set as the location in
the ZIP file.

3. Save the file as feature_rac_mycust.xml.


For other examples of feature_rac_feature-name.xml files, see the
install\modules directory on the installation source.

4. Copy the XML file to the TC_ROOT\install\install\modules directory.

5. Open the TC_ROOT\install directory and run Teamcenter Environment


Manager (TEM).

6. Click Configuration Manager and click Next.

7. Click Perform maintenance on an existing configuration and click Next.

8. Ensure the correct configuration is selected and click Next.

9. Ensure Add/Remove Features is selected and click Next.

10. Under the Client Enhancements node, select the check box for your new files.
The name of the box is the one you gave it in the feature file. Click Next.

11. In the Confirm Selections panel, click Next to start installing your customization
files.

3-18 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Install new client and server customized files with a feature file and Configuration
Manager
If your customization includes one or more files that are not already on the rich
client and you customize both the client and server sides, you must modify the server
(Business Modeler IDE template project) feature file.
1. Open the template project in Business Modeler IDE, and in the Navigator view,
open the feature_template-name.xml file under the installation folder. Add the
following code directly at the same level as the data model feature:
<feature>
<name value="feature-display-name"/>
<property name="feature_id" value="rac"/>
<property name="bmide_optional" value="true"/>
<relation>
<depends>
<or value="FF18D25DA73019F880BCFFBC0029CA28"/>
<or value="E2564104E1B964BB23D78078DBA34EEA"/>
<or value="A2564824E1B434AC23D70178DBA34BCA"/>
</depends>
</relation>
<size value="0"/>
<singular value="true"/>
<guid value="85B3827CD5A0FA61220398F6C60C21AB"/>
<files>
<code>
<unzip file="portal/compressed_files/rac_feature-name.zip"
todir="portal"/>
</code>
</files>
</feature>

In the file, change the following lines:

• In the name tag, change the value text to the feature name you want
displayed in TEM.

• In the size tag, change the value text to the approximate size (in megabytes)
of your customization files.

• In the guid tag, change the value text to a unique value exactly 32
characters in length and composed of any combination of the numbers 0–9
and the letters A–F.

• In the unzip tag, change the file text to the name of the ZIP file that
contains your customizations.
To ensure that the todir="portal" line correctly unzips to the
portal\plugins directory, ensure that \plugins is set as the location in
the ZIP file.

2. Package the template.

3. Open the TC_ROOT\install directory and run Teamcenter Environment


Manager (TEM).

4. Select Configuration Manager and click Next.

5. Select Perform maintenance on an existing configuration and click Next.

6. Ensure the correct configuration is selected and click Next.

7. Ensure Add/Remove Features is selected and click Next.

PLM00075 H Client Customization Programmer’s Guide 3-19


Chapter 3 Rich client customization

8. In the Features panel, click Browse to locate the template.


The template is added to the Features panel.

9. Under Base Install, select Teamcenter Rich Client 2-tier and under the
Extensions node, select the check box for your new files. Click Next.

10. In the Confirm Selections panel, click Next to start installing your customization
files.

Sample rich client customizations


Sample customizations show you step-by-step how to create customizations
for the rich client, from commonly-performed customizations to miscellaneous
customizations.

Common rich client customizations


Commonly performed customizations range from changing style sheets all the way
to adding applications to the rich client. Some customizations do not require you
to write code while others do.
Codeless customization allows you to alter the appearance or functionality of the
rich client without the need to write Java code. Codeless customization tasks require
you to change Teamcenter preference values, change XML files, modify properties
files, and implement Eclipse plug-ins. You should be familiar with XML and Eclipse
before performing codeless customization.
Many common customization tasks require that you write Java code and implement
Eclipse plug-ins. You should be familiar with Java and Eclipse before performing
this kind of customization.

Adding menu commands to a menu, toolbar, and shortcut menu


You can add a menu command to a menu or shortcut menu or add it as a button to a
toolbar using the Eclipse menus, commands, and handlers mechanism.

Add a menu command to a menu


The rich client uses the Eclipse menus, commands, and handlers mechanism for
menus. This example adds the Sample Command menu command to the end of the
Tools menu in the My Teamcenter perspective only.
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Then click Next.

c. In the New Plug-in Project dialog box Plug-in Project pane, type
com.mycom.addmenuitem in the Project name box. Click Next.

d. In the New Plug-in Project dialog box Content pane, do the following:
A. Under Options, ensure the This plug-in will make contributions to the
UI check box is selected.

3-20 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

B. Click the No button next to Would you like to create a rich client
application?.

C. Click Next.

e. Ensure the Create a plug-in using one of these templates check box is
selected and select Hello, World Command in the list. Click Finish.

f. To verify the configuration so far, choose Run→Run Configurations to start


the rich client from your Eclipse environment. Clear the workspace by
selecting the Clear check box in the launch configuration dialog box.
For information about how to set up Eclipse to run the rich client, see Enable
rich client customization.
When you run the rich client from Eclipse, the new Sample Menu menu
appears on the menu bar.

Custom menu command on the menu bar


At the far right of the toolbar, there is also a new button.

Custom button on the toolbar


Selecting either the new menu or new button opens the following dialog box.

Action launched from the custom menu command or button

2. Edit the com.mycom.addmenuitem plug-in’s plugin.xml file to place the


menu command at the bottom of the Tools menu. Replace the entire contents of
the plugin.xml file with the following code:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.6"?>
<plugin>
<extension point="org.eclipse.ui.commands">
<command

PLM00075 H Client Customization Programmer’s Guide 3-21


Chapter 3 Rich client customization

name="Sample Command"
id="com.mycom.addmenuitem.commands.sampleCommand">
</command>
</extension>
<extension point="org.eclipse.ui.handlers">
<handler
commandId="com.mycom.addmenuitem.commands.sampleCommand"
class="com.mycom.addmenuitem.handlers.SampleHandler">
</handler>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution locationURI="menu:tools?after=additions">
<command
commandId="com.mycom.addmenuitem.commands.sampleCommand"
mnemonic="S"
icon="icons/sample.gif"
id="com.mycom.addmenuitem.menus.sampleCommand">
<visibleWhen>
<reference
definitionId="com.teamcenter.rac.ui.inMainPerspective">
</reference>
</visibleWhen>
</command>
</menuContribution>
</extension>
</plugin>

The visibleWhen clause uses the com.teamcenter.rac.ui.inMainPerspective


definition to control visibility. This definition is in the
com.teamcenter.rac.common plug-in’s plugin.xml file. Each Teamcenter
perspective has an inMainPerspective definition, usually in the plug-in’s
plugin.xml file.
For example, the inMainPerspective definition for Structure Manager is in
the plugin.xml file in the com.teamcenter.rac.pse plug-in. If you want the
menu command to be visible in Structure Manager, change the visibleWhen
clause to the following:
<visibleWhen>
<reference
definitionId="com.teamcenter.rac.pse.inMainPerspective">
</reference>
</visibleWhen>

To add the menu to the menu bar instead of the Tools menu, change the
locationURI attribute to the following:
locationURI="menu:org.eclipse.ui.main.menu?after=additions"

3. To verify the configuration, choose Run→Run Configurations to start the rich


client from your Eclipse environment. Clear the workspace by selecting the
Clear check box in the launch configuration dialog box.
The menu command is inserted at the bottom of the Tools menu in the My
Teamcenter perspective.

Custom menu command moved to the Tools menu

3-22 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

4. Package the project.


If you want to package the project for distribution, export it to a JAR file and
place it in the TC_ROOT\portal directory.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.
Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

Add a menu command to the shortcut menu


The rich client uses the Eclipse menus, commands, and handlers mechanism for the
shortcut menu (the right-click menu). This example adds the Sample Command
button to the shortcut menu in the My Teamcenter perspective only.
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Then click Next.

c. In the New Plug-in Project dialog box Plug-in Project pane, type
com.mycom.addshortcut in the Project name box. Click Next.

d. In the New Plug-in Project dialog box Content pane, do the following:
A. Under Options, ensure the This plug-in will make contributions to the
UI check box is selected.

PLM00075 H Client Customization Programmer’s Guide 3-23


Chapter 3 Rich client customization

B. Click the No button next to Would you like to create a rich client
application?.

C. Click Next.

e. Ensure the Create a plug-in using one of these templates check box is
selected and select Hello, World Command in the list. Click Finish.

2. To verify the configuration so far, choose Run→Run Configurations to start the


rich client from your Eclipse environment. Clear the workspace by selecting the
Clear check box in the launch configuration dialog box.
For information about how to set up Eclipse to run the rich client, see Enable
rich client customization.
When you run the rich client from Eclipse, the new Sample Menu menu appears
on the menu bar.

3. Edit the com.mycom.addshortcut plug-in’s plugin.xml file to place the menu


command on the shortcut menu. Replace the entire contents of the plugin.xml
file with the following code:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.6"?>
<plugin>
<extension point="org.eclipse.ui.commands">
<command
name="Sample Command"
id="com.mycom.addshortcut.commands.sampleCommand">
</command>
</extension>
<extension point="org.eclipse.ui.handlers">
<handler
commandId="com.mycom.addshortcut.commands.sampleCommand"
class="com.mycom.addshortcut.handlers.SampleHandler">
</handler>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
<command
commandId="com.mycom.addshortcut.commands.sampleCommand"
mnemonic="S"
icon="icons/sample.gif"
id="com.mycom.addshortcut.menus.sampleCommand">
<visibleWhen>
<reference
definitionId="com.teamcenter.rac.ui.inMainPerspective">
</reference>
</visibleWhen>
</command>
</menuContribution>
</extension>
</plugin>

The visibleWhen clause uses the com.teamcenter.rac.ui.inMainPerspective


definition to control visibility. This definition is in the
com.teamcenter.rac.common plug-in’s plugin.xml file. Each Teamcenter
perspective has an inMainPerspective definition, usually in the plug-in’s
plugin.xml file.
For example, the inMainPerspective definition for Structure Manager is in
the plugin.xml file in the com.teamcenter.rac.pse plug-in. If you want the
menu command to be visible in Structure Manager, change the visibleWhen
clause to the following:
<visibleWhen>
<reference
definitionId="com.teamcenter.rac.pse.inMainPerspective">
</reference>
</visibleWhen>

3-24 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

4. Verify the customization.


a. Choose Run→Run Configurations to start the rich client from your Eclipse
environment. Clear the workspace by selecting the Clear check box in the
launch configuration dialog box.

b. Right-click on any object in the My Teamcenter perspective. For example,


right-click a folder.
The Sample Command menu command appears on the shortcut menu.

PLM00075 H Client Customization Programmer’s Guide 3-25


Chapter 3 Rich client customization

Custom menu command added to the shortcut menu

c. Package the project.

3-26 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

If you want to package the project for distribution, export it to a JAR file and
place it in the TC_ROOT\portal directory.

A. Right-click the project, choose Export→Plug-in


Development→Deployable plug-ins and fragments, select the
TC_ROOT\portal directory as the destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into
the TC_ROOT\portal\plugins directory.

B. Run the TC_ROOT\portal\registry\genregxml file to register the


plug-in with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.
Note
If you make changes to any of the .properties files, or you
add new plug-ins or change plug-in content, you must run the
genregxml script to ensure your changes are included when the
rich client starts. This enhances performance because it caches
the properties so they can be loaded at startup. The script takes
no arguments and generates a RegistryLoader file for each
locale in the portal\Registry directory.

C. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again
when the user starts the rich client. This directory usually contains
RAC and TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

Add a button to the toolbar


The rich client uses the Eclipse menus, commands, and handlers mechanism for the
toolbar. This example adds the Sample Command button to the toolbar in the My
Teamcenter perspective only.
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Then click Next.

c. In the New Plug-in Project dialog box Plug-in Project pane, type
com.mycom.addbutton in the Project name box. Click Next.

d. In the New Plug-in Project dialog box Content pane, do the following:
A. Under Options, ensure the This plug-in will make contributions to the
UI check box is selected.

PLM00075 H Client Customization Programmer’s Guide 3-27


Chapter 3 Rich client customization

B. Click the No button next to Would you like to create a rich client
application?.

C. Click Next.

e. Ensure the Create a plug-in using one of these templates check box is
selected and select Hello, World Command in the list. Click Finish.

2. To verify the configuration so far, choose Run→Run Configurations to start the


rich client from your Eclipse environment. Clear the workspace by selecting the
Clear check box in the launch configuration dialog box.
For information about how to set up Eclipse to run the rich client, see Enable
rich client customization.
At the far right of the toolbar, there is a new button.

Custom button on the toolbar


Selecting the new button opens the following dialog box.

Action launched from the custom button

3. Edit the com.mycom.addbutton plug-in’s plugin.xml file to place the button


on the My Teamcenter toolbar. Replace the entire contents of the plugin.xml
file with the following code:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.6"?>
<plugin>
<extension point="org.eclipse.ui.commands">
<command
name="Sample Command"
id="com.mycom.addbutton.commands.sampleCommand">
</command>
</extension>
<extension point="org.eclipse.ui.handlers">
<handler
commandId="com.mycom.addbutton.commands.sampleCommand"
class="com.mycom.addbutton.handlers.SampleHandler">
</handler>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="toolbar:navigator_Toolbar?after=additions">
<command
commandId="com.mycom.addbutton.commands.sampleCommand"

3-28 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

icon="icons/sample.gif"
tooltip="Say hello world"
id="com.mycom.addbutton.toolbars.sampleCommand">
<visibleWhen>
<reference
definitionId="com.teamcenter.rac.ui.inMainPerspective">
</reference>
</visibleWhen>
</command>
</menuContribution>
</extension>
</plugin>

Each Teamcenter perspective has its own toolbar. For example, the My
Teamcenter toolbar is navigator_Toolbar, and the Structure Manager toolbar
is pse_Toolbar. The toolbar is usually defined in the plugin.xml file for the
perspective. For example, the pse_Toolbar is defined in the plugin.xml file in
the com.teamcenter.rac.pse plug-in.

4. To verify the configuration, choose Run→Run Configurations to start the rich


client from your Eclipse environment. Clear the workspace by selecting the
Clear check box in the launch configuration dialog box.
The button is inserted in the middle of the toolbar in the My Teamcenter
perspective.

Custom button location moved on the toolbar

5. Package the project.


If you want to package the project for distribution, export it to a JAR file and
place it in the TC_ROOT\portal directory.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.
Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

PLM00075 H Client Customization Programmer’s Guide 3-29


Chapter 3 Rich client customization

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

Add a command to a menu or toolbar in a view


You can add a command to a toolbar or menu in a view. To illustrate the process, this
example adds the exit command to My Teamcenter as a button on the Details view
toolbar and as a command on the view menu.
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Then click Next.

c. In the New Plug-in Project dialog box Plug-in Project pane, type
com.mycom.exitcommand in the Project name box. Click Next.

d. In the New Plug-in Project dialog box Content pane, do the following:
A. Under Options, ensure the This plug-in will make contributions to the
UI check box is selected.

B. Click the No button next to Would you like to create a rich client
application?.

C. Click Next.

e. Ensure the Create a plug-in using one of these templates check box is
selected and select Hello, World Command in the list. Click Finish.

2. Update the project tabs.


Click the Runtime tab, click the Add button, and select the following:

com.mycom.exitcommand
com.mycom.exitcommand.handlers

3. Edit the project files.


a. Edit the com.mycom.exitcommand plug-in’s plugin.xml file to place
the menu command on the Details view. Replace the entire contents of the
plugin.xml file with the following code:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.commands">
<category
name="Sample Category"
id="com.teamcenter.rac.exit.commands.category">
</category>
<command

3-30 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

name="Sample Command"
categoryId="com.mycom.exitcommand.commands.category"
id="com.mycom.exitcommand.commands.sampleCommand">
</command>
<command
defaultHandler="com.mycom.exitcommand.handlers.SampleHandler"
id="com.mycom.exitcommand.command1.Exit"
name="Exit">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
commandId="com.mycom.exitcommand.commands.sampleCommand"
class="com.mycom.exitcommand.handlers.SampleHandler">
</handler>
</extension>
<extension
point="org.eclipse.ui.bindings">
<key
commandId="com.mycom.exitcommand.commands.sampleCommand"
contextId="org.eclipse.ui.contexts.window"
sequence="M1+6"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
</key>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
<menu
id="closeMenu"
label="Close">
<command
commandId="com.mycom.exitcommand.command1.Exit"
label="Exit"
style="push"
tooltip="Exit the application">
</command>
</menu>
</menuContribution>
<menuContribution
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
<toolbar
id="com.mycom.exitcommand.toolbar1">
<command
commandId="com.mycom.exitcommand.command1.Exit"
icon="icons/sample.gif"
label="Exit"
style="push"
tooltip="Exit the application">
</command>
</toolbar>
<command
commandId="com.mycom.exitcommand.command1.Exit"
icon="icons/sample.gif"
label="Exit"
style="push"
tooltip="Exit the application">
</command>
</menuContribution>
</extension>
</plugin>

b. Replace the code in the SampleHandler.java file with the following:


package com.mycom.exitcommand.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.handlers.HandlerUtil;
/**
* Our sample handler extends AbstractHandler, an IHandler base class.
* @see org.eclipse.core.commands.IHandler
* @see org.eclipse.core.commands.AbstractHandler
*/
public class SampleHandler extends AbstractHandler {
/**
* The constructor.
*/
public SampleHandler() {
}
/**
* the command has been executed, so extract extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
HandlerUtil.getActiveWorkbenchWindow(event).close();
return null;
}
}

PLM00075 H Client Customization Programmer’s Guide 3-31


Chapter 3 Rich client customization

c. Choose File→Save All.

4. Package the project.


To package the project for distribution, export it to a JAR file and place it in the
TC_ROOT\portal directory.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.
Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

5. Verify the customization.


a. Launch My Teamcenter and click the Details view tab.
The exit command button is displayed on the toolbar of the view.

3-32 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Exit command button on the view toolbar


Do not click the button to exit Teamcenter. You must first verify the new exit
command on the view menu.

b. Click the menu button on the toolbar.

Menu button on the view toolbar

c. Choose Close→Exit on the menu to exit Teamcenter.

PLM00075 H Client Customization Programmer’s Guide 3-33


Chapter 3 Rich client customization

Exit command on the view menu

Although this example shows how to add an exit command, you can use this
process to add your own custom command to a view toolbar and menu.

Add a toggle menu item


You can create toggle menu items and tie them to state inside the rich client. To
illustrate the process, this example adds an Error Level menu with toggled menu
items. Select an object in My Teamcenter and select the toggle on the custom Error
Level menu.
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Then click Next.

c. In the New Plug-in Project dialog box Plug-in Project pane, type
com.mycom.toggle in the Project name box. Click Next.

d. In the New Plug-in Project dialog box Content pane, do the following:
A. Under Options, ensure the This plug-in will make contributions to the
UI check box is selected.

B. Click the No button next to Would you like to create a rich client
application?.

C. Click Next.

3-34 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

e. Ensure the Create a plug-in using one of these templates check box is
selected and select Hello, World Command in the list. Click Finish.

2. Update the project tabs.


a. Click the Dependencies tab, click the Add button, and select the following:
com.teamcenter.rac.aifrcp
com.teamcenter.rac.common
com.teamcenter.rac.kernel
com.teamcenter.rac.util

b. Click the Runtime tab, click the Add button, and select the following:
com.mycom.toggle
com.mycom.toggle.handlers

3. Create the project files.


a. Edit the com.mycom.toggle plug-in’s plugin.xml file. Replace the entire
contents of the plugin.xml file with the following code:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.commands">
<category
name="Sample Category"
id="com.teamcenter.rac.toggleexample.commands.category">
</category>
<command
categoryId="com.mycom.toggle.commands.category"
defaultHandler="com.mycom.toggle.handlers.ToggleInfoHandler"
id="com.mycom.toggle.commands.infoCommand"
name="Info">
<state
class="org.eclipse.ui.handlers.RegistryToggleState:true"
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
<command
categoryId="com.mycom.toggle.commands.category"
defaultHandler="com.mycom.toggle.handlers.ToggleWarnHandler"
id="com.mycom.toggle.commands.warnCommand"
name="Warn">
<state
class="org.eclipse.ui.handlers.RegistryToggleState:false"
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
<command
categoryId="com.mycom.toggle.commands.category"
defaultHandler="com.mycom.toggle.handlers.ToggleErrorHandler"
id="com.mycom.toggle.commands.errorCommand"
name="Error">
<state
class="org.eclipse.ui.handlers.RegistryToggleState:false"
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<menu
id="com.mycom.toggle.menus.sampleMenu"
label="Error Level"
mnemonic="L">
<command
commandId="com.mycom.toggle.commands.infoCommand"
label="Info"
mnemonic="I"
style="toggle">
<visibleWhen>
<reference
definitionId="com.teamcenter.rac.ui.inMainPerspective">
</reference>
</visibleWhen>
</command>
<command

PLM00075 H Client Customization Programmer’s Guide 3-35


Chapter 3 Rich client customization

commandId="com.mycom.toggle.commands.warnCommand"
label="Warn"
mnemonic="W"
style="toggle">
<visibleWhen>
<reference
definitionId="com.teamcenter.rac.ui.inMainPerspective">
</reference>
</visibleWhen>
</command>
<command
commandId="com.mycom.toggle.commands.errorCommand"
label="Error"
mnemonic="E"
style="toggle">
<visibleWhen>
<reference
definitionId="com.teamcenter.rac.ui.inMainPerspective">
</reference>
</visibleWhen>
</command>
</menu>
</menuContribution>
</extension>
</plugin>

b. Open the com.mycom.toggle.handlers package, select the


SampleHandler.java file, choose File→Rename, and rename the file to
ToggleInfoHandler.java.
Replace the contents of the ToggleInfoHandler.java file with the following:
package com.mycom.toggle.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.jface.dialogs.MessageDialog;
import com.teamcenter.rac.util.Registry;
/**
* Our sample handler extends AbstractHandler, an IHandler base class.
* @see org.eclipse.core.commands.IHandler
* @see org.eclipse.core.commands.AbstractHandler
*/
public class ToggleInfoHandler extends AbstractHandler {
private Registry reg ;
/**
* The constructor.
*/
public ToggleInfoHandler() {
}
/**
* the command has been executed, so extract extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
Command command = event.getCommand();
boolean checked = HandlerUtil.toggleCommandState(command);
IWorkbenchWindow window = HandlerUtil
.getActiveWorkbenchWindowChecked(event);
reg = Registry.getRegistry(this);
if (checked) {
MessageDialog.openInformation(window.getShell(), reg.getString("Info.TITLE"),
reg.getString("Info.MESSAGE"));
}
return null;
}
}

c. Right-click the com.mycom.toggle.handlers package, choose New→Class,


and add the following Java files:
ToggleErrorHandler.java
ToggleWarnHandler.java

d. Replace the contents of the ToggleErrorHandler.java file with the


following:

3-36 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

package com.mycom.toggle.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
import com.teamcenter.rac.util.Registry;
public class ToggleErrorHandler extends AbstractHandler {
private Registry reg ;
public ToggleErrorHandler() {
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Command command = event.getCommand();
boolean checked = HandlerUtil.toggleCommandState(command);
IWorkbenchWindow window = HandlerUtil
.getActiveWorkbenchWindowChecked(event);
reg = Registry.getRegistry(this);
if (checked) {
MessageDialog.openError(window.getShell(), reg.getString("Error.TITLE"),
reg.getString("Error.MESSAGE"));
}
return null;
}
}

e. Replace the contents of the ToggleWarnHandler.java file with the


following:
package com.mycom.toggle.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
import com.teamcenter.rac.util.Registry;
public class ToggleWarnHandler extends AbstractHandler {
private Registry reg ;
public ToggleWarnHandler() {
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Command command = event.getCommand();
boolean checked = HandlerUtil.toggleCommandState(command);
IWorkbenchWindow window = HandlerUtil
.getActiveWorkbenchWindowChecked(event);
reg = Registry.getRegistry(this);
if (checked) {
MessageDialog.openWarning(window.getShell(), reg.getString("Warn.TITLE"),
reg.getString("Warn.MESSAGE"));
}
return null;
}
}

f. Right-click the com.mycom.toggle.handlers package, choose New→File,


and add a handlers.properties file.

g. Replace the contents of the handlers.properties file with the following:


Info.TITLE=ToggleInfo
Info.MESSAGE=Info menu is toggled off
Error.TITLE=ToggleError
Error.MESSAGE=Error menu is toggled off
Warn.TITLE=ToggleWarn
Warn.MESSAGE=Warn menu is toggled off

h. Choose File→Save All.

4. Package the project.


To package the project for distribution, export it to a JAR file and place it in the
TC_ROOT\portal directory.

PLM00075 H Client Customization Programmer’s Guide 3-37


Chapter 3 Rich client customization

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.
Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

5. Verify the customization.


a. Launch My Teamcenter and choose Error Level on the menu bar.
The error levels are displayed.

Error Level toggle menus

b. Select toggles on the menu.


When you clear a toggle, a dialog box is displayed.

3-38 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Toggle state dialog box

Adding views and applications to the rich client


You can add a view or application to the rich client. You can also add an application
to the Send To shortcut menu.

Add a view to the rich client


This view contains a menu item that is visible only when the view is active. It uses
the following Eclipse extensions: commands, handlers, menus, expressions, and
views.
Use the Eclipse plug-in create wizard to create the plug-in. Add packages and
classes as needed and copy and paste the class and plugin.xml file content from the
following steps. If you use the same names, you can cut and paste; otherwise, edit
your Java files and plugin.xml file using the following steps as a guide.
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Click Next.

c. In the New Plug-in Project wizard Plug-in Project dialog box, type
com.mycom.customview in the Project name box. Click Next.

d. In the New Plug-in Project wizard Content dialog box, do the following:
A. Under Options, ensure the This plug-in will make contributions to the
UI check box is selected.

B. Click the No button next to Would you like to create a rich client
application?.

C. Click Next.

e. Clear the Create a plug-in using one of these templates check box. Click
Finish.

2. Update the project tabs.


a. Click the Overview tab and select the This plug-in is a singleton check box.

b. Click the Dependencies tab, click the Add button, and select the
com.teamcenter.rac.kernel plug-in.

PLM00075 H Client Customization Programmer’s Guide 3-39


Chapter 3 Rich client customization

3. Create the project files.


a. Right-click the com.mycom.customview project and choose New→Package.
In the Name box, type com.mycom.customview.handlers.

b. Right-click the com.mycom.customview.handlers package and choose


New→Class. In the Name box, type SampleHandler.

c. Create the com.mycom.customview.views package and the CustomView


class in it.
The plug-in structure looks like this:

d. Replace the code in the Activator.java file with the following:


package com.mycom.customview;
import org.osgi.framework.BundleContext;
import com.teamcenter.rac.kernel.AbstractRACPlugin;
import com.teamcenter.rac.services.IAspectService;
import com.teamcenter.rac.services.IAspectUIService;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractRACPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "com.mycom.customview";
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator()
{
super();
Activator.plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugins#start
* (org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugin#stop
* (org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
@Override
public IAspectService getLogicService() {
// TODO Auto-generated method stub
return null;
}

3-40 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

@Override
public IAspectUIService getUIService() {
// TODO Auto-generated method stub
return null;
}
protected void setupServices(BundleContext context) {
// TODO Auto-generated method stub
}
}

e. Replace the code in the SampleHandler.java file with the following:


package com.mycom.customview.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.jface.dialogs.MessageDialog;
/**
* Our sample handler extends AbstractHandler, an IHandler base class.
* @see org.eclipse.core.commands.IHandler
* @see org.eclipse.core.commands.AbstractHandler
*/
public class SampleHandler extends AbstractHandler {
/**
* The constructor.
*/
public SampleHandler() {
}
/**
* the command has been executed, so extract extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
MessageDialog.openInformation(
window.getShell(),
"Customview",
"Hello, from SampleHandler");
return null;
}
}

f. Replace the code in the CustomView.java file with the following:


package com.mycom.customview.views;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.part.ViewPart;
public class CustomView extends ViewPart {
/** ID corresponding to the RCP declaration */
public static final String ID = CustomView.class.getName();
public CustomView()
{
super();
}
@Override
public void createPartControl(Composite parent) {
// TODO Auto-generated method stub
parent.setLayout( new FillLayout() );
Text t = new Text( parent, SWT.BORDER );
t.setBackground( parent.getDisplay().getSystemColor( SWT.COLOR_WHITE ));
t.setForeground( parent.getDisplay().getSystemColor( SWT.COLOR_BLUE ));
Font initialFont = t.getFont();
FontData[] fontData = initialFont.getFontData();
for (int i = 0; i < fontData.length; i++) {
fontData[i].setHeight(18);
}
Font newFont = new Font(parent.getDisplay(), fontData);
t.setFont( newFont );
t.setText( " Hello from CustomView!! ");
}
@Override
public void setFocus() {
// TODO Auto-generated method stub
}
}

PLM00075 H Client Customization Programmer’s Guide 3-41


Chapter 3 Rich client customization

g. To create an empty plugin.xml file, click the Extensions tab and click the
Add button in the Extensions view, and click the Cancel button in the New
Extension dialog box.
A plugin.xml file is added to the project.

h. Click the plugin.xml tab and replace the code in the plugin.xml file with
the following:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.6"?>
<plugin>
<extension point="org.eclipse.ui.commands">
<command
name="Sample Command"
id="com.mycom.customview.commands.sampleCommand">
</command>
</extension>
<extension point="org.eclipse.ui.handlers">
<handler
commandId="com.mycom.customview.commands.sampleCommand"
class="com.mycom.customview.handlers.SampleHandler">
</handler>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<menu
label="Sample Menu"
mnemonic="M"
id="com.mycom.customview.menus.sampleMenu">
<command
commandId="com.mycom.customview.commands.sampleCommand"
mnemonic="S"
id="com.mycom.customview.menus.sampleCommand">
<visibleWhen>
<reference
definitionId="com.mycom.customview.inMainView" />
</visibleWhen>
</command>
</menu>
</menuContribution>
</extension>
<extension point="org.eclipse.ui.views">
<view
name="MyCom Custom View"
class="com.mycom.customview.views.CustomView"
id="com.mycom.customview.views.CustomView">
</view>
</extension>
<extension point="org.eclipse.core.expressions.definitions">
<definition id="com.mycom.customview.inMainView">
<with variable="activePartId">
<equals value="com.mycom.customview.views.CustomView" />
</with>
</definition>
</extension>
</plugin>

i. Choose File→Save All.

4. Verify the customization.


a. Choose Run→Run Configurations to start the rich client from your Eclipse
environment. Clear the workspace by selecting the Clear check box in the
launch configuration dialog box.
For information about how to set up Eclipse to run the rich client, see Enable
rich client customization.

b. Choose Window→Show View→Other→Other→MyCom Custom View.


The custom view is displayed in the list.

3-42 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Custom view in the list of available views


The Sample Menu menu command is visible when MyCom Custom View is
the active view.

PLM00075 H Client Customization Programmer’s Guide 3-43


Chapter 3 Rich client customization

Custom menu command displayed when the custom view is open

5. Package the project.


If you want to package the project for distribution, export it to a JAR file and
place it in the TC_ROOT\portal directory.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.
Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when

3-44 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

Create a view that uses the Selection Service


The following steps illustrate how to add a view that contains a JFace TableViewer
to the rich client. The view is both a selection listener and selection provider and its
behavior is similar to the Details view. This example also shows how to use Eclipse
Job class and get Teamcenter services.
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Click Next.

c. In the New Plug-in Project wizard Plug-in Project dialog box, type
com.mycom.myview in the Project name box. Click Next.

d. In the New Plug-in Project wizard Content dialog box, do the following:
A. Under Options, ensure the This plug-in will make contributions to the
UI check box is selected.

B. Click the No button next to Would you like to create a rich client
application?.

C. Click Next.

e. Clear the Create a plug-in using one of these templates check box. Click
Finish.

2. Update the project tabs.


a. Click the Overview tab and select the This plug-in is a singleton check box.

b. Click the Dependencies tab, click the Add button, and select the following
plug-ins:
com.teamcenter.rac.aifrcp
com.teamcenter.rac.common
com.teamcenter.rac.kernel
com.teamcenter.rac.util

3. Create the project files.


a. Right-click the com.mycom.myview project and choose New→Package. In
the Name box, type com.mycom.myview.views.

b. Right-click the com.mycom.myview.views package and choose New→Class.


In the Name box, type MyComView.

PLM00075 H Client Customization Programmer’s Guide 3-45


Chapter 3 Rich client customization

The plug-in structure looks like this:

c. Replace the code in the Activator.java file with the following:


package com.mycom.myview;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "com.mycom.myview";
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start
* (org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop
* (org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
/**
* Returns an image descriptor for the image file at the given
* plug-in relative path
*
* @param path the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
}

d. Replace the code in the MyComView.java file with the following:


package com.mycom.myview.views;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.viewers.ISelection;

3-46 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.part.*;
import com.mycom.myview.Activator;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.common.IContextInputService;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.util.OSGIUtil;
import com.teamcenter.rac.util.AdapterUtil;
// This view shows how to:
// be a selection listener
// be a selection provider
// use the Teamcenter OSGI IContextInputService
// use the Teamcenter selection to AIFComponentContext adapter
// use Eclipse Jobs (to jump off the main thread)
// ...see IC_SelectionListener()
public class MyComView extends ViewPart {
public static final String ID = "com.mycom.myview.views.MyComView";
private TableViewer m_viewer;
private ISelection m_selection;
private MyComView m_view;
private IC_SelectionListener m_listener;
private boolean m_firstTime = true;
/**
* The constructor.
*/
public MyComView() {
m_view = this;
}
@Override
public void createPartControl(Composite parent) {
parent.setLayout( new FillLayout() );
// setup the viewer
m_viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
m_viewer.setContentProvider(new ViewContentProvider());
m_viewer.setLabelProvider(new ViewLabelProvider());
m_listener = new IC_SelectionListener();
// register the selection listener
getSite().getWorkbenchWindow().getSelectionService().addSelectionListener
( m_listener );
// viewer is a selection provider
getViewSite().setSelectionProvider( m_viewer );
}
@Override
public void dispose() {
// cleanup
getViewSite().setSelectionProvider( null );
getSite().getWorkbenchWindow().getSelectionService().removeSelectionListener
(m_listener);
super.dispose();
}
/**
* Passing the focus request to the viewer’s control.
*/
@Override
public void setFocus() {
//do nothing
}
// this will be executed in a job...it will get the children in the job
// and set the viewer input in the main thread
void setViewerInput() {
// use the Teamcenter adapter
AIFComponentContext ctxt = (AIFComponentContext) AdapterUtil.getAdapter(
( (StructuredSelection) m_selection ).getFirstElement(),
AIFComponentContext.class, true );
AIFComponentContext[] ctxts = null;
if (ctxt != null)
{
TCComponent comp = (TCComponent) ctxt.getComponent();
if (comp!=null)
{
try {
ctxts = comp.getChildren();
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
final AIFComponentContext[] fctxts = ctxts;

PLM00075 H Client Customization Programmer’s Guide 3-47


Chapter 3 Rich client customization

Display.getDefault().asyncExec(new Runnable() {
public void run() {
if (m_viewer.getContentProvider() != null)
{
m_viewer.setInput(fctxts == null ? new AIFComponentContext[0]
: fctxts);
}
}
});
}
// this is the viewer content provider
class ViewContentProvider implements IStructuredContentProvider {
public void inputChanged(Viewer v, Object oldInput, Object newInput) {
}
public void dispose() {
}
public Object[] getElements(Object parent) {
return (AIFComponentContext[])parent;
}
}
// this is the viewer label provider
class ViewLabelProvider extends LabelProvider implements
ITableLabelProvider {
public String getColumnText(Object obj, int index) {
AIFComponentContext ctxt = (AIFComponentContext)obj;
TCComponent tc = (TCComponent)ctxt.getComponent();
return tc.toString();
}
public Image getColumnImage(Object obj, int index) {
return null;
}
}
// this is the selection listener
private class IC_SelectionListener implements ISelectionListener
{
public void selectionChanged( IWorkbenchPart part, ISelection selection )
{
m_selection = selection;
if( selection == null || selection.isEmpty() )
{
IContextInputService contextInputService = (IContextInputService)
OSGIUtil.getService(
Activator.getDefault(), IContextInputService.class );
if( contextInputService != null )
{
m_selection = contextInputService.getInput();
}
}
// ignore selections from this view
// need m_firstTime to load the viewer if we open this view in a
// perspective where it is not showing
if( (m_firstTime) || (part != m_view) )
{
m_firstTime = false;
if (m_selection != null)
{
// use a job...don’t want to tie up the main thread
Job j = new Job( "" )
{
@Override
protected IStatus run( IProgressMonitor monitor )
{
setViewerInput();
return Status.OK_STATUS;
}
};
j.schedule();
}
}
}
}
}

e. To create an empty plugin.xml file, click the Extensions tab and click the
Add button in the Extensions view, and click the Cancel button in the New
Extension dialog box.
A plugin.xml file is added to the project.

f. Click the plugin.xml tab and replace the code in the plugin.xml file with
the following:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.6"?>
<plugin>
<extension point="org.eclipse.ui.views">

3-48 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

<view
name="MyCom View"
class="com.mycom.myview.views.MyComView"
id="com.mycom.myview.views.MyComView">
</view>
</extension>
</plugin>

g. Choose File→Save All.

h. Package the project.


If you want to package the project for distribution, export it to a JAR file and
place it in the TC_ROOT\portal directory.

A. Right-click the project, choose Export→Plug-in


Development→Deployable plug-ins and fragments, select the
TC_ROOT\portal directory as the destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into
the TC_ROOT\portal\plugins directory.

B. Run the TC_ROOT\portal\registry\genregxml file to register the


plug-in with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.
Note
If you make changes to any of the .properties files, or you
add new plug-ins or change plug-in content, you must run the
genregxml script to ensure your changes are included when the
rich client starts. This enhances performance because it caches
the properties so they can be loaded at startup. The script takes
no arguments and generates a RegistryLoader file for each
locale in the portal\Registry directory.

C. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again
when the user starts the rich client. This directory usually contains
RAC and TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

i. Verify the customization.


A. Launch the rich client and choose Window→Show
View→Other→Other→MyCom View.
The custom view is displayed in the list.

PLM00075 H Client Customization Programmer’s Guide 3-49


Chapter 3 Rich client customization

Custom view in the list of available views

B. Select the view.

C. Select an object.
The MyCom View view shows the contents of the selected object.

3-50 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Custom view displaying the contents of the selected object

Create a custom Viewer view


The Viewer view in My Teamcenter displays information about the selected object.
As of Teamcenter 9.1, the Viewer view is converted from Swing to SWT. In this
customization example using SWT, you create two custom Viewer view definitions: a
HelloWorldViewer definition that displays only the text Helloselected-object-name!
for the selected object, and a MyPropertyViewer definition that displays properties
and checkin/checkout buttons at the bottom of the view.
This SWT customization example extends the
com.teamcenter.rac.viewer.ViewerViewRegistry extension point to override the
standard TextViewer viewer and replace it with a new viewers. In the example Java
files, you implement IViewerFactory and ISubViewer components, and extend
the ViewerViewRegistry extension point to register the new SubView definition.
After creating the view, you must update the
defaultViewerConfig.VIEWERCONFIG preference to include this new view for
the data type you want. For example, if you set the custom view for the text dataset
type, the custom view appears when you select that dataset type.
For more information about this preference, see the My Teamcenter Guide or
the defaultViewerConfig.VIEWERCONFIG preference in the Preferences and
Environment Variables Reference.

PLM00075 H Client Customization Programmer’s Guide 3-51


Chapter 3 Rich client customization

Following is an example of a default Viewer view.

Viewer view
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Click Next.

c. In the New Plug-in Project wizard Plug-in Project dialog box, type
com.mycom.customviewerview in the Project name box. Click Next.

d. In the New Plug-in Project wizard Content dialog box, do the following:
A. Under Options, ensure the This plug-in will make contributions to the
UI check box is selected.

B. Click the No button next to Would you like to create a rich client
application?.

C. Click Next.

e. Clear the Create a plug-in using one of these templates check box. Click
Finish.

2. Update the project tabs.


a. Click the Overview tab and select the This plug-in is a singleton check box.

b. Click the Dependencies tab, click the Add button, and select the following
plug-ins:
org.eclipse.ui
org.eclipse.core.runtime
com.teamcenter.rac.aifrcp
com.teamcenter.rac.common

3-52 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

com.teamcenter.rac.kernel
com.teamcenter.rac.util
com.teamcenter.rac.viewer

3. Right-click the com.mycom.customviewerview project, choose New→Package,


and create the following packages:
com.mycom.customviewerview.factory
com.mycom.customviewerview.viewer

4. Create the HelloWorldViewer definition.


a. Create the project files.
A. Right-click the com.mycom.customviewerview.factory package, choose
New→Class, and create the HelloWorldViewerFactory class.

B. Right-click the com.mycom.customviewerview.viewer package, choose


New→Class, and create the following classes:
HelloWorldViewer
HelloWorldViewerContentProvider

C. Replace the code in the HelloWorldViewerFactory.java file with the


following:
package com.mycom.customviewerview.factory;
import org.eclipse.swt.widgets.Display;
import com.mycom.customviewerview.viewer.HelloWorldViewer;
import com.mycom.customviewerview.viewer.HelloWorldViewerContentProvider;
import com.teamcenter.rac.common.tcviewer.factory.AbstractSWTViewerFactory;
import com.teamcenter.rac.util.viewer.IViewerEvent;
import com.teamcenter.rac.util.viewer.SubViewerListener;
import com.teamcenter.rac.util.viewer.ViewerEvent;
/**
* This factory builds HelloWorldViewer.
*/
public class HelloWorldViewerFactory extends AbstractSWTViewerFactory
{
@Override
public void loadViewer( final SubViewerListener listener )
{
Runnable runnable = new Runnable()
{
public void run()
{
try
{
//HelloWorldViewer viewer = new HelloWorldViewer( m_parent );
HelloWorldViewer viewer = new HelloWorldViewer( getParent() );
viewer.setContentProvider( new HelloWorldViewerContentProvider());
listener.done( viewer );
}
catch( Exception e)
{
ViewerEvent viewerError = new ViewerEvent( this,
IViewerEvent.NOVIEWDATAFOUND );
listener.error( viewerError );
}
finally
{
}
}
};
Display.getDefault().asyncExec( runnable );
}
}

D. Replace the code in the HelloWorldViewer.java file with the following:


package com.mycom.customviewerview.viewer;
import org.eclipse.swt.SWT;

PLM00075 H Client Customization Programmer’s Guide 3-53


Chapter 3 Rich client customization

import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import com.teamcenter.rac.common.tcviewer.TCComponentViewerInput;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.util.AdapterUtil;
import com.teamcenter.rac.util.viewer.IViewerEvent;
import com.teamcenter.rac.util.viewer.ViewerEvent;
import com.teamcenter.rac.viewer.view.AbstractSwtSubViewer;
/**
* A simple "Hello World" example viewer.
*/
public class HelloWorldViewer
extends AbstractSwtSubViewer //implements IAdaptable
{
private Composite m_composite = null;
private Label m_label = null;
private TCComponent m_comp = null;
public HelloWorldViewer( Composite parent )
{
m_composite = new Composite( parent , SWT.NONE );
m_composite.setLayout(new FillLayout());
m_label = new Label( m_composite, SWT.None );
m_label.setText( "" );
m_label.setVisible(true);
m_label.setEnabled(true);
}
/*
* Currently this is just getting the TCComponent object
* from the viewer input.
*/
@Override
public void setInput( Object viewerInput )
{
TCComponentViewerInput input = (TCComponentViewerInput)
AdapterUtil.getAdapter( viewerInput,
TCComponentViewerInput.class );
m_comp = (TCComponent)input.getViewableObj();
super.setInput( m_comp );
}
@Override
public void inputChanged( Object input, Object oldInput )
{
HelloWorldViewerContentProvider cp = (HelloWorldViewerContentProvider)
getContentProvider();
String text = cp.getText( input );
m_label.setText( text );
//Notify the host viewer to reload.
ViewerEvent viewerEvent = new ViewerEvent( this, IViewerEvent.RELOADVIEW );
viewerEvent.queueEvent();
}
@Override
public Control getControl() {
return m_composite;
}
@Override
public void refresh() {
m_composite.layout();
}

E. Replace the code in the HelloWorldViewerContentProvider.java file


with the following:
package com.mycom.customviewerview.viewer;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.Viewer;
/**
* ContentProvider for the HelloWorldViewer
*/
public class HelloWorldViewerContentProvider implements IContentProvider
{
@Override
public void dispose()
{
//Do nothing.
}
@Override
public void inputChanged( Viewer viewer, Object oldInput, Object newInput )

3-54 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

{
//Do nothing.
}
public String getText( Object input )
{
return "Hello " + input.toString() + "!";
}
}

F. To create an empty plugin.xml file, click the Extensions tab and click
the Add button in the Extensions view, and click the Cancel button
in the New Extension dialog box.
A plugin.xml file is added to the project.

G. Click the plugin.xml tab and replace the code in the plugin.xml file
with the following:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="com.teamcenter.rac.viewer.ViewerViewRegistry">
<viewer
autoCheckout="false"
factoryClassName="com.mycom.customviewerview.factory.
HelloWorldViewerFactory"
id="HelloWorldViewer"
isSwing="false"
priority="100">
<enableWhen
checkEnabled="false">
</enableWhen>
</viewer>
<viewer
autoCheckout="false"
factoryClassName="com.teamcenter.rac.common.tcviewer.factory.
SwingViewerFactory"
id="SwingPropertyViewer"
isSwing="true"
priority="100"
viewPanel="com.teamcenter.rac.common.tcviewer.GenericViewer">
<enableWhen
checkEnabled="false">
</enableWhen>
</viewer>
</extension>
</plugin>

Note
Copying and pasting the plugin.xml file content is a quick way
to provide you with extensions for this example. However, when
you create your own extensions, instead of placing content directly
in the plugin.xml file, you work in the project’s Extensions tab.
Therefore, review the Extensions tab to see how you can create
extensions yourself.

H. Choose File→Save All.

b. Verify the customization.


A. Choose Run→Run Configurations to start the rich client from your
Eclipse environment. Clear the workspace by selecting the Clear check
box in the launch configuration dialog box.
For information about how to set up Eclipse to run the rich client, see
Enable rich client customization.

PLM00075 H Client Customization Programmer’s Guide 3-55


Chapter 3 Rich client customization

B. Edit the defaultViewerConfig.VIEWERCONFIG preference to point


to the new HelloWorldViewer definition when you select a text dataset.
In My Teamcenter, choose Edit→Options→Index, open the preference,
and change the Text.TextViewer=Text value to Text.HelloWorldViewer.

C. In My Teamcenter, create a text dataset by choosing File→New→Dataset,


selecting More on the left side of the New Dataset dialog box, and
selecting Text from the list of available dataset types.

D. Select the text dataset and click the Viewer view.


The message Hellodataset-name! is displayed in the Viewer view.

Viewer view using the HelloWorldViewer definition

E. If you edit the Viewer view preferences to use the new


HelloWorldViewer definition for another object type, the viewer is
presented.
For example, if you edit the defaultViewerConfig.VIEWERCONFIG
preference to include the Folder.HelloWorldViewer value, when you
select a Folder object such as the Home folder, the Viewer view displays
the following message: Hello, Home!

3-56 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

HelloWorldViewer view specified for another object type


For more information about using preferences to configure the Viewer
view, see the My Teamcenter Guide.

5. Create the MyPropertyViewer definition.


This example displays custom properties named w2str, w2integer, and w2date
in a custom Viewer view. To see the properties, you must create them on a Text
dataset, or create your own custom properties and modify the sample code.

a. Create the project files.


A. Right-click the com.mycom.customviewerview.factory package, choose
New→Class, and create the MyPropertyViewerFactory class.

B. Right-click the com.mycom.customviewerview.viewer package, choose


New→Class, and create the following classes:
MyPropertyViewer
MyPropertyViewerContentProvider

The plug-in structure looks like this:

PLM00075 H Client Customization Programmer’s Guide 3-57


Chapter 3 Rich client customization

C. Replace the code in the MyPropertyViewerFactory.java file with


the following:
package com.mycom.customviewerview.factory;
import org.eclipse.swt.widgets.Display;
import com.mycom.customviewerview.viewer.MyPropertyViewer;
import com.mycom.customviewerview.viewer.MyPropertyViewerContentProvider;
import com.teamcenter.rac.common.tcviewer.factory.AbstractSWTViewerFactory;
import com.teamcenter.rac.util.viewer.IViewerEvent;
import com.teamcenter.rac.util.viewer.SubViewerListener;
import com.teamcenter.rac.util.viewer.ViewerEvent;
/**
*/
public class MyPropertyViewerFactory extends AbstractSWTViewerFactory
{
@Override
public void loadViewer( final SubViewerListener listener )
{
Runnable runnable = new Runnable()
{
public void run()
{
try
{
MyPropertyViewer viewer = new MyPropertyViewer( getParent() );
viewer.setContentProvider( new MyPropertyViewerContentProvider());
listener.done( viewer );
}
catch( Exception e)
{
e.printStackTrace();
ViewerEvent viewerError = new ViewerEvent( this,
IViewerEvent.NOVIEWDATAFOUND );
listener.error( viewerError );
} finally {
}
}
};
Display.getDefault().asyncExec( runnable );
}
}

3-58 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

D. Replace the code in the MyPropertyViewer.java file with the following:


package com.mycom.customviewerview.viewer;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.ISaveablePart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.menus.CommandContributionItem;
import org.eclipse.ui.menus.CommandContributionItemParameter;
import com.teamcenter.rac.aif.kernel.AIFComponentChangeEvent;
import com.teamcenter.rac.aif.kernel.AIFComponentEvent;
import com.teamcenter.rac.aif.kernel.AIFComponentPropertyChangeEvent;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponentEventListener;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.common.SoaPropertyHelper;
import com.teamcenter.rac.common.tcviewer.TCComponentViewerInput;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.util.AdapterUtil;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.SWTUIUtilities;
import com.teamcenter.rac.util.controls.DateControl;
import com.teamcenter.rac.util.controls.TextControl;
import com.teamcenter.rac.util.viewer.IViewerEvent;
import com.teamcenter.rac.util.viewer.ViewerEvent;
import com.teamcenter.rac.viewer.stylesheet.StylesheetRenderingConstants;
import com.teamcenter.rac.viewer.view.AbstractSwtSubViewer;
public class MyPropertyViewer
extends AbstractSwtSubViewer implements IAdaptable, ISaveablePart,
InterfaceAIFComponentEventListener
{
private Composite m_composite = null;
private TCComponent m_comp = null;
private Label m_w2StrLabel = null;
private TextControl m_w2StrText;
private TCProperty m_w2StrProp;
private Label m_w2IntegerLabel = null;
private TextControl m_w2IntegerText;
private TCProperty m_w2IntProp;
private Label m_w2DateLabel = null;
private DateControl m_w2DateButton;
private TCProperty m_w2DateProp;
private Label m_w2ObjDescLabel = null;
private TextControl m_w2ObjDescText;
private TCProperty m_w2ObjDescProp;
// private Label m_lovLabel;
// private LOVComboBox m_lovComboBox;
// private TCProperty m_lovProp;
public MyPropertyViewer( Composite parent )
{
m_composite = new Composite( parent , SWT.NONE );
m_composite.setLayout(new GridLayout(2, false) );
m_w2StrLabel = new Label( m_composite, SWT.None );
m_w2StrText = new TextControl( m_composite, SWT.SINGLE | SWT.FLAT | SWT.BORDER );
GridData m_w2StrTextGd = new GridData();
m_w2StrTextGd.horizontalAlignment = SWT.FILL;
m_w2StrTextGd.verticalAlignment = SWT.CENTER;
m_w2StrTextGd.widthHint = 30 * StylesheetRenderingConstants.
DEFAULT_TEXTFIELD_COL_WIDTH;
m_w2StrText.getTextWidget().setLayoutData( m_w2StrTextGd );
m_w2IntegerLabel = new Label( m_composite, SWT.None );
m_w2IntegerText = new TextControl( m_composite, SWT.SINGLE | SWT.FLAT |
SWT.BORDER );
m_w2IntegerText.getTextWidget().setLayoutData( m_w2StrTextGd );
m_w2DateLabel = new Label( m_composite, SWT.None );

PLM00075 H Client Customization Programmer’s Guide 3-59


Chapter 3 Rich client customization

m_w2DateButton = new DateControl( m_composite );


m_w2ObjDescLabel = new Label( m_composite, SWT.None );
m_w2ObjDescText = new TextControl( m_composite, SWT.WRAP | SWT.MULTI |
SWT.V_SCROLL | SWT.BORDER );
GridData taGd = new GridData();
taGd.horizontalAlignment = SWT.FILL;
taGd.verticalAlignment = SWT.CENTER;
// gd.grabExcessHorizontalSpace = true;
taGd.widthHint = 30 * StylesheetRenderingConstants.
DEFAULT_TEXTAREA_COL_WIDTH;
taGd.heightHint = 5 * StylesheetRenderingConstants.
DEFAULT_TEXTAREA_ROW_HEIGHT;
m_w2ObjDescText.getTextWidget().setLayoutData( taGd );

AIFUtility.getDefaultSession().addAIFComponentEventListener( this );
}
@Override
public void setInput( Object viewerInput )
{
TCComponentViewerInput input = (TCComponentViewerInput)
AdapterUtil.getAdapter( viewerInput,
TCComponentViewerInput.class );
m_comp = (TCComponent)input.getViewableObj();
super.setInput( m_comp );
}
@Override
public void inputChanged( Object input, Object oldInput )
{
MyPropertyViewerContentProvider cp = (MyPropertyViewerContentProvider)
getContentProvider();
m_w2StrLabel.setText( cp.getPropertyDisplayName("w2str") );
m_w2StrProp = cp.getTCPropery("w2str");
m_w2StrText.getTextWidget().setText(m_w2StrProp.getStringValue());
m_w2IntegerLabel.setText(cp.getPropertyDisplayName("w2integer"));
m_w2IntProp = cp.getTCPropery("w2integer");
int ii = m_w2IntProp.getIntValue();
if( !m_w2IntProp.getNullVerdict() )
{
m_w2IntegerText.getTextWidget().setText(Integer.toString(ii));
}
m_w2DateLabel.setText(cp.getPropertyDisplayName("w2date"));
m_w2DateProp = cp.getTCPropery("w2date");
m_w2DateButton.setDate(m_w2DateProp.getDateValue());
m_w2ObjDescLabel.setText(cp.getPropertyDisplayName("object_desc"));
m_w2ObjDescProp = cp.getTCPropery("object_desc");
m_w2ObjDescText.getTextWidget().setText(m_w2ObjDescProp.getStringValue());
ViewerEvent viewerEvent = new ViewerEvent( this, IViewerEvent.RELOADVIEW );
viewerEvent.queueEvent();
}
@Override
public Control getControl()
{
return m_composite;
}
@Override
public void refresh()
{
if( m_composite == null || m_composite.isDisposed() )
{
return;
}
m_composite.layout();
if( m_comp.isCheckedOut() )
{
// Make panel writable
m_w2StrText.getTextWidget().setEditable(true);
m_w2IntegerText.getTextWidget().setEditable(true);
m_w2DateButton.setEnabled(true);
m_w2ObjDescText.getTextWidget().setEditable(true);
}
else
{
// make panel read-only or just show values in label like OOTB behavior.
m_w2StrText.getTextWidget().setEditable(false);
m_w2IntegerText.getTextWidget().setEditable(false);
m_w2DateButton.setEnabled(false);
m_w2ObjDescText.getTextWidget().setEditable(false);
}
}

3-60 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

@Override
public Object getAdapter( Class adapter )
{
if( adapter.equals( IContributionItem[].class ) )
{
return getCommandContributions();
}
return null;
}
private IContributionItem[] getCommandContributions()
{
List<IContributionItem> list = new ArrayList<IContributionItem>();
CommandContributionItemParameter contributionParameters =
new CommandContributionItemParameter(
PlatformUI.getWorkbench(), "", "com.teamcenter.rac.checkOut",
CommandContributionItem.STYLE_PUSH );
contributionParameters.mode = CommandContributionItem.MODE_FORCE_TEXT;
list.add( new CommandContributionItem( contributionParameters ) );
contributionParameters = new CommandContributionItemParameter(
PlatformUI.getWorkbench(), "",
"com.teamcenter.rac.checkIn", CommandContributionItem.STYLE_PUSH );
contributionParameters.mode = CommandContributionItem.MODE_FORCE_TEXT;
list.add( new CommandContributionItem( contributionParameters ) );
contributionParameters = new CommandContributionItemParameter(
PlatformUI.getWorkbench(), "",
"com.teamcenter.rac.saveCheckOut",
CommandContributionItem.STYLE_PUSH );
contributionParameters.mode = CommandContributionItem.MODE_FORCE_TEXT;
list.add( new CommandContributionItem( contributionParameters ) );
contributionParameters = new CommandContributionItemParameter(
PlatformUI.getWorkbench(), "",
"com.teamcenter.rac.cancelCheckOut",
CommandContributionItem.STYLE_PUSH );
contributionParameters.mode = CommandContributionItem.MODE_FORCE_TEXT;
list.add( new CommandContributionItem( contributionParameters ) );
return list.toArray( new IContributionItem[list.size()] );
}
// Implementation of ISaveablePart
@Override
public boolean isDirty()
{
// Check if the value has been changed
String txt = m_w2StrText.getTextWidget().getText();
if( !txt.equals(m_w2StrProp.getStringValue()) )
{
return true;
}
txt = m_w2IntegerText.getTextWidget().getText();
if( !txt.isEmpty() && m_w2IntProp.getNullVerdict() ||
txt.isEmpty() && !m_w2IntProp.getNullVerdict() )
{
return true;
}
if(!txt.isEmpty() && !txt.equals(Integer.toString(m_w2IntProp.getIntValue())))
{
return true;
}
Date date = m_w2DateButton.getDate();
if( (date == null && !m_w2DateProp.getNullVerdict()) ||
(date != null && m_w2DateProp.getNullVerdict()))
{
return true;
}
if( date != null && !date.equals(m_w2DateProp.getDateValue()) )
{
return true;
}
txt = m_w2ObjDescText.getTextWidget().getText();
if( !txt.equals(m_w2ObjDescProp.getStringValue()) )
{
return true;
}
return false;
}
// Implementation of ISaveablePart
@Override
public boolean isSaveAsAllowed()
{

PLM00075 H Client Customization Programmer’s Guide 3-61


Chapter 3 Rich client customization

return false;
}
// Implementation of ISaveablePart
@Override
public boolean isSaveOnCloseNeeded()
{
return true;
}
// Implementation of ISaveablePart
@Override
public void doSaveAs()
{
//not supported
}
// Implementation of ISaveablePart
@Override
public void doSave( final IProgressMonitor monitor )
{
try
{
setBusy( true );
// Save any changes in the viewer
TCProperty[] props = new TCProperty[] {m_w2StrProp,
m_w2IntProp, m_w2DateProp, m_w2ObjDescProp};
//TCProperty[] props = new TCProperty[] {m_w2ObjDescProp, m_lovProp};
String txt = m_w2StrText.getTextWidget().getText();
m_w2StrProp.setStringValueData(txt);
txt = m_w2IntegerText.getTextWidget().getText();
if( txt.isEmpty() )
{
m_w2IntProp.setNullVerdict(true);
}
else
{
int ii = Integer.parseInt(txt);
m_w2IntProp.setIntValueData(ii);
}
Date date = m_w2DateButton.getDate();
m_w2DateProp.setDateValueData(date);
txt = m_w2ObjDescText.getTextWidget().getText();
m_w2ObjDescProp.setStringValueData(txt);
SoaPropertyHelper.setPropertiesService( m_comp, props );
}
catch( Exception e )
{
MessageBox.post(e);
}
}
// Implement InterfaceAIFComponentEventListener
@Override
public void processComponentEvents( AIFComponentEvent[] events )
{
if( getInput() == null )
{
// nothing to be done.
return;
}
boolean requireUpdate = false;
Arrays.sort( events );
for( AIFComponentEvent event : events )
{
InterfaceAIFComponent targetComponent = event.getComponent();
if( targetComponent == getInput() ) // changed.
{
if( event instanceof AIFComponentPropertyChangeEvent )
{
// For property change event, don’t need to refresh the whole panel
}
else if( event instanceof AIFComponentChangeEvent )
{
requireUpdate = true;
}
}
}
if( requireUpdate )
{
SWTUIUtilities.asyncExec( new Runnable()
{
// update the check in/out UI widgets only

3-62 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

@Override
public void run()
{
refresh();
}
} );
}
}
}

E. Replace the code in the MyPropertyViewerContentProvider.java


file with the following:
package com.mycom.customviewerview.viewer;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.Viewer;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.kernel.TCPropertyDescriptor;
import com.teamcenter.rac.util.AdapterUtil;
/**
* ContentProvider for the MyPropertyViewer
*/
public class MyPropertyViewerContentProvider implements IContentProvider
{
private TCComponent m_comp;
@Override
public void dispose()
{
}
@Override
public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
{
String[] propNames = new String[] {"w2str", "w2integer", "w2date", "object_desc"};
m_comp = (TCComponent)AdapterUtil.getAdapter(newInput, TCComponent.class);
if( m_comp == null )
{
return;
}
try
{
// Pre-load properties in one call to reduce the network calls.
m_comp.getTCProperties(propNames);
}
catch (TCException e)
{
e.printStackTrace();
}
}
/**
* Return the TCProperty
* @param propName The property name
* @return TCProperty
*/
public TCProperty getTCPropery(String propName)
{
try
{
return m_comp.getTCProperty(propName);
}
catch (TCException e)
{
e.printStackTrace();
}
return null;
}
/**
* Return the property’s display name
* @param propName The property name
* @return String
*/
public String getPropertyDisplayName( String propName )
{
try
{
TCPropertyDescriptor propDesc = m_comp.getTypeComponent()
.getPropertyDescriptor(propName);
return propDesc.getDisplayName();
}
catch (TCException e)

PLM00075 H Client Customization Programmer’s Guide 3-63


Chapter 3 Rich client customization

{
e.printStackTrace();
}
return propName;
}
/**
* Return the property value
* @param propName The property name
* @return Object
*/
public Object getPropertyValue(String propName)
{
try
{
TCProperty prop = m_comp.getTCProperty(propName);
if( prop != null )
{
return prop.getPropertyData();
}
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}

F. Click the plugin.xml tab and add the code in bold to the plugin.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="com.teamcenter.rac.viewer.ViewerViewRegistry">
<viewer
autoCheckout="false"
factoryClassName="com.mycom.customviewerview.factory.
HelloWorldViewerFactory"
id="HelloWorldViewer"
isSwing="false"
priority="100">
<enableWhen
checkEnabled="false">
</enableWhen>
</viewer>
<viewer
autoCheckout="false"
factoryClassName="com.mycom.customviewerview.factory.
MyPropertyViewerFactory"
id="MyPropertyViewer"
isSwing="false"
priority="100">
<enableWhen
checkEnabled="false">
</enableWhen>
</viewer>
<viewer
autoCheckout="false"
factoryClassName="com.teamcenter.rac.common.tcviewer.factory.
SwingViewerFactory"
id="SwingPropertyViewer"
isSwing="true"
priority="100"
viewPanel="com.teamcenter.rac.common.tcviewer.GenericViewer">
<enableWhen
checkEnabled="false">
</enableWhen>
</viewer>
</extension>
</plugin>

Note
Copying and pasting content into the plugin.xml file is a
quick way to provide you with extensions for this example.
However, when you create your own extensions, instead of placing
content directly in the plugin.xml file, you work in the project’s
Extensions tab. Therefore, review the Extensions tab to see how
you can create extensions yourself.

3-64 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

G. Choose File→Save All.

b. Verify the customization.


A. Choose Run→Run Configurations to start the rich client from your
Eclipse environment. Clear the workspace by selecting the Clear check
box in the launch configuration dialog box.
For information about how to set up Eclipse to run the rich client, see
Enable rich client customization.

B. Edit the defaultViewerConfig.VIEWERCONFIG preference to point


to the new MyPropertyViewer viewer when you select a text dataset.
In My Teamcenter, choose Edit→Options→Index, open the preference,
and change the Text.HelloWorldViewer value to Text.MyPropertyViewer
to load the other viewer when you select a text dataset.

C. Select the text dataset and click the Viewer view.


The Viewer view displays the dataset information using the
MyPropertyViewer definition.
Notice the checkin and checkout button at the bottom of the view.

Viewer view using the MyPropertyViewer definition

6. Package the project.


If you want to package the project for distribution, export it to a JAR file and
place it in the TC_ROOT\portal directory.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

PLM00075 H Client Customization Programmer’s Guide 3-65


Chapter 3 Rich client customization

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.
Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

Add a new rich client application


This code creates a new application in the rich client that contains a single perspective
and a single view. It is displayed in the navigation pane. The project that contains
the application uses the following Eclipse extensions: org.eclipse.ui.perspectives,
org.eclipse.core.expressions.definitions, and org.eclipse.ui.views. It also uses
the Teamcenter com.teamcenter.rac.aifrcp.application extension.
Use the Eclipse plug-in create wizard to create the plug-in. Add packages and
classes as needed and copy and paste the class and plugin.xml file content from the
following steps. If you use the same names, you can cut and paste; otherwise, edit
your Java files and plugin.xml file using the following steps as a guide.
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Click Next.

c. In the New Plug-in Project wizard Plug-in Project dialog box, type
com.mycom.customapp in the Project name box. Click Next.

d. In the New Plug-in Project wizard Content dialog box, do the following:
A. Under Options, ensure the This plug-in will make contributions to the
UI check box is selected.

B. Click the No button next to Would you like to create a rich client
application?.

3-66 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

C. Click Next.

e. Clear the Create a plug-in using one of these templates check box. Click
Finish.

2. Update the project tabs.


a. Click the Overview tab and select the This plug-in is a singleton check box.

b. Click the Dependencies tab, click the Add button, and select the
com.teamcenter.rac.kernel plug-in.

3. Create the project files.


a. Create the following:
• The com.mycom.customapp.perspectives package and the
CustomPerspective class in it.
Note
To create a package, right-click the project and choose
New→Package. To create a class, right-click the package and
choose New→Class.

• The com.mycom.customapp.views package and the CustomView


class in it.

• An icons directory.
Note
To create a directory, right-click the project and choose
New→Folder.

b. Open the com.teamcenter.rac.aifrcp_version.jar in the


TC_ROOT\portal\plugins directory, extract all the
defaultapplication_size.png files and the pview.gif file, and
copy the files to the icons directory you just created.
The plug-in structure looks like this:

PLM00075 H Client Customization Programmer’s Guide 3-67


Chapter 3 Rich client customization

c. Replace the code in the Activator.java file with the following:


package com.mycom.customapp;
import org.osgi.framework.BundleContext;
import com.teamcenter.rac.kernel.AbstractRACPlugin;
import com.teamcenter.rac.services.IAspectService;
import com.teamcenter.rac.services.IAspectUIService;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractRACPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "com.mycom.customapp";
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start
* (org.osgi.framework.BundleContext)
*/
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop
* (org.osgi.framework.BundleContext)
*/
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
@Override
public IAspectService getLogicService() {
// TODO Auto-generated method stub

3-68 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

return null;
}
@Override
public IAspectUIService getUIService() {
// TODO Auto-generated method stub
return null;
}
protected void setupServices(BundleContext context) {
// TODO Auto-generated method stub
}
}

d. Replace the code in the CustomPerspective.java file with the following:


package com.mycom.customapp.perspectives;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
public class CustomPerspective implements IPerspectiveFactory {
/** The perspective ID */
public static final String ID =
"com.mycom.customapp.perspectives.CustomPerspective";
@Override
public void createInitialLayout(IPageLayout layout) {
// TODO Auto-generated method stub
layout.setEditorAreaVisible(false);
String editorArea = layout.getEditorArea();
IFolderLayout top = layout.createFolder("top", IPageLayout.TOP, -2f,
editorArea);
top.addView( "com.mycom.customapp.views.CustomView" );
}
}

e. Replace the code in the CustomView.java file with the following:


package com.mycom.customapp.views;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.part.ViewPart;
public class CustomView extends ViewPart {
public CustomView() {
super();
}
@Override
public void createPartControl(Composite parent) {
// TODO Auto-generated method stub
parent.setLayout( new FillLayout() );
Text t = new Text( parent, SWT.BORDER );
t.setBackground( parent.getDisplay().getSystemColor( SWT.COLOR_WHITE ));
t.setForeground( parent.getDisplay().getSystemColor( SWT.COLOR_BLUE ));
Font initialFont = t.getFont();
FontData[] fontData = initialFont.getFontData();
for (int i = 0; i < fontData.length; i++) {
fontData[i].setHeight(18);
}
Font newFont = new Font(parent.getDisplay(), fontData);
t.setFont( newFont );
t.setText( " Welcome to Custom Application !! ");
}
@Override
public void setFocus() {
// TODO Auto-generated method stub
}
}

f. To create an empty plugin.xml file, click the project’s Extensions tab and
click the Add button in the Extensions view, and click the Cancel button in
the New Extension dialog box.
A plugin.xml file is added to the project.

g. Click the project’s plugin.xml tab and replace the code in the plugin.xml
file with the following:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.6"?>
<plugin>

PLM00075 H Client Customization Programmer’s Guide 3-69


Chapter 3 Rich client customization

<extension point="com.teamcenter.rac.aifrcp.application">
<aif_app_item
displayMode="Primary"
groupName="Mycompany"
icon="icons/defaultapplication_32.png"
id="com.mycom.customapp"
name="Custom Application"
ordinality="200"
perspective_id="com.mycom.customapp.perspectives.CustomPerspective"
session="com.teamcenter.rac.kernel.TCSession"
tooltip="Custom Application"/>
</extension>
<extension point="org.eclipse.ui.perspectives">
<perspective
class="com.mycom.customapp.perspectives.CustomPerspective"
icon="icons/defaultapplication_16.png"
id="com.mycom.customapp.perspectives.CustomPerspective"
name="Custom Application"/>
</extension>
<extension point="org.eclipse.ui.views">
<view
allowMultiple="false"
class="com.mycom.customapp.views.CustomView"
icon="icons/pview.gif"
id="com.mycom.customapp.views.CustomView"
name="Custom View"/>
</extension>
<extension point="org.eclipse.core.expressions.definitions">
<definition id="com.mycom.customapp.inMainView">
<or>
<with variable="activePartId">
<equals value="com.mycom.customapp.views.CustomView" />
</with>
<with variable="arc_property.ACTIVE_APPLICATION">
<equals value="com.mycom.customapp" />
</with>
</or>
</definition>
</extension>
</plugin>

This example does not require the definitions extension; you can remove it.
It is included for reference to show how you can determine if your application
is active.

4. Choose File→Save All.

5. Verify the customization.


a. Choose Run→Run Configurations to start the rich client from your Eclipse
environment. Clear the workspace by selecting the Clear check box in the
launch configuration dialog box.
For information about how to set up Eclipse to run the rich client, see Enable
rich client customization.

b. Verify that the new Custom Application button is shown in the left-hand
navigation pane in the rich client.

c. Click the Custom Application button to launch the new application.

3-70 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Launching the custom application

6. Package the project.


If you want to package the project for distribution, export it to a JAR file and
place it in the TC_ROOT\portal directory.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.
Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

PLM00075 H Client Customization Programmer’s Guide 3-71


Chapter 3 Rich client customization

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

Add an application to the Teamcenter Send To menu


This code allows users in a different application to select an appropriate object,
choose an application from the Send To shortcut menu, and send the selected object
to the custom application.
This code creates a new application that uses the SendToHandler handler. Use
the Eclipse plug-in create wizard to create the plug-in. Add packages and classes as
needed and copy and paste the class and plugin.xml file content from the following
steps. If you use the same names, you can cut and paste; otherwise, edit your Java
files and plugin.xml file using the following steps as a guide.
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Click Next.

c. In the New Plug-in Project wizard Plug-in Project dialog box, type
com.mycom.sendtoapp in the Project name box. Click Next.

d. In the New Plug-in Project wizard Content dialog box, do the following:
A. Under Options, ensure the This plug-in will make contributions to the
UI check box is selected.

B. Click the No button next to Would you like to create a rich client
application?.

C. Click Next.

e. Clear the Create a plug-in using one of these templates check box. Click
Finish.

2. Update the project tabs.


a. Select the Overview tab and select the This plug-in is a singleton check box.

b. Select the Dependencies tab, click the Add button, and select the following
plug-ins:
com.teamcenter.rac.aifrcp
com.teamcenter.rac.common
com.teamcenter.rac.kernel

3. Create the project files.

3-72 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

a. Create the following:


• The com.mycom.sendtoapp.perspectives package and the
CustomPerspective class in it.
Note
To create a package, right-click the project and choose
New→Package. To create a class, right-click the package and
choose New→Class.

• The com.mycom.sendtoapp.services package and the


CustomOpenService class in it.

• The com.mycom.sendtoapp.views package and the CustomView


class in it.

• An icons directory.
Note
To create a directory, right-click the project and choose
New→Folder.

b. Open the com.teamcenter.rac.aifrcp_version.jar in the


TC_ROOT\portal\plugins directory, extract all the
defaultapplication_size.png files and the pview.gif file, and
copy the files to the icons directory you just created.
The plug-in structure looks like this:

PLM00075 H Client Customization Programmer’s Guide 3-73


Chapter 3 Rich client customization

c. Replace the code in the Activator.java file with the following:


package com.mycom.sendtoapp;
import java.util.Dictionary;
import org.osgi.framework.BundleContext;
import com.mycom.sendtoapp.services.CustomOpenService;
import com.teamcenter.rac.kernel.AbstractRACPlugin;
import com.teamcenter.rac.services.IAspectService;
import com.teamcenter.rac.services.IAspectUIService;
import com.teamcenter.rac.services.IOpenService;
import com.teamcenter.rac.services.IServiceConstants;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractRACPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "com.mycom.sendtoapp";
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.
BundleContext)
*/
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.
BundleContext)
*/
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
@Override
public IAspectService getLogicService() {
// TODO Auto-generated method stub
return null;
}
@Override
public IAspectUIService getUIService() {
// TODO Auto-generated method stub
return null;
}
protected void setupServices(BundleContext context) {
// TODO Auto-generated method stub
Dictionary<String, String> properties = new java.util.Hashtable<String,
String>();
// Register the open service
properties.put( IServiceConstants.PERSPECTIVE,
"com.mycom.sendtoapp.perspectives.CustomPerspective" );
CustomOpenService customOpenService = new CustomOpenService();
context.registerService( IOpenService.class.getName(),
customOpenService, properties );
}
}

d. Replace the code in the CustomPerspective.java file with the following:

3-74 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

package com.mycom.sendtoapp.perspectives;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
public class CustomPerspective implements IPerspectiveFactory {
/** The perspective ID */
public static final String ID =
"com.mycom.sendtoapp.perspectives.CustomPerspective";
@Override
public void createInitialLayout(IPageLayout layout) {
// TODO Auto-generated method stub
layout.setEditorAreaVisible(false);
String editorArea = layout.getEditorArea();
IFolderLayout top = layout.createFolder("top", IPageLayout.TOP, -2f,
editorArea);
top.addView( "com.mycom.sendtoapp.views.CustomView" );
}
}

e. Replace the code in the CustomOpenService.java file with the following:


package com.mycom.sendtoapp.services;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.services.IOpenService;
public class CustomOpenService implements IOpenService {
@Override
public boolean close() throws Exception {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean open(final InterfaceAIFComponent cmp) {
Display.getDefault().asyncExec( new Runnable() {
public void run() {
IWorkbenchWindow window = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow();
MessageDialog
.openInformation(window.getShell(),
"CustomOpenService",
"You sent this component to the SendTo Application: "
+ cmp.toString());
}
});
return false;
}
@Override
public boolean open(InterfaceAIFComponent[] cmps) {
// TODO Auto-generated method stub
return false;
}
}

f. Replace the code in the CustomView.java file with the following:


package com.mycom.sendtoapp.views;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.part.ViewPart;
public class CustomView extends ViewPart {
public CustomView() {
super();
}
@Override
public void createPartControl(Composite parent) {
// TODO Auto-generated method stub
parent.setLayout( new FillLayout() );
Text t = new Text( parent, SWT.BORDER );
t.setBackground( parent.getDisplay().getSystemColor( SWT.COLOR_WHITE ));
t.setForeground( parent.getDisplay().getSystemColor( SWT.COLOR_BLUE ));
Font initialFont = t.getFont();
FontData[] fontData = initialFont.getFontData();
for (int i = 0; i < fontData.length; i++) {
fontData[i].setHeight(18);
}
Font newFont = new Font(parent.getDisplay(), fontData);
t.setFont( newFont );
t.setText( " Welcome to the SendTo Application !! ");
}
@Override

PLM00075 H Client Customization Programmer’s Guide 3-75


Chapter 3 Rich client customization

public void setFocus() {


// TODO Auto-generated method stub
}
}

g. To create an empty plugin.xml file, click the project’s Extensions tab and
click the Add button in the Extensions view, and click the Cancel button in
the New Extension dialog box.
A plugin.xml file is added to the project.

h. Click the project’s plugin.xml tab and replace the code in the plugin.xml
file with the following:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.6"?>
<plugin>
<extension point="com.teamcenter.rac.aifrcp.application">
<aif_app_item
displayMode="Primary"
groupName="Mycompany"
icon="icons/defaultapplication_32.png"
id="com.mycom.sendtoapp"
name="SendTo Application"
ordinality="200"
perspective_id="com.mycom.sendtoapp.perspectives.CustomPerspective"
session="com.teamcenter.rac.kernel.TCSession"
tooltip="Send To Application"/>
</extension>
<extension point="org.eclipse.ui.perspectives">
<perspective
class="com.mycom.sendtoapp.perspectives.CustomPerspective"
icon="icons/defaultapplication_16.png"
id="com.mycom.sendtoapp.perspectives.CustomPerspective"
name="SendTo Application"/>
</extension>
<extension point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension targetID="*">
<perspectiveShortcut
id="com.mycom.sendtoapp.perspectives.CustomPerspective" />
</perspectiveExtension>
</extension>
<extension point="org.eclipse.ui.views">
<view
allowMultiple="false"
class="com.mycom.sendtoapp.views.CustomView"
icon="icons/pview.gif"
id="com.mycom.sendtoapp.views.CustomView"
name="Custom View"/>
</extension>
<extension point="org.eclipse.ui.commands">
<command
name="SendTo Application"
id="com.mycom.sendtoapp.sendto">
</command>
</extension>
<extension point="org.eclipse.ui.commandImages">
<command
icon="icons/defaultapplication_16.png"
id="com.mycom.sendtoapp.sendto">
</command>
</extension>
<extension point="org.eclipse.ui.handlers">
<handler
commandId="com.mycom.sendtoapp.sendto"
class="com.teamcenter.rac.common.handlers.SendToHandler:
com.mycom.sendtoapp.perspectives.CustomPerspective">
<enabledWhen>
<iterate ifEmpty="false">
<reference definitionId="com.mycom.sendtoapp.sendToActive"/>
</iterate>
</enabledWhen>
</handler>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:com.teamcenter.rac.sendto?after=additions">
<command
commandId="com.mycom.sendtoapp.sendto">
<visibleWhen>
<iterate ifEmpty="false">
<reference
definitionId="com.mycom.sendtoapp.sendToActive"/>
</iterate>
</visibleWhen>
</command>
</menuContribution>

3-76 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

</extension>
<extension point="org.eclipse.core.expressions.definitions">
<definition id="com.mycom.sendtoapp.sendToActive">
<and>
<adapt type="com.teamcenter.rac.kernel.TCComponent">
<not>
<adapt type="com.teamcenter.rac.kernel.TCComponent">
<test
property=
"com.teamcenter.rac.kernel.TCComponent.typeClass"
value="AllocationLine">
</test>
</adapt>
</not>
</adapt>
</and>
</definition>
<definition id="com.mycom.sendtoapp.inMainView">
<or>
<with variable="activePartId">
<equals value="com.mycom.sendtoapp.views.CustomView" />
</with>
<with variable="arc_property.ACTIVE_APPLICATION">
<equals value="com.mycom.sendtoapp" />
</with>
</or>
</definition>
</extension>
</plugin>

4. Choose File→Save All.

5. Verify the customization.


a. Choose Run→Run Configurations to start the rich client from your Eclipse
environment. Clear the workspace by selecting the Clear check box in the
launch configuration dialog box.
For information about how to set up Eclipse to run the rich client, see Enable
rich client customization.

b. Verify that the new SendTo Application button is shown in the left-hand
navigation pane in the rich client. Click the SendTo Application button.

PLM00075 H Client Customization Programmer’s Guide 3-77


Chapter 3 Rich client customization

New SendTo application in the navigation pane


Verify that when you right-click an object, the new application is displayed
on the Send To menu.

3-78 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

New SendTo application added to the Send To menu


In addition to creating an application, this solution shows how to register
a service and use the SendToHandler handler. The service is registered
in the Activator.setupServices() method. The SendToHandler handler
takes the perspective ID to open as an argument.
com.teamcenter.rac.common.handlers.SendToHandler:
com.mycom.sendtoapp.perspectives.CustomPerspective

The SendToHandler handler shows the specified perspective, gets the


registered OpenService service, then calls the OpenService.open()
method. In this implementation, the CustomOpenService service displays
a message indicating the object that was sent to the SendTo Application
application.
Each application determines if it wants to contribute to the Send To menu,
when it is active (that is when objects can be sent to it), and what to do
when an object is sent to it.

6. Package the project.

PLM00075 H Client Customization Programmer’s Guide 3-79


Chapter 3 Rich client customization

If you want to package the project for distribution, export it to a JAR file and
place it in the TC_ROOT\portal directory.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.
Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

Override Teamcenter commands


The existing Teamcenter commands can be overridden by custom commands.
For a list of commands, see Common Teamcenter command IDs.
For example, the command used for the File→New→Item menu can be overridden.
In the following example, when a folder is selected and the user chooses
File→New→Item, a message dialog box is displayed.
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Click Next.

c. In the New Plug-in Project wizard Plug-in Project dialog box, type
com.mycom.myitem in the Project name box. Click Next.

d. In the New Plug-in Project wizard Content dialog box, do the following:

3-80 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

A. Under Options, ensure the This plug-in will make contributions to the
UI check box is selected.

B. Click the No button next to Would you like to create a rich client
application?.

C. Click Next.

e. Ensure the Create a plug-in using one of these templates check box is
selected and select Hello, World Command in the list. Click Finish.

2. Update the project tabs.


a. Click the Overview tab and select the This plug-in is a singleton check box.

b. Click the Dependencies tab, click the Add button, and select the following
plug-ins:
com.teamcenter.rac.aifrcp
com.teamcenter.rac.common
com.teamcenter.rac.kernel
com.teamcenter.rac.util

c. Click the Runtime tab, click the Add button, and select the following:
com.mycom.myitem
com.mycom.myitem.handlers

3. Create the project files.


a. Under the com.mycom.myitem.handlers package, select the
SampleHandler.java file, choose File→Rename, and change the name to
MyItemHandler.java.

b. Replace the code in the MyItemHandler.java file with the following:


package com.mycom.myitem.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.jface.dialogs.MessageDialog;
import com.teamcenter.rac.util.Registry;
/**
* MyItemHandler extends AbstractHandler, an IHandler base class.
* @see org.eclipse.core.commands.IHandler
* @see org.eclipse.core.commands.AbstractHandler
*/
public class MyItemHandler extends AbstractHandler {
/**
* The constructor.
*/
private Registry reg ;
public MyItemHandler() {
}
/**
* the command has been executed, so extract extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
reg = Registry.getRegistry(this);
MessageDialog.openInformation(
window.getShell(),
reg.getString("MessageDialogBox.TITLE"),
reg.getString("MessageDialogBox.MESSAGE"));
return null;
}

PLM00075 H Client Customization Programmer’s Guide 3-81


Chapter 3 Rich client customization

c. Right-click the com.mycom.myitem.handlers package, choose New→File,


and create a handlers.properties file with the following content:
MessageDialogBox.TITLE=My Item
MessageDialogBox.MESSAGE=Hello,NewItem

d. Click the plugin.xml tab and replace the code in the plugin.xml file with
the following:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.commands">
<category
name="Sample Category"
id="com.mycom.myitem.commands.category">
</category>
<command
name="Sample Command"
categoryId="com.mycom.myitem.commands.category"
id="com.mycom.myitem.commands.sampleCommand">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
commandId="com.mycom.myitem.commands.sampleCommand"
class="com.mycom.myitem.handlers.MyItemHandler">
</handler>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
commandId="com.teamcenter.rac.newItem"
class="com.mycom.myitem.handlers.MyItemHandler">
<activeWhen>
<iterate
ifEmpty="false">
<and>
<adapt
type="com.teamcenter.rac.kernel.TCComponent">
<test
property="com.teamcenter.rac.kernel.TCComponent.typeClass"
value="Folder">
</test>
</adapt>
</and>
</iterate>
</activeWhen>
</handler>
</extension>
<extension
point="org.eclipse.ui.bindings">
<key
commandId="com.mycom.myitem.commands.sampleCommand"
contextId="org.eclipse.ui.contexts.window"
sequence="M1+6"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
</key>
</extension>
</plugin>

e. Choose File→Save All.

4. Package the project.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

3-82 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.
Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

5. Verify the customization.


a. In the rich client, select any folder and choose File→New→Item.
The message dialog box appears.

Message box resulting from the command override

b. Ensure that no folder is selected (for example, click the Details tab) and
choose File→New→Item.
The new item dialog box appears normally.

Localize your customizations


You can localize (present in different languages) the rich client by either modifying
the plugin.xml file or the application_locale.properties file. Modifying the
properties file was used prior to Teamcenter 2007 and is still supported. However,

PLM00075 H Client Customization Programmer’s Guide 3-83


Chapter 3 Rich client customization

if you are creating a localization of a new custom project, modify the Eclipse
plug-in.xml file.
For more information about localization, see the Localization Guide.
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Then click Next.

c. In the New Plug-in Project dialog box Plug-in Project pane, type
com.mycom.l10n in the Project name box. Click Next.

d. In the New Plug-in Project dialog box Content pane, do the following:
A. Under Options, ensure the This plug-in will make contributions to the
UI check box is selected.

B. Click the No button next to Would you like to create a rich client
application?.

C. Click Next.

e. Ensure the Create a plug-in using one of these templates check box is
selected and select Hello, World Command in the list. Click Finish.

2. Create the project files.


a. Add the following line to the end of the MANIFEST.MF file:
Bundle-Localization: plugin

The MANIFEST.MF file should appear as follows:


Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: L10n
Bundle-SymbolicName: com.mycom.l10n; singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.mycom.l10n.Activator
Bundle-Vendor: MYCOM
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin

b. Create a plugin.properties file in the com.mycom.l10n project by


selecting the project and choosing File→New→File.
The empty plugin.properties file appears directly under the
com.mycom.l10n project at the same level as the plugin.xml file.

c. Add the following name/value pairs to the plugin.properties file:


myMenuitem.label=My Hello world
myTooltip.tip=My Say hello world
myCommand.name=My Command

d. Edit the plugin.xml file replacing hard coded values with %keyname for the
name/value pairs you typed in the plugin.properties file. For example:
label="%myMenuitem.label"

3-84 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

The plugin.xml file should appear as follows:


<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.6"?>
<plugin>
<extension point="org.eclipse.ui.commands">
<category
name="Sample Category"
id="com.mycom.l10n.commands.category">
</category>
<command
name="%myCommand.name"
categoryId="com.mycom.l10n.commands.category"
id="com.mycom.l10n.commands.sampleCommand">
</command>
</extension>
<extension point="org.eclipse.ui.handlers">
<handler
commandId="com.mycom.l10n.commands.sampleCommand"
class="com.mycom.l10n.handlers.SampleHandler">
</handler>
</extension>
<extension point="org.eclipse.ui.bindings">
<key
commandId="com.mycom.l10n.commands.sampleCommand"
contextId="org.eclipse.ui.contexts.window"
sequence="M1+6"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
</key>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<menu
label="%myMenuitem.label"
mnemonic="M"
id="com.mycom.l10n.menus.sampleMenu">
<command
commandId="com.mycom.l10n.commands.sampleCommand"
mnemonic="S"
icon="icons/sample.gif"
id="com.mycom.l10n.menus.sampleCommand">
</command>
</menu>
</menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
<toolbar
id="com.mycom.l10n.toolbars.sampleToolbar">
<command
commandId="com.mycom.l10n.commands.sampleCommand"
icon="icons/sample.gif"
tooltip="%myTooltip.tip"
id="com.mycom.l10n.toolbars.sampleCommand">
</command>
</toolbar>
</menuContribution>
</extension>
</plugin>

e. Add a Spanish localization by creating a plugin_es.properties file at the


same level as the plugin.properties file. The keys are identical in the
plugin_es.properties file but have Spanish values.
myMenuitem.label=Mi Hola mundo
myTooltip.tip=Mi para Decir hola mundo
myCommand.name=Mi Orden

3. Verify the customization thus far.


a. Create a new configuration for the Spanish locale by choosing Run→Run
Configurations (or Run→Debug Configurations) and specifying -nl es
instead of -nl ${target.nl} on the Arguments tab. For example:
-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl es

For information about how to set up Eclipse to run the rich client, see Enable
rich client customization.

b. To verify the configuration so far, choose Run→Run Configurations to start


the rich client from your Eclipse environment. Clear the workspace by
selecting the Clear check box in the launch configuration dialog box.

PLM00075 H Client Customization Programmer’s Guide 3-85


Chapter 3 Rich client customization

c. Choose Mi Hola Mundo→Mi Orden to run the custom command.

Choosing the custom menu command in the Spanish user interface


However, the message displayed by the custom command is not localized
(translated).

3-86 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Untranslated custom message box


The message should also be localized.

4. Localize the message.


a. In Eclipse, choose Source→Externalize Strings.
This creates the Messages.java and messages.properties files in the
com.mycom.l10n.handlers package.

b. Create a messages_es.properties file at the same level as the


messages.properties file, and add the following content to the new file:
SampleHandler_0=L10n
SampleHandler_1=Hola, mundo de Eclipse

5. Verify the customization.


a. Choose Run→Run Configurations and choose the Spanish locale to start the
rich client from your Eclipse environment. Clear the workspace by selecting
the Clear check box in the launch configuration dialog box.

b. Choose Mi Hola Mundo→Mi Orden to run the custom command.


The localized message is displayed.

PLM00075 H Client Customization Programmer’s Guide 3-87


Chapter 3 Rich client customization

Translated custom message box


For more information about localizing Eclipse plug-ins, see the Eclipse
documentation. Also, you can unzip any of the Teamcenter plug-ins to
see how the rich client uses localization. The plugin.properties and
plugin.xml files in the aifrcp plug-in are good examples.

6. Package the project.


If you want to package the project for distribution, export it to a JAR file and
place it in the TC_ROOT\portal directory.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.

3-88 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

Customize the rich client properties files


You can customize the appearance of applications in the rich client by creating
user properties files that override the default properties files. The default
properties files, with a .properties extension, are located in the various
com.teamcenter.rac.component.jar files in the TC_ROOT\portal\plugins
directory. You override the default file by creating a _user.properties file and
wrapping it in an Eclipse plug-in. For example, if you want to override a property in
Manufacturing Process Planner, you must override the mpp.properties file located
in the com.teamcenter.rac.cme.legacy.jar file with the mpp_user.properties
file.
1. Create the Java project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Then click Next.

c. In the Project name box, type the project name, which should be in the form
of com.mycom.project-name. For example, type com.mycom.propertiesfile.
Click Next.

d. Under Options, ensure the Generate an activator and This plug-in will make
contributions to the UI check boxes are selected. Click Next.

e. Clear the Create a plug-in using one of these templates check box. Click
Finish.

2. Modify the properties file.


a. Open WinZip, navigate to the TC_ROOT\portal\plugins directory, and
open the JAR file that contains the properties file you want to override. The
file name has the form property.properties. For example, to override the
mpp.properties file, open the com.teamcenter.rac.cme.legacy.jar file.

PLM00075 H Client Customization Programmer’s Guide 3-89


Chapter 3 Rich client customization

b. Extract the properties file you want to override from the JAR file. For
example, extract the mpp.properties file.

c. In a text editor, open the properties file to determine the syntax of the
property you want to modify.

d. Create a new property_user.properties in a text editor. For example, if you


open the mpp.properties file, create the mpp_user.properties file.

e. Type the entries you want to use to override the defaults.

f. Save and exit the file.

3. Update the project tabs.


a. In Eclipse, click your project tab and click its Dependencies tab.

b. Under Required Plug-ins, click the Add button.

c. Select the following plug-ins from the list by holding down the Ctrl key while
you click them:
• com.teamcenter.rac.aifrcp

• com.teamcenter.rac.common

• com.teamcenter.rac.external

• com.teamcenter.rac.kernel

• com.teamcenter.rac.neva

• com.teamcenter.rac.tcapps

• com.teamcenter.rac.util

d. Click OK.

e. Click your project’s Runtime tab.

f. Under Exported Packages, click the Add button.

g. Select your project and click OK.

h. Click your project’s Extensions tab.

i. Click the Add button.

j. Select the com.teamcenter.rac.util.tc_properties extension point.

k. Click Finish.

l. Click the plugin.xml tab. Type text in the file so it looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.6"?>
<plugin>
<extension
point="com.teamcenter.rac.util.tc_properties">

3-90 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

</extension>
</plugin>

If the text is different, edit it in the tab to resemble the example.

m. Save the project by choosing File→Save All.

4. Create a package.
a. In the Package Explorer view, right-click your project and choose
New→Package.

b. In the Name box, type the path name where the properties file was originally.
For example, if you originally extracted the mpp.properties file, the
package name should be com.teamcenter.rac.cme.mpp.

c. Click Finish.

d. From Windows Explorer, drag your modified property_user.properties file


and drop it on the package you created in Package Explorer.

e. In Package Explorer, select plugin.xml.

f. Click the MANIFEST.MF tab and type your new package at the
end of the Export-Package line. For example, if your project
name is com.mycom.propertiesfile and the new package is called
com.teamcenter.rac.cme.mpp, the line should read:
Export-Package: com.mycom.propertiesfile, com.teamcenter.rac.cme.mpp

The MANIFEST.MF file should look like the following:


Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Propertiesfile
Bundle-SymbolicName: com.mycom.propertiesfile;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.mycom.propertiesfile.Activator
Bundle-Vendor: MYCOM
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
com.teamcenter.rac.aifrcp;bundle-version="8000.2.0",
com.teamcenter.rac.common;bundle-version="8000.2.0",
com.teamcenter.rac.external;bundle-version="8000.2.0",
com.teamcenter.rac.kernel;bundle-version="8000.2.0",
com.teamcenter.rac.neva;bundle-version="1.0.0",
com.teamcenter.rac.tcapps;bundle-version="8000.2.0",
com.teamcenter.rac.util;bundle-version="8000.2.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: com.mycom.propertiesfile, com.teamcenter.rac.cme.mpp

g. Click your project’s Runtime tab. If one or more of the items listed in the
Export-Package line in the previous step are missing, add the missing ones
by clicking the Add button, selecting the missing packages, and clicking OK.

5. Save and export your changes.


To save and export your changes, follow the steps in the Export your custom
plug-in to the rich client topic.

6. Debug in Eclipse.
a. In Eclipse, choose Run→Debug Configurations.

PLM00075 H Client Customization Programmer’s Guide 3-91


Chapter 3 Rich client customization

b. In the Debug dialog box, under Java Application on the left-hand side, select
the configuration you want to debug.

c. At the bottom of the dialog box, click the Debug button.


This launches the application in debug mode. To change the perspective to
the debug perspective, choose Window→Open Perspective→Debug.

You can then debug your application.

7. Run the genregxml script.


If you make changes to any of the .properties files, or you add new plug-ins or
change plug-in content, you must run the genregxml script to ensure your
changes are included when the rich client starts. This enhances performance
because it caches the properties so they can be loaded when the rich client starts.
The script takes no arguments and generates a RegistryLoader file for each
locale in the portal\Registry directory. The RegistryLoader file is added
during rich client startup.

a. Delete the old registry loader file:


TC_ROOT\portal\registry\RegistryLoader.xml.gz

b. Run the following script:


TC_ROOT\portal\registry\genregxml
When the script is finished, a new RegistryLoader.xml.gz file is created.

8. Verify the customization.

Infrequent rich client customizations


Some rich client customizations are performed rarely, but fill a specific need.
Samples show how to perform these less-frequently used customizations.

Add a table viewer


You can create a table in its own dialog window and add a menu command to launch
it.
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Then click Next.

c. In the New Plug-in Project dialog box Plug-in Project pane, type
com.mycom.tableviewer in the Project name box. Click Next.

d. In the New Plug-in Project dialog box Content pane, do the following:
A. Under Options, ensure the This plug-in will make contributions to the
UI check box is selected.

B. Click the No button next to Would you like to create a rich client
application?.

3-92 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

C. Click Next.

e. Ensure the Create a plug-in using one of these templates check box is
selected and select Hello, World Command in the list. Click Finish.

2. Update the project tabs.


a. Click the Dependencies tab, click the Add button, and select the following:
com.teamcenter.rac.aifrcp
com.teamcenter.rac.common
com.teamcenter.rac.kernel
com.teamcenter.rac.util

b. Click the Runtime tab, click the Add button, and select the following:
com.mycom.tableviewer
com.mycom.tableviewer.handlers

3. Create the project files.


a. Edit the com.mycom.tableviewer plug-in’s plugin.xml file. Replace the
entire contents of the plugin.xml file with the following code:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.commands">
<category
name="Sample Category"
id="com.mycom.tableviewer.commands.category">
</category>
<command
name="Sample Command"
categoryId="com.mycom.tableviewer.commands.category"
id="com.mycom.tableviewer.commands.sampleCommand">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
commandId="com.mycom.tableviewer.commands.sampleCommand"
class="com.mycom.tableviewer.handlers.TableViewerHandler">
</handler>
</extension>
<extension
point="org.eclipse.ui.bindings">
<key
commandId="com.mycom.tableviewer.commands.sampleCommand"
contextId="org.eclipse.ui.contexts.window"
sequence="M1+6"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
</key>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<menu
label="Viewer"
mnemonic="V"
id="com.mycom.tableviewer.menus.sampleMenu">
<command
commandId="com.mycom.tableviewer.commands.sampleCommand"
id="com.mycom.tableviewer.menus.sampleCommand"
label="TableViewer"
mnemonic="T">
<visibleWhen>
<reference
definitionId="com.teamcenter.rac.ui.inMainPerspective">
</reference>
</visibleWhen>
</command>
</menu>
</menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
<toolbar
id="com.mycom.tableviewer.toolbars.sampleToolbar">

PLM00075 H Client Customization Programmer’s Guide 3-93


Chapter 3 Rich client customization

<command
commandId="com.mycom.tableviewer.commands.sampleCommand"
icon="icons/sample.gif"
id="com.mycom.tableviewer.toolbars.sampleCommand"
label="TableViewer"
tooltip="Explore Tableviewer">
</command>
</toolbar>
</menuContribution>
</extension>
</plugin>

b. Open the com.mycom.tableviewer.handlers package, select the


SampleHandler.java file, choose File→Rename, and rename the file to
TableViewerHandler.java.
Replace the contents of the TableViewerHandler.java file with the following:
package com.mycom.tableviewer.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
/**
* Our TableViewerHandler extends AbstractHandler
* @see org.eclipse.core.commands.AbstractHandler
*/
public class TableViewerHandler extends AbstractHandler {
/**
* The constructor.
*/
public TableViewerHandler() {
}
/**
* the command has been executed, so extract extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
return new TableViewerExample();
}
}

c. Right-click the com.mycom.tableviewer.handlers package, choose


New→Class, and add the following Java files:
Row.java
TableContentProvider.java
TableLabelProvider.java
TableViewerExample.java

d. Replace the contents of the Row.java file with the following:


package com.mycom.tableviewer.handlers;
public class Row {
private String key;
private String value;
public Row(String key, String value) {
setKey(key);
setValue(value);
}
public void setKey(String key) {
this.key = key;
}
public String getKey() {
return key;
}
public void setValue(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}

e. Replace the contents of the TableContentProvider.java file with the


following:
package com.mycom.tableviewer.handlers;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.viewers.IStructuredContentProvider;

3-94 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

import org.eclipse.jface.viewers.Viewer;
public class TableContentProvider implements IStructuredContentProvider {
public Object[] getElements(Object parent) {
List results = new ArrayList();
if (parent instanceof ArrayList) {
results = (ArrayList) parent;
}
return results.toArray();
}
public void dispose() {
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
}

f. Replace the contents of the TableLabelProvider.java file with the


following:
package com.mycom.tableviewer.handlers;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
public class TableLabelProvider extends LabelProvider implements
ITableLabelProvider {
public Image getColumnImage(Object element, int columnIndex) {
return null;
}
public String getColumnText(Object element, int columnIndex) {
Row row = (Row) element;
switch (columnIndex) {
case 0:
return row.getKey();
case 1:
return row.getValue();
}
return null;
}
}

g. Replace the contents of the TableViewerExample.java file with the


following:
package com.mycom.tableviewer.handlers;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.util.Registry;
/**
* This is an example program showing how to use a TableViewer
*/
public class TableViewerExample {
private Table table;
private TableViewer tableViewer;
/** class registry */
private final static Registry reg =
Registry.getRegistry( TableViewerExample.class );
private final static String[] COLUMN_HEADINGS =
{ reg.getString( "Object"),reg.getString( "Type" )};
public TableViewerExample() {
createTableViewerExample();
}
private void createTableViewerExample() {
Shell shell = new Shell(SWT.SHELL_TRIM);
shell.setImage( Registry.getRegistry(

PLM00075 H Client Customization Programmer’s Guide 3-95


Chapter 3 Rich client customization

AbstractAIFDialog.class ).getImage(
"aifDesktop.ICON" ) );
shell.setText(reg.getString("details"));
shell.setLayout(new FillLayout());
createContents(shell);
shell.setSize(400, 400);
shell.open();
while (!shell.isDisposed()) {
if (!Display.getDefault().readAndDispatch())
Display.getDefault().sleep();
}
}
protected Control createContents(Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, false);
layout.verticalSpacing = 10;
composite.setLayout(layout);
GridData data = new GridData(GridData.FILL_BOTH);
data.grabExcessHorizontalSpace = true;
composite.setLayoutData(data);
table = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI
| SWT.FULL_SELECTION);
table.setLinesVisible(true);
table.setHeaderVisible(true);
data = new GridData(SWT.FILL, SWT.FILL, true, false);
data.heightHint = 300;
table.setLayoutData(data);
TableLayout tableLayout = new TableLayout();
table.setLayout(tableLayout);
tableLayout.addColumnData(new ColumnWeightData(10, 50, true));
TableColumn column = new TableColumn(table, SWT.NONE);
column.setText(COLUMN_HEADINGS[0]);
column.setAlignment(SWT.LEFT);
tableLayout.addColumnData(new ColumnWeightData(15, 200, true));
column = new TableColumn(table, SWT.NONE);
column.setText(COLUMN_HEADINGS[1]);
column.setAlignment(SWT.LEFT);
tableViewer = new TableViewer(table);
tableViewer.setColumnProperties(COLUMN_HEADINGS);
tableViewer.setContentProvider(new TableContentProvider());
tableViewer.setLabelProvider(new TableLabelProvider());
CellEditor[] editors = new CellEditor[2];
editors[0] = new TextCellEditor(table);
editors[1] = new TextCellEditor(table);
tableViewer.setCellEditors(editors);
tableViewer.setCellModifier(new TableCellModifier());
Composite buttonComposite = new Composite(composite, SWT.NONE);
FillLayout fillLayout = new FillLayout(SWT.HORIZONTAL);
fillLayout.spacing = 10;
buttonComposite.setLayout(fillLayout);
Button addButton = new Button(buttonComposite, SWT.PUSH);
addButton.setText(reg.getString("Add"));
addButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Row row = new Row("", "");
tableViewer.add(row);
table.setTopIndex(table.getItemCount());
table.select(table.getItemCount() - 1);
tableViewer.editElement(row, 0);
}
});
Button deleteButton = new Button(buttonComposite, SWT.PUSH);
deleteButton.setText(reg.getString("Delete"));
deleteButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ISelection selection = tableViewer.getSelection();
if (selection instanceof IStructuredSelection) {
Iterator iterator = ((IStructuredSelection) selection)
.iterator();
while (iterator.hasNext()) {
Object obj = iterator.next();
tableViewer.remove(obj);
}
}
}
});
Button closeButton = new Button(buttonComposite, SWT.PUSH);
closeButton.setText(reg.getString("Close"));
closeButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
composite.getParent().dispose();
}
});
return composite;
}
class TableCellModifier implements ICellModifier {
public boolean canModify(Object element, String property) {
return true;
}
public Object getValue(Object element, String property) {

3-96 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Object result = null;


Row row = (Row) element;
List<String> list = Arrays.asList(COLUMN_HEADINGS);
int columnIndex = list.indexOf(property);
switch (columnIndex) {
case 0:
result = row.getKey();
break;
case 1:
result = row.getValue();
break;
}
return result;
}
public void modify(Object element, String property, Object value) {
List<String> list = Arrays.asList(COLUMN_HEADINGS);
int columnIndex = list.indexOf(property);
TableItem tableItem = (TableItem) element;
Row row = (Row) tableItem.getData();
switch (columnIndex) {
case 0:
String key = (String) value;
if (key.length() > 0) {
row.setKey(key);
}
break;
case 1:
String v = (String) value;
if (v.length() > 0) {
row.setValue(v);
}
break;
}
tableViewer.update(row, null);
}
}
}

h. Right-click the com.mycom.tableviewer.handlers package, choose


New→File, and add a handlers.properties file.

i. Replace the contents of the handlers.properties file with the following:


Object=Object
Type=Type
details=Details
Add=Add
Delete=Delete
Close=Close

j. Choose File→Save All.

4. Package the project.


To package the project for distribution, export it to a JAR file and place it in the
TC_ROOT\portal directory.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.

PLM00075 H Client Customization Programmer’s Guide 3-97


Chapter 3 Rich client customization

Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

5. Verify the customization.


a. Launch My Teamcenter and choose Viewer→TableViewer on the menu bar,
or click the Explore TableViewer button on the toolbar.

TableViewer menu command

TableViewer button

b. In the Details dialog box, click the Add button to add a line to the table, or
click the Delete button to remove a line.

3-98 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

TableViewer dialog box

Add a tree viewer


You can create a tree in its own dialog window and add a menu command to launch
it. This example displays a file explorer tree that reads the contents of the hard disk.
By default, this example reads the C:\ drive on Windows systems. To read the /user
drive on UNIX systems, change code in the Explorer.java file.
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Then click Next.

c. In the New Plug-in Project dialog box Plug-in Project pane, type
com.mycom.treeviewer in the Project name box. Click Next.

d. In the New Plug-in Project dialog box Content pane, do the following:
A. Under Options, ensure the This plug-in will make contributions to the
UI check box is selected.

B. Click the No button next to Would you like to create a rich client
application?.

C. Click Next.

PLM00075 H Client Customization Programmer’s Guide 3-99


Chapter 3 Rich client customization

e. Ensure the Create a plug-in using one of these templates check box is
selected and select Hello, World Command in the list. Click Finish.

2. Update the project tabs.


a. Click the Dependencies tab, click the Add button, and select the following:
com.teamcenter.rac.aifrcp
com.teamcenter.rac.common
com.teamcenter.rac.kernel
com.teamcenter.rac.util

b. Click the Runtime tab, click the Add button, and select the following:
com.mycom.treeviewer
com.mycom.treeviewer.handlers

3. Create the project files.


a. Edit the com.mycom.treeviewer plug-in’s plugin.xml file. Replace the
entire contents of the plugin.xml file with the following code:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.commands">
<category
name="Sample Category"
id="com.mycom.treeviewer.commands.category">
</category>
<command
name="Sample Command"
categoryId="com.mycom.treeviewer.commands.category"
id="com.mycom.treeviewer.commands.sampleCommand">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
commandId="com.mycom.treeviewer.commands.sampleCommand"
class="com.mycom.treeviewer.handlers.TreeViewerHandler">
</handler>
</extension>
<extension
point="org.eclipse.ui.bindings">
<key
commandId="com.mycom.treeviewer.commands.sampleCommand"
contextId="org.eclipse.ui.contexts.window"
sequence="M1+6"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
</key>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<menu
label="Viewer"
mnemonic="V"
id="com.mycom.treeviewer.menus.sampleMenu">
<command
commandId="com.mycom.treeviewer.commands.sampleCommand"
id="com.mycom.treeviewer.menus.sampleCommand"
label="TreeViewer"
mnemonic="T"
tooltip="Explore Treeviewer">
<visibleWhen>
<reference
definitionId="com.teamcenter.rac.ui.inMainPerspective">
</reference>
</visibleWhen>
</command>
</menu>
</menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
<toolbar
id="com.mycom.treeviewer.toolbars.sampleToolbar">
<command
commandId="com.mycom.treeviewer.commands.sampleCommand"
icon="icons/sample.gif"

3-100 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

id="com.mycom.treeviewer.toolbars.sampleCommand"
label="TreeViewer"
tooltip="Explore Treeviewer">
</command>
</toolbar>
</menuContribution>
</extension>
</plugin>

b. Open the com.mycom.treeviewer.handlers package, select the


SampleHandler.java file, choose File→Rename, and rename the file to
TreeViewerHandler.java.
Replace the contents of the TreeViewerHandler.java file with the following:
package com.mycom.treeviewer.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
/**
* TreeViewerHandler extends AbstractHandler, an IHandler base class.
* @see org.eclipse.core.commands.IHandler
* @see org.eclipse.core.commands.AbstractHandler
*/
public class TreeViewerHandler extends AbstractHandler {
/**
* The constructor.
*/
public TreeViewerHandler() {
}
/**
* the command has been executed, so extract extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
Explorer explorer = new Explorer();
explorer.setBlockOnOpen(true);
explorer.open();
return null;
}
}

c. Right-click the com.mycom.treeviewer.handlers package, choose


New→Class, and add the following Java files:
Explorer.java
FileTreeExplorerContentProvider.java
FileTreeExplorerLabelProvider.java

d. Replace the contents of the Explorer.java file with the following:


package com.mycom.treeviewer.handlers;
import java.io.File;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.widgets.*;
import org.eclipse.jface.window.ApplicationWindow;
public class Explorer extends ApplicationWindow {
public Explorer() {
super(null);
}
protected Control createContents(Composite parent) {
TreeViewer tv = new TreeViewer(parent);
tv.setContentProvider(new FileTreeExplorerContentProvider());
tv.setLabelProvider(new FileTreeExplorerLabelProvider());
// if for Linux/Unix platforms
// tv.setInput(new File("/usr/"));
tv.setInput(new File("C:\\"));
return tv.getTree();
}
}

Note
By default, this example reads the C:\ drive on Windows systems.
To read the /user drive on UNIX systems, change code in the
Explorer.java file.

PLM00075 H Client Customization Programmer’s Guide 3-101


Chapter 3 Rich client customization

e. Replace the contents of the FileTreeExplorerContentProvider.java file


with the following:
package com.mycom.treeviewer.handlers;
import java.io.File;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
public class FileTreeExplorerContentProvider implements ITreeContentProvider
{
public Object[] getChildren(Object element)
{
Object[] children = ((File) element).listFiles();
return children == null ? new Object[0] : children;
}
public Object[] getElements(Object element)
{
return getChildren(element);
}
public boolean hasChildren(Object element)
{
return getChildren(element).length > 0;
}
public Object getParent(Object element)
{
return ((File)element).getParent();
}
public void dispose()
{
//No implementation
}
public void inputChanged(Viewer viewer, Object old_input, Object new_input)
{
//No implementation
}
}

f. Replace the contents of the FileTreeExplorerLabelProvider.java file


with the following:
package com.mycom.treeviewer.handlers;
import java.io.File;
import org.eclipse.jface.viewers.LabelProvider;
public class FileTreeExplorerLabelProvider extends LabelProvider
{
public String getText(Object element)
{
return ((File) element).getName();
}
}

g. Choose File→Save All.

4. Package the project.


To package the project for distribution, export it to a JAR file and place it in the
TC_ROOT\portal directory.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.

3-102 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

5. Verify the customization.


a. Launch My Teamcenter and choose Viewer→TreeViewer on the menu bar, or
click the Explore TreeViewer button on the toolbar.

TreeViewer menu command

TreeViewer button

b. Browse the tree structure.

PLM00075 H Client Customization Programmer’s Guide 3-103


Chapter 3 Rich client customization

Tree viewer

Add a quick search item


You can add an existing query to the quick search box at the top of the navigation
pane. You can add any query from Query Builder, including queries you create
yourself. In the following example, add the Item Revision... query to the quick
search list.
For information about how to use quick search, see the Rich Client Interface Guide.
1. Add the text for the new quick search item to the locale text file.
In the TC_ROOT\lang\textserver\en_US\weblocal_locale.xml file, add
the following lines:
<key id="Item Revision..._DisplayName">Item Revision Name</key>
<key id="Item Revision..._SearchAttributeDisplayName">Item Revision Name</key>
<key id="Item Revision..._tooltip">Enter Name to search</key>

3-104 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Note
If you create your own query in Query Builder, you
must also add the query to the list of queries in the
TC_ROOT\lang\textserver\en_US\qry_text_locale.xml
file.

2. Add values to quick search preferences.


a. Open the preferences by choosing Edit→Options→Index.

b. Open the Quick_Access_Queries preference and add the name of the query
to the list (for example, add Item Revision...).

c. Open the Quick_Access_Queries_Attribute preference and add the search


attribute to use for the query (for example, Name):
Item Revision..._SearchAttribute=Name

Note
The attribute to use for the search (for example, Name) must exist on
the query. Look at the query in Query Builder to see the attributes
on the query.

3. Clear cache.
• Thin client
Shut down Web services and delete temporary tc_text.xml.mem files, for
example:
%TEMP%\V9000.0.1.20011number\number\TextSrv\en_US\tc_text.xml.mem.

Restart services.

• Rich client
To clear cache, delete the Teamcenter subdirectory in the user’s home
directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
If you delete this directory, the last state of the rich client is lost, and the
user interface appears as it does at initial startup.
Also delete the directory containing temporary server cache (*.mem)
files for the Teamcenter server. On a Windows client, it is typically the
C:\temp\PTeamcenter-version directory.
For more information, see Ensure your customizations appear.

4. Test the new quick search item by clicking the arrow to the right of the quick
search.

PLM00075 H Client Customization Programmer’s Guide 3-105


Chapter 3 Rich client customization

Adding a new search type to the quick search list

Change the display color of read-only properties


You can change the foreground and background colors of read-only properties
specified in style sheets. This affects all elements that use style sheets to set the
layout, such as the Summary view and the Properties dialog box.
Override the default values for display. The format of the properties file is the
following:
# Color for read only properties display
# Value can be a RGB value or color name.
PropertyBeanReadOnly.Background=255,255,128
PropertyBeanReadOnly.Foreground=gray

Note
Background and foreground color customizations are possible for style sheet
rendering in the Summary tab of My Teamcenter only when the selected
object is in a checked-out state. This is because of flat rendering, when text or
empty display areas do not have widgets (such as a text box in the background
for a checked-in object).

Use the Teamcenter registry, which looks for the color setting in the following file
order:
a. customer.properties

b. properties_user.properties

c. properties.properties

By changing the color settings in the properties_user.properties file, the default


settings in the application-name.properties file are overridden.
Create a custom plug-in that extends the com.teamcenter.rac.util.tc_properties
extension point and deploy it to the plugins directory.
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Then click Next.

3-106 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

c. In the Project name box, type com.mycom.readonlycolor. Click Next.

d. Under Options, ensure the Generate an activator and This plug-in will make
contributions to the UI check boxes are selected. Click Next.

e. Clear the Create a plug-in using one of these templates check box. Click
Finish.

2. Update the project tabs.


a. In Eclipse, click your project tab and click its Dependencies tab.

b. Under Required Plug-ins, click the Add button, select the


com.teamcenter.rac.util plug-in, and click OK.

c. Click your project’s Extensions tab, click the Add button, and select the
com.teamcenter.rac.util.tc_properties extension point. Click Finish.

d. Click your project’s Overview tab and select the This plug-in is a singleton
check box.

e. Save the project by choosing File→Save All.

3. Create the project files.


a. In Package Explorer, right-click the com.mycom.readonlycolor project
and choose New→Package.

b. In the Name box, type com.teamcenter.rac.common.

c. Click Finish.

d. Right-click the com.teamcenter.rac.common package and choose New→File.

e. In the Name box, type common_user.properties.

f. Click Finish.

g. Add the following to the common_user.properties file:


PropertyBeanReadOnly.Background=lightGray
PropertyBeanReadOnly.Foreground=blue

The plug-in structure looks like this:

PLM00075 H Client Customization Programmer’s Guide 3-107


Chapter 3 Rich client customization

h. Click the plugin.xml tab. The text in the tab should look like the following:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.6"?>
<plugin>
<extension
point="com.teamcenter.rac.util.tc_properties">
</extension>
</plugin>

If the text is different, edit it in the tab to resemble the example.

i. Click your project’s MANIFEST.MF tab. It should look like the following:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Readonlycolor
Bundle-SymbolicName: com.mycom.readonlycolor;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.mycom.readonlycolor.Activator
Bundle-Vendor: MYCOM
Require-Bundle: org.eclipse.core.runtime,
com.teamcenter.rac.util;bundle-version="8000.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy

4. Package the project.


To package the project for distribution, export it to a JAR file and place it in the
TC_ROOT\portal directory.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.

3-108 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

5. Verify the customization.


a. In the rich client, select an item and click More Properties in the Summary
tab.
Read-only properties are gray with blue characters.

Changed color for read-only properties

PLM00075 H Client Customization Programmer’s Guide 3-109


Chapter 3 Rich client customization

Customize the workflow template filter list


To add more ways to filter Workflow templates, you need to implement the
applyTemplateFilter extension point. The applyTemplateFilter extension point
is exposed in the com.teamcenter.rac.workflow.processdesigner plug-in.
The existing Teamcenter rich client framework allows you to create Workflow
template filters based on object type and group name only. With the
applyTemplateFilter extension point, functionality for advanced template filtering
is made available based on object class, object attributes, and the status applied to
the target object.
Before showing you the sample customization using the applyTemplateFilter
extension point, following is a review of the normal process to filter Workflow
templates:
1. In Workflow Designer, choose Edit→Template Filter.

2. In the Process Template Filter dialog box, select a group in the Group Name
box (for example dba), type in the Object Type box (for example, Item) and move
templates from the Defined Process Template list on the right to the Assigned
Process Template list on the left. Click Apply.
This assigns these Workflow templates to the dba group for Item objects so
that only these templates are available for use with that object type with the
specified group.

Assigning a workflow process template

3-110 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

3. To test the template assignment, log on to My Teamcenter as a member of the


dba group, choose an object type for which you created a filter (for example, an
item), and choose File→New→Workflow Process.

4. In the New Process Dialog dialog box, click the Assigned button.
The filtered templates you previously chose for that object type and group name
are displayed in the Process Template box list.

Viewing the assigned workflow process template


For more information about how to perform Workflow filtering, see the Workflow
Designer Guide.

Perform the following steps to create a sample customization that evaluates on


review status.
1. Create the project.
a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Click Next.

PLM00075 H Client Customization Programmer’s Guide 3-111


Chapter 3 Rich client customization

c. In the New Plug-in Project wizard Plug-in Project dialog box, type
com.mycom.workflowtemplatefilter in the Project name box. Click Next.

d. Do not change the default settings on the Content dialog box. Click Finish.

2. Update the project tabs.


a. Click the Overview tab and select the This plug-in is a singleton check box.

b. Click the Dependencies tab, click the Add button, and select the following
plug-ins:
com.teamcenter.rac.aifrcp
com.teamcenter.rac.kernel
com.teamcenter.rac.util
com.teamcenter.rac.workflow.processdesigner

c. Choose File→Save All.

d. Add the applyTemplateFilter extension point.


A. Click the Extensions tab, click Add, and
in the Extension point filter box, select
com.teamcenter.rac.workflow.processdesigner.applyTemplateFilter
and click Finish.

B. Right-click the
com.teamcenter.rac.workflow.processdesigner.applyTemplateFilter
extension point and choose New→Client.
This adds an entry to the class box.

C. Click the class box, and in the resulting Java Class


dialog box, type CustomFilter in the Name box.
Ensure that the Interfaces box is populated with the
com.teamcenter.rac.workflow.commands.newprocess.ItemplateFilter
extension.
Click Finish.
A CustomFiler.java file is added to the project.

3. Edit the project files.


a. Replace the code in the CustomFiler.java file with the following:
package com.mycom.workflowtemplatefilter;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.kernel.TCComponentTaskTemplate;
import com.teamcenter.rac.kernel.TCComponentType;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.TypeInfo;
import com.teamcenter.rac.util.ButtonLayout;
import com.teamcenter.rac.util.HorizontalLayout;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.Separator;
import com.teamcenter.rac.util.VerticalLayout;
import com.teamcenter.rac.workflow.commands.newprocess.ITemplateFilter;
import com.teamcenter.rac.workflow.commands.newprocess.

3-112 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

NoCustomFilteringRequiredException;
public class CustomFilter implements ITemplateFilter
{
TCSession session;
public Vector allTasktemplates = new Vector<TCComponentTaskTemplate>();
public Vector assignedTasktemplates = new Vector<TCComponentTaskTemplate>();
InterfaceAIFComponent[] pasteTargets = null;
boolean cancelButtonClicked = false;
public CustomFilter()
{
// TODO Auto-generated constructor stub
}
public Vector getFilteredTemplates(Vector alltemplates, Vector Assignedtemplates,
InterfaceAIFComponent[] pastetargets, TCSession s)throws
NoCustomFilteringRequiredException
{
allTasktemplates = alltemplates;
assignedTasktemplates = Assignedtemplates;
session = s;
CustomFilterDialog v = new CustomFilterDialog(true, this);
cancelButtonClicked = false;
v.showDialog();
if (cancelButtonClicked)
{
throw new NoCustomFilteringRequiredException ("Exception");
}
else
return v.templatelist;
}
// customize this dialog to add the status selection UI.
class CustomFilterDialog extends AbstractAIFDialog
{
/**
*
*/
private static final long serialVersionUID = 1L;
public Vector templatelist = new Vector<TCComponentTaskTemplate> ();
private JButton cancelButton;
private JButton applyButton;
private JComboBox statuses = null;
private JComboBox criteria = null;
CustomFilter op;
public CustomFilterDialog(boolean first, CustomFilter operation )
{
super(first);
op = operation;
initdialog();
}
public void showDialog()
{
this.setModal( true );
this.setVisible( true );
}
public void initdialog()
{
JPanel parentPanel = new JPanel (new VerticalLayout (5,2,2,2,2));
this.setTitle( "Filter Based on Status" );
this.getContentPane().add(parentPanel);
JPanel buttonPanel = new JPanel (new ButtonLayout ());
JPanel compPanel = new JPanel (new HorizontalLayout ());
applyButton = new JButton ("Apply");
applyButton.setMnemonic(’A’);
applyButton.addActionListener ( new ActionListener()
{
public void actionPerformed (ActionEvent e)
{
startApplyOperation();
}
});
cancelButton = new JButton ("Cancel");
cancelButton.setMnemonic(’C’);
cancelButton.addActionListener ( new ActionListener()
{
public void actionPerformed (ActionEvent e)
{
setVisible(false);
cancelButtonClicked = true;
dispose();
}
});
//Add the buttons to the buttonPanel
buttonPanel.add(applyButton);
buttonPanel.add(cancelButton);
//ADD button panel and the com panel to the parent panel
parentPanel.add ( "top.bind", compPanel );

PLM00075 H Client Customization Programmer’s Guide 3-113


Chapter 3 Rich client customization

parentPanel.add ( "top.bind", new Separator () );


parentPanel.add ( "bottom.bind.center.top", buttonPanel);
JPanel filterpanel = new JPanel (new HorizontalLayout ());
parentPanel.add ( "top.bind", filterpanel );
JLabel l4 = new JLabel("Select status");
statuses = new JComboBox();
filterpanel.add ( "bottom.left",l4);
filterpanel.add ( "bottom.left",statuses);
JLabel l3 = new JLabel("Criteria");
criteria = new JComboBox();
filterpanel.add ( "bottom", l3);
filterpanel.add ( "bottom.bind", criteria );
criteria.addItem("Ends With");
criteria.addItem("Starts With");
criteria.addItem("Equals");
criteria.addItem("Contains");
try
{
String typeNames[] = null;
TypeInfo typeInfo = null;
TCComponentType ct = op.session.getTypeComponent ( "TaskType");
typeInfo = ct.getTcTypes("TaskType", false);
if ( typeInfo != null )
typeNames = typeInfo.getTypeNames();
for(int i=0;i<typeNames.length;i++)
statuses.addItem(typeNames[i]);
}
catch(Exception ex)
{
MessageBox.post(ex);
//ex.printStackTrace();
}
this.pack();
//Centering the position of the Dialog
this.centerToScreen(1.0, 1.0);
}
public void startApplyOperation()
{
try
{
boolean isMatch = false;
Vector filtertemplates = new Vector<TCComponentTaskTemplate> ();
if(op.assignedTasktemplates.size() > 0)
{
filtertemplates = op.assignedTasktemplates;
}
else
{
filtertemplates = op.allTasktemplates;
}
for(int i=0;i<filtertemplates.size();i++)
{
if(criteria.getSelectedIndex() == 0)
{
isMatch = ((TCComponentTaskTemplate) filtertemplates.get(i)).
getProperty("template_name").toLowerCase().
endsWith(statuses.getSelectedItem().toString().toLowerCase());
}
else if(criteria.getSelectedIndex() == 1)
{
isMatch = ((TCComponentTaskTemplate)filtertemplates.get(i)).
getProperty("template_name").toLowerCase().
startsWith(statuses.getSelectedItem().toString().toLowerCase());
}
else if(criteria.getSelectedIndex()==2)
{
isMatch = ((TCComponentTaskTemplate)filtertemplates.get(i)).
getProperty("template_name").toLowerCase().
equalsIgnoreCase(statuses.getSelectedItem().toString().toLowerCase());
}
else
{
isMatch = ((TCComponentTaskTemplate)filtertemplates.get(i)).
getProperty("template_name").toLowerCase().
contains(statuses.getSelectedItem().toString().toLowerCase());
}
if(isMatch)
{
this.templatelist.add( filtertemplates.get(i) );
}
}
dispose();
}
catch(Exception ex)

3-114 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

{
ex.printStackTrace();
}
}
}
}

b. Choose File→Save All.

4. Package the project.


To package the project for distribution, export it to a JAR file and place it in the
TC_ROOT\portal directory.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.
Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

5. Verify the customization.


a. To test the template assignment, in My Teamcenter, choose an object
type for which you created a filter (for example, an item) and choose
File→New→Workflow Process.

b. In the New Process Dialog dialog box, click the Assigned button.
The Filter Based on Status dialog box is displayed.

PLM00075 H Client Customization Programmer’s Guide 3-115


Chapter 3 Rich client customization

Custom filtering applied to the assigned workflow process template


Note
This is a sample customization. You can create your own customization
by altering the contents of the CustomFiler.java file in the plug-in.

6. Package the project.


If you want to package the project for distribution, export it to a JAR file and
place it in the TC_ROOT\portal directory.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.

3-116 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

Add a column to view occurrence notes


By default, you cannot view occurrence notes on intermediate data capture (IDC)
objects in the Multi-Structure Manager. However, you can view the occurrence notes
if you can add a column to display them. To accomplish this, you must define the alias
for the occurrence note type in the TC_DATA\structure_alias.xml file, and then add
the column for the occurrence note type in the IDCStructureColumnsShownPref
preference.
1. Create the occurrence note on the IDC object.
a. Create a structure in Multi-Structure Manager.

b. In the data pane to the right, select an occurrence (item revision) in the
structure.

c. Right-click a column heading and add a column for an occurrence note type
(for example, UG NAME).

d. For the selected occurrence, double-click in the empty cell in that column and
type in your note (for example, type This is my occurrence note).

e. In the left pane, select that occurrence in the structure (the item revision)
and choose Tools→Intermediate Data Capture. For our example, choose
the Transfer Mode Name of tcm_export because it transfers the UG NAME
type of occurrence note.
When the IDC appears on the tab, there is no content in the data panel, and
there is no occurrence note column (for example, no UG NAME column).
That’s because the occurrence note type column must be added to this IDC
structure view using a customization.

f. Exit the rich client.

2. Open the TC_DATA\structure_alias.xml file and add code.

PLM00075 H Client Customization Programmer’s Guide 3-117


Chapter 3 Rich client customization

a. Add the following under the Alias name="BOM.Property" node:


<Alias name="UG NAME" default=""type="string" size="0"/>

b. Add the following under the AliasAlternate name="BOM.Property" node:


<Alias name="UG NAME">
<Path depth="0..0">*:*:@instancedRef</Path>
<Xpath>/UserData/UserValue[@title=&apos;UGNAME&apos;]/@value</Xpath>
</Alias>

3. Restart the rich client. (Be sure to delete the rich client cache and use the -clean
option when restarting Teamcenter.)
For more information, see Ensure your customizations appear.

4. Add the UG NAME value to the IDCStructureColumnsShownPref


preference, and add a value for the new column’s width to the
IDCStructureShownColumnWidthsPref preference.

5. Select the item structure in My Teamcenter and send it to Multi-Structure


Manager. The occurrence note displays on the IDC in the right data panel under
the new column (for example, the UG NAME column).

New column for occurrence notes

Add perspectives to Manufacturing Process Planner


This example adds new perspectives to the Manufacturing Process Planner
application. Creating new perspectives in Manufacturing Process Planner is
similar to creating a new perspective in any other application in Teamcenter,
but with some modifications. The project that contains the perspectives
uses the Eclipse org.eclipse.ui.perspectives extension and the Teamcenter
com.teamcenter.rac.aifrcp.perspectiveDefs extension.
Use the Eclipse plug-in create wizard to create the plug-in. Add packages and
classes as needed and copy and paste the class and plugin.xml file content from the
following steps. If you use the same names, you can cut and paste; otherwise, edit
your Java files and plugin.xml file using the following steps as a guide.
1. Create the project.
a. In Eclipse, choose File→New→Project.

3-118 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

b. In the New Project dialog box, select Plug-in Project. Click Next.

c. In the New Plug-in Project wizard Plug-in Project dialog box, type
com.mycom.mpp.perspectives in the Project name box and clear the
Source folder box. Click Next.

d. In the New Plug-in Project wizard Content dialog box, do the following:
A. Under Options, ensure the This plug-in will make contributions to the
UI check box is selected.

B. Click the No button next to Would you like to create a rich client
application?.

C. Click Next.

e. Clear the Create a plug-in using one of these templates check box. Click
Finish.

2. Update the project tabs.


a. Click the Overview tab and select the This plug-in is a singleton check box.

b. Click the Dependencies tab, click the Add button, and select the following:
org.eclipse.core.runtime
org.eclipse.ui
com.teamcenter.rac.cme.mpp
com.teamcenter.rac.aifrcp

c. Click the Runtime tab, click the Add button, and select
com.mycom.mpp.perspectives.

3. Create the project files.


a. Create project icons.
A. Right-click the project, choose New→Package, and create an icons
package.

B. Click the Runtime tab, click the Add button, select the Show non-Java
packages check box, and select icons.

C. Add the following icons to the package:

Icon File name Use


consumptionPerspective_16.png Small icon used in the Manufacturing -
Process Consumption perspective
consumptionPerspective_24.png Medium icon used in the Manufacturing
- Process Consumption perspective
consumptionPerspective_32.png Large icon used in the Manufacturing -
Process Consumption perspective
mbom_pbop_16.png Small icon used in the Manufacturing -
MBOM to Product BOP perspective

PLM00075 H Client Customization Programmer’s Guide 3-119


Chapter 3 Rich client customization

Icon File name Use


mbom_pbop_24.png Medium icon used in the Manufacturing
- MBOM to Product BOP perspective
mbom_pbop_32.png Large icon used in the Manufacturing -
MBOM to Product BOP perspective
threeD_16.png Small icon used in the Manufacturing -
Product 3D perspective
threeD_24.png Medium icon used in the Manufacturing
- Product 3D perspective
threeD_32.png Large icon used in the Manufacturing -
Product 3D perspective

b. Create the plugin.properties file.


A. Create a plugin.properties file in the com.mycom.mpp.perspectives
project by selecting the project and choosing File→New→File.

B. Add the following name/value pairs to the plugin.properties file:


#Properties file for com.mycom.mpp.perspectives
Bundle-Name = Manufacturing Incubator Plug-in
consumption.perspective.name = Manufacturing - Process Consumption
product-3d.perspective.name = Manufacturing - Product 3D
mbom-pbop.perspective.name = Manufacturing - MBOM to Product BOP
ProcessConsumption.tooltip = Process Consumption
Product3D.tooltip = Product 3D
MBOM2ProductBOP.tooltip = MBOM to Product BOP

c. Create the plugin.xml file.


A. To create an empty plugin.xml file, click the project’s Extensions tab
and click the Add button in the Extensions view, and click the Cancel
button in the New Extension dialog box.
A plugin.xml file is added to the project.

B. Click the project’s plugin.xml tab and replace the code in the plugin.xml
file with the following:
<plugin>
<extension
point="org.eclipse.ui.perspectives">
<perspective
class="com.teamcenter.rac.aifrcp.perspective.GenericRACPerspective"
icon="icons/consumptionPerspective_16.png"
id="com.teamcenter.rac.cme.mpp.Consumption"
name="%consumption.perspective.name">
</perspective>
</extension>
<extension
point="com.teamcenter.rac.aifrcp.perspectiveDefs">
<perspective
displayMode="Tertiary"
icon16="icons/consumptionPerspective_16.png"
icon24="icons/consumptionPerspective_24.png"
icon32="icons/consumptionPerspective_32.png"
id="com.teamcenter.rac.cme.mpp.Consumption"
label="%consumption.perspective.name"
legacyAppClass="com.teamcenter.rac.cme.application.
MFGLegacyApplication"
legacyAppId="com.teamcenter.rac.cme.mpp.MPPApplication"
ordinality="0"
taskpaneID="DFTaskPane"
tooltip="%consumption.perspective.name">
<contextRef id="com.teamcenter.rac.cme.mpp.ConsumptionContext"/>
<viewRef
allocateSecondaryId="false"
folderIdOverride="RAC_Folder_UL"
id="com.teamcenter.rac.cme.processView"

3-120 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

secondaryId="MPPApplication_1"
placeholderOnly="false">
</viewRef>
<viewRef
allocateSecondaryId="false"
folderIdOverride="RAC_Folder_UR"
id="com.teamcenter.rac.cme.productView"
secondaryId="MPPApplication_1"
placeholderOnly="false">
</viewRef>
<viewRef
allocateSecondaryId="false"
folderIdOverride="RAC_Folder_LR"
id="com.teamcenter.rac.cme.plantView"
secondaryId="MPPApplication_1"
placeholderOnly="false">
</viewRef>
<folderLayout
id="RAC_Folder_UR"
ratio="0.5">
</folderLayout>
<viewRef
folderIdOverride="RAC_Folder_UL"
id="com.teamcenter.rac.cme.processView"
placeholderOnly="true">
</viewRef>
<viewRef
folderIdOverride="RAC_Folder_UR"
id="com.teamcenter.rac.cme.productView"
placeholderOnly="true">
</viewRef>
<viewRef
folderIdOverride="RAC_Folder_LR"
id="com.teamcenter.rac.cme.plantView"
placeholderOnly="true">
</viewRef>
</perspective>
</extension>
<extension point="org.eclipse.ui.contexts">
<context id="com.teamcenter.rac.cme.mpp.ConsumptionContext"
description="%consumption.perspective.name"
name="%consumption.perspective.name"
parentId="com.teamcenter.rac.cme.mpp.MPPApplication.
applicationContext"/>
</extension>
<extension
point="org.eclipse.ui.perspectives">
<perspective
class="com.teamcenter.rac.aifrcp.perspective.
GenericRACPerspective"
icon="icons/threeD_16.png"
id="com.teamcenter.rac.cme.mpp.product3D"
name="%product-3d.perspective.name">
</perspective>
</extension>
<extension
point="com.teamcenter.rac.aifrcp.perspectiveDefs">
<perspective
displayMode="Tertiary"
icon16="icons/threeD_16.png"
icon24="icons/threeD_24.png"
icon32="icons/threeD_32.png"
id="com.teamcenter.rac.cme.mpp.product3D"
isLegacyAppDefault="false"
label="%product-3d.perspective.name"
legacyAppId="com.teamcenter.rac.cme.mpp.MPPApplication"
ordinality="0"
taskpaneID="DFTaskPane"
tooltip="%product-3d.perspective.name">
<contextRef id="com.teamcenter.rac.cme.mpp.MPPApplication.
applicationContext"/>
<viewRef
allocateSecondaryId="false"
folderIdOverride="RAC_Folder_UL"
id="com.teamcenter.rac.cme.productView"
secondaryId="MPPApplication_1"
networkId="3D_productView_001"
placeholderOnly="false">
</viewRef>
<viewRef
allocateSecondaryId="false"
folderIdOverride="RAC_Folder_UR"
id="com.teamcenter.rac.cme.graphics.3d"
secondaryId="com.teamcenter.rac.cme.productView_MPPApplication_1"
networkRef="3D_productView_001"
placeholderOnly="false">
</viewRef>
</perspective>
</extension>
<extension
point="org.eclipse.ui.perspectives">
<perspective

PLM00075 H Client Customization Programmer’s Guide 3-121


Chapter 3 Rich client customization

class="com.teamcenter.rac.aifrcp.perspective.GenericRACPerspective"
icon="icons/mbom_pbop_16.png"
id="com.teamcenter.rac.cme.mpp.mbom-pbop"
name="%mbom-pbop.perspective.name">
</perspective>
</extension>
<extension
point="com.teamcenter.rac.aifrcp.perspectiveDefs">
<perspective
displayMode="Tertiary"
icon16="icons/mbom_pbop_16.png"
icon24="icons/mbom_pbop_24.png"
icon32="icons/mbom_pbop_32.png"
id="com.teamcenter.rac.cme.mpp.mbom-pbop"
label="%mbom-pbop.perspective.name"
legacyAppId="com.teamcenter.rac.cme.mpp.MPPApplication"
ordinality="100"
taskpaneID="DefaultTaskPane"
tooltip="%mbom-pbop.perspective.name">
<contextRef id="com.teamcenter.rac.cme.mpp.MPPApplication.
applicationContext"/>
<viewRef
allocateSecondaryId="false"
folderIdOverride="RAC_Folder_UL"
id="com.teamcenter.rac.cme.productBopView"
secondaryId="MPPApplication_1"
networkId="mbom-pbop.pbop1"
placeholderOnly="false">
</viewRef>
<viewRef
allocateSecondaryId="false"
folderIdOverride="RAC_Folder_LL"
id="com.teamcenter.rac.cme.productView"
secondaryId="MPPApplication_1"
placeholderOnly="false">
</viewRef>
<viewRef
allocateSecondaryId="true"
id="com.teamcenter.rac.cme.mpp.ProcessRelationView"
networkRef="mbom-pbop.pbop1"
placeholderOnly="false"
secondaryId="mbom-pbom_001"
standalone="false">
</viewRef>
<folderLayout
id="RAC_Folder_LL"
ratio="0.5">
</folderLayout>
<folderLayout
id="RAC_Folder_UR"
ratio="0.5">
</folderLayout>
</perspective>
</extension>
</plugin>

d. Replace the contents of the MANIFEST.MF file with the following:


Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.mycom.mpp.perspectives;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: com.mycom.mpp.perspectives.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui,
com.teamcenter.rac.cme.mpp,
com.teamcenter.rac.aifrcp
Export-Package: com.mycom.mpp.perspectives;x-internal:=true,
icons;x-internal:=true

e. Choose File→Save All.


The project files look like the following:

3-122 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Project files for the com.mycom.mpp.perspectives plug-in

4. Verify the customization.


a. To verify the configuration so far, choose Run→Run Configurations to start
the rich client from your Eclipse environment. Clear the workspace by
selecting the Clear check box in the launch configuration dialog box.
For information about how to set up Eclipse to run the rich client, see Enable
rich client customization.

b. Choose Window→Open Perspective→Other.


The following new perspectives appear in the list.

PLM00075 H Client Customization Programmer’s Guide 3-123


Chapter 3 Rich client customization

New Manufacturing Process Planner perspectives

c. Choose the perspectives one-by-one.


Following are the new perspectives.

Manufacturing - MBOM to Product BOP perspective

3-124 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Manufacturing - Process Consumption perspective

Manufacturing - Product 3D perspective

PLM00075 H Client Customization Programmer’s Guide 3-125


Chapter 3 Rich client customization

5. Package the project.


If you want to package the project for distribution, export it to a JAR file and
place it in the TC_ROOT\portal directory.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.
Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

6. Examine the project’s Extensions tab to review the extensions created in the
project.
Copying and pasting the plugin.xml file content is a quick way to provide
you with extensions for this example. However, when you create your own
extensions, instead of placing content directly in the plugin.xml file, you work
in the project’s Extensions tab. Therefore, you should review the Extensions
tab to see how you can create extensions yourself.
To make a perspective, a org.eclipse.ui.perspectives extension and a
com.teamcenter.rac.aifrcp.perspectiveDefs extension must be created for
each perspective.

a. Examine the org.eclipse.ui.perspectives extension.


When the org.eclipse.ui.perspectives extension is created,
the perspective gets a unique ID, name, and an icon, and the
com.teamcenter.rac.aifrcp.perspective.GenericRACPerspective class
is used.

3-126 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

org.eclipse.ui.perspectives extension

b. Examine the com.teamcenter.rac.aifrcp.perspectiveDefs extension.


When the com.teamcenter.rac.aifrcp.perspectiveDefs extension is
created, use the ID previously given for the perspective and do the following:

A. Type DFTaskPane in the taskpaneID box.

B. Type values to the displayMode and ordinality boxes to define the


location of the new perspective in the left hand navigation.

C. Type com.teamcenter.rac.cme.mpp.MPPApplication in the legacyAppID


box.

D. Leave the legacyAppClass box empty.

E. Choose false in the isLegacyAppDefault box.

PLM00075 H Client Customization Programmer’s Guide 3-127


Chapter 3 Rich client customization

com.teamcenter.rac.aifrcp.perspectiveDefs extension

c. Under each com.teamcenter.rac.aifrcp.perspectiveDefs extension, do


the following:
A. Add a contextRef element and the choose
com.teamcenter.rac.cme.mpp.MPPApplication.applicationContext
for the ID.

B. Add a viewRef element for each view you want to appear in the
perspective.
Following are the common primary views that are supported in
Manufacturing Process Planner:
• com.teamcenter.rac.cme.productView
• com.teamcenter.rac.cme.processView
• com.teamcenter.rac.cme.plantView
• com.teamcenter.rac.cme.plantBopView
• com.teamcenter.rac.cme.workinstructions.
win32.STXLibraryView (for STX)
• com.teamcenter.rac.cme.appInterfaceView (for IDC)
• com.teamcenter.rac.cme.plantBopView (for EBOP)
• com.teamcenter.rac.cme.productBopView (for EBOP)
• com.teamcenter.rac.cme.genericBopView (for EBOP)

For primary views:

• The id box shows the ID of the view you want to use.

• The secondaryId box value should be composed of the short


application ID, (for example, MPPApplication for Manufacturing
Process Planner), an underscore (_), and a view number between 1
and 10, for example, MPPApplication_1. Ensure this is the same

3-128 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

number in any perspective you define so that this view represent


the same view in all perspectives.

• In the allocateSecondaryId box, select false.

• In the placeHolderOnly box, select false. It should be true only if you


do not want this view to appear in the perspective by default.

• In the folderIdOverride box, select the folder you want the view to
appear in.

• If you want to define a secondary view for this primary view in this
perspective, type it in the networkId box. It does not matter what the
ID is as long as it is unique in this perspective.

viewRef element (primary view)

C. If you want to create a view to display graphics, add a viewRef element


for the view and use the com.teamcenter.rac.cme.graphics.3d view
type ID.
Because this is a secondary view, note the following:

• The value in the secondaryId box is composed of the ID of the


primary view that you want to associate this graphics view to, an
underscore (_), and the secondaryId value of the primary view, for
example, com.teamcenter.rac.cme.productView_MPPApplication_1.

• In the allocateSecondaryId box, select false.

• In the placeHolderOnly box, select false. It should be true only if you


do not want this view to appear in the perspective by default.

PLM00075 H Client Customization Programmer’s Guide 3-129


Chapter 3 Rich client customization

• In the folderIdOverride box, select the folder you want the view to
appear in.

• In the networkId box, type the networkId value you provided in the
primary view.

viewRef element for graphics (secondary view)

D. If you want to create a secondary view that is not a graphics view, add
a viewRef element for the view and set the allocateSecondaryId box
to true.
Take note of the following for secondary views:

• In the id box, browse to the view you want to use for the secondary
view.

• In the secondaryId box, type a unique ID for the view.

• In the allocateSecondaryId box, select true.

• In the placeHolderOnly box, select false. It should be true only if you


do not want this view to appear in the perspective by default.

• In the folderIdOverride box, select the folder you want the view to
appear in.

• In the networkRef box, type the networkId value you provided in the
primary view. (If the networkRef value is set, then the secondaryId
value also must be set.)

3-130 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

viewRef element (secondary view)

Customizing forms and properties display


There are several processes used to create forms in the Teamcenter rich client.
For more information, see Methods of form customization.
There two perspectives in creating forms. The first perspective is the actual
creation of forms within the rich client. It takes very little work and requires no
programming ability to create and display a form. The second perspective is that
of the programmer, which focuses on the techniques used to develop sophisticated
solutions.
A form is a logical storage mechanism that supports captured, informative, and
derived data. Captured data are the boxes within a form in which users type data;
these are generally required boxes. Business rules often dictate that certain boxes
be populated before the form is created. Informative data are read-only boxes that
appear within the form and cannot be modified by the user. Derived data are the
boxes within a form that are the sum or combination of other boxes, or PDM data
that is composed and displayed within the form. Derived data typically cannot
be modified.
Forms capture information that users reference and view. These forms store data,
such as work order, ECO, or ECN information. Information contained in forms can
be used for queries. Companies typically use forms to:
• Capture and store information for work orders, ECOs, or ECNs. This is the most
common use of forms.

• Maintain processing information to support other features. For example, a form


can be developed to maintain the next available number when automatically
generating numbers. This type of form is used by administrators.

PLM00075 H Client Customization Programmer’s Guide 3-131


Chapter 3 Rich client customization

Note
• Character (char) and character array (char [ ]) data types are not
supported in forms. Use a string (string) or a string array (string [ ])
data type with a length of 1.

• The default string value for False is an empty string. Therefore, end users
must click the Show empty properties link on the rendering page to see
this logic attribute if its value is set to False.

Methods of form customization


The forms feature allows companies to create electronic versions of forms,
representing logically organized data fields. Forms persist to a POM class object.
The display is determined by the form properties in the POM class definition.
Teamcenter supports the following methods of form customization:
• XML style sheet
Allows you to define a set of properties to display, including the display order and
user interface rendering component. The XML style sheet method is supported
for both the rich client and thin client.
For more information, see Using style sheets.

• Automatic forms
Allows you to display forms that have no associated interface definition. The
interface is created automatically as the form is displayed, based on the storage
fields identified within the form POM class.
For more information, see Developing automatic forms.

• JavaBean
Allows you to define forms using JavaBeans and an IDE (such as Eclipse) to
present form properties. Each bean knows how to display and save a specific
property type. This method is less complex than the abstract rendering method
but still requires some programming knowledge.
For more information, see Developing forms using JavaBeans.

• Abstract rendering
Allows you to write the form display by extending the AbstractRendering
class. This is the most flexible method of form customization. It is also the most
complex method and requires coding.
For more information, see Developing forms by extending the abstract class.

3-132 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Note
The following class attributes have been lengthened from 32 to 128 bytes:
• item_id in the Item class

• object_name in the WorkspaceObject class

• name in the AuditLog class

If you used these attributes in customized code, ensure they still display
correctly.

Developing automatic forms


You can create and implement automatic forms. All work is performed on the
server; no work is required on the client. This form solution works with existing
Teamcenter implementations. Once the rich client is installed, existing forms appear
automatically because they are considered to be automatic forms and can display
without customization. The rich client assumes that forms are automatic if they are
not registered on the client. If an error occurs during form loading, the system
throws an exception. All attempts are made to display the data.
1. Create a form type on the server side.
The form type can be created in Teamcenter using the Business Modeler IDE
application. All methods require you to enter the form type name: POM storage.

2. Create the POM storage in the Teamcenter schema.


For more information, see the Business Modeler IDE Guide.

Developing forms using JavaBeans


1. Launch your IDE and create a new JPanel.

2. Add components to the new JPanel. To select a library to add components,


select the one that includes the com.teamcenter.rac plug-in files. If the library
containing the plug-in files is not listed, add it.

3. Locate and select a property bean class.


Note
The property JavaBeans are located in the
com\teamcenter\rac\stylesheets directory.

4. Repeat the previous steps to add additional JavaBeans.


The property JavaBeans are now ready to use.
For a list of available property beans, see Property beans.

For an example of creating a form using JavaBeans, see Create a sample custom
form using JavaBeans.

PLM00075 H Client Customization Programmer’s Guide 3-133


Chapter 3 Rich client customization

Create a sample custom form using JavaBeans


You can create a custom Java panel (JPanel) assigned to a custom business object
and display the properties using JavaBeans.
In this example, when a user selects a custom ItemRevision business object and
chooses the Viewer view or View→Properties, the custom panel is displayed. The
custom properties on the business object are set on the Java panel using property
beans (JavaBeans).
For more information about JavaBeans, see Developing forms using JavaBeans.
Note
Panel rendering is registered to the business object by placing the following
command into a custom stylesheet_user.properties file:
custom-business-object-name.JAVARENDERING.
package-name.custom-java-panel-name

1. Create a custom item business object.


a. In the Business Modeler IDE, create a custom item business object as a child
of the Item business object, for example, A5_MyItem.
For more information about how to use the Business Modeler IDE, see the
Business Modeler IDE Guide.
Note
The A5_ portion of the name is an example of a naming prefix. When
you create a Business Modeler IDE project, you are required to define
a unique prefix that will be affixed to the name of all custom data
model items you create to show that they belong to your custom data
model. You can use your own prefix, but remember that the following
coding examples use this example prefix.

b. In the Business Objects view, open the item revision business object (for
example, A5_MyItemRevision), click the Properties tab, and create the
custom persistent properties you want to display in the panel, for example:
• a5_MyDate
Select the Date attribute type.

• a5_MyDouble
Select the Double attribute type.

• a5_MyFlag
Select the Boolean attribute type.

• a5_MyLongString
Select the LongString attribute type.

• a5_MyLOV
Select the String attribute type. Attach an LOV to this property, for
example, BillCodes.

3-134 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

• a5_MyRef
Select the TypedReference attribute type. Choose a reference business
object, for example, Item.

c. Set the Enabled property constant to True for each of the new properties.
This means the property is enabled for display in the user interface.

d. Deploy the custom template from the Business Modeler IDE to your
Teamcenter server. If you use the deployment wizard, select the Generate
Server Cache? check box to generate shared server cache that contains
the new data model.
For more information, see the Business Modeler IDE Guide.

e. After deployment, test your new business object in the Teamcenter rich
client by creating an instance of it.
For example, in the My Teamcenter application, choose File→New→Item.
Your new business object appears in the New Item dialog box. Choose your
new business object and launch the New Item wizard.

2. Create the Eclipse project.


a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Click Next.

c. In the Project name box, type com.mycom.custompanel. Click Next.

d. Under Options, ensure the Generate an activator and This plug-in will make
contributions to the UI check boxes are selected. Click Next.

e. Clear the Create a plug-in using one of these templates check box. Click
Finish.

3. Update the project tabs.


a. Update the Dependencies tab.
A. In Eclipse, click your project tab and click its Dependencies tab.

B. Under Required Plug-ins, click the Add button.

C. Select the following plug-ins from the list by holding down the Ctrl key
while you click them:
com.teamcenter.rac.aifrcp
com.teamcenter.rac.common
com.teamcenter.rac.external
com.teamcenter.rac.kernel
com.teamcenter.rac.neva
com.teamcenter.rac.tcapps
com.teamcenter.rac.util

D. Click OK.

b. Update the Runtime tab.

PLM00075 H Client Customization Programmer’s Guide 3-135


Chapter 3 Rich client customization

A. Click your project’s Runtime tab.

B. Under Exported Packages, click the Add button.

C. Select your project and click OK.

c. Update the Extensions tab.


A. Click your project’s Extensions tab.

B. Click the Add button.

C. Select the com.teamcenter.rac.util.tc_properties extension point.

D. Click Finish.

d. Save the project by choosing File→Save All.

4. Create the project files.


a. Create the custom viewer panel.
A. In Package Explorer, right-click your project and choose New→Package.

B. In the Name box, type com.teamcenter.rac.stylesheet. This is the path


name where rich client style sheet files are located.

C. Click Finish.

D. Right-click the com.teamcenter.rac.stylesheet package and choose


New→File.

E. Open the project’s Runtime tab, click the Add button, and add the
com.teamcenter.rac.stylesheet package.

F. In the File Name box, type CustomSamplePanel.java and click Finish.

G. Open the CustomSamplePanel.java file and enter the following code:


package com.teamcenter.rac.stylesheet;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import com.teamcenter.rac.util.PropertyLayout;
import java.awt.BorderLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
/**
* This example shows how to use the property java beans to display properties/form.
* To use this example, please create an object with following attributes (or change the
* property names used in this example to match the data model you have):
* a5_MyDouble: double type
* a5_MyDate: date type
* a5_MyFlag: logical type
* a5_MyLongString: long string type
* a5_MyRef: typed reference type
* a5_MyLOV: a string type attached with LOV
*
* To register the usage of this panel, user needs to add a line to the stylesheet_user.properties file,
* with the format: <type_name>.JAVARENDERING=<package name>.CustomSamplePanel
*
* For example, I have this panel registered to display my custom item revision properties:
* A5_MyItemRevision.JAVARENDERING=com.teamcenter.rac.stylesheet.CustomSamplePanel
*
* When user selects A5_MyItemRevision and launches the properties dialog, this CustomSamplePanel
* should be displayed.
*/
public class CustomSamplePanel
extends JPanel
{

3-136 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

public CustomSamplePanel()
{
try
{
init();
}
catch( Exception e )
{
e.printStackTrace();
}
}
private void init()
throws Exception
{
this.setLayout( new BorderLayout() );
this.setOpaque( false );
JPanel jPanel1 = new JPanel();
jPanel1.setLayout( new PropertyLayout() );
jPanel1.setOpaque( false );
JLabel jLabel1 = new JLabel("Test double");
PropertyTextField doubleTextField = new PropertyTextField();
doubleTextField.setProperty( "a5_MyDouble" );
JLabel jLabel2 = new JLabel("Test date" );
PropertyDateButton dateButton = new PropertyDateButton();
//dateButton.setDate( (String) null );
//dateButton.setDisplayFormat( "d-MMM-yyyy HH:mm:ss" );
dateButton.setProperty( "a5_MyDate" );
dateButton.setMandatory( true );
JLabel jLabel3 = new JLabel("Test boolean");
PropertyLogicalPanel logicalPanel = new PropertyLogicalPanel();
logicalPanel.setProperty( "a5_MyFlag" );
JLabel jLabel4 = new JLabel("Test longstring");
PropertyLongTextPanel longTextPanel = new PropertyLongTextPanel();
longTextPanel.setProperty( "a5_MyLongString" );
JLabel jLabel5 = new JLabel("Test ref");
PropertyObjectLink refLink = new PropertyObjectLink();
refLink.setProperty( "a5_MyRef" );
JLabel jLabel6 = new JLabel("Test Lov");
PropertyLOVUIComponent lovUIComp = new PropertyLOVUIComponent();
lovUIComp.setProperty( "a5_MyLOV" );
this.add( jPanel1, BorderLayout.WEST );
jPanel1.add( "1.1", jLabel1 );
jPanel1.add( "1.2", doubleTextField );
jPanel1.add( "2.1", jLabel2 );
jPanel1.add( "2.2", dateButton );
jPanel1.add( "3.1", jLabel3 );
jPanel1.add( "3.2", logicalPanel );
jPanel1.add( "4.1", jLabel4 );
jPanel1.add( "4.2", longTextPanel );
jPanel1.add( "5.1", jLabel5 );
jPanel1.add( "5.2", refLink );
jPanel1.add( "6.1", jLabel6 );
jPanel1.add( "6.2", lovUIComp );
}
}

Note
If you want to set your panel’s background color, you cannot use
the setOpaque(false) tag. For more detail on the usage of this
Java API, go to the following URL:
http://download.oracle.com/javase/6/docs/api/javax/swing/
JComponent.html#setOpaque%28boolean%29

b. Create a style sheet property file to render the new panel.


A. Right-click the com.teamcenter.rac.stylesheet package and choose
New→File.

B. In the File Name box, type stylesheet_user.properties and click Finish.


This file adds content to the stylesheet.properties file. The _user name
in the file indicates that this is a custom file provided by a user.

C. Open the stylesheet_user.properties file and enter the following line:

PLM00075 H Client Customization Programmer’s Guide 3-137


Chapter 3 Rich client customization

A5_MyItemRevision.JAVARENDERING=
com.teamcenter.rac.stylesheet.CustomSamplePanel

D. In the rich client, create a preference for this rendering.


Choose Edit→Options→Index→New and in the Name box type
A5_MyItemRevision.JAVARENDERING and in the Values box, type
com.teamcenter.rac.stylesheet.CustomSamplePanel.

c. Save the new files by choosing File→Save All.

5. Package the project.

a. Right-click the project, choose Export→Plug-in Development→Deployable


plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.

Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

6. Verify the customization.

a. In the rich client, choose File→New→Item and select the new custom item
type (for example, A5_MyItem), and create an instance of it.

b. Select the item revision and click the Viewer tab or choose View→Properties
to see your new panel.

3-138 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Custom form using JavaBeans

Using the Teamcenter property beans


You can create a JPanel component in which to contain the property beans, place
them in the panel, and connect them directly to the form properties by entering in
the property for the box. Once this is done, compile the form and register it with
the rich client.
Registration is accomplished by adding an entry in the form of
Form-Type-Name.FORMJAVARENDERING=Your-Form-Class to the
com.teamcenter.rac.stylesheet.stylesheet_user.properties file. Once
registered, the rich client uses the custom form when the form type is opened.
For example, if the form type is MyFormType and the form display class is named
com.mycompany.forms.MyForm, the entry is added to the properties file, as
follows:
My\ Form\ Type.FORMJAVARENDERING=com.mycompany.forms.MyForm

Often, a form must obtain the reference to the TCComponentForm component


with which it is rendering. Each property bean has knowledge of the
TCComponentForm class; however, for the JPanel component to recognize the
form, you must include a constructor that includes the TCComponentForm
component. When you use your IDE to create the JPanel component, you may be
provided a default constructor, for example:
public MyPanel()
{
}

PLM00075 H Client Customization Programmer’s Guide 3-139


Chapter 3 Rich client customization

To reference the TCComponentForm component, include a constructor requesting


a reference, as shown in the following example:
// IDE given
public MyPanel()
{
}
// User written
public MyPanel ( TCComponentForm f )
{
}

When the form loads, the system looks first for the constructor with a reference to
the TCComponentForm component. If one is found, it is used. If not, the default
constructor is used.
The properties of each property bean are described in Property beans.

Developing custom property beans


Each property bean fundamentally knows how to load and save itself. When the
form is loaded and ready to be displayed, each property bean is notified to load itself
and its data. The property bean uses the defined property and obtains the value from
the Teamcenter database. When the user clicks the Save button, each property bean
is notified to save. When the form is loaded, the top-level container (the JPanel
component) that is registered for the form type is recursively cycled to look for the
InterfacePropertyComponent interface. When found, the beans are instructed to
either load or save. The property beans can be nested as deeply as desired within
containers and still be selected by the system.
To implement property beans, decide which user interface class to
subclass. Then, identify a Teamcenter property bean and implement the
InterfacePropertyComponent interface, which contains two methods:
public void load ( TCComponent ) throws Exception
public void save ( TCComponent f ) throws Exception

After you create the component, all other JavaBean rules apply. For example, you
can attach icons for reference within an Integrated Development Environment
(IDE), such as Eclipse, and attach property rendering rules.
To perform checks prior to loading the property beans, override the checkObject
method as follows:
public void checkObject() throws Exception
{
//required checks
}

Note
All IDEs that support JavaBeans work with the property beans.

To increase the efficiency of property beans, Siemens PLM Software recommends


that you also implement the InterfaceBufferedPropertyComponent class. This
requires a method that has the following signature:
public TCFormProperty saveProperty ( TCComponent f )
throws Exception

This method should only use the setValue<type>Data calls to the form property
and return it. Therefore, all properties in the property bean system are collected and
saved in one call. This increases the efficiency of the property bean.
Siemens PLM Software provides both save() and saveProperty() methods to allow
for flexibility in form storage. All property beans delivered with Teamcenter use the

3-140 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

saveProperty() method. If you choose to override any of the base property beans,
Siemens PLM Software recommends that you override the saveProperty() method.

Developing forms by extending the abstract class


Perform the following steps to create a user interface form:
1. Create a form type on the server side.
The form type can be created in Teamcenter using the Business Modeler IDE
application. All methods require you to enter the form type name: POM storage.

2. Extend the schema.


For more information, see Business Modeler IDE Guide.

3. Create the form panel.


Create a Java object that extends from the AbstractRendering class,
which requires the implementation of two methods: loadRendering() and
saveRendering(). The loadRendering() method is invoked when the form is
constructed and reads the values from the TCComponent class to populate the
form interface. The saveRendering() method writes the values from the user
interface components to the TCComponent class. Override the checkObject()
method to enable performance of checks prior to loading the form.

4. Register the form panel with the rich client.


Once a form class is written on the client, it must be registered in the
stylesheet_user.properties registry file to be recognized within Teamcenter.
The key within the stylesheet_user.properties file points to the implemented
AbstractRendering class definition and is comprised of the form type
name appended with .FORMJAVARENDERING. The associated client-side
definition file for the Item Revision Master form type is shown in the following
code example.
ItemRevision\ Master.FORMJAVARENDERING=com.teamcenter.rac.form.ItemRevisionMaster

The backslash character and a space (\ ) in the string create a space. If the
backslash character is not used, the space is misinterpreted and the form is
displayed using the automatic form display. Java interprets the key as item and
does not parse past the space, considering it the delimiter for the key/value
combination.

For an example of creating a form by extending the abstract class, see Create a
sample custom form by extending the abstract class.

Create a sample custom form by extending the abstract class


You can extend the abstract class (AbstractRendering) to display properties for a
custom business object.
In this example, you create a custom Java form assigned to the ItemRevisionMaster
form. When a user chooses File→New→Item to launch the New Item wizard for a
custom Item business object, a new form is displayed on the Define additional item
revision information page of the wizard.

PLM00075 H Client Customization Programmer’s Guide 3-141


Chapter 3 Rich client customization

This example extends the AbstractRendering component. The sample code uses
the getRenderingModified and isRenderingModified methods. These methods
ensure the values are copied from the New Item wizard to the form.
For more information about extending the abstract class, see Developing forms by
extending the abstract class.
Note
Rendering of the form is tied directly to the business object by placing the
following command into a custom stylesheet_user.properties file:
custom-business-object-name.FORMJAVARENDERING.
package-name.custom-java-form-name

1. Create a custom item business object.


a. In the Business Modeler IDE, create a custom item business object as a child
of the Item business object, for example, A5_MyItem.
For more information about how to use the Business Modeler IDE, see the
Business Modeler IDE Guide.
Note
The A5_ portion of the name is an example of a naming prefix. When
you create a Business Modeler IDE project, you are required to define
a unique prefix that will be affixed to the name of all custom data
model items you create to show that they belong to your custom data
model. You can use your own prefix, but remember that the following
coding examples use this example prefix.

b. Deploy the new custom item business object from the Business Modeler IDE
to your Teamcenter server.

c. After deployment, test your new business object in the Teamcenter rich
client by creating an instance of it.
For example, in the My Teamcenter application, choose File→New→Item.
Your new business object appears in the New Item dialog box. Choose your
new business object and launch the New Item wizard.
Observe the boxes on the Define additional item revision information page.
These are provided by the item revision master form. In the following steps,
you are going to create your own custom form to replace it and to provide
different boxes on this page.

3-142 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Default form in the item creation wizard

2. Create the Eclipse project.


a. In Eclipse, choose File→New→Project.

b. In the New Project dialog box, select Plug-in Project. Click Next.

c. In the Project name box, type com.mycom.masterform. Click Next.

d. Under Options, ensure the Generate an activator and This plug-in will make
contributions to the UI check boxes are selected. Click Next.

e. Clear the Create a plug-in using one of these templates check box. Click
Finish.

3. Update the project tabs.


a. Update the Dependencies tab.
A. In Eclipse, click your project tab and click its Dependencies tab.

B. Under Required Plug-ins, click the Add button.

PLM00075 H Client Customization Programmer’s Guide 3-143


Chapter 3 Rich client customization

C. Select the following plug-ins from the list by holding down the Ctrl key
while you click them:
com.teamcenter.rac.aifrcp
com.teamcenter.rac.common
com.teamcenter.rac.external
com.teamcenter.rac.kernel
com.teamcenter.rac.neva
com.teamcenter.rac.tcapps
com.teamcenter.rac.util

D. Click OK.

b. Update the Runtime tab.


A. Click your project’s Runtime tab.

B. Under Exported Packages, click the Add button.

C. Select the com.mycom.custompanel and com.teamcenter.rac.stylesheet


packages and click OK.

c. Update the Extensions tab.


A. Click your project’s Extensions tab.

B. Click the Add button.

C. Select the com.teamcenter.rac.util.tc_properties extension point.

D. Click Finish.

d. Click the plugin.xml tab and replace the contents of the file with the
following:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension point="com.teamcenter.rac.util.tc_properties">
<plugin_properties pluginName="com.mycom.masterform"/>
</extension>
</plugin>

e. Save the project by choosing File→Save All.

4. Create the project files.


a. Create the custom item revision master form.
A. Right-click the com.mycom.masterform package and choose
New→File.

B. In the File Name box, type A5_MyItemMaster.java and click Finish.

C. Open the A5_MyItemMaster.java file and enter the following code:


package com.mycom.masterform;
import com.teamcenter.rac.stylesheet.AbstractRendering;
import com.teamcenter.rac.kernel.TCComponentForm;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.PropertyLayout;
import com.teamcenter.rac.util.VerticalLayout;

3-144 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

import java.util.HashMap;
import java.util.Map;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class A5_MyItemMaster extends AbstractRendering
{
/**
*
*/
private static final long serialVersionUID = 1L;
private JTextField data1_jtextfield;
private JTextField data2_jtextfield;
private TCProperty data1_tcproperty;
private TCProperty data2_tcproperty;
private TCComponentForm form;
public A5_MyItemMaster( TCComponentForm c)throws Exception
{
super ( c );
form = c;
loadRendering();
}
@Override
public void loadRendering() throws TCException
{
initializeUI();
data1_tcproperty = form.getFormTCProperty("user_data_1");
data2_tcproperty = form.getFormTCProperty("user_data_2");
data1_jtextfield.setText(data1_tcproperty.getStringValue());
data2_jtextfield.setText(data2_tcproperty.getStringValue());
}
@Override
public void saveRendering()
{
try
{
data1_tcproperty.setStringValueData(data1_jtextfield.getText() );
data2_tcproperty.setStringValueData(data2_jtextfield.getText() );
TCProperty[] ps = new TCProperty[2];
ps[0] = data1_tcproperty;
ps[1] = data2_tcproperty;
form.setTCProperties(ps);
}
catch ( TCException ex )
{
MessageBox.post(ex.getMessage(), null, MessageBox.ERROR);
}
}
@Override
public boolean isRenderingModified()
{
if( data1_tcproperty != null && !data1_jtextfield.getText().equals( data1_tcproperty.getStringValue() ) )
{
return true;
}
if( data2_tcproperty != null && !data2_jtextfield.getText().equals( data2_tcproperty.getStringValue() ) )
{
return true;
}
else
{
return false;
}
}
@Override
public Map getRenderingModified ()
{
Map modifiedRendering = new HashMap<String, Object> ();
if( data1_tcproperty != null && !data1_jtextfield.getText().equals( data1_tcproperty.getStringValue() ) )
{
data1_tcproperty.setStringValueData(data1_jtextfield.getText() );
modifiedRendering.put( "user_data_1", data1_tcproperty );
}
if( data2_tcproperty != null && !data2_jtextfield.getText().equals( data2_tcproperty.getStringValue() ) )
{
data2_tcproperty.setStringValueData( data2_jtextfield.getText() );
modifiedRendering.put( "user_data_2", data2_tcproperty );
}
return modifiedRendering;
}
private void initializeUI()
{
setLayout ( new VerticalLayout() );
JPanel mainPanel = new JPanel( new PropertyLayout());
mainPanel.setOpaque(false);
mainPanel.setEnabled(false);
// Create all the text fields
data1_jtextfield = new JTextField(15);
data2_jtextfield = new JTextField(15);
//Add components to Panel
mainPanel.add("1.1.right.center",new JLabel("User Data One"));
mainPanel.add("1.2.left.center", data1_jtextfield);

PLM00075 H Client Customization Programmer’s Guide 3-145


Chapter 3 Rich client customization

mainPanel.add("2.1.right.center",new JLabel("User Data Two"));


mainPanel.add("2.2.left.center", data2_jtextfield);
add("unbound.bind", mainPanel);
}
}

b. Create a style sheet property file to render the new form.


A. In Package Explorer, right-click your project and choose New→Package.

B. In the Name box, type com.teamcenter.rac.stylesheet. This is the path


name where rich client style sheet files are located.

C. Click Finish.

D. Right-click the com.teamcenter.rac.stylesheet package and choose


New→File.

E. In the File Name box, type stylesheet_user.properties and click Finish.


This file adds content to the stylesheet.properties file. The _user name
in the file indicates that this is a custom file provided by a user.

F. Open the stylesheet_user.properties file and enter the following line:


A5_MyItemRevisionMaster.FORMJAVARENDERING=
com.mycom.masterform.A5_MyItemMaster

c. Save the new files by choosing File→Save All.

5. Package the project.


a. Right-click the project, choose Export→Plug-in Development→Deployable
plug-ins and fragments, select the TC_ROOT\portal directory as the
destination, and click Finish.
The com.mycom.project-name JAR file is automatically generated into the
TC_ROOT\portal\plugins directory.

b. Run the TC_ROOT\portal\registry\genregxml file to register the plug-in


with the rich client.
When the script is finished, a new
TC_ROOT\portal\registry\RegistryLoader.xml.gz file is created.
Note
If you make changes to any of the .properties files, or you add new
plug-ins or change plug-in content, you must run the genregxml
script to ensure your changes are included when the rich client starts.
This enhances performance because it caches the properties so they
can be loaded at startup. The script takes no arguments and generates
a RegistryLoader file for each locale in the portal\Registry
directory.

c. To clear cache, delete the Teamcenter subdirectory in the user’s home


directory on the client. This directory is automatically created again when
the user starts the rich client. This directory usually contains RAC and
TAO subdirectories.

3-146 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

On a Windows client, it is typically the C:\Documents and


Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

6. Verify the customization.


a. In the rich client, choose File→New→Item and select the new custom item
type (for example, A5_MyItem), and click Next.

b. Assign the new item an ID and name and click Next.

c. Click Next on the Define additional item information page.

d. On the Define additional item revision information page, you should see
your new item revision master form.

Custom form in the item creation wizard

General comments
The form user interface is not limited to creation using an integrated development
environment (IDE) or to the use of any Java component. Third-party Java
components can be used within the form.
The Eclipse IDE can be used to generate the contents of the form. Once created,
you need only add the code required to read the property values from Teamcenter

PLM00075 H Client Customization Programmer’s Guide 3-147


Chapter 3 Rich client customization

and set the property values within the associated component on the panel. Other
components, such as LOVButton, make it easier to render the form properties.
If you upgrade from a previous version of Teamcenter that used the note attribute
in the form storage class, instances created from that class will continue to use the
note attribute. If you create a new storage class, it uses the string attribute, and
instances created from that class use the string attribute.
Starting with Engineering Process Management 2005, you should use the new
style sheet package (com.teamcenter.rac.stylesheet) instead of the old form
package (com.teamcenter.rac.form). The old form package will be deprecated
in a later release. If you want to still use the old custom forms in the new
package, move the entries you added to the form_user.properties file to the
stylesheet_user.properties file.

Form performance issues


System performance when forms are saved depends largely on the way the
API is used. All API components for saving and loading forms are found in
the TCComponentForm component. The object retrieves form values and
can represent all types of data found in Teamcenter. It is patterned after the
TCProperty object. The TCComponentForm class is responsible for handling the
retrieval and storage of properties to a form. The TCFormProperty object handles
the data representation of the value (or property).
It is more efficient to save all form properties in one call, because this minimizes
network traffic and limits the save action to one commit to the database. If each
property is saved individually, each requires a network call and a commit to the
database, which degrades system performance.
For example, a form containing 20 properties takes approximately two seconds
to save when all properties are saved in one call and approximately 25 seconds
to save when each property is saved individually. There are legitimate cases for
saving properties both individually and collectively. Therefore, take care when
deciding which API to use to achieve a desired result. The following examples
illustrate the different usages of the form API and assume a component f of type
TCComponentForm:
• Obtaining one form property
TCFormProperty p = f.getFormTCProperty(“my_prop_name”);

• Obtaining all form properties


TCFormProperty[] props = f.getAllFormProperties();

• Saving one form property


TCFormProperty p = f.getFormTCProperty(“my_prop_name”);
// Get the property to set
p.setStringValue ( “abc” ); // Set it.
At this point it is saved to the db.

• Saving several form properties


TCFormProperty[] ps = f.getAllFormProperties();
// Get the property to set
ps[0].setStringValueData ( “abc” );
// Sets the value but is not saved.
ps[1].setStringValueData ( “def” );
// Sets the value but is not saved.
f.setTCProperties(ps); // Now is saved to the db.

3-148 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

In summary, performance gains depend on how form data is saved. Whenever


possible, obtain an array of properties and set their values by using methods
such as setStringValueData() as opposed to the setStringValue() method. The
setStringValue() method sets the value and performs the save immediately. The
setStringValueData() method sets the value but relies on a subsequent call
to perform the commit. Finally, for an array of properties, make a call such as
setTCProperties() to increase efficiency.

Form events
When a form is displayed, the size is governed by the standard of preferred size
for a dialog box. However, it may be necessary to control the dialog box size prior
to displaying the form. In this event, implement the InterfaceRendererEvent
interface within the form display class. This interface forces the implementation
of two methods: dialogDisplayed (OpenFormDialog dlg, boolean state).
The method is called before the dialog box is displayed. It is the place where the
setBounds() method for the dialog box can be called.
When a form is displayed, the okToModify() method is invoked. If the form is
modifiable, it is constructed and displayed as designed. However, if the form is not
modifiable, logic is executed to determine what should or should not be editable.
When a read-only form is displayed, the components shown in the following table
are modified.

Component Read-only effect


JTabbedPane None
JSplitPane None
JPanel None
JLabel None
JScrollPane None
JProgressBar None
JTextComponent Edit ability set to False
All others Disabled

When a form is not modifiable, all Container objects, such as JTabbedPane, are
ignored and the remaining components are disabled. This is because Container
objects allow users to traverse and work through them to view the data. You may
want to control the read-only ability of a component within a form, in which case you
must override the read-only logic by implementing the InterfaceRendererEvent
interface and providing body to the setReadOnly() method.

Form user interface display components


The rich client has changed the strategy of forms in Teamcenter. Forms within
the rich client are user interface representations only. Teamcenter stores the
information for the form; therefore, when the form is loaded and displayed in the
rich client, all data is obtained from the server and placed into user interface
components. The base component for a rich client form is a JPanel component that
provides flexibility for the placement of forms within different parent containers.
The following figure shows a form panel.

PLM00075 H Client Customization Programmer’s Guide 3-149


Chapter 3 Rich client customization

Form user interface display panel

Displaying a form
When a form is displayed, the user interface definition for the form is constructed,
populated, and placed within a container. In the rich client, a form can be displayed
under two paradigms: dialog box and viewer. The dialog box displays when the form
is opened using the Open menu or the form is double-clicked.

Form displayed in a dialog box


The viewer paradigm is used when the form is selected and the Viewer tab is active
(the following figure). The contents of nonwritable form are displayed as read-only.
If the user has write access, the form can be edited.

3-150 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Form displayed in the rich client viewer


A reusable Java component is used for form panel construction. Given the component
reference to the form, call the RenderingLoader.load(TCComponent) method,
which constructs and returns the form panel. The form definition within the rich
client is flexible and supports a wide variety of applications. When a form panel is
loaded, the RenderingLoader looks to see if there is a registered form panel for
the component. If so, the registered form panel is returned. If not, an automatic
form is constructed and returned.

Performing advanced customizations


Most customizations you make in the rich client involve using a small set of
techniques, such as using XML rendering style sheets, custom forms, and standard
Eclipse framework customizations (for example, to alter menus, views, and
applications). Some customizations are more advanced and involve making changes
that require other techniques. These can include changing .properties files, using
Command Suppression source, calling user service functions, and registering
run-time properties.
Caution
An advanced customization known as headless customization was allowed in
previous versions of Teamcenter. Headless customization techniques are now
obsolete. Starting a new project with this technique is strongly discouraged.
The preferred choice is to use the Java, C#, or C++ client bindings to published
Teamcenter Services.
For instructions about using Teamcenter Services (SOA) to create your own
Teamcenter client applications, see the Services Guide.

PLM00075 H Client Customization Programmer’s Guide 3-151


Chapter 3 Rich client customization

Customizing Command Suppression


You can suppress menu commands using the Command Suppression application in
Teamcenter. If you want to make your custom plug-ins conform to the Command
Suppression application, you must add the proper coding to the plug-ins.
For more information about the Command Suppression application, see the
Command Suppression Guide.
The rich client uses Eclipse declarative commands, menu contributions, and
handlers to define the vast majority of menu bar and toolbar items. Eclipse
uses a Boolean expression-based syntax to allow control over visibility of any
specific command in a menu using the visibleWhen expression. Just like Eclipse
provides some sources like activeContexts, activePartId, and so on, a rich client
rac_command_suppression source is defined.
Every command contribution in a custom plugin.xml file must have a visibleWhen
expression consuming the rac_command_suppression source using the with
expression. (That is, those command contributions using the org.eclipse.ui.menus
extension point to contribute a command using the menuContribution source.)
Using the rac_command_suppression source ensures that the command is visible
only when it is not suppressed.
The rac_command_suppression source gets called whenever the workbench state
changes, for example, when new commands are suppressed, when switching between
perspectives, and so on.
The with expression (henceforth referred to as the Command Suppression
expression) consuming the rac_command_suppression source must be specified
in the visibleWhen expression of every command contribution. A template of this
Command Suppression expression follows:
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="command_ID_of_the_command_contribution"/>
</iterate>
</not>
</with>

Replace command_ID_of_the_command_contribution with the command ID of the


respective command contribution.

Using the Command Suppression expression in the plugin.xml file


Using the Command Suppression expression in a rich client plugin.xml file varies
based on the following scenarios:
• The command contribution does not contain a visibleWhen expression.
Example before changes:
<menuContribution locationURI="menu:edit?after=cut.ext">
<command commandId="org.eclipse.ui.edit.cut" id="org.eclipse.ui.edit.cut"
label="%cutAction.NAME">
</command>
</menuContribution>

Example after changes:


<menuContribution locationURI="menu:edit?after=cut.ext">
<command commandId="org.eclipse.ui.edit.cut" id="org.eclipse.ui.edit.cut"
label="%cutAction.NAME">
<visibleWhen>
<with variable="rac_command_suppression">
<not>

3-152 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

<iterate operator="or">
<equals value="org.eclipse.ui.edit.cut"/>
</iterate>
</not>
</with>
</visibleWhen>
</command>
</menuContribution>

• The command contribution contains a visibleWhen expression with a nested


and expression.
Example before changes:
<menuContribution locationURI="popup:org.eclipse.ui.popup.any
?after=org.eclipse.ui.edit.paste">
<command commandId="com.teamcenter.rac.pasteDuplicate">
<visibleWhen>
<and>
<reference definitionId="com.teamcenter.rac.cme.mpp.inMainView"/>
<reference definitionId="com.teamcenter.rac.tcapps.
isPasteDuplicateAllowed"/>
</and>
</visibleWhen>
</command>
</menuContribution>

Example after changes:


<menuContribution locationURI="popup:org.eclipse.ui.popup.any
?after=org.eclipse.ui.edit.paste">
<command commandId="com.teamcenter.rac.pasteDuplicate">
<visibleWhen>
<and>
<reference definitionId="com.teamcenter.rac.cme.mpp.inMainView"/>
<reference definitionId="com.teamcenter.rac.tcapps.
isPasteDuplicateAllowed"/>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.teamcenter.rac.pasteDuplicate"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
</menuContribution>

• The command contribution contains a visibleWhen expression with nested


expressions (not the and expression).
Example before changes:
<menuContribution locationURI="menu:file?after=save.ext">
<command commandId="com.teamcenter.rac.importAMRuleTree"
icon="icons/importamruletree_16.png" mnemonic="%importAMRuleTreeAction.MNEMONIC">
<visibleWhen>
<reference definitionId="com.teamcenter.rac.accessmanager.inMainView"/>
</visibleWhen>
</command>
</menuContribution>

Example after changes:


<menuContribution locationURI="menu:file?after=save.ext">
<command commandId="com.teamcenter.rac.importAMRuleTree"
icon="icons/importamruletree_16.png" mnemonic="%importAMRuleTreeAction.MNEMONIC">
<visibleWhen>
<and>
<reference definitionId="com.teamcenter.rac.accessmanager.inMainView"/>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.teamcenter.rac.importAMRuleTree"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>

PLM00075 H Client Customization Programmer’s Guide 3-153


Chapter 3 Rich client customization

</menuContribution>

Command Suppression constraints


Following are constraints on Command Suppression customization:
• The Command Suppression application cannot suppress commands that
are dynamic contributions using the <dynamic> </dynamic> tag in the
menuContribution section of the org.eclipse.ui.menus extension point.

• Any contributions that are done statically in the code (for example, the Window
menu) cannot be suppressed.

• Any contributions that are done using Eclipse actions cannot be suppressed.

Naming convention for extensions and Command Suppression


Every command contribution in a plug-in has the visibleWhen expression
containing the rac_command_suppression source provider. The naming
convention of the extensions in a plug-in should always start with the bundle
symbolic name to clearly indicate which plug-in is providing the contribution.
Assume that the com.mycom.myapp plug-in has the com.mycom.myapp bundle
symbolic name in the META-INF/MANIFEST.MF. Assume that this plug-in creates
the Sample Perspective perspective and makes contributions to the global menu
bar and toolbar that are visible in the perspective. The perspective ID starts with
the bundle symbolic name, for example:
com.mycom.myapp.perspectives.samplePerspectiveId

Because the command contributions from the com.mycom.myapp plug-in should


be visible only in the Sample Perspective perspective, a reference definition can be
defined and associated on all command contributions, for example:
<definition id="com.mycom.myapp.inMainPerspective">
<with variable="activeContexts">
<iterate operator="or">
<or>
<equals value="com.mycom.myapp.perspectives.samplePerspectiveId"/>
</or>
</iterate>
</with>
</definition>

Assume that the plug-in contributes a sample command. This means that the
plug-in must define a command ID using the org.eclipse.ui.commands extension
point adhering to the naming convention, for example:
com.mycom.myapp.sampleCommand

To make this sample command visible only in the Sample Perspective perspective,
and if it is not suppressed from the Command Suppression perspective, use a
combination of this reference definition and the command suppression source
provider, for example:
<command commandId="com.mycom.myapp.sampleCommand" tooltip="%sampleCommand.TIP">
<visibleWhen>
<and>
<reference definitionId="com.mycom.myapp.inMainPerspective"/>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.mycom.myapp.sampleCommand"/>
</iterate>
</not>
</with>
</and>

3-154 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

</visibleWhen>
</command>

Registering user service functions on the server side


The rich client TCUserService Java class method allows you to register functions
on the server side and call those functions from the rich client, for example:
try
{
AbstractAIFApplication app = null;
app = AIFDesktop.getActiveDesktop().getCurrentApplication();
TCSession session = (TCSession) app.getSession();
TCUserService userService = session.getUserService();

int n_input_args = 1;
Object [] input_args = new Object[n_input_args];
String[] client_string_array =
new String[]{"string_a", "string_b", "string_c"};
input_args[0] = client_string_array;
String return_data =
(String)userService.call("exchange_strings", input_args) ;
}
catch( TCException ex )
{
MessageBox.post(ex);
}

User service methods are registered during initialization of the Teamcenter server
and apply for the duration of the Teamcenter server session. User service methods
must be registered through the USERSERVICE_register_methods () function.
First, a custom callback function for the USERSERVICE_register_methods ()
function is registered through the CUSTOM_register_exit function. Then, in the
custom callback function, a custom user service method is registered by calling the
USERSERVICE_register_method () function.
For more information, see the Server Customization Programmer’s Guide.
Note
The USERSERVICE_register_methods function is called for rich client
logon only. It is used to register user service methods that are executed
only from the rich client. Teamcenter recommends that SOA interfaces be
developed to implement custom services.

Displaying files in the viewer


On Windows platforms, you can display Microsoft Word, PowerPoint, Excel, Portable
Document Format (PDF), and text files in the Viewer panel. On UNIX platforms, the
properties of the file are displayed instead.

Display Word, Excel, PowerPoint, PDF, and text files in the viewer

Microsoft Word, Excel, PowerPoint, PDF, and text files are displayed automatically
with no additional configuration required.

PLM00075 H Client Customization Programmer’s Guide 3-155


Chapter 3 Rich client customization

Display Web files in the viewer


To use Internet Explorer as the browser component in the Browser application, open
the Web Browser application. This feature is available only on Windows platforms.
For more information about using the Web Browser application, see Web Browser
Guide.

Display QAF files in the viewer


To display QAF files in the viewer if Teamcenter lifecycle visualization is not already
installed:
1. In the com.teamcenter.rac.common plug-in, create an empty
com\teamcenter\rac\common\tcviewer\tcviewer_user.properties file.

2. In the com.teamcenter.rac.common plug-in, open the


tcviewer\tcviewer.properties file, copy the entire
DatasetViewer.VIEWSEARCHORDER line, and paste it into the new
tcviewer_user.properties file.

3. In the tcviewer_user.properties file, add UG-QuickAccess-Binary to the


end of the DatasetViewer.VIEWSEARCHORDER line.

4. Add the following line to the tcviewer_user.properties file:


UGMASTER.VIEWPANEL=com.teamcenter.rac.common.tcviewer.DatasetViewer

5. In the com.teamcenter.rac.util plug-in, create a


com\teamcenter\rac\util\viewer\viewer_user.properties file, and
add the following line:
Imager.EXTENSION=gif,jpg,qaf

Disable the toolbar in the viewer


Go to com/teamcenter/rac/common/tcviewer, create the
tcviewer_user.properties file in a text editor, and add the following
entry:
useNevaIEViewerToolBar=false

Customizing the data tabs display


If you have administrator privileges, you can customize how data tabs appear in
Multi-Structure Manager and other applications. When a user runs one of these
applications and selects the data panel, several tabs appear in the panel. You can
change the tabs that appear by editing the application properties file.
There are two types of tabs in each application:
• Tabs that always appear for a particular parent panel regardless of whether
anything is selected.

• Tabs that appear only when particular components are selected in the parent
panel.

You can customize how the second, selection-specific group of tabs is displayed.

3-156 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

To determine the tabs to display, the system checks four criteria:


• The class type of the selected display component, for example:
BOMLine
CfgAttachmentLine
TcItemBOPLine

• The subtype of the selected display component, which is generally the same
as the class type. However, for BOM lines, it is the occurrence type and for
attachment lines it is the relation to the parent.

• The class type of the underlying component, such as ItemRevision.

• The subtype of the underlying component (the component type name).

For each selection, the system checks for six properties and adds all the tabs found.
You can edit these properties to change the tabs that are presented to the user:
Display-component-classtype.TABS
Display-component-subtype.TABS
Display-component-classtype.underlying component classtype.TABS
Display-component-classtype.underlying component subtype.TABS
Display-component-subtype.underlying component classtype.TABS
Display-component-subtype.underlying component subtype.TABS

For example, in the Multi-Structure Manager application, the default properties are:
BOMLine.TABS=Referencers, Variant, Attachments, InClassAtt, CMEViewer, Report,
IncrementalChangeInfo
TcItemBOPLine.TABS=Referencers, Variant, Attachments, InClassAtt, CMEViewer,
Report, IncrementalChangeInfo
AppGroupBOPLine.TABS=Referencers, Attachments, CMEViewer, IncrementalChangeInfo
GDELine.TABS=Referencers, InClassAtt, CMEViewer, Report, IncrementalChangeInfo
GDELinkLine.TABS=Referencers, InClassAtt, CMEViewer, Report,
IncrementalChangeInfo
MEAppearanceLine.TABS=Referencers, Attachments, CMEViewer, IncrementalChangeInfo
CfgAttachmentLine.TABS=Referencers, CMEViewer, IncrementalChangeInfo, Report
BOMLine.ItemRevision.TABS=ProductAppearance
TcItemBOPLine.ItemRevision.TABS=ProductAppearance
CfgAttachmentLine.ItemRevision.TABS=InClassAtt

You can add or delete the names of tabs that are displayed for each data panel in
this file.

Edit a custom properties file to display tabs


To display tabs, you can place the changes in a _user.properties file to override the
default .properties file.
For more information about the general process, see Customize the rich client
properties files.
1. Extract the application.properties file from the appropriate
com.teamcenter.rac.component.jar file using the jar xf command. For
example, if you want to extract the mpp.properties file for Part Planner, the
command looks like this:
jar xf com.teamcenter.rac.cme.legacy.jar com/teamcenter/rac/cme/mpp/mpp.properties

Note
For more information about the jar command, see Sun’s Java
documentation.

2. Save the extracted file as the application_user.properties file.

3. In the custom properties file, edit the .TABS line to include the tab you want.

PLM00075 H Client Customization Programmer’s Guide 3-157


Chapter 3 Rich client customization

4. Insert the custom properties file into your own custom plug-in.

Sample tab customization


The following example is for creating new tabs for Manufacturing Process Planner.
1. In the Business Modeler IDE, create a new type as a child of the MEProcess
business object.
When the object is deployed to the rich client and displayed in Manufacturing
Process Planner, the tabs in the data pane are different than the tabs for the
MEProcess business object. You must customize the tabs for the new business
object so that they match tabs for the parent.

2. Open the
installation-location\portal\plugins\com.teamcenter.rac.cme.legacy JAR
file and find the mpp.properties file in the following directory:
com\teamcenter\rac\cme\mpp\mpp.properties

3. Make a copy of the mpp.properties file and rename it into a customer-specific


application_user.properties file.
For more information about the process, see Edit a custom properties file to
display tabs.

4. In the custom properties file, create .TABS entries for your custom business
object.
Manufacturing Process Planner accepts the following definitions in the
properties files:
line-type.TABS= tab-1, tab-2, tab-n
line-subtype.TABS=tab-1, tab-2, tab-n
line-type.underlying-type.TABS= tab-1, tab-2, tab-n
line-type.underlying-subtype.TABS= tab-1, tab-2, tab-n
line-subtype.underlying-type.TABS= tab-1, tab-2, tab-n
line-subtype.underlying-subtype.TABS= tab-1, tab-2, tab-n

line-type is the type of the BOM line, for example, BOMLine,


ImanItemBOPLine, or Mfg0BvrProcess. line-subtype is the subtype
of a line and it can be an occurrence type or a relation type, for example,
MEConsumed (in some cases, it is equal the line type). underlying-type is
the type of the underlying component; a BOPLine can have the underlying
MEOperationRevision type, MEProcessRevision type, or other types.
underlying-subtype is the subtype of the underlying component; like the line
subtype, the underlying subtype can also be the same as the underlying type.
If a BOMLine type matches more than one definition, the result is the sum of
tabs from all matched definitions. For example, an item name I1 is assigned to
an operation as MEConsumed type. The following tab lines are defined:
ImanItemBOPLine.TABS= Variant
ImanItemBOPLine.ItemRevision.TABS= CMEViewer
BOMLine.TABS= Referencers
BOMLine.ItemRevision.TABS= ProductAppearance

Selecting the I1 item in the process structure (below the operation) matches
ImanItemBOPLine.TABS and ImanItemBOPLine.ItemRevision.TABS,
and as a result, the system shows the Variant and CMEViewer tabs.

3-158 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

But selecting I1 in the BOM structure matches BOMLine.TABS and


BOMLine.ItemRevision.TABS; therefore, the system shows the References
and ProductAppearance tabs.
Note
The tabs are also defined in the mpp.properties file:
tab.CLASS
tab.ICON

The tab label and tooltip are defined in the mpp_locale.properties file:
tab.TABLABEL
tab.TOOLTIP

5. Insert the custom properties file into your own custom plug-in.

Customizing the rich client to perform additional validations on a file


You can customize the rich client to allow users to perform additional validations on
a file when creating a dataset or importing named references. To do this, you must
implement the filesSelector extension point in the com.teamcenter.rac.common
plug-in.
You must specify the following attributes in the extension point:
• class
Specifies the name of the custom Java class that implements the extension
point. This customer-supplied custom class must implement the IFilesSelector
interface.
This Java-type attribute is required.

• priority
Specifies the priority of the extension using a valid integer value. If multiple
extensions are available for the filesSelector extension point, the rich client
refers to this attribute to choose the extension with the highest priority.
This string-type attribute is required.

Following are the methods in the IFilesSelector interface:


• initialize
Custom code must implement this method to allow a user to interactively select
the file by popping up the appropriate dialog box.
Siemens PLM Software recommends that you use the ImportFilesFileChooser
dialog box defined in the com.teamcenter.rac.commands.namedreferences
package. This is a standard Teamcenter dialog box that gets information about
the selected file from the user. Apart from selecting the file, this dialog box has
additional widgets that allow a user to select the file type and reference type.

• getSelectedFiles

PLM00075 H Client Customization Programmer’s Guide 3-159


Chapter 3 Rich client customization

Custom code must implement this method to return information about the file
selected by the user. This method must not perform any GUI interaction with
the end user.
This method encapsulates the file object, file type, and reference type
information in a TCFileDescriptor object and return it to the caller. The
TCFileDescriptor constructor is designed to perform validation on the file type
and reference type, and throw exceptions if the validation fails. Custom code is
expected to handle these exceptions.

• getFormattedText
Custom code must implement this method to return the path of the selected file.
This method should not attempt any GUI interaction with end users.

• resetSelectedFiles
Custom code must implement this method to clear the list of selected files.

The following example code demonstrates how a simple validation can be performed
using the filesSelector extension point. This sample code validates if the file being
imported is of length 0 bytes or if the file object selected by the user is a directory:
package sample;
import com.teamcenter.rac.commands.namedreferences.ImportFilesFileChooser;
import com.teamcenter.rac.commands.newdataset.IFilesSelector;
import com.teamcenter.rac.commands.newdataset.TCFileDescriptor;
import com.teamcenter.rac.kernel.TCComponentDatasetDefinition;
import com.teamcenter.rac.kernel.TCComponentDatasetDefinition.TCInvalidFileTypeException;
import com.teamcenter.rac.kernel.TCComponentDatasetDefinition.TCInvalidRefTypeException;
import com.teamcenter.rac.kernel.TCException;
import java.io.File;
import javax.swing.JFileChooser;
import java.util.List;
import java.util.ArrayList;
import javax.swing.JOptionPane;

public class SampleFileSelector implements IFilesSelector {


private List<TCFileDescriptor> listOfFileDesc = null;
public void initialize(TCComponentDatasetDefinition dsDef,
String[] extensions, String refType)
{
ImportFilesFileChooser fc= new ImportFilesFileChooser ( dsDef, null, extensions,
refType );
int ret = fc.showDialog ( null, null );
if ( ret == JFileChooser.APPROVE_OPTION )
{
File selectedFile= fc.getSelectedFile();
String fileType = fc.getType();
String fileRefType = fc.getReferenceType();
listOfFileDesc = new ArrayList<TCFileDescriptor>(1);
try
{
TCFileDescriptor currDesc=null;
//Any additional validations which customer wants to implement
isSelectedFileValid(selectedFile);
//Create TCFilDescriptor object
currDesc = new TCFileDescriptor(dsDef,selectedFile,fileType,fileRefType);
listOfFileDesc.add(currDesc);
}
catch (TCInvalidRefTypeException ex)
{
//Do appropriate exception handling
}
catch (TCInvalidFileTypeException ex)
{
//Do appropriate exception handling
}
catch(TCException ex)
{
//Do appropriate exception handling
}
catch(Exception ex)
{
JOptionPane.showMessageDialog(null, ex);
resetSelectedFiles();

3-160 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

return;
}
}
}
public List<TCFileDescriptor> getSelectedFiles()
{
return listOfFileDesc;
}
public String getFormattedText()
{
if ((listOfFileDesc != null) && (listOfFileDesc.size()>0))
{
String displayText=listOfFileDesc.get(0).getFile().getPath();
for (int i=1;i<listOfFileDesc.size();++i)
{
displayText = displayText + ", " + listOfFileDesc.get(i).getFile().getPath();
}
return displayText;
}
return null;
}
//Additional user-validation methods, We have chosen some simple validation examples
//Customer can similar validation in preferred fashion
public String isFileADirectory(File fileObj)
{
if ( fileObj.isDirectory())
{
return "You have selected directory (" + fileObj.getName() + "),
please select a valid file";
}
return null;
}
public String isFileZeroLength(File fileObj)
{
if ( fileObj.length()==0)
{
return "You have selected file (" + fileObj.getName() + " with length 0,
please select a valid file";
}
return null;
}
public void resetSelectedFiles()
{
listOfFileDesc = null;
}
public boolean isSelectedFileValid(File fileObj) throws Exception
{
String validationMessage=null;
validationMessage = isFileADirectory(fileObj);
if (validationMessage!=null)
{
throw new Exception(validationMessage);
}
validationMessage = isFileZeroLength(fileObj);
if (validationMessage!=null)
{
throw new Exception(validationMessage);
}
return true;
}
}

Customize the Launch Pad


The Launch Pad is an application that provides a desktop space to place items and
notes for quick reference.
For more information about the Launch Pad, see the Rich Client Interface Guide.
Perform the following steps to create your own Launch Pad configuration:
1. Expose the Launch Pad perspective by removing the Launch Pad from the list of
hidden perspectives in the HiddenPerspectives preference.

2. Open the TC_ROOTportal\plugins\com.teamcenter.rac.launchpad JAR


file and extract the l1_launchpad.xml file. This is the default Launch Pad

PLM00075 H Client Customization Programmer’s Guide 3-161


Chapter 3 Rich client customization

configuration file. You can use this as the basis for your own Launch Pad
configuration file. The file’s contents are as follows:
<?xml version="1.0" encoding="UTF-8"?>
<launchpad name="Getting Started"
xmlns="http://com.teamcenter.rac.launchpad">

<launchnode type="URLLaunch" title="Web Links"


title_image="url_16.png" contents_image="links.png">
<attrib name="url" value="www.google.com/calendar"/>
<attrib name="url" value="www.npr.org"/>
</launchnode>

<launchnode type="MyTasksLaunch" title="My Tasks"


title_image="task_16.png" contents_image="mytasks.png"/>

</launchpad>

3. Rename the file (for example, to MyDefault_Launchpad.xml) and change it as


you like. Also create icons to use for your Launch Pad configuration.
For example, you could create a file containing the following:
<?xml version="1.0" encoding="UTF-8"?>
<launchpad name="Default" xmlns="http://com.teamcenter.rac.launchpad">
<launchnode type="MyTasksLaunch" title_image="icon.png"/>
<launchnode type="ScheduleLaunch"/>
<launchnode type="RequirementsLaunch"/>
<launchnode type="ApplicationLaunch" title="NX"
title_image="application_16.png" contents_image="VehicleArchitecture.png">
<attrib name="target" value="NX"/>
</launchnode>
</launchpad>

Tip
You can look at the schema directory in the
TC_ROOTportal\plugins\com.teamcenter.rac.launchpad plug-in
to see the definitions for file elements you can use in the Launch Pad
XML file.

4. Create a Launch Pad Rendering dataset and import your XML file:
a. In My Teamcenter, select the folder where you want to place your new
dataset and choose File→New→Dataset.

b. In the New Dataset dialog box, choose the Launch Pad Rendering type, type
the name of the dataset (for example, MyDefault_Launchpad) in the Name
box, select TextEditor in the Tool Used box, and click the Import button.

c. In the Import File dialog box, select Fnd0XMLRendering in the Reference


box, select your Launch Pad configuration XML file (for example,
MyDefault_Launchpad.xml), and click Import.

d. Click OK.
The dataset is created.

5. Add icons referenced in the XML file to the named references for the dataset:
a. Right-click the new Launch Pad Rendering dataset and choose Named
References.

3-162 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

b. In the Named References dialog box, click the Import button and select the
icons referenced in your Launch Pad XML file.

c. When you are finished, click Close.

6. Now that you have created the Launch Pad Rendering dataset, create a
DEFAULT_LAUNCHRENDERING site preference whose value is the Launch
Pad Rendering dataset name (for example, MyDefault_Launchpad).
Now when you click the Launch Pad button in the left navigation bar, your
custom Launch Pad configuration is displayed. (You may have to close the
Launch Pad and open it again before the new configuration is displayed.)

7. You can pin objects to the Launch Pad such as items, item revisions, folders,
and so on, by right-clicking the objects and choosing Pin to Launch Pad.
Create additional Launch Pad configurations for these objects so that when
you double-click the object pinned on the Launch Pad, the configuration for
that object type is launched.
a. Create an XML configuration file for a specific object type by placing
that type into the launchpad name node of the XML configuration file.
For example, to create a configuration for Folder types, use launchpad
name="Folder", or to create a configuration for Item types, use launchpad
name="Item". Then create the Launch Pad dataset, import the XML file,
and add the necessary icons to the dataset’s named references.

b. Create a business-object-name_LAUNCHRENDERING site preference for


that business object type (for example, Folder_LAUNCHRENDERING
or Item_LAUNCHRENDERING.

c. When you double-click an that business object type (for example, an item or
folder) that is pinned to the Launch Pad, the new configuration is displayed.
(To return to the default configuration, click the Getting Started button
on the Launch Pad toolbar.)

Tips for rich client customization


You can use a number of techniques to make working with rich client customization
easier and more effective. These range from hiding perspectives to overriding
properties.

Localization of rich client customizations


There are two ways to localize the rich client user interface:
• Properties files
You can localize your user interface by placing the modified
strings in the application_locale.properties files. These files are
either in the com.teamcenter.rac.tcapps_version.jar file or the
com.teamcenter.rac.application-name_version.jar file.

• Plug-in

PLM00075 H Client Customization Programmer’s Guide 3-163


Chapter 3 Rich client customization

The registry checks the localization plug-in to see if there is a


localized property defined in the plugin.properties file in the
com.teamcenter.rac.common_version.jar file. If the string needs to be
localized, use % and the key name in the value area to define the key value in
the plugin.properties file.
For more information, see the following Web sites:

http://www.eclipse.org/articles/Article-Internationalization/how2I18n.html

http://www.eclipse.org/articles/Article-Speak-The-Local-Language/article.html

For an example of localization customization, see Localize your customizations. For


more information about localizing Teamcenter, see the Localization Guide.

Updating your rich client customizations from previous versions


If you customized the rich client in previous versions of Teamcenter or Teamcenter
engineering process management, you may have to update your customizations to
work with the current version. Some of the significant changes are:
• Customizations should be placed into Eclipse plug-ins if they are not already.

• Some Java API classes, methods, and constructors are deprecated or obsolete
and should be replaced.
For more information about deprecated and obsolete API, see the Teamcenter 9.1
Release Bulletin.

• Some applications have their own plug-in. Open the TC_ROOT\portal\plugins


directory to see which applications have their own plug-in.

Hide perspectives
1. Log on to Teamcenter as a user that is in the dba group.

2. Choose Edit→Options→Index and search for the HiddenPerspectives


preference.

3. Modify the preference to include the perspective you want to hide.


For more information about editing preference values, see the Preferences and
Environment Variables Reference.
For more information about perspectives that can be hidden, see the description
of the HiddenPerspectives preference. For information about where to locate
plug-ins for perspectives, see Plug-in locations of perspectives.

Adding a third-party JAR file to your plug-in


Sometimes, you may need to add a third-party JAR file to your plug-in project. To
accomplish this, add the JAR file to a project library.
1. To create a folder to hold the JAR file, right-click your Eclipse project, choose
New→Folder, and create a lib folder. This stands for libraries and can contain
all the third-party JAR files required by the project.

3-164 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

2. To import the JAR file, right-click the lib folder, choose Import→General→File
System, select the directory that contains the JAR file on your system, and
select the JAR file to import.
The JAR file is imported into the lib folder.

3. To add the lib folder to the classpath, on the Runtime tab, click the Add button
and select the lib folder

4. To ensure the new JAR file is built with the project, click the Build tab, and in
the Binary Build pane, select the check the box next to the lib folder.

5. Click the Save button.

6. To update the class path, right-click the project and choose PDE Tools→Update
classpath.
The JAR file is added to the Referenced Libraries container under the project.

7. To add the JAR to the project Java build path properties, perform the following
steps:
a. Right-click the project, choose Properties, and select Java Build Path in
the left pane.

b. In the Java Build Path dialog box, click the Add Library button, select User
Library, click Next, select the lib folder, and click Finish.

c. In the Java Build Path dialog box, select the lib library, click the Add JARs
button, select the JAR file under the lib folder, and click OK.

Troubleshooting rich client customization


By its very nature, customization can cause problems when you try to run
the customized client. Writing customizations, running the client to verify,
and correcting problems is the normal working process. Troubleshooting your
customizations can be a challenge, but there is help available. There are a number of
tools to troubleshoot rich client customization, including Eclipse tools (such as the
Console view) and rich client tools (such as the Communication Monitor view). To
see error logs, you can enable client-side logging in the TcLogger.properties file.

Common problems in rich client customization


Common problems when performing rich client customization include not having
Eclipse properly configured or not having rich client cache cleared.

Eclipse startup error

If you get the error shown in the following figure during Eclipse’s startup, either the
Java Runtime Environment is not installed or the PATH statement does not contain
the JDK-installation-directory\bin directory.

PLM00075 H Client Customization Programmer’s Guide 3-165


Chapter 3 Rich client customization

Customizations from a new plug-in do not appear


Teamcenter has a base set of Eclipse plug-ins for the rich client. They are located
in the TC_ROOT\portal\plugins directory, and the file names start with
com.teamcenter. When you add a new plug-in, you deploy it into this directory.
If you add or remove a plug-in when customizing the rich client and your changes do
not appear, delete the Teamcenter subdirectory in the user’s home directory on the
client. This clears the cache.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX client, it is
typically the $HOME/Teamcenter/ directory.
For more information, see Ensure your customizations appear.

Unable to load application error


When you start the rich client, you may get the following error:
Unable to Load Application: application-name
Details java.lang.reflect.InvocationTargetException

This error can occur when you expose custom classes using Eclipse but do not include
the class information in the MANIFEST.MF file. To correct this error, ensure that
you have added your plug-in on the Runtime tab in the Exported Packages pane in
Eclipse. This adds class information to the MANIFEST.MF file.
Previous to Teamcenter 2007.2, the classpath alone was sufficient to handle custom
class information. In later Teamcenter versions, you must add your plug-in to
the Exported Packages pane on the project Runtime tab to ensure that the
MANIFEST.MF file is correctly updated.

Rich client debugging tools


You can debug your customizations to the rich client by using the following tools:
• Console view
Shows the standard output, standard error, and standard input for your program.
Used to debug problems with customizations and to monitor rich client activity.
For more information, see the following URL in the Eclipse help:

3-166 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/
views/console/ref-console_view.htm

• Print Object view


Displays the selected object’s internal attribute values. Use it to determine if
there is an incorrect value for an attribute.

• Communication Monitor view


Shows you the calls between the rich client and server. Use it to determine if
your data is being correctly exchanged between the server and client.

• Performance Monitor tool


Tracks the calls between the server and the database. Use it to determine how
fast the server and the database are communicating.

There are also standard Eclipse views that can help you debug your customization.
For more information about the Eclipse views, see Debug using Eclipse views.

Debug using the Print Object view


1. In the rich client, choose Window→Show View→Print Object.

2. Select an object, such as an item or dataset. You can also copy an object’s tag
from a syslog and paste it in the UID box.
The object’s attributes and their values appear in the Print Object pane at the
bottom of the rich client.
Note
You cannot edit the values in the Print Object pane.

3. (Optional) Limit what is displayed in the pane by changing All attrs in the list
to one of the following:
• Refs only
Shows only those attributes whose value is a tag.

• Strings only
Shows only those attributes whose value is a string.

• Refs & Strings


Shows only those attributes whose value is a tag or a string.

4. (Optional) Expand what is displayed in the pane by changing Hide OM attrs


in the list to Show OM attrs.
This shows the object manager attributes in addition to the attributes already
displayed.

5. If you want to save the attributes and their values to a file, click the SAVE
button in the pane.

PLM00075 H Client Customization Programmer’s Guide 3-167


Chapter 3 Rich client customization

6. To see attributes of another object, leave the pane open and select the other
object. If you want to see attributes of an object you selected earlier, select it
from the list at the top of the pane.

Debug using the Communication Monitor view


1. In the rich client, choose Window→Show View→Communication Monitor.
The values appear in the Communication Monitor pane at the bottom of the
rich client.

2. To choose what you want to see in the monitor, click the Menu button in the
Communication Monitor pane and choose one or more of the following:
• Show Server Calls
Displays an entry for each call to the server.

• Show Stack Trace


Displays the call stack trace for each call to the server.

• Show Request
Displays the XML request sent to the server.

• Show Response
Displays the XML response returned by the server.

• Show Timing
Displays the length of the server call in seconds.

3. If you want to clear the data, click the Clear button in the pane.

4. If you want to save the data to a file, click the Save As button in the pane.

Debug using the Performance Monitor tool


1. Set the TC_PERFORMANCE_MONITOR environmental variable to 0.
For more information about setting environmental variables, see the Preferences
and Environment Variables Reference.
The tool appears the next time you open the rich client.

2. To see the data from the server and client, click the Report button. The data
is also logged along with the text in the Log comment box. It also resets the
counters.
• The SQL and server CPU statistics are retrieved from the server.

• Wallclock time since reset is the time since the last reset.
Times are shown in milliseconds. If the top of the Performance Monitor
states that the Hi-Res timer is in use, times are accurate to 1 millisecond.
Otherwise the standard operating system clock is in use; Microsoft Windows
uses a 60 Hertz clock, so times on Windows are accurate to about 16
milliseconds.

3-168 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

• Client CPU time is available only with the Hi-Res timer.

• Server calls made is a count of all calls made to the server, not including the
call to get the SQL statistics.

Note
If you select the Reset on first server call check box, the Performance
Monitor is reset after the next server call after you click the Report button.

3. To clear the data and reset all counters, click the Reset button.
Note
If you select the Reset on first server call check box, the Performance
Monitor is reset after the next server call after you click the Reset button.

4. To save the data to a file, click the Save button.

Debug using Eclipse views


Some Eclipse views may be helpful when debugging your customizations:
• Console view
Shows the standard output, standard error, and standard input for your program.
For more information, see the following URL in the Eclipse help:

http://help.eclipse.org/helios/index.jsp?topic=
/org.eclipse.jdt.doc.user/reference/views/console/ref-console_view.htm

• Progress view
Shows the progress of background jobs. You can connect this view to your
customizations if you want to see the progress when your customizations run.
For more information, see the following URL in the Eclipse help:

http://help.eclipse.org/helios/index.jsp?topic=
/org.eclipse.platform.doc.isv/guide/runtime_jobs_progress.htm

Enabling client-side logging


Teamcenter uses the log4j mechanism for logging. You can change
logging parameters in the TcLogger.properties file, located in the
TC_ROOT\portal\plugins\configuration_version directory, to specify the level
and scope of logging, as well as changing the log file location.

Changing the logging level and location


You can change the logging level for the entire rich client, a package, or a single
class, as well as the log location:
• Rich client debug-level logging

PLM00075 H Client Customization Programmer’s Guide 3-169


Chapter 3 Rich client customization

To enable debug-level logging for the entire rich client, change the
log4j.rootLogger line in the TcLogger.properties file to DEBUG. The line
should look like this:
log4j.rootLogger=DEBUG, TcLoggerConsoleAppender, TcLoggerFileAppender,
TcLogContext

• Package debug-level logging


To enable debug-level logging for a package, add a line in the
TcLogger.properties file for it. For example, if you want to enable debug-level
logging for Structure Manager, the line looks line this:
log4j.logger.com.teamcenter.rac.pse=DEBUG

• Single class debug-level logging


To enable debug-level logging for a single class, add a line in the
TcLogger.properties file for it. For example, if you want to enable logging for
the TCSession class, the line looks line this:
log4j.logger.com.teamcenter.rac.kernel.TCSession=DEBUG

• Log location
By default, the rich client log is the operating-system-user-name_TcRAC.log file
in your operating system’s temporary directory. You can change the location
by changing the log4j.appender.TcLoggerFileAppender.file entry in the
TcLogger.properties file. This is the default location:
log4j.appender.TcLoggerFileAppender.file=${osgi.instance.area}/
${user.name}_TcRAC_${timestamp}.log

Adding appenders
You can easily add or remove an appender to a logger. The content of all appender
output is identical unless you add a filter to the content. Each appender supports
a pattern layout that determines the format of the output. By default, the rich
client has two kinds of appenders:
• A console appender which outputs to the console. To see console output in the
rich client outside of Eclipse, you must use the -consolelog flag on the command
line when you run the rich client.

• A file appender which outputs to a file.

Pattern layouts
Use a pattern layout to include more information in the console or log file. Each
appender has a pattern layout, which is a substitution string for the output.
• c
Display the logger (category) name.

• C
Display the fully qualified class name of the caller issuing the logging request.

• d

3-170 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Display the date of the logging event.


%d{HH:mm:ss,SSS}

• F
Display the file name where the logging request was issued. This slows execution.

• l
Display the location information of the caller that generated the logging event.
This slows execution.

• L
Display the line number from where the logging request was issued. This slows
execution.

• m
Display the message.

• M
Display the method name where the logging request was issued. This slows
execution.

• n
Insert a new line.

• p
Display the priority of the logging event (DEBUG, WARN, INFO).

• r
Display the number of milliseconds elapsed since the start of the application
until the creation of the logging event.

• t
Display the name of the thread that generated the logging event.

• x
Display the nested diagnostic context (NDC) associated with the thread that
generated the logging event.

For example:
• %-5p: %m%n
This layout produces the following log message:
ERROR: There is something wrong here!

• %n%-5p: %d{HH:mm:ss,SSS} %x - %C{1}.%M:%L%n%m%n


This layout produces the following log message:
INFO : 11:51:54,871 - Class.method:90

PLM00075 H Client Customization Programmer’s Guide 3-171


Chapter 3 Rich client customization

Session logging via TcLoggerFileAppender into file


C:\Windows\temp\smithj_TcRAC.log

Add logging to your code


1. Import the Apache logger:
import org.apache.log4j.Logger;

2. Add a static logger to the file at the top of the class:


private final static Logger logger = Logger.getLogger( MyClass.class );

3. Specify the logger output you want:


• Error condition
logger.error( String [,Throwable] );

• Warning condition
logger.warn( String [,Throwable] );

• Information condition
logger.info( String [,Throwable] );

• Debug condition
logger.debug( String [,Throwable] );

4. (Optional) Add debug control flags to the TcLogContext appender defined in


the TcLogger.properties file:
a. Add the boolean flag to the TcLogger.properties file.

b. Add the getter and setting for the flag to the


com.teamcenter.rac.util.log.TcLogContext line.

c. Use the getter to control your debug code:


if( TcLogger.getLogContext().getMyFlag() ) doSomething();

Listener leaks
Events in Java are fired by means of listeners. An object registers interest with a
target object, so that when an event occurs the listening object is notified. For this
relationship to be maintained, the target object must maintain a reference to the
listening object. The Java memory management facilities look only to delete objects
from virtual memory when the objects are no longer referenced by any other Java
object. The problem at hand is the removal of listeners.
Rich client does not currently have a system in place to facilitate the removal of
listeners. This creates two issues:
• It causes a memory leak.
The memory leak issue exists because references are maintained to Java objects
that are no longer needed. This creates the situation in which the garbage
collector runs but is unable to remove the old objects because they are still tied
as listeners. Under this condition, the virtual memory of the Java VM eventually
runs out.

3-172 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

• It begins to impact performance of the UI, because old components are being
needlessly updated.
The performance issue is more prevalent than the memory leak. System
performance begins to deteriorate quickly under certain UI conditions. The use
of the viewer illustrates this, because as new viewers are displayed, they add
their components to the session, attached as listeners. The UI appears sluggish
and eventually becomes unusable.

Classes and operations


The InterfaceSignalOnClose and SignalOnClose classes described in this section
are used to remedy listener leaks.

InterfaceSignalOnClose
The InterfaceSignalOnClose class requires the implementation of the
closeSignaled() method. This interface is designed to signify the desire to be
notified when closure is to commence. The closeSignaled() method is designed to
remove any listeners that were created during the life of the object.
This interface signifies that the implementing class registers interest to be known
when closure occurs. The implementing class is required to implement the
closeSignaled() method. The closeSignaled() method is invoked when closure is
commencing (as shown in the following code):
public interface InterfaceSignalOnClose
{
public void closeSignaled();
}
Example: An implementation of the closeSignaled() method can look like the following:
public void closeSignaled()
{
TCSession session = (TCSession) application.getSession();
if (session != null)
{
session.removeAIFComponentEventListener( this );
}
}

SignalOnClose
The SignalOnClose class is designed to signal the processing of the components
to detach themselves from listeners and prepare to be closed. This class contains a
single method, close(), which is designed to be passed a reference to a Container
object. The Container object is the start of a recursive walk down the component
tree to look for instances of InterfaceSignalOnClose classes. If instances are
found, the classes are notified that closure is commencing. At this point, it is the
responsibility of the implementing class to take appropriate action.

Rich client customization reference


Reference information about rich client customization includes background
information, coding standards, and guidelines.

Teamcenter extension points


To see the available extension points, open a project in Eclipse and click the Add
button in the project’s Extensions tab.

PLM00075 H Client Customization Programmer’s Guide 3-173


Chapter 3 Rich client customization

For more information about using extension points, see topics in Sample rich client
customizations. Some topics show detailed use of Teamcenter extension points,
such as Add a new rich client application.
The following Teamcenter extension points are available for your use.

Extension point Description


Application Adds an application to the rich client. All new
applications are plugged in from this extension point.
ApplicationTaskPane Adds an application task pane to an application. Each
application task pane can be comprised of one or more
application task pane sections. An application task
pane is associated with:
• ID
Unique ID of the application task pane.

• title
Application task pane title.

• class
Application task pane implementation class.

• ApplicationTaskPaneSectionID
Sequence of section component IDs that contribute
to the application task pane. Each of the
ApplicationTaskPaneSectionID defined should
correspond to the ID attribute on the extensions
defined for the ApplicationTaskPaneSection
extension point.
ApplicationTaskPaneSection Adds an application task pane section to an application
task pane. Each ApplicationTaskPaneSection can
be composed of zero or more section components. An
application task pane section is associated with:
• ID
Unique ID of the application task pane section.

• title
Application task pane section title.

• iconBundleName
Location of the icons if they are located in a different
bundle.

• icon
Application task pane section icon.

3-174 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Extension point Description

• class
Application task pane section implementation class.

• secondaryTitle
Application task pane section secondary title.

• secondaryActionClass
Secondary action implementation class.

• SectionComponentID
Sequence of section component IDs that contribute
to the application task pane section. Each of the
SectionComponentID defined should correspond
to the ID attribute on the extensions defined for the
SectionComponent extension point.
SectionComponent Adds a section component to an application task pane
section. A section component is associated with:
• ID
Unique ID of the section component.

• title
Section component title.

• iconBundleName
Location of the icons if they are located in a different
bundle.

• icon
Section component icon.

• class
Section component implementation class.

• secondaryTitle
Section component secondary title.

• secondaryActionClass
Secondary action implementation class.

• SectionComponentID

PLM00075 H Client Customization Programmer’s Guide 3-175


Chapter 3 Rich client customization

Extension point Description

Sequence of section component IDs that contribute


to the application task pane section. Each of the
SectionComponentID defined should correspond
to the ID attribute on the extensions defined for the
SectionComponent extension point.
boTypesLoader Contributes extensions used to load types. The types
loader class decides which base type and its subtypes to
load, the types to be excluded, and if the most recently
used list (MRU) is enabled.
boTypesPage Contributes extensions that add custom panels to the
types selection page in New Other dialog box.
buttonProvider Registers the button providers with the Clipboard
composite area.
extWizard Registers wizards.
extWizardPage Registers pages with the specified wizard.
extWizardRef Registers pages with the specified wizard.
filesSelector Defines a custom implementation for the file selection
dialog box displayed when the user creates a dataset or
imports files to an existing dataset and performs any
additional validations on the imported files.
health Registers the IHealthCheckControl Factories for the
health check status bar area.
Kernel_Components Controls the mapping of the server side schema type
definitions to the client.
For an example of implementation, see the plugin.xml
file in the com.teamcenter.rac.kernel plug-in JAR
file. For example:
<extension-point id="Kernel_Components" name="components"
schema="schema/components.exsd"/>
<extension id="com.teamcenter.rac.kernel"
point="com.teamcenter.rac.kernel.Kernel_Components">
<entry id="ACTLine"
name="com.teamcenter.rac.kernel.TCComponentACTLine"
type="com.teamcenter.rac.kernel.TCComponentBOMLineType"
icct="com.teamcenter.tc.kernel.icctstubs.ICCTBOMLine" />
...

Kernel_Services Defines the ICCT-based services used by the kernel.


ICCT is deprecated so you should not use this extension.
Use service-oriented architecture (SOA) for client-server
communication instead of ICCT.
For an example of implementation, see the plugin.xml
file in the com.teamcenter.rac.kernel plug-in JAR
file. For example:
<extension-point id="Kernel_Services" name="services"
schema="schema/services.exsd" />
<extension id="com.teamcenter.rac.kernel"
point="com.teamcenter.rac.kernel.Kernel_Services">
<entry id="BMF_SERVICE"
name="com.teamcenter.rac.kernel.BMFService" />
...

3-176 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Extension point Description


navigatorRoots Adds root node objects to the Navigator view.
openConfiguration Contributes extensions used when the File→Open
menu is chosen.
• typeName
Teamcenter type name

• perspectiveId
Perspective ID that should be the same as the
ID in the org.eclipse.ui.perspectives extension
point or in the perspective_id attribute of the
com.teamcenter.rac.aifrcp.
application extension point.

• applicationId
The id attribute on the aif_app_item element
under the com.teamcenter.rac.aifrcp.
application extension point.
openWithConfiguration Matches editors with Teamcenter types in the Open
With menu.
• typeName
Teamcenter type name.

• editorId
Editor ID that is registered using the
org.eclipse.ui.editors extension point.

• perspectiveId
If specified, the perspective is posted prior to
opening the editor in the perspective. If the
specified perspective does not have an editor area
visible, then a default perspective (metadata-editing
perspective) is posted prior to opening the editor.
operation Contributes extensions that are used to perform an
operation from a wizard or dialog box.
ProjectSections Supports associating sections within a view.
tcOpenConfiguration Allows the extenders to specify a perspective ID to open
with in conjunction with the Eclipse core expressions.
When the core expression evaluates to true, the
perspective ID registered against it is used to open the
selected object.
tc_properties Defines the entry point where the customer can plug in
their override properties file.

PLM00075 H Client Customization Programmer’s Guide 3-177


Chapter 3 Rich client customization

Command line options for rich client startup


You can specify the following command line options during rich client startup.
For more information about creating a batch file that uses command line options,
see Install Eclipse.
Note
• You can specify these same command line options in Eclipse when you test
your customization. Choose Run→Debug Configurations or Run→Run
Configurations, select the application in the left pane that you want to
test, click the Arguments tab, and enter the command line options in the
Program arguments box.

• You can also use some of these command line arguments (such as
-attach) when constructing a URL to launch the rich client in a four-tier
environment. To obtain a URL in the four-tier rich client, right-click an
object such as an item and choose Copy, and then paste the resulting URL
into the address bar of a Web browser. This allows you to launch the rich
client and automatically open the copied object. For example:
http://svi6w101:7001/tc/launchapp?-attach=true&-s=226TCSession&
-o=QNG11_93oEfenBAAAAAAAAAAAAA

In this example, launchapp? launches the rich client, and -attach


launches within an already-running rich client session if one is available.
(While not rich client command line options, the -s argument designates
the session, and the -o argument designates the object to open.)

• -arch architecture
Defines the processor architecture on which the Eclipse platform is running. The
Eclipse platform ordinarily computes the optimal setting using the prevailing
value of Java os.arch property. If specified here, this is the value that the
Eclipse platform uses. The value specified here is available to plug-ins as
BootLoader.getOSArch(). Example values: x86, sparc, PA-RISC, ppc.

• -attach
Attaches the new client to an existing session.
For example, a user launches CATIA from the rich client and works on a
structure. The same structure is also loaded in Structure Manager. Selecting a
part in CATIA, the user wants to synchronize the same selections in Structure
Manager. This is where the -attach argument is useful to indicate that the
synchronization of the selections should happen in an existing rich client session.

• -application applicationId
Specifies the application to run. Applications are declared by plug-ins supplying
extensions to the org.eclipse.core.runtime.applications extension point.
This argument is typically not required. If specified, the value overrides the
value supplied by the configuration. If not specified, the Eclipse Workbench is
run. For example, to launch My Teamcenter, use the following command:
portal.bat -application=com.teamcenter.rac.ui.perspectives.navigatorPerspective

• -clean

3-178 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Cleans cached data used by the OSGi framework and Eclipse run time. This is
useful if you have new plug-ins you have added to your environment. Try to run
Eclipse once with this argument if you observe startup errors after installation,
update, or using a shared configuration.
Note
When you start the rich client, if your customization changes still do not
appear in the user interface after running the -clean argument, delete
the Teamcenter subdirectory in the user’s home directory on the client.
This directory is automatically created again when the user starts the
rich client.
On a Windows client, it is typically the C:\Documents and
Settings\user-name\Teamcenter\ directory on Windows XP or the
Desktop\user-name\Teamcenter directory on Windows 7. On a UNIX
client, it is typically the $HOME/Teamcenter/ directory.
If you delete this directory, the last state of the rich client is lost, and the
user interface appears as it does at initial startup.

• -configuration configurationFileURL
The location for the Eclipse platform configuration file, expressed as a URL.
The configuration file determines the location of the Eclipse platform, the set
of available plug-ins, and the primary feature. Note that relative URLs are
not allowed. The configuration file is written to this location when the Eclipse
platform is installed or updated.

• -consolelog
Mirrors the Eclipse platform’s error log to the console used to run Eclipse. It is
effective when combined with -debug.

• -data workspacePath
The path of the workspace on which to run the Eclipse platform. The workspace
location is also the default location for projects. Relative paths are interpreted
relative to the directory that Eclipse was started from.

• -detach
Detaches the client from an existing session.
Starts clients as separate sessions. This is the default behavior, even if the
-detach option is not specified.

• -debug [optionsFile]
Puts the platform in debug mode and loads the debug options from the file at the
given location, if specified. This file indicates which debug points are available
for a plug-in and whether or not they are enabled. If a file location is not given,
the platform looks in the directory that eclipse was started from for a file called
.options. Both URLs and file system paths are allowed as file locations.

• -dev [classpathEntries]
Puts the platform in development mode. The optional classpath entries (a
comma separated list) are added to the run-time classpath of each plug-in. For

PLM00075 H Client Customization Programmer’s Guide 3-179


Chapter 3 Rich client customization

example, when the workspace contains plug-ins being developed, specifying


-dev bin adds a classpath entry for each plug-in project’s directory named
bin, allowing freshly generated class files to be found there. Redundant or
nonexistent classpath entries are eliminated.

• -DskipRegReload args
If you are starting the rich client inside the Eclipse IDE, this option prevents the
registry database from loading if it already exists, which can save up to a minute
or more during startup depending on your system. You can add this argument to
your run/debug configuration. However, if you use this argument, any changes
you make to the registry property files are not used. If you are making changes
to the registry database, do not use this argument.

• -initialize
Initializes the configuration being run. All run-time related data structures
and caches are refreshed. This is useful with shared installs; running Eclipse
once with this option from an account with write privileges improves startup
performance.

• -nl locale
Defines the name of the locale on which the Eclipse platform is running. The
Eclipse platform ordinarily computes the optimal setting automatically. If
specified here, this is the value that the Eclipse platform uses. The value
specified here is available to plug-ins as BootLoader.getNL(). For example,
you can use the following: en_US or fr_FR_EURO.

• -nosplash
Runs the platform without putting up the splash screen.

• -os operatingSystem
Defines the operating system on which the Eclipse platform is running. The
Eclipse platform ordinarily computes the optimal setting using the prevailing
value of Java os.name property. If specified here, this is the value that the
Eclipse platform uses. The value specified here is available to plug-ins as
BootLoader.getOS() and used to resolve occurrences of the $os$ variable in
paths mentioned in the plug-in manifest file. For example, you can use one of the
following: win32, linux, hpux, solaris, aix.

• -perspective perspectiveId
The perspective to open in the active workbench window on startup. If this
parameter is not specified, the perspective that was active on shutdown will be
opened.

• -plugincustomization propertiesFile
The location of a properties file containing default settings for plug-in
preferences. These default settings override default settings specified in the
primary feature. Relative paths are interpreted relative to the directory that
Eclipse was started from.

• -product productId

3-180 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

The ID of the product to run. The product gives the launched instance of Eclipse
its personality, and determines the product customization information used.
This replaces -feature, which is still supported for compatibility.

• -refresh
Option for performing a global refresh of the workspace on startup. This
reconciles any changes that were made in the file system since the platform
was last run.

• -showlocation [workspaceName]
Option for displaying the location of the workspace in the window title bar. The
optional workspace name argument displays the provided name in the window
title bar instead of the location of the workspace.

• -vm vmPath
The location of Java Runtime Environment (JRE) to use to run the Eclipse
platform. If not specified, the JRE is at jre, sibling of the Eclipse executable.
Relative paths are interpreted relative to the directory that Eclipse was started
from.

• -vmargs args
When passed to Eclipse, this option customizes the operation of the Java Virtual
Machine (VM) used to run Eclipse. If specified, this option must come at the
end of the command line. The given arguments are dependant on the VM that
is being run.

Coding standards
Coding standards, such as file and directory structure conventions, naming and
property conventions, and dialog box text and color policies, ensure the consistency
and uniformity of customized code.

File organization

The following file and directory structure standards should be used when developing
the rich client customization code:
• All package names must be lowercase. Do not use space characters in package
names.

• The general package registry should have the same name as the last package
name. For example, for the com.mycompany.rac.explorer package, the
file for the ResourceBundle object that contains the registry information is
explorer.properties.

• Image files associated with a particular package must be located within the
images directory below the package.

• Image file names must consist of all lowercase letters.

PLM00075 H Client Customization Programmer’s Guide 3-181


Chapter 3 Rich client customization

Naming conventions

The following table describes the recommended naming convention for the various
Java types.

Java
type Rule Example Comment
Interface Interface[name], I[name] InterfaceAIFOperationListener, Teamcenter
ISelectionService standard
Abstract Abstract[name] AbstactAIFApplication Teamcenter/Java
class standard
Exception [name]Exception SomethingHappenedException Java
class standard
Variable Lowercase first word, factoryName Java
naming uppercase first letter of standard
other words.
Accessor Getting: Use getXXX, except getFactoryName(), Java
methods for Booleans, where XXX setFactoryName(), isReady() standard
is allowed. Setting: use
setXXX.
Source Same as Class name ISelectionService.java Java
files (including case). requirement
Class Uppercase first character of ComponentManager Java
names each word. standard

Property conventions

Property files can be categorized in three ways:


• Core development

• Localization

• User properties

The reason for this distinction is that customers modify the user property files while
maintaining the links to the core development property files. The following table
describes the properties files using explorer as an example.

File Description
explorer.properties Base property file
explorer_locale.properties Property file for the purpose of localization
explorer_user.properties Customer created property file

Source code conventions

The source conventions follow the Sun Java source code standards that match the
industry norms for Java development.

3-182 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Dialog box standards


The following standards should be used when customizing the rich client dialog
boxes:
• Dialog boxes must always be modal unless the situation requires that they be
nonmodal, such as when the user selects additional information when the dialog
box is visible.

• Mnemonics should be used for common dialog box buttons, such as OK, Apply,
and Cancel.

• The initial location of the dialog box must be screen centered, and the sizing of
the dialog box must be adjusted with a sizing factor.

• Dialog boxes should include a default focus when displayed.

• Text field/area policies:


o Allow only the maximum number of characters that the property can accept.

o Send an audible beep when the maximum is reached.

o Set all text area components to the initial size of 3 rows by 30 columns.

o Select the text when the focus is gained inside the text field.

o Set word wrapping to true for text area components.

• Color policies
Whenever possible, use the default color provided by the base component. Allow
the current look and feel to determine the color.
o If it is not possible to use the default color, use the SystemColor class.

o If neither the default color nor the SystemColor class suffice, define the
color in the property files so users can change it.

For more information, see AIF customization and development.

• Font policies
Whenever possible, use the default font provided by the base component.
If the default font is not sufficient, try one of the following options:

1. Offset the font based on the size of the current font. Do not hard code the
font name, because the font may not be available on all platforms.

2. Mention the font in the property file.

Property beans
The following table lists JavaBeans that you can use to customize the properties
display.

PLM00075 H Client Customization Programmer’s Guide 3-183


Chapter 3 Rich client customization

Note
To display a red asterisk in the upper-right corner of a UI widget to indicate
a mandatory property, use the Business Modeler IDE to set the Required
property constant to true.
For more information, see the Business Modeler IDE Guide.

JavaBean Description
PropertyNameLabel Renders the name of a property (as shown in the following
figure). By specifying the name property, it shows either the
displayable name or real name of the property according to the
setting. This bean can be used along with other beans that
display the property value.

PropertyNameLabel
Properties:
property
Specifies the property name presented by the bean.
displayableName
Indicates whether the displayable name or real name is used.
colon
Indicates whether or not a colon is displayed after the name.
ProperyTextField Renders any nonarray type property, except reference/relation
type properties (as shown in the following figure). This bean
wraps the rendering of the given POM property into JTextField.
Upon saving, the bean attempts to convert the string to the
corresponding property type. If it cannot convert the string to
the required type, an exception is thrown.

PropertyTextField
Properties:
property
Specifies the property name presented by the bean. When a
component is provided, the property value is displayed inside
the box.

3-184 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

JavaBean Description

modifiable
Indicates whether the property is modifiable. If not
modifiable, the text box cannot be edited.
TitledProperty Displays the property name above the text box (as shown in the
TextField following figure). This bean is similar to the PropertyTextField
bean and actually contains two beans: PropertyNameLabel
and PropertyTextField.

TitledPropertyTextField
Properties:
bordered
Indicates whether a border is drawn around the text box.

In addition, you can apply the properties of the


PropertyTextField bean.
PropertyTextArea Renders any nonarray type property except reference/relation
type. This bean wraps the rendering of the given POM property
into the JTextArea, and is generally used for longer text (as
shown in the following figure). Upon saving, it attempts to
convert the string to the corresponding type. If it cannot convert
the string to the required type, an exception is thrown.

PropertyTextArea
Properties:
property
Specifies the property name presented by the bean. When a
component is provide, the property value is displayed inside
the text area.
modifiable
Indicates whether the property is modifiable. If not
modifiable, the text area cannot be edited.

PLM00075 H Client Customization Programmer’s Guide 3-185


Chapter 3 Rich client customization

JavaBean Description
TitledProperty Displays the property name above the text area (as shown in the
TextArea following figure). This bean is similar to the PropertyTextArea
bean and actually contains two beans: PropertyNameLabel
and PropertyTextArea.

TitledPropertyTextArea
Properties:
bordered
Indicates whether a border is drawn around the text area.

In addition, you can apply the properties of the


PropertyTextArea bean.
PropertyLabel Renders any nonarray type property and displays the value of
the property as the label text. Users cannot change the label
text; therefore, save does not apply to this bean.
Properties:
property
The property name presented by the bean. When a
component is provided, the property value is displayed as
the label text.
TitledPropertyLabel Displays the property name above the label (as shown in the
following figure). This bean is similar to the PropertyLabel
bean, and it actually contains two beans: PropertyNameLabel
and PropertyLabel.

TitledPropertyLabel
Properties:
bordered
Indicates whether a border is drawn around the label.

In addition, you can apply the properties of the PropertyLabel


bean.

3-186 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

JavaBean Description
PropertySlider Renders any numeric type property. For double or float types, the
value is cast to an integer. For string or note types, the value is
converted to an integer if possible. Upon save, the value set on
the slider is converted to the corresponding property type and
saved. The following figure illustrates an implementation of the
PropertySlider bean.

PropertySlider
Properties:
property
The property name presented by the bean. When a
component is provided, the slider value is set according to
the property value.
modifiable
Indicates whether the property is modifiable. If not, the
slider is disabled.
TitledPropertySlider Displays the property name above the slider (as shown in the
following figure). This bean is similar to the PropertySlider
bean, and it actually contains two beans: PropertyNameLabel
and PropertySlider.

TitledPropertySlider
bordered
Indicates whether a border is drawn around the slider.

In addition, you can apply the properties of the PropertySlider


bean.

PLM00075 H Client Customization Programmer’s Guide 3-187


Chapter 3 Rich client customization

JavaBean Description
PropertyCheckbox Renders any nonarray type property, except reference/relation
type, using JCheckBox. A flag indicates whether the value is
saved only when the check box is selected or whether it is always
saved. There is a variable for the value to use on saving for a
selected button or for the deselected button. If the flag is set to
save regardless of whether the button is selected or deselected,
both the selected value to save and the deselected value to save
must be set. The following figure illustrates an implementation
of the PropertyCheckbox bean.

PropertyCheckbox
Properties:
property
The property name presented by this bean. When a
component is provided, the check box is selected if the
property value is same as the selected value.
modifiable
Indicates if the property is modifiable. If not, the check box is
disabled.
selectedValue
Specifies the value used for saving when the check box is
selected.
deselectedVaue
Specifies the value to use for saving when the check box is
deselected.
saveOnlyWhenSelected
Indicates to save only when check box is selected or to always
save.
TitledProperty Displays the property name above the check box (as shown in the
Checkbox following figure). This bean is similar to the PropertyCheckbox
bean and actually contains two beans: PropertyNameLabel
and PropertyCheckbox.

TitledPropertyCheckbox
bordered
Indicates whether a border is drawn around the check box.

3-188 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

JavaBean Description

In addition, you can apply the properties of the


PropertyCheckbox bean.
PropertyRadioButton The usage of this bean is same as that of the PropertyCheckbox
bean; however, rather than using JCheckBox, JRadioButton
is used. The following figure illustrates an implementation of the
PropertyRadioButton bean.

PropertyRadioButton
Properties:
property
The property name presented by the bean. When a
component is provided, the button is selected if the property
value is the same as the selected value.
modifiable
Indicates whether the property is modifiable. If not, the
button is disabled.
selectedValue
Specifies the value used for saving when the button is
selected.
deselectedVaue
Specifies the value to use for saving when the button is
deselected.
saveOnlyWhenSelected
Indicates to save only when the button is selected or to
always save.
TitledProperty Displays the property name above the button (as shown
RadioButton in the following figure). This bean is similar to the
PropertyRadioButton bean.

TitledPropertyRadioButton
bordered
Indicates whether a border is drawn around the button.

PLM00075 H Client Customization Programmer’s Guide 3-189


Chapter 3 Rich client customization

JavaBean Description

In addition, you can apply the properties of the


PropertyRadioButton bean.
PropertyToggleButton The usage of this bean is the same as the PropertyCheckbox
bean; however, this bean uses JToggleButton rather than
JCheckBox. The following figure illustrates an implementation
of the PropertyToggleButton bean.

PropertyToggleButton
Properties:
property
The property name presented by the bean. When a
component is provided, the button is selected if the property
value is the same as the selected value.
modifiable
Indicates whether the property is modifiable. If not, the
button is disabled.
selectedValue
Specifies the value used for saving when the button is
selected.
deselectedVaue
Specifies the value to use for saving when the button is
deselected.
saveOnlyWhenSelected
Indicates to save only when the button is selected or to
always save.
TitledProperty Displays the property name above the button. This bean
ToggleButton is similar to the PropertyToggleButton bean. The
following figure illustrates an implementation of the
TitledPropertyToggleButton bean.

TitledPropertyToggleButton
bordered
Indicates whether a border is drawn around the button.

3-190 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

JavaBean Description

In addition, you can apply the properties of the


PropertyToggleButton bean.
PropertyLOVButton Used for any property that has an LOV attached to it except
logical type. It uses LOVPopupButton to present this property
(as shown in the following figure).

LOVPopupButton
Properties:
property
The property name presented by the bean. When a
component is provided, the button text is set to the property
value.
modifiable
Indicates whether the property is modifiable. If not, the
button is disabled.
lovName
Specifies the name of the LOV that the bean uses. If
undefined, the LOV information is retrieved from the
property descriptor.
TitledProperty Displays the property name above the LOV button (as
LOVButton shown in the following figure). This bean is similar to the
PropertyLOVButton bean and actually contains two beans:
PropertyNameLabel and PropertyLOVButton.

PLM00075 H Client Customization Programmer’s Guide 3-191


Chapter 3 Rich client customization

JavaBean Description

TitledPropertyLOVButton
bordered
Indicates whether a border is drawn around the LOV popup
button.

In addition, you can apply the properties of the


PropertyLOVButton bean.
PropertyLOV This bean is similar to the PropertyLOVPopupButton
Combobox bean; however, it uses LOVComboBox rather than
LOVPopupButton to present the property (as shown in the
following figure).

PropertyLOVPopupButton
Properties:
property
The property name presented by the bean.

3-192 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

JavaBean Description

modifiable
Indicates whether the property is modifiable. If not, the
combo box is disabled.
lovName
Specifies the name of the LOV that the bean will use.
If undefined, the LOV information is retrieved from the
property descriptor.
TitledProperty Displays the property name above the LOV combo box (as
LOVCombobox shown in the following figure). This bean is similar to the
PropertyLOVCombobox bean.

TitledPropertyLOVCombobox
bordered
Indicates whether a border is drawn around the LOV combo
box.
In addition, you can apply the properties of the
PropertyLOVCombobox bean.
PropertyCheckbox Presents each value in the LOV as a check box (as shown in the
OptionLov following figure). This bean is designed for any type property
that has a LOV attached. If the property is not an array, the
check boxes are added to a button group; otherwise, they are not
added to the button group and multiple selections are allowed.

PropertyCheckboxOptionLov
Properties:
property
The property name presented by the bean.

PLM00075 H Client Customization Programmer’s Guide 3-193


Chapter 3 Rich client customization

JavaBean Description

modifiable
Indicates whether the property is modifiable. If not, the
check boxes are disabled.
lovName
Specifies the name of the LOV that the bean will use.
If undefined, the LOV information is retrieved from the
property descriptor.
TitledPropertyCheckbox Displays the property name above the check boxes (as
OptionLov shown in the following figure). This bean is similar to the
PropertyCheckboxOptionLov bean.

TitledPropertyCheckboxOptionLov
bordered
Indicates whether a border is drawn around the check boxes.
In addition, you can apply the properties of the
PropertyCheckboxOptionLov bean.
PropertyRadioButton Same as the PropertyCheckboxOptionLov bean, except it
OptionLov uses buttons (as shown in the following figure).

PropertyRadioButtonOptionLov

3-194 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

JavaBean Description
TitledPropertyRadio Displays the property name above the buttons (as shown
ButtonOptionLov in the following figure). This bean is similar to the
PropertyRadioButtonOptionLov bean.

TitledPropertyRadioButtonOptionLov
PropertyToggleButton Same as PropertyCheckboxOptionLov, except it uses buttons
OptionLov (as shown in the following figure).

PropertyToggleButtonOptionLov
TitledPropertyToggle Displays the property name above the buttons (as shown
ButtonOptionLov in the following figure). This bean is similar to the
PropertyToggleButtonOptionLov bean.

TitledPropertyToggleButtonOptionLov

PLM00075 H Client Customization Programmer’s Guide 3-195


Chapter 3 Rich client customization

JavaBean Description
PropertyPanel This bean is a generic container that allows the integrator to
control how property values are stored and displayed. You must
override the load and save methods to implement this standard
behavior. You can combine one or more UI components within
JPanel to provide custom behavior.
For example, if a property in a form called status is an integer
and is either 1 or 2 meaning Running or Stopped, you may
want two toggle buttons with radio behavior to represent this
property. To accomplish this, use the PropertyPanel bean with
two JToggleButtons contained within.
You must override the load and save methods of the
PropertyPanel to determine the selection state from the two
buttons. The PropertyPanel is designed for special behavior
beyond the scope of the other property beans described in this
manual.
TitledPropertyPanel Displays the property name above the panel. This is the same
as the PropertyPanel bean.
PropertyObjectLink This bean renders reference type properties. A shortcut menu is
provided for users to modify the value (as shown in the following
figure). If the value is not modifiable, the shortcut menu is not
available. When the link is clicked, the system displays a dialog
box with properties of this reference component.

PropertyObjectLink
Properties:
property
The property name presented by the bean.
modifiable
Indicates whether the property is modifiable. If not, the
shortcut menu is not available.

3-196 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

JavaBean Description
TitledProperty Displays the property name above the link (as shown
ObjectLink in the following figure). This bean is similar to the
PropertyObjectLink bean.

TitledPropertyObjectLink
bordered
Indicates whether a border is drawn around the link.
In addition, you can apply the properties of the
PropertyObjectLink bean.
PropertyLongText This bean can be used with any string or note type properties,
but is generally used to render text with lengths over 2500
characters. It contains a text area and a button. The long text
dialog box is displayed by clicking the button, making it easier to
browse the text (as shown in the following figure).

PropertyLongText
Properties:
property
The property name presented by the bean.

PLM00075 H Client Customization Programmer’s Guide 3-197


Chapter 3 Rich client customization

JavaBean Description

modifiable
Indicates whether the property is modifiable. If not, the text
area cannot be edited and only the close button is available
in the long text dialog box.
TitledProperty Displays the property name above the long text panel (as
LongText shown in the following figure). This bean is similar to the
PropertyLongText bean.

TitledPropertyLongText
bordered
Indicates whether a border is drawn around the text area.
In addition, you can apply the properties of the
PropertyLongText bean.
PropertyLogicalPanel This bean is used to present a logical type property. It uses two
buttons, one for value true and another for false.
property
The property name presented by the bean.
modifiable
Indicates whether the property is modifiable. If not, the
buttons are disabled.
TitledProperty Displays the property name above the box (as shown
LogicalPanel in the following figure). This bean is similar to the
PropertyLogicalPanel bean.

TitledPropertyLogicalPanel
bordered
Indicates whether a border is drawn around the text area.
In addition, you can apply the properties of the
PropertyLongText bean.

3-198 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

JavaBean Description
PropertyArray Renders all array type properties. It is composed with a list box
and buttons to access the values in the list box (as shown in the
following figure). Based on the type of the property, a different
renderer is used for modifying or adding values. If the property
is read only, users cannot enter edit mode.

PropertyArray
property
The property name presented by the bean.
modifiable
Indicates whether the property is modifiable. If not, the edit
button is not available and the user cannot enter edit mode.

PLM00075 H Client Customization Programmer’s Guide 3-199


Chapter 3 Rich client customization

JavaBean Description
TitledPropertyArray Displays the property name above the property array (as shown
in the following figure) and is similar to the PropertyArray
bean.

TitledPropertyArray
bordered
Specifies whether a border is drawn around the panel.

In addition, you can apply the properties of the PropertyArray


bean.
PropertyImage This bean is limited to items, item revision, datasets, and BOM
view revisions. It walks down these objects to find a dataset
with a displayable image and displays that image. It uses the
same logic as Engineering Process Management Visualization
to find the image dataset and read the search order defined in
the tcviewer.properties file. For example, the following figure
shows an image attached to the selected item revision.

3-200 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

JavaBean Description

PropertyImage

Rich client Javadoc


Teamcenter provides APIs you can use in your rich client customizations.
The Javadoc documentation for these rich client APIs can be found in the
JavaDoc.zip file provided within the Teamcenter-version_pub.zip file on the
Teamcenter installation source. After unzipping the JavaDoc.zip file, open
the index.html files to view the Javadoc for these packages, for example,
javadoc\com.teamcenter.rac.common\index.html.
Teamcenter is moving toward SWT/JFace as the user interface toolkit and moving
away from AWT and Swing. Siemens PLM Software encourages you to customize
Teamcenter using SWT/Jface components. Siemens PLM Software will discontinue
Swing/AWT support in a future version.
For more information about SWT, see Introduction to SWT.
Following are Swing classes. Siemens PLM Software discourages their use and
encourages the use of SWT/JFace:
AbstractUINode
AIFTree
ButtonLayout
GenericTableModel
GraphPanel
HorizontalLayout
InterfaceUINodeLayout
LOVComboBox
LOVDialog
LOVPanel
LOVPopupButton
PropertyLayout
ReferencerUINode
SplitPane

PLM00075 H Client Customization Programmer’s Guide 3-201


Chapter 3 Rich client customization

TCComponentUINode
TCTable
TCTableCellRenderer
TCTableLine
TCTableModel
TCTableSelectionAdapter
TCTree
TCTreeCellRenderer
TCTreeNode
TCTreeOpenEvent
TCTreeOpenListener
TCTypeRenderer
VerticalLayout

User interface components documented in Javadoc


Teamcenter provides user interface components you can use in your
rich client customizations. The Javadoc documentation for these rich
client components can be found in the JavaDoc.zip file within the
Teamcenter-version_pub.zip file provided on the Teamcenter installation
source. After unzipping the JavaDoc.zip file, look at the Javadoc found in the
javadoc\com.teamcenter.rac.common and javadoc\com.teamcenter.rac.util
packages. Open the index.html file to view the Javadoc for these packages, for
example, javadoc\com.teamcenter.rac.common\index.html.

User interface components in the com.teamcenter.rac.common package


Teamcenter provides user interface components you can use in your rich
client customizations in the com.teamcenter.rac.common package. The
Javadoc documentation for these rich client APIs can be found in the
JavaDoc.zip file provided within the Teamcenter-version_pub.zip file on the
Teamcenter installation source. After unzipping the JavaDoc.zip file, open the
javadoc\com.teamcenter.rac.common\index.html file to view the Javadoc.
The following is not a complete list. These are merely some of the
components available for use. For the complete list, see the Javadoc at
javadoc\com.teamcenter.rac.common\index.html.

AbstractProgessDialog
This class contains the definition for the AbstractProgressDialog class, which
displays the progress of multiple components individually, as they are processed.
The AbstractProgressDialog class has the following features:
• The status of the operation, such as in-progress, successful completion, or
failure of completion, is indicated for each component on the dialog box in the
following figure.

• If an operation fails, the tooltip on the error symbol describes the error.

• If the error symbol is clicked, the system displays a detailed error message.

• If confirmation is required before the operation can proceed, the


AbstractProgressDialog component can display the confirmation flag.

3-202 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

• If confirmation is not required, the operation processes the first component as


soon as the dialog box is displayed.

• When an operation is in progress, a Stop button displays on the dialog box and
can be used to stop the operation. This feature is available only for the open
and delete operations. When the delete operation is aborted, the operation in
progress on a component cannot be stopped; however, the operation is stopped
before the next component is deleted.

The following figures show the behavior of the delete operation.

Delete dialog

1 Click Yes to initiate Delete operation.


2 Click More to see components to be deleted.

Expanded Delete dialog

1 Components to be deleted.
2 Click Yes to initiate Delete operation.

Progress indicators

PLM00075 H Client Customization Programmer’s Guide 3-203


Chapter 3 Rich client customization

1 Overall progress indicator.


2 Hourglasses indicate components in the midst of being deleted.
3 If Stop is clicked, the components being processed are deleted and the
operation is stopped.

Completion indicators

1 Indicates unsuccessful completion of the operation.


2 Indicates successful completion of the operation.

The following Teamcenter commands subclass from the AbstractProgressDialog


class:
• Cut

• Copy

• Paste

• Delete

• Check-In

• Check-Out

• Transfer Check-Out

• Publish

• Unpublish

The following code shows how the AbstractProgressDialog class is used to


display the components and execute the delete operation. The dialog box calls the
initializeDialog method in its constructor. The initializeDialog method sets the
display parameters for the components.
public class DeleteDialog extends AbstractProgressDialog
{
//The Constructor calls the initializeDialog method
initializeDialog(targets);
//The initialize Dialog sets the methods for the display in the AbstractProgressDialog
public void initializeDialog (AIFComponentContext[] targets)
{
try
{

3-204 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

// set the title for the dialog


setDialogTitle(r.getString("command.TITLE"));
//display the components that are successfully processed
setDisplaySuccessComponents(true);
//Set the icon to be displayed on the dialog
setCommandIcon(r.getImageIcon("delete.ICON"));
//Set the icon that needs to be set if the components is successfully processed
setSuccessIcon(r.getImageIcon("delete.ICON"));
//set the confirmation to true. The user has to press the Yes button
//to initiate the operation.
setConfirmationText(r.getString("confirmationText"));
// for delete, don’t need to show parent
setShowParentFlag(false);
// display objects that needs to be cut and their parents on dialog
setTCComponents(targets);
}
catch ( Exception ex )
{
//Show the messageBox and return
}
}
// ask user’s confirmation before starting operation
setConfirmationFlag(true);
}
//The abstract method to be implemented to execute the selected operation
protected void getOperations ( AIFComponentContext compContext )
{
// In here the developer has to use addOperation method to add the
// operation.
addOperation ( new DeleteOperation( compContext ) );
}
// There’s also an overloaded getOperations() method which can be used by the developers.
protected void getOperations ( TCComponent parentComp, AIFComponentContext[] ctxts )
{
// Create whatever operation you want to based on the parent component
// and the contexts.
// Then use the addOperation() method to add the operation.
addOperation ( createdOperation );
}

The startOperation() method is called when you click the Yes button. This method
builds the DeleteOperation class, which in turn calls the startProcess() method
from the AbstractProgressDialog class. The startProcess() method sets the focus
on the first displayed component, sets the in-progress icon against the component,
and calls the getOperations() method, which is an abstract method that the
subclass must implement. The getOperations() method in the DeleteDialog class
calls the DeleteOperation class on the first component.
The methods implemented by the subclass are shown in the following code:
setDialogTitle(r.getString("command.TITLE"));
setDisplaySuccessComponents(true);
setCommandIcon(r.getImageIcon("delete.ICON"));
setSuccessIcon(r.getImageIcon("delete.ICON"));
setConfirmationText(r.getString("confirmationText"));
setShowParentFlag(false);
setTCComponents(targets);
setConfirmationFlag(true);
public void run()
public void execute( AIFComponentContext compContext ) throws Exception
(This method builds the appropriate operation on the component)
public void startOperation()
(This method calls the startProcess() method from the AbstractProgressDialog

ExpansionRule
The ExpansionRule component gets the specific components of related types
that are attached to a component. Users can set the relations for specific types of
components and use the getChildren() method to get the required children. The
ExpansionRule component also provides the ability to filter out unwanted children.

Lists of values (LOVs)


The LOVComboBox, LOVPopupButton, and LOVDialog components represent
lists of values (LOVs).

PLM00075 H Client Customization Programmer’s Guide 3-205


Chapter 3 Rich client customization

LOVComboBox
The LOVComboBox component is used in place of the JComboBox component.
Note
This component is a Swing class. Teamcenter is moving toward SWT/JFace as
the user interface toolkit and moving away from AWT and Swing. Siemens
PLM Software encourages you to customize Teamcenter using SWT/Jface
components. Siemens PLM Software will discontinue Swing/AWT support in
a future version.

The LOVComboBox component loads the JComboBox component with the LOV
using a non-UI thread managed by the AIFSession object. This separates the UI
thread from the LOV loading thread and is beneficial because using the UI thread
to load an LOV containing a large number of entries takes a long time and hangs
the interface. Contents of LOVs are retrieved from the server side. If something
happens on the server or network, it blocks the user interface if an LOV is loading
using the UI thread but has no effect on the interface when a non-UI thread is
used to load the LOV.
For exhaustive and suggestive LOVs, the end user must use the backspace key to
clear the existing selection in the text box.

LOVDialog
The LOVDialog component provides another way to display an LOV.
Note
This component is a Swing class. Teamcenter is moving toward SWT/JFace as
the user interface toolkit and moving away from AWT and Swing. Siemens
PLM Software encourages you to customize Teamcenter using SWT/Jface
components. Siemens PLM Software will discontinue Swing/AWT support in
a future version.

It works like the LOVPopupButton component, except that it displays data in a


dialog box rather than a popup window (as shown in the following figure).

LOV dialog box


The code in the following example constructs an LOV dialog that lists all users:
try
{
TCComponent userComponent = session.getUser();
TCProperty userProperty = userComponent.getTCProperty("user_id");
usersLOV = userProperty.getLOV();
}
catch(Exception ex)

3-206 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

{
MessageBox mb = new MessageBox(ex);
mb.setModal(true);
mb.setVisible(true);
}
lovDialog = new LOVDialog(parent, usersLOV);
lovDialog.setVisible(true);
TCQueryClause currentClause;

The code in the following example constructs an LOV popup button and displays a
default value:
LOVPopupButton lovPopup;
TCComponentListOfValues currentLov = currentClause.getLOV();
if(currentLov != null)
{
lovPopup = new LOVPopupButton(currentLov, null);
if (entryValue.length() != 0)
{
lovPopup.setDefaultValue(entryValue);
}
}

LOVPanel
The LOVPanel component is used by the LOVPopupButton and LOVDialog
components.
Note
This component is a Swing class. Teamcenter is moving toward SWT/JFace as
the user interface toolkit and moving away from AWT and Swing. Siemens
PLM Software encourages you to customize Teamcenter using SWT/Jface
components. Siemens PLM Software will discontinue Swing/AWT support in
a future version.

The following figure shows an LOV panel.

LOV panel

1 Value field
2 Find button
3 LOVListBox
4 Message center
5 Load Previous button
6 Load Next button

PLM00075 H Client Customization Programmer’s Guide 3-207


Chapter 3 Rich client customization

7 Load All button


8 Copy button

If an LOV is a suggestive list that accepts user input, the value field acts as an input
field. Users can input a value and press the Enter key. If the user clicks the Find
button, the list box loads the values that match the search criteria.
If the LOV is an exhaustive list that does not allow user input, the value field acts
as a filter input field. Users can input a value and press the enter key, which is
the same as clicking the Find button. The list box loads the values that match
the search criteria. Partially loading the LOV or using the query feature makes
searching efficient. The Load All button loads all found values and the Load Next
button loads the next set of found values.

LOVPopupButton

The LOVPopupButton custom component provides different ways to load the


contents of an LOV (List of Values).
Note
This component is a Swing class. Teamcenter is moving toward SWT/JFace as
the user interface toolkit and moving away from AWT and Swing. Siemens
PLM Software encourages you to customize Teamcenter using SWT/Jface
components. Siemens PLM Software will discontinue Swing/AWT support in
a future version.

The LOVPopupButton component extends from the AbstractPopupButton


class and uses the LOVPanel component for the popup window. The following
code constructs an LOV popup button:
LOVPopupButton lov = new LOVPopupButton ();

The following figure shows an LOV popup button.

LOVPopupButton with no arguments


The LOVPopupButton component takes a blank default value (" ") set on its text
field.
The following code constructs an LOVPopupButton component with an
TCComponentListOfValues "c" and a string that sets the text field.
LOVPopupButton lov = new LOVPopupButton (c, "4");

The following figure shows the LOV popup window.

3-208 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

LOVPopupButton with arguments and popup window

1 The LOVPopupButton component takes a given value set on its text field
(4 in this example).
2 Popup window is shown after the user clicks the button.

MRUButton

The MRUButton component is used by applications to maintain a list of previously


referenced InterfaceAIFComponent objects. It is generic and works with any AIF
application within the AIF framework. When one of the objects is clicked, the open
method for the application is invoked with the component.
The MRUButton component maintains a list of components supplied by the
application. The application must populate the components to the MRUButton
component and determine the number of objects to place inside the component.
Different behaviors can be associated with the use of the MRUButton component in
different applications. A purge limit is commonly associated with the MRU button;
however, the MRUButton component shown in the following figure does not employ
a purge limit.
The code in the following example constructs the MRUButton component:
mruButton = new MRUButton ( explorerApp );
mruButton.setSuggestedVerticalAlignment(MRUButton.TOP);
mruButton.loadMRUEntries();

OpenByNameButton

The OpenByNameButton component allows an application to open new objects


that can be manipulated. It also allows users to issue queries and view properties of
the objects located by the query.
The objects that are found by the query are loaded into the table. Instead of loading
all objects, only the first set is loaded. To load the next set, click the Load Next
button. To load all objects, click the Load All button. The Load Previous button
loads the previous set and appends it to the current selection. Once the object is
located, double-click the object to open it in the application.
Objects can be selected in the table and copied to the clipboard. The Copy button is
active only when an item has been selected.
The OpenByNameButton component enforces the limitation that a query can only
be performed on a single object type, for example, item revisions or folders. This
is usually acceptable, as most applications can only support one root object type.
Examples of this are My Teamcenter, which only supports folders as root objects, and
Structure Manager, which only supports occurrences as root objects.

PLM00075 H Client Customization Programmer’s Guide 3-209


Chapter 3 Rich client customization

The OpenByNameButton component is subclassed from the


AbstractPopupButton class, which allows it to be inserted into the user interface
where it is treated like any other Java button.
This composition allows you to add things to uniquely identify the button and its
purpose, such as tooltips and icons.
The following code shows how to construct the OpenByNameButton component for
the My Teamcenter application, which only searches on folders:
OpenByNameButton openByNameButton = new OpenByNameButton(explorerApp, "Folder");

OrgSelectionDialog

The OrgSelectionDialog reusable component displays the organization chart in


tree form. The root of the chart is a root group, and nodes in the tree represent
groups, roles, and users. The tree displays hierarchies within the organization.
This dialog box consists of a vertical split pane. The left pane displays the tree, and
the right pane displays information about the selected role, group, or user node.
The dialog box shown in the following figure displays information about a fictional
organization. The first-level nodes in the tree represent groups. Groups can be
expanded to display the hierarchical groups or roles contained within the group.
Roles can be expanded to display the users assigned to the role.

OrgSelectionDialog component
In addition, the dialog box provides the ability to search for a specific group, role,
or user within the organization (as shown in the following figure). If you click the

3-210 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Reload button, the tree displays all top-level groups in the organization. Both
figures show the features of the OrgSelectionDialog component.

Organization dialog box search feature


The Access dialog box presents the OrgSelectionDialog component as a separate
dialog box. The OrgSelectionDialog component handles its own events and
display; therefore, dialog boxes that use this dialog component must invoke the
OrgSelectionDialog component. The code in the following example shows the
OrgSelectionDialog component constructed from the AccessDialog component:
JButton selectUserButton = new JButton(appReg.getImageIcon("selectUser.ICON"));
selectUserButton.addActionListener ( new ActionListener()
{
public void actionPerformed (ActionEvent e)
{
//Create the OrgSelectionDialog
orgSelectionDialog = new OrgSelectionDialog(parent, target);
orgSelectionDialog.addPropertyChangeListener(AccessDialog.this);
orgSelectionDialog.setVisible(true);
}
});

The OrgSelectionDialog component is constructed and added as a


propertyChangeListener to the AccessDialog component, and the visibility of
the dialog component is set to true. The Organization Selection displays when you
click the Select User button in the Access dialog box.

PLM00075 H Client Customization Programmer’s Guide 3-211


Chapter 3 Rich client customization

ReferencersPanel
The ReferencersPanel component displays where-used and where-referenced
diagrams. An object can be sent to the Referencers panel, where the user can
double-click it to search for where the object is used or referenced.
When a component is sent to the Referencers panel, whether it defaults to the
where-referenced or where-used display depends on the component type. Users can
define which components to display in the panel.

Referencers panel
The Referencers panel can display the nodes in reverse horizontal style, vertical
style, or tree-look style. Three layout managers are used to accomplish this:
• ReferencersReverseHorizontalNodeLayout

• ReferencersTreeLookNodeLayout

• ReferencersVerticalNodeLayout

ReferencersReverseHorizontalNodeLayout
The ReferencersReverseHorizontalNodeLayout layout manager extends from
the ReverseHorizontalNodeLayout component. It displays the nodes in reverse
horizontal order where the structure is expanded from right to left horizontally and
can display where-referenced and where-used information in different colors.

Referencers reverse horizontal node layout

3-212 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

ReferencersTreeLookNodeLayout

The ReferencersTreeLookNodeLayout layout manager extends from the


TreeLookNodeLayout component. It displays the nodes in a JTree manner and
can display where-referenced and where-used information in different colors.

Referencers tree look node layout

ReferencersVerticalNodeLayout

The ReferencersVerticalNodeLayout layout manager extends from the


VerticalNodeLayout component. It displays the nodes in vertical order expanded
from top to bottom and can display different where-referenced and where-used
information in different colors.

Referencers vertical node layout

ReferencerUINode

The ReferencerUINode component is an extension of the TCComponentUINode


component. It adds an attribute that tells if a where-used or where-referenced
expansion is associated with the node.

PLM00075 H Client Customization Programmer’s Guide 3-213


Chapter 3 Rich client customization

Note
This component is a Swing class. Teamcenter is moving toward SWT/JFace as
the user interface toolkit and moving away from AWT and Swing. Siemens
PLM Software encourages you to customize Teamcenter using SWT/Jface
components. Siemens PLM Software will discontinue Swing/AWT support in
a future version.

This example shows how to construct a ReferencersPanel component and set


a component in it:
referencersPanel = new ReferencersPanel(explorerApp, false, false, false, false);
referencersPanel.setComponent ( c );

TCComponentUINode

The TCComponentUINode component is an extension of the AbstractUINode


class, and creates a UI node based on an TCComponent object.
Note
This component is a Swing class. Teamcenter is moving toward SWT/JFace as
the user interface toolkit and moving away from AWT and Swing. Siemens
PLM Software encourages you to customize Teamcenter using SWT/Jface
components. Siemens PLM Software will discontinue Swing/AWT support in
a future version.

The UI node is presented with the TCComponent object name and rendered icon
(as shown in the following figure).

Item revision UI component


The following code shows the code used to create an TCComponentUINode
component as the root in a GraphPane panel.
// myFolder is an TCComponent
TCComponentUINode node = new TCComponentUINode ( myFolder );
GraphPane panel = new GraphPane ( new VerticalNodeLayout() );
// add the UI node to the panel and set it as the root
panel.setRoot ( node );

TCConstants

The TCConstants class contains constants used across Teamcenter and its related
packages. Use the static variables defined in this class rather than hard-coding
strings.

RolePanel
The RolePanel reusable component extends the JPanel component and can be used
by any application to display role information (as shown in the following figure).

3-214 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Role panel in the Organization Selection dialog box


The following code shows how the RolePanel component is constructed and added
to the dialog box.
RolePanel rolePanel = new RolePanel (roleComponent);
mainSplitPane.setRightComponent (rolePanel);

GroupPanel

The GroupPanel reusable component extends the JPanel component and can be
used by any application to display group information (as shown in the following
figure).

PLM00075 H Client Customization Programmer’s Guide 3-215


Chapter 3 Rich client customization

Group panel in the Organization Selection dialog box


The GroupPanel component can be constructed and added to the dialog box for
display (as shown in the following code example):
GroupPanel groupPanel = new GroupPanel (grpComponent);;
mainSplitPane.setRightComponent (groupPanel);

UserPanel
The UserPanel reusable component extends the JPanel component and can be used
by any application to display group information (as shown in the following figure).

3-216 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

User panel in the Organization Selection dialog box


The UserPanel component can be constructed and added to the dialog box for
display (as shown in the following code example).
UserPanel userPanel = new UserPanel (roleComponent);
mainSplitPane.setRightComponent (userPanel);

TCTypeRenderer

The TCTypeRenderer class is an implementation of a renderer that returns


an icon based on either the Teamcenter object type or an object property. Many
Teamcenter components use this render class.
Note
This component is a Swing class. Teamcenter is moving toward SWT/JFace as
the user interface toolkit and moving away from AWT and Swing. Siemens
PLM Software encourages you to customize Teamcenter using SWT/Jface
components. Siemens PLM Software will discontinue Swing/AWT support in
a future version.

PLM00075 H Client Customization Programmer’s Guide 3-217


Chapter 3 Rich client customization

Usage of the TCTypeRenderer class


The following code example shows how to obtain the icon for an TCComponent
object using the TCTypeRenderer class:
String text;
if ( comp instanceof TCComponent )
{
TCComponent ic = (TCComponent)comp;
text = ic.toString();
JButton bt = new JButton();
bt.setText ( text );
bt.setIcon ( TCTypeRenderer.getIcon ( ic, false ) );
}

User interface components in the com.teamcenter.rac.util package


Generic components, layout managers, and JavaBeans are delivered in
the com.teamcenter.rac.util package. To see the Javadoc documentation
for these rich client API components, see the JavaDoc.zip file
provided within the Teamcenter-version_pub.zip file on the Teamcenter
installation source. After unzipping the JavaDoc.zip file, open the
javadoc\com.teamcenter.rac.common\index.html file to view the Javadoc.
The following is not a complete list. These are merely some of the
components available for use. For the complete list, see the Javadoc at
javadoc\com.teamcenter.rac.util\index.html.

AbstractDialog
The AbstractDialog component enhances the functionality of the JDialog
component, allowing you to instantiate the dialog box from a nonvisible application
and keep it modal. The AbstractDialog component also provides centerToScreen
methods.

3-218 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

The AbstractDialog class must be inherited by another class in order to work.


For example, the StringViewerDialog component extends the AbstractDialog
class, as follows:
public class StringViewerDialog extends AbstractDialog
{
// Class implementation here.
};

AbstractPopupButton
The AbstractPopupButton class creates a custom popup window from a button.
This allows a small UI component to display a larger window that functions like
a dialog box.
The AbstractPopupButton component works like a JComboBox component. It
initially displays as a button (as shown in the following figure).

Initial state of an AbstractPopupButton component


It displays a popup window when the button is clicked (as shown in the following
figure). Classes that extend from the AbstractPopupButton class must implement
the UI for the popup window.

AbstractPopupButton component popup window


The following example adds three check boxes and a button to the popup window.
When you click the OK button, the popup window closes.
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import com.teamcenter.rac.util.*;
public class PopupButtonTest extends AbstractPopupButton
{
PopupButtonTest (String txt)
{
super(txt);
}
public void initPopupWindow()
{
// get the panel for popup window

PLM00075 H Client Customization Programmer’s Guide 3-219


Chapter 3 Rich client customization

JPanel popupWin = getPanel();


JPanel main = new JPanel ( true );
main.setLayout ( new VerticalLayout(2,4,4,4,4) );
JCheckBox op1 = new JCheckBox ( "option 1" );
JCheckBox op2 = new JCheckBox ( "option 2" );
JCheckBox op3 = new JCheckBox ( "option 3" );
JButton okButton = new JButton ( "OK" );
okButton.addActionListener( new ActionListener()
{
public void actionPerformed ( ActionEvent e )
{
// post down the popup window
postDown();
}
});
main.add ( "top", op1 );
main.add ( "top", op2 );
main.add ( "top", op3 );
main.add ( "top", okButton );
// add the created panel to the popup window
popupWin.add ( "Center", main );
}
public static void main(String s[])
{
WindowListener l = new WindowAdapter()
{
public void windowClosing(WindowEvent e) {System.exit(0);}
};
Frame f = new Frame("PopupButton Test");
f.addWindowListener(l);
f.add("Center", new PopupButtonTest ("Click Me"));
f.pack();
f.setSize(new Dimension(350,350));
f.show();
}
}

GenericTableModel

The GenericTableModel class is an implementation of a custom TableModel


component that stores and caches the strings it manages.
Note
This component is a Swing class. Teamcenter is moving toward SWT/JFace as
the user interface toolkit and moving away from AWT and Swing. Siemens
PLM Software encourages you to customize Teamcenter using SWT/Jface
components. Siemens PLM Software will discontinue Swing/AWT support in
a future version.

The following example shows code used to create a GenericTableModel component:


//Create the Table to show the history
columnNames.addElement(appReg.getString("date"));
columnNames.addElement(appReg.getString("user"));
columnNames.addElement(appReg.getString("activity"));
columnNames.addElement(appReg.getString("changeId"));
columnNames.addElement(appReg.getString("comments"));
dataModel = new GenericTableModel(columnNames, 0);
dataModel.markColumnEditable(0, true);
JTable historyTable = new JTable (dataModel);
…………

The following figure shows a table created with the GenericTableModel component.

3-220 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Table created using GenericTableModel component

iTextArea
The iTextArea component is a subclass of the JTextArea class and displays all the
same behaviors. Use this component to achieve a consistent look and feel across the
system. The goal is to use this component across the entire commercial Teamcenter
interface, so that when standards change or are enhanced the changes can be placed
in this class and be inherited by all implementing components.
Using the iTextArea subclass provides the following benefits over using the
JTextArea class:
• Field selection when focus is gained
Data is automatically selected when the focus is gained within the text area.

• Improved focus traversal


The up arrow and down arrow keys provide next and previous focus traversal
abilities.

• Require signaling
You no longer must override the paint method to implement the paint, as
required. Instead, invoke the setRequired(Boolean state) method.

iTextField
The iTextField component is a subclass of the JTextField class and displays all the
same behaviors. Use this component to achieve a consistent look and feel across the
system. The goal is to use this component across the entire commercial Teamcenter
interface, so that when standards change or are enhanced the changes can be placed
in this class and be inherited by all implementing components.
Using the iTextField subclass provides the following benefits over using the
JTextfield class:
• Field selection when focus is gained
Data is automatically selected when the focus is gained within the text field.

• Improved focus traversal


The up arrow and down arrow keys provide next and previous focus traversal
abilities.

• Require signaling

PLM00075 H Client Customization Programmer’s Guide 3-221


Chapter 3 Rich client customization

You no longer must override the paint method to implement the paint, as
required. Instead, invoke the setRequired(Boolean state) method.

Layout managers
This section describes the use of the layout managers (ButtonLayout,
HorizontalLayout, VerticalLayout, and PropertyLayout) in the design of
dialog boxes.

ButtonLayout
This section provides examples of horizontal and vertical button layouts using the
ButtonLayout layout manager.
Note
This component is a Swing class. Teamcenter is moving toward SWT/JFace as
the user interface toolkit and moving away from AWT and Swing. Siemens
PLM Software encourages you to customize Teamcenter using SWT/Jface
components. Siemens PLM Software will discontinue Swing/AWT support in
a future version.

Horizontal ButtonLayout layout manager examples


The following figure shows the ButtonLayout layout manager with horizontal
orientation and center alignment.
Note
This component is a Swing class. Teamcenter is moving toward SWT/JFace as
the user interface toolkit and moving away from AWT and Swing. Siemens
PLM Software encourages you to customize Teamcenter using SWT/Jface
components. Siemens PLM Software will discontinue Swing/AWT support in
a future version.

Horizontal button layout with center alignment


The constructor is called, as follows:
buttonPanel.setLayout (new ButtonLayout(ButtonLayout.HORIZONTAL,
ButtonLayout.CENTER)

Buttons are added in the order in which they are displayed. In the previous figure,
the sequence is OK, Apply and Cancel.
The following figure shows the dialog box when it is resized. The components
maintain their orientation and alignment.

3-222 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Results of resizing the dialog box


The following figure shows the ButtonLayout layout manager with horizontal
orientation, left alignment, and a 20-unit gap between the buttons.

Horizontal button layout with left alignment and a 20-unit gap


The constructor is called, as follows:
buttonPanel.setLayout (new ButtonLayout(ButtonLayout.HORIZONTAL,
ButtonLayout.LEFT, 20);

Since the alignment is set to LEFT, the first button added is aligned to the left
corner of the dialog box and the remaining buttons are placed to the right of the
first, with a 20-unit gap between buttons. The following figure shows the dialog
box when it is resized.

PLM00075 H Client Customization Programmer’s Guide 3-223


Chapter 3 Rich client customization

Results of resizing the dialog box


The following figure shows the ButtonLayout layout manager with horizontal
orientation, right alignment, and a 20-unit gap between the buttons.

Horizontal button layout with right alignment and a 20-unit gap


The constructor is called, as follows:
buttonPanel.setLayout (new Buttonlayout(ButtonLayout.HORIZONTAL,
ButtonLayout.RIGHT, 20);

Since the alignment is set to RIGHT, the first button added is aligned to the right
corner of the dialog box and the remaining buttons are placed to the left of the first,
with a 20-unit gap between buttons. The following figure shows the dialog box when
it is resized.

3-224 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Results of resizing the dialog box


The following example shows the code used to create the previous examples:
public class testlayout extends JDialog
{
protected JButton one, two, three;
protected JPanel buttonPanel;
public testlayout ( Frame parent, String title )
{
super ( parent, title, false );
// Create a new panel with a ButtonLayout Manager
buttonPanel = new Jpanel();
buttonPanel.setlayout ( new ButtonLayout(ButtonLayout.HORIZONTAL));
// Create three buttons
one = new JButton ( "OK" );
two = new JButton ( "Apply" );
three = new JButton ( "Cancel" );
// Add the buttons to the Panel created
buttonPanel.add (one );
buttonPanel.add (two);
buttonPanel.add (three);
this.add (buttonPanel);
this.pack ();
}
}

The buttonPanel panel is created. The panel uses the ButtonLayout layout
manager and assumes the default values for its parameters. Three buttons are
created and added to the panel. The buttons are positioned horizontally, in the
center of the panel, with a 10-unit gap between buttons. The buttons are not resized
when the panel is resized. The position of the buttons in relation to the edges of the
panel also remains unchanged.

Vertical ButtonLayout layout manager examples


The following figure shows the ButtonLayout layout manager with vertical
orientation and center alignment.
Note
This component is a Swing class. Teamcenter is moving toward SWT/JFace as
the user interface toolkit and moving away from AWT and Swing. Siemens
PLM Software encourages you to customize Teamcenter using SWT/Jface
components. Siemens PLM Software will discontinue Swing/AWT support in
a future version.

PLM00075 H Client Customization Programmer’s Guide 3-225


Chapter 3 Rich client customization

Vertical button layout with center alignment


The constructor is called, as follows:
buttonPanel.setLayout (new Buttonlayout(ButtonLayout.VERTICAL,
ButtonLayout.CENTER);

When the panel is resized, the buttons maintain their size and alignment in relation
to the dialog box. The buttons are placed in the sequence in which they are added
to the panel.
The following figure shows the ButtonLayout layout manager with vertical
orientation and top alignment.

3-226 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Vertical button layout with top alignment


The constructor is called, as follows:
buttonPanel.setLayout (new ButtonLayout(ButtonLayout.VERTICAL,
ButtonLayout.TOP);

The following figure shows the ButtonLayout layout manager with vertical
orientation and bottom alignment.

Vertical button layout with bottom alignment


The constructor is called, as follows:
buttonPanel.setLayout (new Buttonlayout(ButtonLayout.VERTICAL,
ButtonLayout.BOTTOM);

The following figure shows the code used to create the previous examples:
public class testlayout extends JDialog
{
protected JButton one, two, three;
protected JPanel buttonPanel;
public testlayout ( Frame parent, String title )

PLM00075 H Client Customization Programmer’s Guide 3-227


Chapter 3 Rich client customization

{
super ( parent, title, false );
// Create a new panel with a ButtonLayout Manager
buttonPanel = new JPanel();
buttonPanel.setlayout ( new ButtonLayout(ButtonLayout.HORIZONTAL));
// Create three buttons
one = new JButton ( "OK" );
two = new JButton ( "Apply" );
three = new JButton ( "Cancel" );
// Add the buttons to the Panel created
buttonPanel.add (one );
buttonPanel.add (two);
buttonPanel.add (three);
this.add (buttonPanel);
this.pack ();
}
}

The buttonPanel panel is created. The panel uses the ButtonLayout layout
manager and assumes default values for its parameters. Three buttons are created
and added to the panel. The buttons are positioned horizontally in the center of the
panel with a 10-unit gap between buttons. Resizing a ButtonLayout panel does
not resize the buttons. The position of the buttons relative to the four edges of the
panel also remains unchanged.

HorizontalLayout
The HorizontalLayout layout manager positions children and attachments
horizontally in the container object.
Note
This component is a Swing class. Teamcenter is moving toward SWT/JFace as
the user interface toolkit and moving away from AWT and Swing. Siemens
PLM Software encourages you to customize Teamcenter using SWT/Jface
components. Siemens PLM Software will discontinue Swing/AWT support in
a future version.

When a component is added to the container object, the position of the component
is determined by the parameters passed in the name field. These parameters are
{Attachment, bind, HorizontalAlignment, VerticalAlignment}. The default
positioning for a component added without correct formatting in the name field is
(left.bind.center.center). bind and nobind indicate that the component will be
resized or maintained based on the space available. Top components are positioned
first, followed by bottom components and unbound components. If you do not call the
add function with a name string in the argument, an exception occurs.
The following figure shows the use of the HorizontalLayout layout manager.

3-228 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Horizontal layout with center alignment


The following figure shows the results when the dialog box is resized.

Results of resizing the dialog box


When the dialog box is resized, the Left and Right buttons maintain their shape,
size, and alignment in relation to the edges of the dialog box because they are added
with a nobind parameter. The Unbound button is resized when the dialog box is
resized because it is added to the dialog box using a bind parameter.
The following figure shows the dialog box when the placement of the components is
changed according to the parameters indicated in the figure. The behavior of the
dialog boxes when resized is also shown.

PLM00075 H Client Customization Programmer’s Guide 3-229


Chapter 3 Rich client customization

Horizontal layout with components added


When you resize dialog boxes, components added with the bind parameter are
resized.
In the following figure, the Left and Unbound buttons are added with a bind
parameter and the Right button is added with a nobind parameter. When the dialog
box is resized, the Left and Unbound buttons are resized, but the Right button
maintains its size and alignment.

3-230 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Horizontal layout with components added


In addition to controlling the placement of the components within the dialog box,
the LayoutManager component controls the spacing of the components relative to
the edges of the dialog box by passing the parameters into the constructor for the
LayoutManager component. The order in which the parameters are passed into
the constructor is important. The constructor is as follows:
new HorizontalLayout ( vgap, lm, rm, tm, bm);

vgap indicates the distance between the components in the dialog box. lm indicates
the left margin, rm indicates the right margin, tm indicates the top margin, and
bm indicates the bottom margin. All parameters are expressed in integers and
measured in pixels.
The following figure shows the dialog box that results when the following parameters
are passed to the constructor:
new HorizontalLayout (25, 10, 10, 25, 25);

The following figure also shows the behavior when the dialog box is resized. The
margins and spacing between components are maintained.

PLM00075 H Client Customization Programmer’s Guide 3-231


Chapter 3 Rich client customization

Horizontal layout with parameters


The following example shows the code used to create the previous examples:
public class testlayout extends JDialog
{
protected JButton one, two, three;
protected JPanel buttonPanel;
public testlayout( Frame parent, String title )
{
super ( parent, title, false );
buttonPanel = new JPanel();
buttonPanel.setLayout ( new HorizontalLayout(10,2,2,2,0));
one = new JButton ( "Left" );
two = new JButton ( "Right" );
three = new JButton ( "UnBound" );
buttonPanel.add ( "left.nobind.center.center", one );
buttonPanel.add ( "unbound.nobind.center.center", three );
buttonPanel.add ( "right.nobind.center.center", two );
this.add (buttonPanel);
this.pack ();
}
public static main void ( String [] args){
{
Frame f = new Frame ( "Horizontal Layout Test" );
f.resize ( 100,100 );
f.show();
testlayout d = new teslayout ( f, "AWT Layout Manager: Horizontal Layout" );
d.show();
}
}

The buttonPanel panel is created. The HorizontalLayout layout manager is used


and three buttons are created and added to the panel. The placement of the buttons
in each of the examples is determined by the parameters passed in the name field.

VerticalLayout

The VerticalLayout layout manager positions children and attachments vertically


in the container object.
Note
This component is a Swing class. Teamcenter is moving toward SWT/JFace as
the user interface toolkit and moving away from AWT and Swing. Siemens
PLM Software encourages you to customize Teamcenter using SWT/Jface
components. Siemens PLM Software will discontinue Swing/AWT support in
a future version.

3-232 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

When a component is added to the container object, the position of the component
is determined by the parameters passed in the name field. These parameters are
{Attachment.Binding.HorizontalAlignment.VerticalAlignment}. The default
positioning for a component added without correct formatting in the name field is
(top.center.center.bind). Top components are positioned first, followed by bottom
components and unbound components. If you do not call the add function with a
name string in the argument, an exception occurs.
The following figure shows the use of a VerticalLayout layout manager. The
placement of the components within the dialog box is determined by the parameters
passed into the name field.

Vertical layout with components added


The following figure shows the results of resizing the dialog box.

Results of resizing the dialog box


The code creates a new buttonPanel panel. The layout in the panel is set to
VerticalLayout with default parameters. Three buttons are created and added
to the panel. The top components are positioned first, followed by the bottom
components and unbound components. All the buttons are added to the panel with a
nobind parameter and placed in the center of the dialog box. When the dialog box is
resized, the Unbound button is resized, but the Top and Bottom components are not.

PLM00075 H Client Customization Programmer’s Guide 3-233


Chapter 3 Rich client customization

The following figure shows the layout of the components added with a bind
parameter. The Top and Unbound components are added with a bind parameter.
The Bottom component is added with a nobind parameter.

Horizontal layout with components added


The following figure shows the resizing behavior of the components added with a
bind parameter.

Results of resizing the dialog box


Upon resizing the dialog box, the unbound component is resized. The top
component, which is added with a bind parameter, remains attached to the edges
of the dialog box. The bottom component, added with a nobind parameter, does
not change.
The following figure shows the behavior of the dialog box when resized.

Results of resizing the dialog box


The following figure shows the layout of the dialog boxes when the components are
added with the parameters indicated in the figure.

3-234 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Vertical layout with components added


In addition to controlling the placement of components in the dialog box, the
LayoutManager component also controls the spacing of the components relative
to the edges of the dialog box. This is achieved by the parameters passed into the
LayoutManager constructor. The order in which the parameters are passed into
the constructor is important. The constructor is:
new VerticalLayout ( vgap, lm, rm, tm, bm);

vgap indicates the distance between the components in the dialog box. lm indicates
the left margin, rm indicates the right margin, tm indicates the top margin, and
bm indicates the bottom margin. All parameters are expressed in integers and
measured in pixels.
The following figure shows the dialog box layout when the following parameters
are passed to the constructor:
new VerticalLayout (25, 10, 10, 25, 25);

The behavior of the dialog box when resized is also shown in the following figure.
The dialog box maintains the margins and the spacing between the components
when resized.

Vertical layout with margin setup


The following figure shows the code used to create the previous examples:
public class testlayout extends JDialog
{

PLM00075 H Client Customization Programmer’s Guide 3-235


Chapter 3 Rich client customization

protected JButton one, two, three;


protected JPanel buttonPanel;
public testlayout( Frame parent, String title )
{
super ( parent, title, false );
buttonPanel = new JPanel();
buttonPanel.setLayout ( new VerticalLayout(10,2,2,2,0));
one = new JButton ( "Top" );
two = new JButton ( "UnBound" );
three = new JButton ( "Bottom" );
buttonPanel.add ( "top.nobind.center.center", one );
buttonPanel.add ( "unbound.nobind.center.center", two );
buttonPanel.add ( "bottom.nobind.center.center", three);
this.add (buttonPanel);
this.pack ();
}
public static void main ( String[] args ){
{
Frame f = new Frame ( "Vertical Layout Test" );
f.resize ( 100,100 );
f.show();
testlayout d = new testlayout ( f, "AWT Layout Manager: Vertical Layout" );
d.show();
}
}

PropertyLayout

The PropertyLayout layout manager positions children and attachments vertically


within the container object.
Note
This component is a Swing class. Teamcenter is moving toward SWT/JFace as
the user interface toolkit and moving away from AWT and Swing. Siemens
PLM Software encourages you to customize Teamcenter using SWT/Jface
components. Siemens PLM Software will discontinue Swing/AWT support in
a future version.

When a component is added to the container object, its position is determined by a


mask passed through the name field that describes how to position the component
and whether resizing of the component is desired. The parameters are Row,
Column, HorizontalAlignment, VerticalAlignment, HorizontalAttachment,
and VerticalAttachment. The default positioning for a component added without
correct formatting in the name field is 1.1.center.center.preferred.preferred.
The following figure shows the use of the PropertyLayout layout manager with
default parameters for each of the components.

Property layout with components added

3-236 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

The code creates a buttonPanel panel using the PropertyLayout layout manager.
Three buttons are created and added to the panel in three separate columns. When
resized, the placement and size of the components remain unchanged (as shown in
the following figure). The default positioning of the components in the dialog box is
1.1.center.center.preferred.preferred. Because the horizontal alignment and
vertical alignment parameters are set to preferred, the components are not resized
along with the dialog box.

Results of resizing the dialog box


The following figure shows the layout of a dialog box using the PropertyLayout
layout manager. The components are placed according to the parameters indicated
in the figure. Note that the HorizontalAttachment and VerticalAttachment
parameters are set to resizable.

Property layout with components added


The following figure shows the behavior when the dialog box is resized. All
components are resized except the component placed in the column 1, row 1 position.
The other components in the dialog box are resized both horizontally and vertically.

PLM00075 H Client Customization Programmer’s Guide 3-237


Chapter 3 Rich client customization

Results of resizing the dialog box


In addition to controlling the placement of components in the dialog box, the
LayoutManager component controls the spacing of the components relative to
the edges of the dialog box. This is achieved by the parameters passed into the
constructor. The order in which the parameters are passed into the constructor is
important. The constructor is as follows:
new PropertyLayout ( hgap, vgap, lm, rm, tm, bm);

hgap indicates the horizontal distance between components in the dialog box. vgap
indicates the vertical distance between components in the dialog box. lm indicates
the left margin, rm indicates the right margin, tm indicates the top margin, and
bm indicates the bottom margin. All parameters are expressed in integers and
measured in pixels. The components are added to the dialog box horizontally, that is,
they are placed on the dialog box in the same row but in different columns.
The following figure shows the dialog box that results from passing the following
parameters to the constructor:
new PropertyLayout (10, 20, 10, 10, 40, 40);

The following figure also shows the behavior when the dialog box is resized. Only
the left and top margins and spacing between components are maintained when
the dialog box is resized.

PropertyLayout Manager with margin setup


The following figure shows a dialog box in which the components are only resizable
vertically. The HorizontalAttachment parameter is set to preferred. The buttons
in the figure do not seem aligned due to the positions selected for their placement.

3-238 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Results of resizing the dialog box


The following figure shows a dialog box in which the components are only resizable
vertically. The HorizontalAttachment parameter is set to preferred.

Results of resizing the dialog box


The following example shows the code used to create the previous examples:
public class testlayout extends JDialog
{
protected JButton one, two, three;
protected JPanel buttonPanel;
public testlayout( Frame parent, String title )
{
super ( parent, title, false );
buttonPanel = new JPanel();
buttonPanel.setLayout ( new PropertyLayout());
one = new JButton ( "Top" );
two = new JButton ( "Bottom" );
three = new JButton ( "UnBound" );
buttonPanel.add ( "1.1 ", one );
buttonPanel.add ( "1.2", two );
buttonPanel.add ( "1.3", three );
this.getContentPane().add (buttonPanel);
this.pack ();
}
public static void main ( String[] args ){
{
Frame f = new Frame ( "Vertical Layout Test" );
f.show();
testlayout d = new testlayout ( f, "AWT Layout Manager: Vertical Layout" );

PLM00075 H Client Customization Programmer’s Guide 3-239


Chapter 3 Rich client customization

d.show();
}
}

MessageBox
The MessageBox class communicates informational, warning, working, and error
messages to the user (as shown in the following figure).

MessageBox
The MessageBox class is a specialized JDialog class that provides the ability
to create and display a wide variety of message boxes to the user. Examples of
the information that appears in message boxes include help, detailed messages,
and general messages with icons that are set based on the type of MessageBox
component.
The following example shows code used to create a MessageBox component:
JFrame frm = new JFrame();
JPanel displayPanel = new JPanel(new BorderLayout());
JButton invokeButton = new JButton("Invoke MessageBox");
final MessageBox msgBox = new MessageBox(frm, "Some Message", "Title", MessageBox.ERROR);
displayPanel.add("Center", invokeButton);
frm.getContentPane().add(displayPanel);
invokeButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
msgBox.setVisible(true);
}
} );
frm.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
} );
frm.pack();
frm.validate();
frm.setVisible(true);

The following figure shows the message box produced by the code.

MessageBox produced from sample code

3-240 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

MLabel

The MLabel component displays text on multiple lines (as shown in the following
figure). The current AWT label and JLabel components are only capable of
displaying one line of text. The backslash and n character (\n) delimit the lines of
text.

MLabel component
The code in the following example constructs an MLabel component:
int fontSize = getFont().getSize();
Font fontText = new Font("TimesRoman", Font.PLAIN, fontSize+4);
Font f2 = new Font("TimesRoman", Font.BOLD, fontSize+32);
MLabel labelBanner = new MLabel(“TC Portal\nDesktop”);
labelBanner.setFont(f2);
labelBanner.setTextAlignment(MLabel.CENTER);
MLabel labelVersion = new MLabel(“Version 6.0\nUpdate version: 0”);
labelVersion.setFont(fontText);
labelVersion.setTextAlignment(MLabel.CENTER);

The following figure shows the results of the code.

PLM00075 H Client Customization Programmer’s Guide 3-241


Chapter 3 Rich client customization

MLabel component produced from sample code

Registry

The Registry class contains registry information and provides a means of obtaining
information stored in a resource bundle, extending the functionality of the resource
bundle by way of encapsulation. This class provides the ability to native data types
and instance classes via key registry entries. The registry files must match the
package name.
The following code shows an example of a registry file.
# comments
import=com.teamcenter.rac.util
myLabel=My Label:
myIcon=images\myIcon.gif
ok=OK
ok.MNEMONIC=O
cancel=Cancel
cancel.MNEMONIC=C

The import statement in the preceding figure imports another registry file. It can
also import multiple files using a comma delimiter. The following figure shows the
hierarchy of the registry files in the com.teamcenter.rac.util package.

3-242 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Hierarchy of the com.teamcenter.rac.util package


The keys and values inside the util_user.properties file override those defined in
the util_locale.properties and util.properties files. The locale version property
files are provided for localization and the user property files are provided so that
users can define their own values. If no user version is defined, the default values in
the util.properties file are used.
References to Registry objects are obtained by the getRegistry() static methods
provided in this class (as shown in the following code example):
Registry reg = Registry.getRegistry ( this );
String label = reg.getString ( “myLabel” );
ImageIcon myIcon = reg.getImageIcon ( “myIcon” );
The following is the corresponding registry file read by the above code:
# comments
import=com.teamcenter.rac.util
myLabel=My Label:
myIcon=images\myIcon.gif
ok=OK
ok.MNEMONIC=O
cancel=Cancel
cancel.MNEMONIC=C

PLM00075 H Client Customization Programmer’s Guide 3-243


Chapter 3 Rich client customization

Separator
The Separator component visually separates user interface components (as shown
in the following figure). Separators can be oriented either horizontally or vertically.

Separator in New Item dialog box

1 Separator used to separate dialog box header from the body


2 Separator used to separate dialog box footer from the body

The code in the following example uses the Separator component:


import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import com.teamcenter.rac.util.*;
public class SepartorTest extends JPanel
{
SepartorTest ()
{
this.setLayout ( new VerticalLayout(10,4,4,4,4) );
JLabel label = new JLabel ( "Test" );
JTextArea text = new JTextArea ( 10, 3 );
JButton okButton = new JButton ( "OK" );
this.add ("top.nobind.left.top", label);
this.add ("top.bind", new Separator());
this.add ("bottom.nobind.center.center", okButton);
this.add ("bottom.bind", new Separator());
this.add ("unbound.bind", text);
}
public static void main(String s[])
{
WindowListener l = new WindowAdapter()
{
public void windowClosing(WindowEvent e) {System.exit(0);}
};
Frame f = new Frame("Separator Test");
f.addWindowListener(l);
f.add("Center", new SepartorTest());
f.pack();

3-244 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

f.setSize(new Dimension(350,350));
f.show();
}
}

The following figure shows the results of the code.

Separator produced from sample code

SplitPane

The SplitPane component is similar to the JSplitPane component. It extends


from the JPanel component and creates a split pane with two panels: either left
and right, or top and bottom.
Note
This component is a Swing class. Teamcenter is moving toward SWT/JFace as
the user interface toolkit and moving away from AWT and Swing. Siemens
PLM Software encourages you to customize Teamcenter using SWT/Jface
components. Siemens PLM Software will discontinue Swing/AWT support in
a future version.

The code in the following example creates the SplitPane component. It adds two
components, one for the left pane and one for right. The divider is set at 45 percent
of the total size of the SplitPane component.
SplitPane splitPane = new SplitPane ( SplitPane.HORIZONTAL_SPLIT );
JPanel leftPanel = new JPanel ();
JPanel rightPanel = new JPanel ();
// add components to splitPane
splitPane.setLeftComponent ( leftPanel );
splitPane.setRightComponent ( rightPanel );
splitPane.setDividerLocation(0.45);
splitPane.setDividerSize(2);

The following figure shows the pane produced by the code.

PLM00075 H Client Customization Programmer’s Guide 3-245


Chapter 3 Rich client customization

SplitPane component used in a dialog box

StringViewerDialog
The StringViewerDialog class loads a string array and displays text in a scrollable
format. This class extends from the AbstractDialog class. The dialog box allows
you to save and print the string array text and can also act as a simple text editor. In
the following figure, the entire panel is a StringViewerDialog component.

StringViewerDialog component
The code in the following example creates a StringViewerDialog component.
StringViewerDialog dlg = new StringViewerDialog (file);
dlg.setVisible(true);

StringViewerPanel
The StringViewerPanel component displays a text file or string array using a
JTextArea component to store and render the text. A scroll pane ID handles text
scrolling. The StringViewerPanel component serves as both a simple text editor
and a file viewer and supports print and saving files.
The following figure shows the Validation report, constructed using the
StringViewerPanel component.

3-246 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Validation report
The code in the following example creates a StringViewerPanel component:
private StringViewerPanel stringViewerPanel = null;
stringViewerPanel = new StringViewerPanel(file);
parentPanel.add ( "unbound.bind.center.top", stringViewerPanel );

Common Teamcenter command IDs


You can use Teamcenter command IDs to override rich client menu commands and
toolbar commands. You can also use these same IDs to tailor XML style sheets to
change the appearance of various form displays.
For more information about overriding commands, see Override Teamcenter
commands.
You can find these IDs inside the Teamcenter JAR files, but they are not easy to
locate. The following tables collect the IDs in one place so you do not have to parse
multiple XML files searching for them.

→New menu commands


My Teamcenter File→
Menu command Command ID
File→New→Item com.teamcenter.rac.newItem
File→New→Folder com.teamcenter.rac.newFolder
File→New→Form com.teamcenter.rac.newForm
File→New→Dataset com.teamcenter.rac.newDataset
File→New→URL com.teamcenter.rac.newURL
File→New→ID com.teamcenter.rac.newAlternateId
File→New→Item Element com.teamcenter.rac.newGDE
File→New→BOM View Revision com.teamcenter.rac.newBVR
File→New→Structure Context com.teamcenter.rac.newSC
File→New→Configuration Context com.teamcenter.rac.newConfigContext
File→New→Collaboration Context com.teamcenter.rac.newCC
File→New→Work Context com.teamcenter.rac.WorkContext
File→New→Interface Definition com.teamcenter.rac.newInterfaceGDE
File→New→Process Variable com.teamcenter.rac.newPVariable

PLM00075 H Client Customization Programmer’s Guide 3-247


Chapter 3 Rich client customization

→New menu commands


My Teamcenter File→
Menu command Command ID
File→New→Signal com.teamcenter.racnewSignal.
File→New→Workflow Process com.teamcenter.rac.newProcess
File→New→Envelope com.teamcenter.rac.newEnvelope
File→New→Part com.teamcenter.rac.newPart
File→New→Design com.teamcenter.rac.newDesign
File→New→CAE Item com.teamcenter.rac.newCAEItem
File→New→Other com.teamcenter.rac.newBO

→Edit menu commands


My Teamcenter File→
Menu command Command ID
File→Edit→Cut org.eclipse.ui.edit.cut
File→Edit→Copy org.eclipse.ui.edit.copy
File→Edit→Copy Workflow com.teamcenter.rac.copyProcess
Process
File→Edit→Paste org.eclipse.ui.edit.paste
File→Edit→Properties com.teamcenter.rac.checkoutProperties
File→Edit→Delete org.eclipse.ui.edit.delete
File→Edit→Purge com.teamcenter.rac.purge
File→Edit→Make Immune com.teamcenter.rac.makeImmune
File→Edit→Remove Immunity com.teamcenter.rac.removeImmunity
File→Edit→User Setting com.teamcenter.rac.userSetting
File→Edit→Options com.teamcenter.rac.preferences
File→Edit→Change Ownership com.teamcenter.rac.changeOwnership
File→Edit→Parametric com.teamcenter.rac.customNotes
Requirement→Custom Note

Plug-in locations of perspectives


The following table lists plug-ins that define perspectives in the rich client. If
you want to customize rich client perspectives, look for these plug-ins in the
TC_ROOT\portal\plugins directory. The perspectives are declared in the
plug-ins with the org.eclipse.ui.perspectiveExtensions extension point in the
plugin.xml file.
To hide perspectives, you can use the HiddenPerspectives preference.
For more information about this preference, see the Preferences and Environment
Variables Reference. For more information about perspectives, see the Rich Client
Interface Guide.

3-248 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Plug-in locations of perspectives


Perspective Plug-in
Access Manager com.teamcenter.rac.accessmanager
ADA License com.teamcenter.rac.adalicense
Appearance Configuration com.teamcenter.rac.appearanceconfiguration
As-Built Manager com.teamcenter.rac.asbuiltmanager
Audit Manager com.teamcenter.rac.auditmanager
Authorization com.teamcenter.rac.authorization
CAE Manager com.teamcenter.rac.caese
CAE Structure Designer com.teamcenter.rac.smb
Change Manager com.teamcenter.rac.cm
Classification com.teamcenter.rac.classification.icm
Classification com.teamcenter.rac.classification.icadmin
Administration
CM Viewer (Classic) com.teamcenter.rac.ecmanagement
Command Suppression com.teamcenter.rac.commandsupporession
Database Utilities com.teamcenter.rac.databaseutilities
DesignContext com.teamcenter.rac.designcontext
DPV Measurements com.teamcenter.rac.dpv
Getting Started com.teamcenter.rac.aifrcp
Issue Manager com.teamcenter.rac.issuemanager
Launch Pad com.teamcenter.rac.launchpad
Lifecycle Viewer com.teamcenter.rac.vis
Manufacturing Process com.teamcenter.rac.cme.mpp
Planner
Multi-Structure Manager com.teamcenter.rac.cme.collaborationcontext
My Teamcenter com.teamcenter.rac.ui
My Teamcenter (2007) com.teamcenter.rac.explorer
Organization com.teamcenter.rac.organization
Part Planner com.teamcenter.rac.cme.pmp
Plant Designer com.teamcenter.rac.cme.fse
Platform Designer com.teamcenter.rac.architecturemodeler
PLM XML Export Import com.teamcenter.rac.plmxmlexportimportadministration
Administration
Project com.teamcenter.rac.project
Query Builder com.teamcenter.rac.querybuilder
Registry Editor com.teamcenter.rac.aif.registryeditor

PLM00075 H Client Customization Programmer’s Guide 3-249


Chapter 3 Rich client customization

Plug-in locations of perspectives


Perspective Plug-in
Relation Browser com.teamcenter.rac.tcgrb
Report Builder com.teamcenter.rac.crf
Report Generator com.teamcenter.rac.cme.cmereport
Systems Engineering com.teamcenter.rac.requirementsmanager.win.embeddedword
Resource Manager com.teamcenter.rac.cme.mrm
Schedule Manager com.teamcenter.rac.schedule
Service Manager com.teamcenter.rac.servicemanager
Service Planner com.teamcenter.rac.serviceplanner
Setup Wizard com.teamcenter.rac.setupwizard
Structure Manager com.teamcenter.rac.pse
Subscription Monitor com.teamcenter.rac.subscriptionmonitor
Validation Manager com.teamcenter.rac.validation
Volume Management com.teamcenter.rac.vm
Web Browser com.teamcenter.rac.aifrcp
Workflow Designer com.teamcenter.rac.workflow.processdesigner
Workflow Viewer com.teamcenter.rac.workflow.processviewer

Application Integration Framework (AIF)


In versions prior to Teamcenter 2007, the rich client ran on its own Application
Integration Framework (AIF). The AIF and rich client were both written using Java.
The rich client used Swing for its user interface and all customization mechanisms
were Teamcenter-developed.
Note
Teamcenter still supports the AIF in the Eclipse RCP. However, you should
make every effort to migrate your customization to use the Eclipse RCP menu,
toolbar, and status bar functionality.

In Teamcenter 2007, the rich client was hosted within the Eclipse rich client platform
(RCP) framework. The RCP is a general purpose application framework that
provides strong support for modular and extensible component-based development
through the use of plug-ins. The rich client took limited advantage of the Eclipse
framework. There was a single Teamcenter perspective that all Teamcenter
applications used. The user interface was mostly Swing running with the aid of
the SWT_AWT bridge.
Starting with Teamcenter 8, the rich client took advantage of many Eclipse features
and introduced many SWT-based controls. Some of the rich client changes include:
• Each application became its own perspective.

• Menus were declarative.

3-250 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

• Eclipse OSGi services were used.

• Many Teamcenter extension points, services, and SWT controls were added.

AIF customization and development


In versions prior to Teamcenter 2007, the Application Integration Framework (AIF)
was an integration framework that enabled developers and customers to build
custom interfaces to applications for Teamcenter, NX, and personal use.
This framework provided the foundation through which applications could be
launched and executed in a standard manner. It also provided the basic design for
applications, the base classes and methods, and a methodology for creating and
handling events generated by the user interface. In addition, the AIF provided tools
to handled the registration of components, represented by JavaBeans, as well as a
mechanism for locating and passing messages to those components.
This framework allowed products to be built using a standard interface and
methodology. It was modular and dynamic with regard to how applications were
registered and launched, allowing applications to be written in a plug-and-play
manner and to be released independently of the framework. Applications could
be independent of both Teamcenter and NX, but the framework provided simple
mechanisms to use Teamcenter as the primary data management system.
The AIFDesktop component provided the main window users interacted with
during the course of their session.

Integrating the Application Integration Framework (AIF) desktop with the Eclipse
workbench
If you have older AIF desktop customizations, you can integrate them with the
newer Eclipse RCP. However, although Teamcenter still supports the AIF in the
Eclipse RCP, you should make every effort to migrate your customization to use the
Eclipse RCP menu, toolbar, and status bar functionality.
In the rich client, the main integration point is an application. The active
application defines what is showing and its layout in the main pane area. The
current application controls the contents of the main menu bar and toolbar. The
navigation pane is always on and helps you to select the current application. In the
rich client, there is a main banner that identifies the current application and how
to switch between active applications. The main mechanism for defining the set of
applications has been the portal.properties file. This file is still supported and is
augmented by the aif_application extension point. The extension point supports
three different types of scenarios:
• Adding new traditional or legacy-based applications without modifying the
portal.properties file.

• Adding new pure SWT-based applications.


For more information about how pure SWT user interface components work
together in a workbench, see the following Web site:

http://www.eclipse.org/articles/Article-UI-Workbench/workbench.html

• Adding hybrid applications or defining existing legacy applications to be


hybrid to allow Swing-based user interface components from within an Eclipse

PLM00075 H Client Customization Programmer’s Guide 3-251


Chapter 3 Rich client customization

perspective that can also manage pure SWT-based user interface components
simultaneously. Though these components can co-exist, there is no additional
infrastructure for these different user interface components to collaborate.

The rich client desktop is built on top of the Eclipse RCP workbench, including
the menubar, toolbar, and status bar. The RCP workbench is augmented with
additional shell trim that defines the main application switcher/banner bar and
the navigation pane. The remaining area is the current active Eclipse perspective.
By default, there is a simple Teamcenter perspective that simply holds a tabbed
stack of views. Each rich client application is forced to be associated with an
Eclipse perspective. Whenever a rich client application is activated, the associated
Eclipse perspective is made active. By default, an application is associated with the
Teamcenter perspective so legacy applications are not forced to define a perspective
to be associated with. If any application also contains a non-null main Swing JPanel,
that panel is wrapped in an AWT_SWT bridge view and placed in the stack of views.
Since each rich client application is associated with an Eclipse perspective, you
might want to read more about what an Eclipse perspective is.
For more information, see the following Web site:
http://www.eclipse.org/articles/using-perspectives/PerspectiveArticle.html

Context sensitivity

The AIF supports the concept of context sensitivity for all UI components. Context
sensitivity is controlling the availability of UI components when certain conditions or
states exist. In some cases, context sensitivity can be confusing to the user because
he or she may not know what to do to activate an option. One of the techniques
currently used to solve this is to change the tooltip text.
The model for the context sensitivity system is tied to the application where the
action appears. There is a selection listener associated with the application such
that when something is selected within the application, the application notifies
all listeners that a selection is changed. The idea behind this model is that the
application fires the event to all listeners and each UI component has an associated
handler that knows the UI component it is working for. The handler contains the
logic that determines the validity of the UI component with which it is associated.
In basic terms, the handler typically sets a component to disabled (setEnabled
(false)). However, the handler is flexible and is designed to allow any action to
be taken upon the associated UI component. For example, instead of disabling a
component you may want to write a handler that sets a UI component visibility
based upon a certain state. The handler interrogates the application for the state,
and based on the result invokes the UI components setVisible() method. The
handler simply implements one method. That method is responsible for making the
verdict and applying the appropriate action to the UI component.

3-252 Client Customization Programmer’s Guide PLM00075 H


Rich client customization

Context Sensitivity object model

Registration
The registration process is where the application, handler, and UI component are
bound together based on the context sensitivity object model. Each application
maintains a list of handlers (listeners) that are notified whenever a selection is
made within the application.
To register a handler (listener) with an application, invoke the following:
// c is an instance of a Component
MyHandler h = new MyHandler ( c );
app.addSelectionListener ( h );

This is typically done within the menu bar and toolbar construction. This can also be
done within the application panel construction for components located there.
There is a special implementation for Teamcenter applications that utilizes the
action system for the menu bar and toolbar. Register your handler within the
actions.properties file, and it is automatically used with the associated command.
Therefore, to register the simple RequiredSelectionHandler handler, which is
prepackaged for use, add it to your action definition within the actions.properties
file, as follows:
<yourCommand>.SELECTION_HANDLER=
com.teamcenter.rac.aif.common.contextsensitivity.RequiredSelectionHandler

No other registration is required for the command. When the selections change
within the application, your command is available only when something is selected.
If nothing is selected, it is not available.
If you want to keep components within the toolbar and menu bar synchronized like a
state selection, you can use this mechanism by manually triggering the selection
event and having your handlers refer to a class variable within the application for
the state. The system is written generically so that it can handle a variety of cases.

Write a handler
Base AIF provides the framework for context sensitivity as well as one implemented
handler, RequiredSelectionHandler. The RequiredSelectionHandler handler
looks at the given application, and if one or more components are selected, the

PLM00075 H Client Customization Programmer’s Guide 3-253


Chapter 3 Rich client customization

associated components are enabled. Otherwise, the component is disabled. This is


enabled for many actions that currently appear within the menu bar and toolbar,
more notably the cut, copy, and paste actions.
Use the following steps to write your own handler:
1. Write a class that subclasses the AbstractAIFContextSensitivityHandler
class.

2. Provide the implementation method within the class public void


componentSelected (SelectionEvent e). The implementation of the
componentSelection() class interrogates the application to get the desired data
and takes the appropriate action, such as checking the number of components
selected within the application and setting the state of the component. The
following code shows the source for the RequiredSelectionHandler handler:
public class RequiredSelectionHandler extends
AbstractAIFContextSensitivityHandler
implements AIFComponentSelectionListener
{
public RequiredSelectionHandler ( Component cmp )
{
super ( cmp );
}
public void componentSelected ( AIFComponentSelectionEvent e )
{
AbstractAIFUIApplication a = e.getApplication();
Component c = getComponent();
if ( a.getTargetContexts() != null )
{
c.setEnabled ( true );
}
else
{
c.setEnabled (false );
}
}
}

3. Register your handler with the action by either adding to the registry or
manually registering it within the UI parent in which it is contained (menu
bar, toolbar, panel).

To manually initiate the firing of a selection event, invoke the fireSelectionEvent()


method within the application (a.fireSelectionEvent()).

3-254 Client Customization Programmer’s Guide PLM00075 H


Chapter

4 Thin client customization

Thin client customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1

Generating a thin client page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1


Choosing the menu command and displaying the dialog box . . . . . . . . . . . 4-2
Submitting the data and submitting the Web request . . . . . . . . . . . . . . . . 4-4
Processing on the Teamcenter server . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
Receiving the response and displaying feedback . . . . . . . . . . . . . . . . . . . . 4-6

Basic customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6


Top-level pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
Directory structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
Customization recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
Deploying changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
Change static files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Change dynamic files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Setting default options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Options user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Cascading style sheets (CSS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11
Menu system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13
Modifying menu commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14
Customizing menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
Change the business objects displayed in the New menu . . . . . . . . . . . 4-15
Adding and modifying business object icons in the thin client . . . . . . . . . . 4-16
Configuration settings in the user interface . . . . . . . . . . . . . . . . . . . . . . . 4-17

Customizing forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-18


Altering form content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-21
Custom form override mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-21
Overriding parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-21
Custom form override example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-24
Customize property names in the user interface . . . . . . . . . . . . . . . . . . . . 4-27

Customizing Teamcenter with TcScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-27


Write TcScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-27
Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-30
Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-30
Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-31
System constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-31
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-31
Reserved variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-32
Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-32
String operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-32
Integer operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-32

PLM00075 H Client Customization Programmer’s Guide


Array operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-33
LENGTH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-33
REVERSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-33
SORT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-33
SPLICE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-34
Accessing Teamcenter data with TcScript . . . . . . . . . . . . . . . . . . . . . . . . 4-34
Calling ITK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-35
Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-35
Writing specialized ITKs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-35
LOG function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-36
Work with the user exits sample file . . . . . . . . . . . . . . . . . . . . . . . . . 4-36
Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-36
for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-36
if . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-37
include . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-38
def/enddef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-38
Error handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-38
TcScript syntax errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-39
Teamcenter errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-39
ERRORS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-39
CLEARERRORS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-39
Property error table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-40
Useful helper functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-40
car . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-40
Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-40
contains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-41
ErrorStack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-41
HTMLDefaultHeader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-41
HTMLErrorStack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-42
imanText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-42
Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-42
Preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-43
quote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-43
quoteImanText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-44
removeArrayElement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-44
replaceArrayElement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-44
replaceChar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-45
replaceString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-45
SetPreference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-46
SinglePreference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-46
startsWith . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-47
throwIfErrorNot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-47
throwIfErrorNotArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-48
tokenize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-48
XMLDefaultHeader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-49

Client Customization Programmer’s Guide PLM00075 H


Chapter

4 Thin client customization

Thin client customization


The Teamcenter thin client is based on a client-server architecture. Both the client
and server layers can be customized. The client is the user interface (UI) layer and
can be customized using JavaScript and other methods. The server layer can be
customized using many methods, including TcScript, the Integration Toolkit (ITK),
and the C++ programming language.
To fully understand the inner workings of the thin client for large-scale
customizations, you should explore the code. The standard, mainstream methods
and paradigms employed by the thin client are covered in this guide, but there are
many exception cases where one or more standard practices have been substituted
with an alternate approach to achieve an alternate result. If the standard interfaces
documented here do not cover your special case, your knowledge of the existing user
interface is invaluable. Try identifying a similar special case in the user interface
and tracing how it works.

Generating a thin client page


This detailed process shows the end-to-end flow of a typical request/response
transaction in the Teamcenter thin client:
1. The user chooses a menu command.
For more information, see Choosing the menu command and displaying the
dialog box.

2. A dialog box is instantiated for user input.

3. The user enters data in the dialog box and submits it by clicking either the OK
or Apply button.
For more information, see Submitting the data and submitting the Web request.

4. A server-side request is initiated.


For more information, see Processing on the Teamcenter server.

5. The selected action is performed.

6. The results are displayed as feedback to the user.


For more information, see Receiving the response and displaying feedback.

For example, if the user creates a new folder, the process is:

PLM00075 H Client Customization Programmer’s Guide 4-1


Chapter 4 Thin client customization

1. The user chooses New→Folder in My Teamcenter.

2. The New Folder dialog box appears.

3. The user types a name and a description for the folder, selects a type from the
list, and clicks OK.

4. A request to the server is generated that includes the data from the dialog box
and the appropriate insertion point.

5. The new folder is created on the server and attached using ITK.

6. An XML response is returned from the server with either the data to insert the
new folder in the user interface or an error message.

If you review the flow of this typical example, it helps you understand how the thin
client works. You can follow this example in detail to see how the infrastructure
components work together to implement this behavior.

Choosing the menu command and displaying the dialog box


To see the association between the menu entry and the JavaScript, see the following
example:
<menuentry title="Folder..." key="newFolderAction"
url="javascript:popupNewFolderDialog();"
image="teamcenter/dhtml/icons/folder.png">
</menuentry>

Note that menu commands can execute arbitrary JavaScript. The menu XML is
delivered to the client and rendered as HTML with the JavaScript action attached.
In this case, the popupNewFolderDialog() function is called when the user
chooses the New→Folder menu command.
Note
Most menu entries are defined in the XML files, but the
New menu entries are the exception. The New menu items
are read from the WEB_displayed_new_menu_objects
preference, as shown by the following code in the line in the
staging_location\webapp_root\teamcenter\dhtml\common\
intl\language\wsomenu.xml file:
<menu type="new" title="New">
<menu type="NewmenuPlaceHolder" desc="Placeholder for menu entries of
WEB_displayed_new_menu_objects preference"></menu>

The menu XML is delivered to the client and rendered as HTML with a
JavaScript action attached. In this case, the popupNewFolderDialog()
function is called when the user chooses the New→Folder menu command.

The popupNewFolderDialog() function is based on a standard


dialog box invocation template function that is used in many places.
It maintains a single dialog box instance; it is not useful to have
more than one open New Folder dialog box at a time. In the
staging_location\webapp_root\teamcenter\dhtml\apps\dialogs\new.js file
(shown in the following code sample), a global variable tracks the existence of the
New Folder dialog box.

4-2 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

// new folder dialog is a singleton


var globalNewFolderDialog = null;

function popupNewFolderDialog( context )


{
var selcon = checkSelCon( context );
var form;
var browserName=getBrowserName();

if( checkDialogReset( selcon, globalNewFolderDialog ) )


{
if(browserName == "IE")
{
form = newfolderform.XMLDocument.documentElement;
}
else if(browserName == "Netscape")
{
form=getFormByName(getString("web_newfolder_title"));
}

globalNewFolderDialog = createActionDialog( form,


"common/actions/newfolder.xml",
selcon, // take selection?
true ); // have apply button
}
globalNewFolderDialog.popup();
}

If the dialog box already exists, the code displays it instead of creating a new
one. The dialog box is implemented using Teamcenter actionDialog code. The
actionDialog code generates a generically abstracted dialog box that incorporates
behaviors used by many Teamcenter dialog boxes, so the code needed to create an
instance of the dialog box is terse.
The description of the form itself is in the form renderer XML format required for
the actionDialog code. The XML data is held within a data island in the HTML
page structure. Many dialogs boxes take a server trip to assemble the appropriate
form (dynamic dialog boxes as opposed to static). This occurs if performance is an
issue (for example, the User Settings dialog box), or if Teamcenter suggests values
based on the selected object (for example, the New Process dialog box).
The following sample shows the generated XML form code:
<form name="New Folder">
<field name="name" displayname="Name" required="true" />
<field name="description" displayname="Description" />
</form>

The createActionDialog method takes this XML code as input and renders it as
HTML. The popupNewFolderDialog() function calls the popup method on the
dialog box instance. This displays the dialog box to the user.

PLM00075 H Client Customization Programmer’s Guide 4-3


Chapter 4 Thin client customization

New Folder dialog box

Submitting the data and submitting the Web request


After the user fills in the form and clicks OK, the actionCall function in the generic
actionDialog code is executed using the DHTML onclick event attached to the
OK button. The actionCall function builds a request URL based on the associated
action (the newfolder.xml file), the form input values, and the currently selected
object from the tree. The associated action was an argument to the actionDialog
code earlier; the form values are collected by the buildURL() method in the
staging_location\webapp_root\teamcenter\dhtml\common\formrenderer.js
file, and the currently selected object from the tree is taken using an interface to the
treeRenderer code. The request URL arguments look like the following:
tc_file=actions/newfolder.xml&_name=example&_description=&_type=Folder&parent_uid=
wcysT3taAAAMeC

The associated action argument specifies a given script to execute on the server. To
compare it to a function call, the newfolder.xml argument is similar to the API
function name; the rest of the URL is similar to the argument list. This creates a
request object suitable for submission to the XML loader.
Up to this point, all operations are on the client side. The XML loader is the module
that submits requests to the server. Teamcenter allows only a single logical request
to be active at a time with a blocking and queuing mechanism because Web users
prefer to avoid multiple requests, even though JavaScript is inherently threaded
and the Teamcenter pool manager can queue multiple requests and serialize them
on the server side.

4-4 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

Processing on the Teamcenter server


The HTTP server transmits a request to the Teamcenter pool manager. The pool
manager then queues the query until an available TcScript process is ready to accept
it. For more detailed information, see Getting Started with Customization.
The tcserver process executes the newfolder.xml script, calling ITK
as appropriate, to create the new folder and to attach it to its specified
parent. There are several ITK functions needed to create and save a folder,
including the FL_create function. You can see the actual script in the
TC_ROOT\web\htdocs\tc\common\actions\newfolder.xml file. If an error
occurs during the script processing, an exception is thrown and a POM rollback
occurs to maintain the all-or-nothing transactionality.
Depending on the result, the script outputs either an XML refresh message or an
XML error stack to the client. When creating a folder, the refresh message format
is refresh this parent object and insert this new folder. The first message ensures
that the last modified dates and users are synchronized. The following code sample
shows a typical success response:
<?xml version="1.0" encoding="iso-8859-1"?>
<update>
<refresh>
<line tag="wcysT3taAAAMeC " name="Home" link="/tc/webclient/wcysT3taAAAMeC" type="Folder"
class="Folder">
<prop name="actions"/>
<prop name="object_type">Folder</prop>
<prop name="owning_user" link="/tc/webclient/Q_wsTuYwAAAMeC" class="User">phin</prop>
<prop name="owning_group" link="/tc/webclient/Qc9YS80iAAAMeC" class="Group">
MyLocation.MyDepartment.TC.P&O.MyCompany</prop>
<prop name="last_mod_date">02-Nov-2008 11:13</prop>
<prop name="checked_out"></prop>
<prop name="release_status_list"></prop>
<children type="Folder" link="/tc/webclient/ wcysT3taAAAMeC?TC_file=data/wsochildren.xml"/>
<children type="WhereReferenced" link="/tc/webclient/ wcysT3taAAAMeC?
TC_file=data/wherereferenced.xml"/>
</line>
</refresh>
<insert parent_uid="wcysT3taAAAMeC">
<line tag="A6$segTGAAAMeC" name="example" link="/tc/webclient/A6$segTGAAAMeC" type="Folder"
class="Folder">
<prop name="actions"/>
<prop name="object_type">Folder</prop>
<prop name="relation"/><prop name="object_desc"></prop>
<prop name="owning_user" link="/tc/webclient/Q_wsTuYwAAAMeC" class="User">phin</prop>
<prop name="owning_group" link="/tc/webclient/Qc9YS80iAAAMeC" class="Group">
MyLocation.MyDepartment.TC.P&O.MyCompany</prop>
<prop name="last_mod_date">02-Nov-2008 11:13</prop>
<prop name="checked_out"></prop>
<prop name="release_status_list"></prop>
<children type="GRM" link="/tc/webclient/A6$segTGAAAMeC?TC_file=data/wsochildren.xml"/>
<children type="WhereUsed" link="/tc/webclient/A6$segTGAAAMeC?TC_file=data/whereused.xml"/>
<children type="WhereReferenced" link="/tc/webclient/A6$segTGAAAMeC?TC_file=
data/wherereferenced.xml"/>
</line>
</insert>
</update>

If the new folder cannot be created, an errorstack message is returned with the
XML code of the error stack.
After the message is sent, the server script completes and the TcScript process
signals its availability to perform another query.

PLM00075 H Client Customization Programmer’s Guide 4-5


Chapter 4 Thin client customization

Receiving the response and displaying feedback


When the message is received, a generic update callback specified by the
actionDialog code processes the XML, updates the parent folder, and
dynamically inserts the new folder into the DOM. For details, see the
staging_location\webapp_root\teamcenter\dhtml\common\update.js file.
For each type of update message, the appropriate action is performed. In the new
folder example, an insert message containing details of the new folder is received.
The new folder is inserted into the tree below the appropriate parent. In addition,
a refresh message is received that updates the parent line with any new data. If
the creation of the new folder fails, an errorstack message is received. This is
interpreted by the refresh callback, and an HTML alert dialog box is displayed to
the user with the errors.
If the user clicks OK, the dialog box closes on success. If there is an error, the
dialog box remains open so the user can correct the error. If the user clicks Apply,
the dialog box remains open.

Basic customization
Basic thin client customization tasks include customizing the menus, style sheets,
and icons.
Tip
A free Firefox add-on called Firebug is especially useful. The three most
useful features are:
• Net
View the HTTP requests and responses.

• Console
View the in-page XMLHTTPRequest (XHR) calls and the XML
responses.

• Script
Debug your JavaScript.

Top-level pages
Top-level pages are Teamcenter Web requests that are returned within an HTML
wrapper. Every Teamcenter Web application, such as My Teamcenter and Structure
Manager, has a top-level page that initializes the client. Most actions do not
depend on how the browser achieves this initial state. After the top-level page
loads, subsequent actions within the page, such as tree expansions and dialog box
instantiations, result in requests for XML that are handled within the page. The
initial HTML returned consists of the following:
• JavaScript files to cache on the client (client-side components)

• Small XML data islands

4-6 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

• Menu string data (user/group/role/version)

• Menu entry suppression data

• Special search menu data

• In-page JavaScript for rendering the current page from the Teamcenter data
XML

• XML menus

• A large XML data island containing the Teamcenter data to be rendered

• A small amount of HTML code to create the basic page structure

• Another data island containing the XML description of the static forms worth
caching on the client

To see the HTML code, view the browser source for one of the pages. Most HTML code
is generated by the TC_ROOT\web\htdocs\tc\common\head.ish file. If you
need to include common HTML elements across the entire HTML layout, add them
to the TC_ROOT\web\htdocs\tc\custom\custom_head.ish file. The in-page
JavaScript contains an onLoad() function initiated by the browser onLoad event.
This function renders the Teamcenter XML data island as displayable HTML code.

Directory structure
There are two kinds of files: static and dynamic.
Static files are consumed directly and cached by the browser. These include .js
files, image files (.gif, .jpg, and .png), some static .xml files for menus (all in
the intl directory), and .css files. You choose the thin client staging directory
(staging_location) during the J2EE Web tier installation.
For more information, see the Installation on Windows Servers Guide. You can
find JavaScript files in the subdirectories of the staging_location\webapp_root
directory.
For example, the formrender.js file is located in the
staging_location\webapp_root\teamcenter\dhtml\common directory. The
following table shows the directories that contain the various types of static files.

File type Directory


Style sheets webapp_root\teamcenter\dhtml\common\css
Common components (for webapp_root\teamcenter\dhtml\common
example, the renderers)
Common dialog code webapp_root\teamcenter\dhtml\apps\dialogs
Internationalized files and webapp_root\teamcenter\dhtml\common\intl\
menus language
Teamcenter type icons webapp_root\typeicons
Teamcenter icons webapp_root\teamcenter\dhtml\icons
Images webapp_root\teamcenter\dhtml\images

PLM00075 H Client Customization Programmer’s Guide 4-7


Chapter 4 Thin client customization

File type Directory


Custom JavaScript files webapp_root\teamcenter\dhtml\custom

Dynamic files are written in the TcScript language and interpreted at run time by
the tcserver process. They have .xml, .isx, .ish, .html, and .is extensions and
reside in the TC_ROOT\web\htdocs\tc directory. The directory for dynamic files
is created when Teamcenter is installed. The following table shows the directories
that contain the various types of dynamic files.

File type Directory


Application files TC_ROOT\web\htdocs\tc subdirectories
such as workspace, inbox, and pse
Common XML data retrieval TC_ROOT\web\htdocs\tc\common\data
scripts
Common XML action scripts TC_ROOT\web\htdocs\tc\common\actions
Application-specific XML data TC_ROOT\web\htdocs\tc\application\data
retrieval scripts
Application-specific XML action TC_ROOT\web\htdocs\tc\application\actions
scripts
Redirection scripts TC_ROOT\web\htdocs\tc\redirs

Customization recommendations
When customizing Teamcenter, put as much of your customization into the core code
and as little into the user interface as possible. If your installation uses multiple
interfaces, this minimizes duplication. Also, use simpler configuration and tailoring
techniques before using custom code.
Whenever possible, avoid making changes to existing source files. Instead,
create new custom JavaScript files for implementing new functionality under the
staging_location\webapp_root\teamcenter\dhtml\custom directory. When
including custom JavaScript files (for example, custom_form1.js), add them to the
TC_ROOT\web\htdocs\tc\custom\custom_head.ish file (shown in following
code sample) instead of the head.ish file:
print ’<script type="text/javascript"
src="teamcenter/dhtml/custom/custom_form1.js"></script>’ + NL

If you do this, you do not need to merge the old and new head.ish files when you
apply a maintenance patch or upgrade to a new version.

Deploying changes
In the thin client, files are either static or dynamic:
• Static files are deployed in the Web tier and are consumed directly and cached by
the browser. These files include JavaScript (.js), images (.png, .gif, .jpg), a few
static XMLs for menus under the intl directory, and cascading style sheets (.css).
To deploy static file changes to the thin client, regenerate the tc.ear file
using the Web Application Manager, and deploy the updated file to your Web
application server.

4-8 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

• Dynamic files are written in TcScript, used only on the server, and interpreted
at run time by the tcserver process. These files have .xml, .isx, .ish, .html,
and .is extensions.
To deploy dynamic file changes, restart your tcserver process to pick up changes.

Change static files


1. Change the .js files in the staging_location\webapp_root directory.

2. Regenerate the tc.ear file and deploy in the application server domain.

3. Clear your browser cache so the new version can be loaded.

Change dynamic files


1. Change the .xml, .isx, or .ish files in the TC_ROOT\web\htdocs\tc directory.

2. Restart your tcserver process to pick up changes. Either restart the pool
manager or log off Teamcenter and log on again. You can avoid this step by
setting the TC_WEB_NO_CACHE environment variable to TRUE.
For more information, see Customizing Teamcenter with TcScript.

Setting default options


Many options affect the behavior of the Teamcenter thin client. The details are
documented in the official help collection. The most useful of these options can be
set directly in the thin client with the Edit→Options menu command. Set the site
options before end users start modifying their personal options. Teamcenter sets
default options out-of-the-box, but you can change them to more appropriate settings
for your site.
For more information about setting and scoping preferences, see the Preferences
and Environment Variables Reference.
Note
Most Web-specific options begin with WEB_.

Options user interface


You can set user preferences directly in the thin client Options dialog box. They can
be set for a site, group, role, or user. If they are set directly in the user interface, they
only alter the logged-on user’s options.
For more details about the hierarchical nature of preferences, see the Preferences
and Environment Variables Reference.
The following table contains important preferences that affect the thin client.

Preference Definition
CR_allow_alternate_procedures Determines if only assigned processes are
permitted.
ECM_delivered_engine_status Defines the status used on delivered
engine changes.

PLM00075 H Client Customization Programmer’s Guide 4-9


Chapter 4 Thin client customization

Preference Definition
ECM_form_relation Specifies the relation by which EC forms
are attached to the EC.
EPM_adhoc_signoffs Enables or disables ad hoc signoff.
WEB_auto_assign_ds_id Determines if dataset IDs are
auto-assigned.
WEB_core_help_server Sets the URL location of the general
Teamcenter help collection; it is used
to create the Help→General Collection
menu command.
WEB_dataset_shown_relations Controls the contents displayed on the
Dataset page (for example, show reference
objects and show multiple file versions).
WEB_dataset_upload_mode Sets the default dataset upload mode for
the site. Set to 0 if the dataset does not
need to be checked out to upload a file to
it (auto-checkout). Set to 1 if the dataset
must be checked out explicitly to upload a
file to it.
WEB_default_site_server Specifies the address of the Web server; set
this to generate visualization bookmarks.
WEB_displayed_new_menu_objects Defines the list of items in the New menu.
WEB_help_server Defines the URL location of the
Teamcenter Web help collection; it is used
to create the Help→Web Collection menu
command.
WEB_max_search_results Sets the maximum number of results to
show in the search page.
WEB_processes Defines the EPM processes to be listed
from the Web (if not set, processes are not
filtered).
WEB_protocol Sets the protocol used by the Web server
(default is http:\\).

WEB_title_contents Defines the title bar formula.


WEB_type-name_default_relation Customizes the default paste relation by
type.

The following table contains important preference that affect visualization in the
thin client.

Preference Definition
SecondaryVMUDatasets Lists the non-VMU dataset types that could
contain VMU datasets.
VMU_Datasets Visualization dataset types that should be
launched using VMU.

4-10 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

Preference Definition
VMU_FileSearchOrder Defines the valid named reference types for
VMU datasets.

Cascading style sheets (CSS)


CSS is a W3C standard used to separate stylistic elements from data and other
display logic. The thin client uses CSS to package the display and style information
in one place. Changes to the style sheet are reflected across the entire application.
This makes applying a custom style to the thin client much easier and more portable.
You should become familiar with CSS basics.
Use cascading style sheets to design the thin client user interface (HTML
pages, dialog boxes, and forms). The files related to CSS are located in the
staging_location\webapp_root\teamcenter\dhtml\common\css directory.
If you create other style sheets, the WEB_style_sheet user preference
determines which one is used, and the WEB_style_sheet_list and
WEB_style_sheet_list_names preferences define the available style
sheets. To change the style sheet being used in the thin client, choose
Edit→Options→Advanced→Style Sheet, click the arrow in the Style Sheet box, and
select the style sheet, such as Teamcenter Default. The Teamcenter Default style
sheet corresponds to the tc.css style sheet file specified in the WEB_style_sheet
preference. To create a custom style sheet, modify the tc.css file and save it with
a different name.
There are three additional style sheets you can use to change the look of the thin
client user interface:
• siemens/skin.css
Defines the Siemens PLM Software look for the user interface.

• ui-core.css
Defines core widget styles, including styles for page header, layout, and
multicolumn support.

• yui-core.css
Defines core widget styles for fonts, grids, containers, resize components, data
tables, menus, layout manager, tab views, and tree views.

Common changes such as font sizes, colors, and background colors are achieved by
modifying the skin.css file. For example, the default style for the top menu bar
menus defined in the following code examples from the skin.css file:
.siemens-skin .yuimenuitemlabel {
color: #000000;
cursor: default;
font-size: 85%;
padding: 0 15px 0 7px;
text-decoration: none;

And:
.siemens-skin .yuimenu .bd
background-color: #EFEFEF;
border: 1px solid #808080;

PLM00075 H Client Customization Programmer’s Guide 4-11


Chapter 4 Thin client customization

The following figure shows the menu using the CSS in the previous code examples.

Default menu
To change the background color of the menu to red and to change the font, set the
style in CSS as shown in the following code examples:
.siemens-skin .yuimenuitemlabel {
color: #000000;
cursor: default;
font-size: 100%; // font size increased
font-weight: bold; //added style for bolder text
padding: 0 15px 0 7px;
text-decoration: none;

And:
.siemens-skin .yuimenu .bd
background-color: #DD6464; // changed to reddish
border: 1px solid #000000; //changed to black

4-12 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

Customized menu

Menu system
The menus and left-hand navigation (LHN) toolbar are configured using static XML
from the Web tier. The top menus retain the contextual actions (application or
selection context specific). There is one menu for each application or top-level page.
The LHN provides a consistent location for a simple set of context-free actions. The
LHN is consistent throughout the applications. There are three basic types of actions:
• Navigate to a new URL, either replacing the current page or opening a new
browser (for example, go to the Home folder).

• Open a dialog box (for example, create a new item).

• Execute an action within the current page (for example, clipboard actions).

The behavior of all three types may depend on the current selection within the tree,
though the default LHN actions generally do not. The menu XML files are in the
staging_location\webapp_root\teamcenter\dhtml\common\intl\language
directory. There is one LHN definition file (toolbar.xml) and one top-level menu
definitions file for each application (applicationmenu.xml). For example, the
following code from the wsomenu.xml file renders the menu in the following figure:
<menu type="Connection" title="Connection">
<menuentry ID="Revisable" title="Revisable..." key="newPSConnectionAction"
url="javascript:popupNewBusinessObject(’PSConnection’, true, false);"
image="teamcenter/dhtml/icons/PSConnection.png"/>
<menuentry ID="Non-Revisable" title="Non-Revisable..."
key="newGDELinkAction" url="javascript:popupNewBusinessObject(’GeneralDesignElementLink’,
true, true);" image="teamcenter/dhtml/icons/GeneralDesignElementLink.png"/>
</menu>

PLM00075 H Client Customization Programmer’s Guide 4-13


Chapter 4 Thin client customization

New Connection menu


The menuentry attributes are:
• title
Specifies the localized display name for the entry.

• key
Specifies the name used for menu entry suppression configuration.

• url
Specifies the URL or arbitrary section of JavaScript.

Note
The menu style is controlled by a CSS style sheet. The LHN uses different
tags with similar attributes in the toolbar.xml file.
For more information, see Cascading style sheets (CSS).
To deploy menu changes, regenerate the .ear or .war files.
For more information, see Deploying changes.

Modifying menu commands

To make changes across an entire site, you can manually add, remove,
or modify menu commands by editing the *menu.xml files in the
staging_location\webapp_root\teamcenter\dhtml\common\intl\language
directory.

4-14 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

The WEB_menu_entry_new_window preference controls which menu commands


are targeted to open in new browsers. You can further tune this setting using the
target attribute to target specific browsers rather than always opening a new one.
For example, the help pages are configured by default to open in a new browser
using the WEB_menu_entry_new_window preference. If you choose the
Help→Web Collection menu command to open the documentation from your
Home folder, it opens in a new browser. If the target attribute is not set, and
you return to the browser displaying your Home folder and choose Help→Web
Collection again, another browser opens even though one is already open. However,
the target attribute is set by default to use a specific browser as seen in the
commonmenus.xml file:
<menuentry title="Web Collection" key="applicationHelpAction" url="webclient?
TC_file=redirs/tcwebhelp" target="tchelp" ></menuentry>

With the target attribute set, if you return to the browser displaying your Home
folder and choose Help→Web Collection again, the already opened help browser is
displayed. The target attribute is used only if the menu command is listed in the
WEB_menu_entry_new_window preference; otherwise it is ignored.

Customizing menus
To add common menus commands to all applications, add the menu
details in the custom_menu_additions.xml file found in the
staging_location\webapp_root\teamcenter\dhtml\intl\language directory.
Custom menu files are defined for each application. For example, the standard menu
file for the My Teamcenter application is wsomenu.xml, and the custom menu file is
wsomenu_custom.xml. If you add menu commands to the wsomenu_custom.xml
file, those menu commands are rendered.
The action attribute in the menu node of the XML code defines the behavior. If the
action attribute value is replace, the entire menu is replaced. If the value is add
or the attribute is not defined, the menu commands are added to the existing menu.
To add custom menu commands in all applications, define the commands in the
custom_menu_additions.xml file. Custom static menu files take precedence over
standard static menu files.
Note
To deploy the changes, regenerate the .ear or .war files.
For more information, see Deploying changes.

Change the business objects displayed in the New menu


You can change the business objects displayed in the New menu by changing the
WEB_displayed_new_menu_objects preference. Use this preference to add,
remove, or change ordering of the business objects in the menu.
For example, you can use this preference to add a custom business object to the
New menu:
1. Create a custom business object using the Business Modeler IDE and install it
to the server.
For more information, see the Business Modeler IDE Guide.

PLM00075 H Client Customization Programmer’s Guide 4-15


Chapter 4 Thin client customization

2. Add the custom business object to the WEB_displayed_new_menu_objects


preference.

3. Add an icon for the business object.


For more information, see the Business Modeler IDE Guide.

4. Regenerate the tc.ear file using the Web Application Manager, and deploy the
updated file to your Web application server.
When you open the New menu, the custom business object is displayed.

Custom business object on the New menu


Note
When you create a business object using the New menu, the business object
type is added to the New→Recent menu. The number of business objects
added to this menu is defined by the Create_WorkspaceObject_mru_max
preference.

Adding and modifying business object icons in the thin client


Business object icons are named and displayed by business object. You can modify
them in the staging_location\webapp_root\typeicons directory.
If you add a custom business object to Teamcenter, add a business object icon for it
in both the thin client and the rich client. You must name the business object icon
using the exact, case-sensitive business object name. If the business object has
spaces in its name, you must use an underscore in the icon name for each space. You
can reuse copies of the same icon for different business objects. If Teamcenter cannot
find the business object icon, it silently loads the class icon. However, this prevents
caching, which slows performance and should be avoided.

4-16 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

Note
When you add a new business object icon, add it in the PNG format.

For instructions about changing business object icons in the rich client, see the
Business Modeler IDE Guide.

Configuration settings in the user interface


The following figure shows some of the important configuration settings that control
the user interface.

Configuration settings in the user interface

1 WEB_title_contents Preference that specifies what appears in the


browser title bar.

PLM00075 H Client Customization Programmer’s Guide 4-17


Chapter 4 Thin client customization

2 wsomenu.xml File that specifies what appears in the


thin client menu bar. Find this file in the
staging_location\webapp_root\teamcenter\
dhtml\common\intl\language directory.
3 appbar_title_contents Preference that specifies the title string that
appears in the application bar.
4 toolbar.xml File that specifies what appears in the
navigation pane. Find this file in the
staging_location\webapp_root\teamcenter\
dhtml\common\intl\language directory.

Customizing forms
Forms can be customized in the following ways:
• XML rendering template (XRT)
For more information, see Using style sheets.

• Altering of form contents


For more information, see Altering form content.

• Custom form override mechanism


For more information, see Custom form override mechanism.

You can customize Teamcenter forms in many ways. A general strategy is to put as
much of your customization into the core and as little into the user interface as
possible. If your site uses multiple interfaces, as most do, you minimize duplicated
effort. Some custom forms can be done completely in the core and are inherently
supported by all Teamcenter interfaces. Other customizations require user interface
effort, particularly forms with specialized display or interaction requirements.
Forms are used to store information. You can create a class with the required
attributes and create a form based on the class. When you click a form object in the
thin client, a request is sent to the Teamcenter server to retrieve the form object
attributes, fields, and their values. Response XML code is sent to the client with
the details. The XML is parsed to get the field details and render them as various
components.
The following are the data types and components supported by forms:

4-18 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

Data types and


components Example
String – text field

Large strings (strings


of defined database
length greater than
60 characters) – text
area

PLM00075 H Client Customization Programmer’s Guide 4-19


Chapter 4 Thin client customization

Data types and


components Example
Date – calendar

Boolean – check box

Multiple choices –
buttons

List of values (LOVs


can be exhaustive or
suggestive. In case of
suggestive LOVs, the
user can enter a value
in the LOV field) –
list box

4-20 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

Altering form content


The form customization techniques change the client-side presentation of the existing
form data, but they do not affect the XML form data coming from the server. To add
new or alter existing fields, you can write custom XML nodes under the <custom>
tag. This technique can be used along with any other customization technique.
• The standard TC_ROOT\web\htdocs\tc\common\data\form.isx file is
typically used for retrieving the XML code on the server side.

• The form.isx file includes the


TC_ROOT\web\htdocs\tc\custom\data\custom_forms_data.xml file.
You can add extra attributes and their values to the form XML as needed. This
XML code can also include attributes that need to be overridden.

• On the client, the XML code is transformed by removing the custom nodes and
integrating with the standard form XML.

• While rendering, the attributes in <custom> field nodes are given preference
when the same set of nodes exist in the standard form XML.

The resulting XML code looks like the following on the server side:
<form>
<field name=attr1 …></field>
<field name=attr2 …></field>
<field name=attr3 …></field>
<custom>
<field name=attr3 ….><lov>values…</lov></field>
<field name=attr4 ….></field>
</custom>
</form>

After transformation on the client, the XML looks like the following:
<form>
<field name=attr1 …></field>
<field name=attr2 …></field>
<field name=attr3 ….><lov>values…</lov></field>
<field name=attr4 ….></field>
</form>

Custom form override mechanism


If you cannot customize the Web user interface form with the preferred techniques,
you can use the form override mechanism to customize most of them. This
mechanism provides a unified and abstract interface to the most useful form
characteristics. These characteristics can then be special cased by form type. It is
especially useful because you can have a complete form customization in one file
rather than placing hooks in several places, so you can port customizations more
easily from one version of Teamcenter to another.

Overriding parameters
Several characteristics summarize Teamcenter dialog boxes.
These characteristics are factored and parameterized as
arguments to the createActionDialog() function in the
staging_location\webapp_root\teamcenter\dhtml\common\actiondialog.js
file. The arguments are:

PLM00075 H Client Customization Programmer’s Guide 4-21


Chapter 4 Thin client customization

• actionCall

• actionScript

• applyButton

• formNode

• numCols

• renderer

• resizable

• takeSelection

You can override these inputs based on your dialog


box type using the customization mechanism in the
staging_location\webapp_root\teamcenter\dhtml\common\customform.js
file. You can override one, none, or all of these parameters based on the form type.
In this context, a form is a subtype of dialog box. This information applies to all
dialog boxes, but is most commonly used with forms. By default, forms have the
required XML type box, but other dialog boxes do not. All dialog boxes use the XML
<form> node and are created using the createActionDialog function.

Parameter Definition and default value


actionCall Specifies the JavaScript function called to parse
your arguments and calls your action script. See the
genericActionCall() function in the actiondialog.js file.
This parameter should be the actual function handle (the
name without quotation marks), not a string. The default
is genericActionCall.
actionScript Specifies the TcScript action or file to execute when you
click the OK or Apply button. The form default is found in
the TC_ROOT\web\htdocs\tc\common\actions\
formmodify.xml file; other dialog boxes have different
defaults.
applyButton Specifies whether or not to add an Apply button to the
form in addition to the OK and Cancel buttons. Values are
either true or false. The form default is true; other dialog
boxes have different defaults.
formNode Specifies the DOM reference to the first XML node
describing your dialog box. Do not change this
parameter—it must not be overridden.
numCols Specifies the number of columns in the dialog box. You must
use 2 or 3 unless you are substituting your own renderer
and argument parser in the actionCall parameter. The
form default is 2. Some dialog boxes (such as Route task
perform, Time task, and Out of office) explicitly pass in 3.

4-22 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

Parameter Definition and default value


renderer Specifies the JavaScript function called to render your
XML into your dialog table. This must be a string literal
(quoted), not a function handle like in the actionCall
parameter. The default is "processFORM" for both forms
and dialogs.
resizable Specifies whether the dialog box is dynamically resized or
static. The default is false (in other words, static). Set to
any non-null value to turn resizing on.
takeSelection Specifies whether or not to pass the current tree selection
to your action script. It is either true or false. The form
default is false; other dialog boxes have different defaults.

These parameters are not listed in the order they are used. To better understand
their usage, think about them in the order they are used. The formNode,
applyButton, resizable, numCols, and renderer parameters are used for creating
the form. Then, on submission, the actionCall function is called, which uses the
takeSelection parameter and makes a request to the server file, actionScript.
You can override these parameters by initializing new values in a special
multidimensional associative array called globalCustomDialogType. Additionally
in this file, you must define any new functions you mention in the renderer or
actionCall parameters.
You do not need to initialize parameters to their default values; you only need to set
the ones you want to override.
In section 1 of the customform.js file, add a new parameter array to
globalCustomDialogType, keyed by the type name. For each parameter you want
to override, add the value to the parameter array, keyed by the parameter name. An
example is shown in the following figure.
In section 2, if you are overriding renderer or actionCall, define your new
functions. Your new renderer is passed two parameters automatically: the DOM
reference to the XML dialog node and the DOM reference to the div table the dialog
box is created in. Therefore, your renderer should accept two inputs. Your new
actionCall does not take any arguments. An example is shown in the following
code example:
/ SECTION 1 //
// create and initialize associative arrays
// associative area of custom dialog types and renderers
var globalCustomDialogType = new Array(); //instantiate global array

// instantiate inner arrays for any dialog types you want to override here...
// remark form example:
globalCustomDialogType[ "remark form" ] = new Array();
// parameter array for "remark form" type

// custom form example:


globalCustomDialogType[ "custom form" ] = new Array();
// parameter array for "custom form" type

// override 2 remark form parameters:


globalCustomDialogType[ "remark form" ][ "renderer" ] = "processREMARKFORM";
//note quotes

globalCustomDialogType[ "remark form" ][ "actionCall" ] = mightyMightyActionCall;

PLM00075 H Client Customization Programmer’s Guide 4-23


Chapter 4 Thin client customization

//note no quotes

// override everything on custom form type


globalCustomDialogType[ "custom form" ][ "renderer" ] = "processREMARKFORM";
//note quotes

globalCustomDialogType[ "custom form" ][ "actionCall" ] = mightyMightyActionCall;


//note NO quotes

globalCustomDialogType[ "custom form" ][ "actionScript" ] = "myspecialcustomscript.xml";


// note that this tcscript file must be placed in the actions directory

globalCustomDialogType[ "custom form" ][ "takeSelection" ] = true;


//pass selected line to actionScript

globalCustomDialogType[ "custom form" ][ "applyButton" ] = false;


//OK/cancel only

globalCustomDialogType[ "custom form" ][ "numCols" ] = 7;


// 7 column dialog

// SECTION 2 //
// define your renderer here
// example:
// Of course calling processFORM is exactly what you do not want to
// actually do because this renders your form XML using our default renderer.
// But you could use this skeleton to test that you have hooked everything
// up properly.

function processREMARKFORM( customFormNode, table )


{
alert( "Success!" );
processFORM( customFormNode, table );
}

function mightyMightyActionCall()
{
alert( "Call successful" );
}

Custom form override example


This example creates a custom item revision master form.
Copy the code and paste it in the customform.js file in the
staging_location\webapp_root\teamcenter\dhtml\custom directory.
The customized form has a second column. The original form has only one column.
var globalCustomDialogType = new Array();
globalCustomDialogType[ "ItemRevision Master" ] = new Array();

// override everything on itemrevision master form type


globalCustomDialogType[ "ItemRevision Master" ][ "renderer" ] = "processIRMFORM";
//note quotes
globalCustomDialogType[ "ItemRevision Master" ][ "actionCall" ] = irmActionCall;
//note NO quotes
globalCustomDialogType[ "ItemRevision Master" ][ "actionScript" ] = "common/actions
/formmodify.xml";
// note that this tcscript file must be placed in the actions directory
globalCustomDialogType[ "ItemRevision Master" ][ "takeSelection" ] = true;
//pass selected line to actionScript
globalCustomDialogType[ "ItemRevision Master" ][ "applyButton" ] = false; //OK/cancel only
globalCustomDialogType[ "ItemRevision Master" ][ "numCols" ] = 4; //4 column dialog
globalCustomDialogType[ "ItemRevision Master" ][ "resizable" ] = true; //resizable dialog

4-24 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

function processIRMFORM( irmFormNode, table )


{
initializeForm( irmFormNode, table );
var dialog = getDialog( table );
var tbody = table.firstChild;
var fieldNode = irmFormNode.firstChild;
var row;

// create the dialog box title and also the header rows within the tbody
// table thead tr
row = dialog.headtable.firstChild.firstChild;
row.firstChild.innerHTML = irmFormNode.getAttribute( "name" );
row = document.createElement( "tr" );
tbody.appendChild( row );
var column1 = document.createElement( "td" );
var column2 = document.createElement( "td" );
var column3 = document.createElement( "td" );
var column4 = document.createElement( "td" );

row.appendChild( column1 );
row.appendChild( column2 );
row.appendChild( column3 );
row.appendChild( column4 );

row.modifiable = true;
column1.innerHTML = irmFormNode.firstChild.getAttribute("displayname");
column1.name = irmFormNode.firstChild.getAttribute( "name" );
var input = document.createElement( "input" );
input.type = "text";
input.value = irmFormNode.firstChild.getAttribute( "value" );
column2.appendChild( input );

column3.innerHTML = irmFormNode.firstChild.nextSibling.getAttribute("displayname");
column3.name = irmFormNode.firstChild.nextSibling.getAttribute( "name" );

input = document.createElement( "input" );


input.type = "text";
input.value = irmFormNode.firstChild.nextSibling.getAttribute( "value" );
column4.appendChild( input );
dialog.popup();
}
function irmActionCall(table, popDownOnSuccess)
{
doRequest( new irmAction( table, popDownOnSuccess ) );
}

function irmAction( table, popDownOnSuccess )


{
var actionScript = table.getAttribute("actionScript");
if(actionScript == null)
{
actionScript = table.actionScript;
}

var request = "webclient?TC_file=" + actionScript;


request += buildIrmURL( table );

if ( table.takeSelection )
{
if( table.takeSelection == ’top’ )
{
request += "&parent_uid=" + getTopLine().iman_parent_uid;
}
else
{
request += "&parent_uid=" + firstSelectedRowOrTopLine().iman_parent_uid;

PLM00075 H Client Customization Programmer’s Guide 4-25


Chapter 4 Thin client customization

if( table.takeSelection == ’lhn’ )


{
request += "&lhn=true";
}
}
}

this.url = request;

this.dialog = getDialog(table);
this.callback = updateCallback;
this.popDownOnSuccess = popDownOnSuccess;
}

function buildIrmURL( table )


{
// go through the table body
// for each row
// if it’s a row with two columns
// add the QUOTED string _row.fieldName=rightCell.input thing.value.somewhere

var URL = "";


// add object tag
if ( table.tc_object )
{
URL += "&object=" + table.tc_object;
}

var dialog = getDialog(table);


var tbody = dialog.getTBodyFromTable( table );

if( tbody == null )


{
alert("Cannot handle null. NULL tbody pointer.\n");
}
var row = tbody.firstChild;
while ( row )
{
// certain fields use this to indicate an unset value should not be submitted
if( row.modifiable )
{
var nameCell = row.firstChild; // 1st td
if ( nameCell )
{
var valueCell = nameCell.nextSibling; // 2nd td
if ( valueCell )
{
URL = URL + "&_" + fromUnicode( nameCell.name )
+ "=" + fromUnicode( queryInputValue( valueCell ) );
}
}
// second set of inputs
nameCell = row.firstChild.nextSibling.nextSibling; // 3rd td
if ( nameCell )
{
var valueCell = nameCell.nextSibling; // 2nd td
if ( valueCell )
{
URL += URL + "&_" + fromUnicode( nameCell.name )
+ "=" + fromUnicode( queryInputValue( valueCell ) );
}
}
}
row = row.nextSibling;
}
return URL;

4-26 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

Customize property names in the user interface


You may want to change how a property name appears in the user interface. For
example, you have a property named my_prop but want it displayed as My
Property. Use the Business Modeler IDE to define the display names of properties.
For more information, see the Business Modeler IDE Guide.
Previously, if you wanted to define property display names when using ITK, you
made this change in the user_property_names.xml file. Now if you use ITK,
you should call the PROPDESC_set_display_name function in the property
initialization module function registered for the type on which this property exits.
For more information, see the Server Customization Programmer’s Guide.

Customizing Teamcenter with TcScript


TcScript is a proprietary server-side scripting language used to access Teamcenter.
Typically the data retrieved is used to create Web pages. The data generated can
be potentially in any format. In the out-of-the-box Teamcenter thin client, HTTP
requests come in and XML is returned.
You may need to write server-side TcScript to satisfy your customization
requirements. By making modifications to existing TcScript, you can alter the data
returned to the client. By writing your own TcScript, you can implement new
functionality.
The thin client optimizes performance by caching TcScript parse trees. You do not
see changes made to TcScript code until your tcserver process is restarted by
either restarting the pool manager, killing your tcserver process, or logging off
and logging on again. You can avoid restarting the tcserver process by setting the
TC_WEB_NO_CACHE environment variable to TRUE so you can see your TcScript
changes immediately. Once you complete your modifications, set the variable back
to FALSE for improved performance.

Write TcScript
TcScript has its own structure and command syntax, but its most important
characteristic is that it has a binding layer to Teamcenter ITK. You must be familiar
with ITK to develop TcScript. For further information and examples using TcScript,
see the existing code. One broad end-to-end example is described in Generating
a thin client page.
TcScript sections of pages are interpreted by the thin client. To identify these
sections, you must enclose TcScript in <script> tags. In this particular example, the
entire file is written in TcScript.
1. Begin with the following line:
<script type="text/IMAN">

2. Include useful TcScript helper functions using paths relative to the htdoc root
directory:
include ’common/basic.isx’

PLM00075 H Client Customization Programmer’s Guide 4-27


Chapter 4 Thin client customization

include ’actions/relations.isx’
include ’actions/update.isx’

3. Print an XML document header:


print XMLDefaultHeader()

The XMLDefaultHeader function is defined in the


TC_ROOT\web\htdocs\tc\common\basic.isx file. The print statement is
used to output data. Anything printed is sent to the requesting browser.

4. Make the first ITK call. Most ITK functions are available in TcScript.
POM_place_markpoint( ’mymark’ )

This function places a mark point in the database that you can roll back to if
anything goes wrong.

5. Add a try call:


try

TcScript supports try/catch blocks. This makes error handling much simpler.
Instead of checking the return value of each ITK function, wrap anything that
could potentially fail in a try block and handle the potential error in the catch
block.

6. Add the first comment. Use the hash (#) character to denote TcScript comments.
# Must have a name....

7. You cannot create an item without a name, so use a conditional statement to


evaluate the &_name input parameter. All arguments passed in the requesting
URL are available in TcScript. If you look at the URL requesting the page in
the access log, you should see &_name=xxx in the argument section of the URL.
This URL can also be found in the TcScript syslog and the client Temporary
Internet Files address field.
if _name == ’’
then
# You must supply a name for an Item(Revison)
EMH_store_error( 1, 63065 )
throw ’error’
endif

Note that the quotation marks are single quotation marks. Always use single
quotation marks in TcScript to denote string literals. If no name is supplied, an
error is stored on the stack and thrown directly to the catch, skipping the lines
in between.

8. Split the parent_uid argument in two. This parent_uid is the Teamcenter UID
(or tag) of the line selected as the insertion point for the new item concatenated
with the relation type UID (tag). Thin client UIDs are Web-safe versions of
tag_t. The UID and tag_t are essentially the same, because the conversions
are handled in the bindings to the ITK. Therefore, they are referred to as tags.
The ITK output parameters are passed as literals. This is synonymous with
passing a pointer.
WEB_decompose_double_tag( parent_uid, ’parent’, ’relation’ )

4-28 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

9. Initialize the rest of the input arguments:


item_id = _id
rev_id = _revid

10. Call ITK to validate or create them, and then handle the response.
USER_validate_item_rev_id (item_id, rev_id, _type, ’modified_item_id’,
’modified_rev_id’, ’status’)
# USER_invalid_id -- reject
# USER_valid_id -- create as given
# USER_override_id -- create as modified (silent change, for example,
# for case conversion)
# USER_modified_id -- may create as given, has returned a better version
if status == ’USER_invalid_id’
then
# Failed to create item -- invalid id supplied
EMH_store_error( 1, 63080 )
throw ’error’
elif status == ’USER_override_id’
then
if modified_item_id != ’’
then
item_id = modified_item_id
endif
if modified_rev_id != ’’
then
rev_id = modified_rev_id
endif

11. Call the ITK to create the item. The newItem and newRev tags are set as
output.
# create the item with default rev id
ITEM_create_item( item_id, _name, _type, rev_id, ’newItem’, ’newRev’ )

12. Set the description for the item and revision and save them.
WSOM_set_description( newItem, _description )
WSOM_set_description( newRev, _description )
AOM_save( newRev )
AOM_save( newItem )
AOM_refresh( newRev, 0 )
AOM_refresh( newItem, 0 )

13. Link it to the appropriate place:


parent_uid = MakeRelation( parent_uid, newItem )

14. If there are no ITK errors or a thrown error, you can assume success and can
send an XML message to the browser asking for the parent line to be refreshed
(in case any displayed properties have changed) and for the new item to be
inserted into the tree.
This message is discussed in more detail in Processing on the Teamcenter server.
print ’<update>’
+ RefreshUpdate( WSOLine( parent ) )
+ InsertUpdate( parent_uid, WSOLine( newItem ) )
+ ’</update>’

15. Delete the mark point because yo do not need to roll back.
POM_forget_markpoint( mymark )

PLM00075 H Client Customization Programmer’s Guide 4-29


Chapter 4 Thin client customization

If a thrown error was caught, you roll back to preserve the all-or-nothing nature
of the transaction.

16. Add a contextual error message to the stack and print the XML error stack. This
function is defined in the basic.isx file.
catch error
POM_roll_to_markpoint( mymark, ’stateChanged’ )
EMH_store_error( 1, 63009 )
print ErrorStack( ’’ ) + NL

17. Close the try block with an endtry statement and close the script tag. This
concludes the script. The XML message sent to the client is interpreted.
endtry
</script>

Values
TcScript requires the use of specific values in the following elements:
• Types

• Strings

• System constants

• Variables

• Reserved variables

Types

TcScript values can have one of the following types:

Type Definition
Array Array of TcScript values of any type
Date Teamcenter date
Integer Integer number
Logical Logical or Boolean value (TRUE or FALSE)
Object Teamcenter object (in other words, a Teamcenter tag)
String Literal text string

In most cases, the value type is not relevant to the author of a Teamcenter Web
page because TcScript automatically converts values to a suitable type in the ITK
bindings. There is one exception: the string to integer conversion. All HTTP
arguments are strings, so if you have &index=22 in your URL, the variable index is
set to the string 22 in your TcScript environment. If you then need this value as an
integer to pass to ITK, you must explicitly convert it using the WEB_string_to_int
ITK function.

4-30 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

Strings

String literals are enclosed by single quotation marks. All whitespace (including new
lines) between the quotes is included verbatim in the string. For example:

String Description
’hello world’ Literal text string
" Empty string
’ New line character

’<table> Literal segment of HTML
<tr>
<td>NW</td>
<td>NE</td>
</tr>
<tr>
<td>SW</td>
<td>SE</td>
</tr>
</table>’

System constants

The following constants are defined in TcScript.

Constants Definition
EMPTYARRAY Empty array
FALSE Logical value false
NL Literal new line
NULLTAG Object value representing a Teamcenter NULLTAG
TRUE Logical value true

Variables
Values can be assigned to a variable. For example:
id = IMAN_user.user_id

The variable id is created automatically if it does not exist before the assignment.
The variable can then be used or reassigned throughout the rest of the page.
Array variables can be assigned in requests as follows:
selection[0]=a&selection[1]=b

This creates an array selection with two elements in it. This array notation is only
valid in requests. TcScript does not have a mechanism for dereferencing particular
elements of an array. Instead, arrays are generally looped through incrementally. In
TcScript, arrays can be formed using the :: concatenation operator. For example:
selection = a :: b

PLM00075 H Client Customization Programmer’s Guide 4-31


Chapter 4 Thin client customization

Reserved variables
The following metavariables are defined by TcScript. Their values are set
appropriately immediately before each page is processed:

Metavariable Definition
IMAN_user Current user’s tag
IMAN_role Current user’s role tag
IMAN_group Current user’s group
IMAN_config_rule Current configuration rule tag
IMAN_site_name Name of the site
MANGLED_QUERY Query with standard mangling (to allow POST/GET)
QUERY Page query tag
TC_VERSION Teamcenter version string

Operators
TcScript includes the following types of operators:
• String operators

• Integer operators

• Array operators

String operators
The only string operator in TcScript is the concatenation operator (+). This operator
converts its left and right hand operands to strings and concatenates them.

Example code Result


’hello’ + ’world’ ’helloworld’
’hello’ + ’ ’ + ’world’ ’hello world’
name = ’hello’ ’hello world’
id = ’world’
name + ’ ’ + id

Integer operators
TcScript does not implement any mathematical functions directly. To perform
addition, subtraction, multiplication, or division of TcScript integers, call the
WEB_arithmetic ITK function:
WEB_arithmetic( num_left, op, num_right, output )

num_left and num_right are integers, op is an operator character, and output is


the mathematical result. The operator character can be:
• +

• –

4-32 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

• *

• \

For example:
index = 0
WEB_arithmetic( index, ’+’, 1, ’index’ )

This code adds 1 to the value of index.

Array operators
There are four specialized TcScript functions for manipulating arrays:
• LENGTH

• REVERSE

• SORT

• SPLICE

The examples for the functions use the following arrays:


• animals
{ ’laura lion’, ’henry hamster’, ’vicky vicuna’ }

• dates
{ ’05-Apr-1998’, ’23-Nov-1997’,’17-Jun-1998’ }

LENGTH
The LENGTH function returns the number of elements in an array. For example:

Example Result
LENGTH( animals ) ’3’

LENGTH( EMPTYARRAY ) ’0’

REVERSE
The REVERSE function reverses a list. For example:

Example Result
REVERSE( dates ) { ’17-Jun-1998’, ’23-Nov-1997’, ’05-Apr-1998’ }

REVERSE( EMPTYARRAY ) EMPTYARRAY

SORT
The SORT function sorts a list by a specified property. The syntax is:
SORT( array, criterion )

The criterion argument is a string value giving the name of the property by which
to sort the array: For example:

PLM00075 H Client Customization Programmer’s Guide 4-33


Chapter 4 Thin client customization

Example Result
SORT( birthdates, { { ’henry hamster’, ’23-Nov-1997’ },
{ ’laura lion’, ’05-Apr-1998’ },
’individual’ ) { ’vicky vicuna’ , ’17-Jun-1998’ } }

SPLICE

The SPLICE function splices two lists together, returning a single array of objects.
The syntax is:
SPLICE( list1, name1, list2, name2 )

The list1 and list2 arguments have equal lengths. The nth object in the returned
array is a pair of the nth element of the first list, and the nth element of the second
list. The first and second elements of each pair can then be accessed by the name1
and name2 field names, respectively. This provides a mechanism for constructing a
multi-dimensional array from HTTP name/values pairs. The SPLICE function is
rarely used but allows simultaneous iteration over two arrays. Note that several of
the data functions such as FORM and QUERYFIELDS effectively return SPLICE
lists. The following example shows iterating over a SPLICE array. Let birthdates
be SPLICE( animals, ’individual’, dates, ’day’ ). The value of birthdates can
be represented as:
{ { ’laura lion’, ’05-Apr-1998’ },
{ ’henry hamster’, ’23-Nov-1997’ },
{ ’vicky vicuna’ , ’17-Jun-1998’ } }

The following code lists out the animals and their birthdays:
for birthday in birthdates

print birthday.individual + ’ was born on ’ + birthday.day

print <br>

next

The SPLICE3 function is similar to the SPLICE function. It splices three lists
together, returning a single array of objects. The syntax is:
SPLICE3( list1, name1, list2, name2, list3, name3 )

Accessing Teamcenter data with TcScript


Data can be retrieved using functions or properties. There are three kinds of
functions available in TcScript:
• Bound ITK

• Specialized TcScript

• Helper functions

Helper functions are written in TcScript and access Teamcenter data using one of
the standard methods, so they are not described. They are used only to conveniently
wrap these methods behind a layer of abstraction. Additionally, Teamcenter data
can be accessed using properties.

4-34 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

Calling ITK

ITK is the preferred method for accessing Teamcenter data in TcScript. Most ITK
functions can be called from TcScript. The function returns a logical value TRUE
or FALSE depending on whether it succeeded or not; errors must be handled by
examining the error stack.
For simplicity in this create folder example, the return value is checked explicitly.
The try/catch block is preferred.
name = ’my folder’
if( FL_create( name, ’my generic description’, ’newFolder’ ) )
then
AOM_save( newFolder )
endif

You can pass the string, object, array of objects, integer, date, and logical input
arguments directly into the ITK function. Input arguments, if defined earlier, should
be referred to in the ITK call without quotation marks. You can also pass an input
argument as a value; in the case of a string, use single quotation marks as shown in
this example. Output arguments are returned by passing the name of a variable as a
string; when the function completes, the output value is set to this variable. In this
example, the newFolder variable is not defined yet and therefore mentioned as a
string within single quotation marks. When the function completes, the newFolder
variable is set to the value of the folder tag.
All memory management issues involving output arguments are handled
automatically by TcScript. Most enum values can be passed in as literal strings.
ITK structure types are not supported.

Properties

Given a Teamcenter object in TcScript, you can access any property of the object
(including any user-defined properties) with the . operator. The syntax is:
objectName[.attr]+

This allows property accesses to be chained together. For example:


item.object_name
rev.structure_revisions
namedRef.ref.object_type

Writing specialized ITKs

Functions beginning with the WEB_ prefix are a special class of ITK implemented
to perform specific functions for the thin client. They are treated exactly like
standard ITK. They should only be used in cases where standard ITK functions do
not provide the needed capability. The string functions can be used with only a
small amount of data.

Function Description
WEB_arithmetic Performs mathematical operations like +, –, *, and \.
WEB_compare Used to compare numbers.
WEB_string_to_int Converts a string to an integer.

PLM00075 H Client Customization Programmer’s Guide 4-35


Chapter 4 Thin client customization

LOG function
The LOG function is a useful debugging tool to keep data and debugging separate.
For example:
my_val = ’blue’
LOG( ’the sky is ’ + my_val + NL )

This writes the sky is blue\n to the tcserverpid.syslog file.

Work with the user exits sample file


User exits are places in the server where you can add additional behavior by
attaching an extension. Examples of user exits for thin client customization using
TcScript can be found in the TC_ROOT\sample\examples\user_web.c sample
file.
For more information about user exits and extensions, see the Business Modeler
IDE Guide.
1. Install sample files:
a. Start Teamcenter Environment Manager (TEM).

b. In the Maintenance panel, select Configuration Manager and click Next.

c. In the Configuration Maintenance panel, select Perform maintenance on an


existing configuration and click Next.

d. In the Configuration Selection panel, select the configuration from which


the corporate server was installed. Click Next.

e. In the Feature Maintenance panel, under the Teamcenter section, select


Add/Remove Features. Click Next.

f. In the Features panel, under Server Enhancements, select Sample Files.

g. Click Next.

h. In the Confirm Selections panel, click Next.


The sample files are placed at the following location:

TC_ROOT\sample

2. Locate the user_web.c file in the following directory:


TC_ROOT\sample\examples

3. Open the user_web.c file and follow the directions in the commented text.

Statements
TcScript statements include for, if, include, and def\enddef.

for
The for statement is used to iterate over an array. The syntax is:

4-36 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

for variable in array


# body
# do something with each variable
next

Each value in an array is assigned to variable in turn, and body is processed for
each value.

if
The syntax of the if statement is:
if cond
then
# body
[ elif cond then body] *
[ else body ]
endif

The body segment can be any arbitrary set of TcScript statements, and cond is
a logical expression. Logical expressions can contain logical variables, logical
operators, and parentheses.
The binary logical operators are of the form: lvalue op rvalue, where op is one of
the following:
• and
True if lvalue and rvalue are both true.

• or
True if lvalue or rvalue is true.

• ==
True if lvalue is equal to rvalue.

• !=
True if lvalue is not equal to rvalue.

• isa
True if lvalue is an instance of the class defined by rvalue.

• hasa
True if rvalue is the name of a valid property of the object defined by lvalue.

The and and or operators use short circuit evaluation; that is, rvalue is not evaluated
if the final value of the expression can be established by only evaluating lvalue.
The only unary logical operator is not, which negates the value of its argument. The
precedence of the operators in decreasing order is:
1. ==, !=, isa, hasa

2. not

3. and

PLM00075 H Client Customization Programmer’s Guide 4-37


Chapter 4 Thin client customization

4. or
Note
The optional elif keyword often simplifies complex if statements.

include
The syntax of the include statement is:
include ’filename’

The filename argument is the full file name of another thin client page relative to
the document root. The included page is interpreted in line, as if it were textually
inserted into the including page. This means that the included page must not have
<script> tags.

def/enddef
This statement is used to define your own functions in TcScript. The syntax is:
def saveWorld( world )
# do stuff here
saveWorld = TRUE
enddef

Note that enddef has two ds. Also note that a value can be retuned by setting it
equal to the function name, as illustrated in the syntax.

Error handling
The easiest way to manage error handling in TcScript is to use try/catch statements.
The syntax for a typical case looks like the following:
# print my header (document type, encoding)
print XMLDefaultHeader()
# potentially place a DB mark point
POM_place_markpoint( ’mymark’ )
try
output = ...
# perform some ITK functions
...
output += ...
...
print output
catch error
# potentially rollback to markpoint
POM_roll_to_markpoint( mymark, ’stateChanged’ )
# potentially add contextual error to stack
EMH_store_error( 1, 63xxx )
# print error stack
print ErrorStack( ’’ ) + NL
endtry

This format is convenient because you do not have to check every return code at
every potential point of failure. Instead, a block that includes n points of failure can
be wrapped between the try and catch statements. Any error within that block
halts execution of the try block statements and jumps to the catch block. If ITK
fails, it puts its own error on the stack; it is still useful to add your own error for
context. Another important point is that no output is printed to the client until
the last point of failure is passed. This is done by building up the response as a

4-38 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

variable (output in this case). This allows two possible responses: success (in the
form of some XML to be rendered), or failure (in the form of an XML error stack to be
rendered). You generally do not want to mix the two responses. If you are building
an HTML response, this is not as important because most browsers are tolerant
of broken HTML. However, if you are building an XML response, it is important
because XML parsers are not tolerant of broken XML. Therefore, in the thin client
interface, most requests return either success or failure and nothing in between.

TcScript syntax errors


Any errors encountered while parsing a TcScript page are reported within the page
and list the line number and context of the error. The TcScript parser uses recursive
descent parsing. If there are multiple error messages, the later messages may be
meaningless. When debugging, focus on the first syntax error. Some of the most
common errors committed by TcScript programmers are:
• Misspelling enddef.

• Using an if statement without a then statement.

• Attempting simple arithmetic, which is not supported, or trying to pass a string


to an ITK function expecting an integer.

Teamcenter errors
Teamcenter errors can be caused by property access, saved query execution, or any
TcScript or ITK function call.

ERRORS
The ERRORS function returns an array representing the current state of the
Teamcenter error stack. The information is returned as an array of errors, where
each error has three pseudo-properties: the ifail integer, the error text message,
and the severity integer. The syntax is:
ERRORS()

More conveniently, you can call the TcScript helper functions that wrap this call,
defined in the TC_ROOT\web\htdocs\tc\common\basic.isx file. The most
common is:
ErrorStack( text )

It takes a contextual text message as input and returns the error stack as XML. The
contextual message is displayed to the user, but it is not added to the Teamcenter
error stack. If you opt to add a contextual error to the stack before displaying the
error, you would typically pass an empty string as input.
Two similar functions of limited use are alertErrorStack(text) and
HTMLErrorStack(text). The alertErrorStack function wraps the error stack
with some alert display logic, while the HTMLErrorStack function returns the
stack in displayable HTML. This is used with top-level page errors where there is no
guarantee that the error stack rendered is available on the client side.

CLEARERRORS
The CLEARERRORS procedure clears the Teamcenter error stack. The syntax is:

PLM00075 H Client Customization Programmer’s Guide 4-39


Chapter 4 Thin client customization

CLEARERRORS()

This procedure is useful if there are specific errors you want to handle. If you know
a particular ITK function may return an error you can recover from or handle
non-fatally, wrap that function in its own try block. This usually means that you
have nested try statements. In the catch section of the inner try statement, you
attempt to handle the error. If successful, call CLEARERRORS and continue. If
unsuccessful, use the throw statement to jump to your outer catch section. Another
useful helper function in this case is throwIfErrorNotArray (see the basic.isx
file).

Property error table


If you run the thin client with the IMAN_SDL_MAGIC environment variable set,
any error generated while accessing an object property dumps a property table
into the output page. This table shows the name type and value of each valid
property of the relevant object. Do not use this facility in production. The Type
Browser is another useful property interrogation tool and can be found in the system
administrator Web pages.

Useful helper functions


Helper functions are defined in the
TC_ROOT\web\htdocs\tc\common\basic.isx file. Any TcScript file that
includes the basic.isx file can use these functions.

car
DESCRIPTION
Returns the first element of an array.
SYNTAX
car( list )
ARGUMENTS
• list
Array.

RETURN
VALUE
Returns the first element of the array.

Class
DESCRIPTION
Returns the name of the Teamcenter class of an object.
SYNTAX
Class( object )
ARGUMENTS
• object

4-40 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

Teamcenter object tag.


RETURN
VALUE
Returns the Teamcenter class of your input object.

contains
DESCRIPTION
Checks whether list contains value.
SYNTAX
contains( list, value )
ARGUMENTS
• list
Array that may have the specified value.

• value
Value to look for.
RETURN
VALUE
Returns either true or false.

ErrorStack
DESCRIPTION
Returns the error stack details in XML format.
SYNTAX
ErrorStack( text )
ARGUMENTS
• text
Contextual text message.
RETURN
VALUE
Returns the error stack as XML.

HTMLDefaultHeader
DESCRIPTION
Returns a header appropriate to an HTML document including a localized encoding
string. Encoding string comes from the UID string table.
SYNTAX
HTMLDefaultHeader()
ARGUMENTS
None.

PLM00075 H Client Customization Programmer’s Guide 4-41


Chapter 4 Thin client customization

RETURN
VALUE
Returns an HTML header string.

HTMLErrorStack

Description
Returns XML with the error messages; used for potential top-level page errors.

Syntax
HTMLErrorStack( text )

Arguments
• text
Contextual text message.

Return value
Returns the error stack as XML.

imanText
DESCRIPTION
Returns a localized Teamcenter string from the UID table.
SYNTAX
imanText( key )
ARGUMENTS
• key
Teamcenter key string.
RETURN
VALUE
Returns the localized Teamcenter string from the UID table.

Message
DESCRIPTION
Returns the message in XML format. The Teamcenter Web renderer knows how to
renderer this XML format into a user message.
SYNTAX
Message( text )
ARGUMENTS
• text
Message string to be displayed.

4-42 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

RETURN
VALUE
Returns an XML-formatted message.

Preference
DESCRIPTION
Looks up multivalued preferences.
SYNTAX
Preference( pref, scope, optional )
ARGUMENTS
• pref
Name of the option to retrieve.

• scope
One of the following strings depending on the desired search scope:

o TC_preference_all

o TC_preference_user

o TC_preference_role

o TC_preference_group

o TC_preference_site

• optional
Whether or not to display an error if the preference cannot be found in the
database. Set to TRUE or FALSE.
RETURN
VALUE
Returns an array of preference values.

quote
DESCRIPTION
Escapes special XML characters within a string.
SYNTAX
quote( unquoted )
ARGUMENTS
• unquoted
String to be quoted.
RETURN
VALUE
Returns the XML-safe representation of the string.

PLM00075 H Client Customization Programmer’s Guide 4-43


Chapter 4 Thin client customization

quoteImanText
DESCRIPTION
Returns a localized Teamcenter string from the UID table encased in quotation
marks.
SYNTAX
quoteImanText( key )
ARGUMENTS
• key
Teamcenter key string.

RETURN
VALUE
Returns a localized and quoted Teamcenter string from the UID table.

removeArrayElement
DESCRIPTION
Removes the given element from the array.
SYNTAX
removeArrayElement( element, list )
ARGUMENTS
• element
Element to remove.

• list
Array that contains the element.

RETURN
VALUE
Returns the modified array.

replaceArrayElement
DESCRIPTION
Replaces the specified element of an array with the new element.
SYNTAX
replaceArrayElement( oldElement, newElement, list )
ARGUMENTS
• oldElement
Existing element of the input array.

• newElement
New element to replace the existing element.

4-44 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

• list
Array with element to be replaced.
RETURN
VALUE
Returns the modified array.

replaceChar
DESCRIPTION
Replaces a character in the string with another character.
SYNTAX
replaceChar( string, oldchar, newchar, front )
ARGUMENTS
• string
Input string.

• oldchar
Existing character in the input string.

• newchar
New character to replace existing character.

• front
Empty string as ”.
RETURN
VALUE
Returns the modified string.

replaceString
DESCRIPTION
Replaces a substring in the string with another substring.
SYNTAX
replaceString( string, oldstring, newstring )
ARGUMENTS
• string
Input string.

• oldstring
Existing string in the input string.

• newstring
New string to replace existing string.

PLM00075 H Client Customization Programmer’s Guide 4-45


Chapter 4 Thin client customization

RETURN
VALUE
Returns the modified string.

SetPreference
DESCRIPTION
Sets values to the preference
SYNTAX
SetPreference( pref, index, prefValue, scope )
ARGUMENTS
• pref
Name of the option to set.

• index
Length of the array.

• prefValue
Array of values to be set.

• scope
One of the following:

o TC_preference_all

o TC_preference_user

o TC_preference_site

o TC_preference_role

o TC_preference_group
RETURN
VALUE
None.

SinglePreference
DESCRIPTION
Looks up options (preferences) indirectly from the .tc_env file.
SYNTAX
SinglePreference( pref, scope, optional )
ARGUMENTS
• pref
Name of the option to retrieve.

• scope

4-46 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

One of the following strings depending on the desired search scope:

o TC_preference_all

o TC_preference_user

o TC_preference_role

o TC_preference_group

o TC_preference_site

• optional
Whether or not to display an error if the preference cannot be found in the
database. Set to TRUE or FALSE.

RETURN
VALUE
Returns the preference value.

startsWith
DESCRIPTION
Checks if a string starts with a substring.
SYNTAX
startsWith( str, subStr )
ARGUMENTS
• str
Input string.

• subStr
Substring to check.

RETURN
VALUE
Returns either TRUE or FALSE.

throwIfErrorNot
DESCRIPTION
Either rethrows your error or clears it depending on whether or not it is in your
expectedValues array.
SYNTAX
throwIfErrorNot( caughtError, expectedValue )
ARGUMENTS
• caughtError
Input to the catch block.

PLM00075 H Client Customization Programmer’s Guide 4-47


Chapter 4 Thin client customization

• expectedValue
Value to compare with caughtError.

RETURN
VALUE
Returns an error if caughtError is not the expectedValue.

throwIfErrorNotArray
DESCRIPTION
Either rethrows your error or clears it depending on whether or not it is in your
expectedValues array.
SYNTAX
throwIfErrorNotArray( caughtError, expectedValues )
ARGUMENTS
• caughtError
Input to the catch block.

• expectedValues
Array of error codes to suppress.

RETURN
VALUE
Returns an error if caughtError is not in the expectedValues array.

tokenize
DESCRIPTION
Divides the input string into tokens using separator.
SYNTAX
tokenize( input, separator )
ARGUMENTS
• input
Input string.

• separator
Character to use as a separator.

RETURN
VALUE
Returns an array of tokens.

4-48 Client Customization Programmer’s Guide PLM00075 H


Thin client customization

XMLDefaultHeader
DESCRIPTION
Adds a header appropriate to an XML document. The encoding string comes from
the UID string table.
SYNTAX
XMLDefaultHeader( )
ARGUMENTS
None.
RETURN
VALUE
Returns a header appropriate to an XML document including a localized encoding
string.

PLM00075 H Client Customization Programmer’s Guide 4-49


Appendix

A Glossary

PLM00075 H Client Customization Programmer’s Guide


Appendix

A Glossary

AIF
See Application Integration Framework (AIF).

Application Integration Framework (AIF)


Integration framework that enables developers to build custom interfaces to
applications for Teamcenter and NX. This framework provides the foundation
through which applications can be launched and executed in a standard manner. It
also provides the basic design for applications, the base classes and methods, and
a methodology for creating and handling events generated by the user interface.
In addition, the AIF provides tools to handle the registration of components,
represented by Java beans, and a mechanism for locating and passing messages to
those components.

class
Set of objects that share the same list of attributes but distinguishable by the value
the attributes acquire for specific objects. For example, the Automobile class can be
defined by the brand, color, and price, but each car associated to the Automobile
class has a different brand, color, and price combination.

class hierarchy
Structure defining subclasses that inherit the attributes of their superclasses, also
called their parents or ancestors.

Client
Role played by a software component of a system when it requests particular services
be performed on its behalf by another entity, a server. See also server.

client tier
Teamcenter architectural tier that comprises the Teamcenter clients, Teamcenter
integrations with third-party applications, and the third-party applications
associated with the integrations.

corporate server
Host computer at the center of a Teamcenter network. This host contains the
Teamcenter application root directory, Teamcenter data directory, licensing, File
Management System (FMS), and volumes. For installations that include the Web
tier (four-tier architecture), the corporate server also contains the Teamcenter server
manager. Multiple application clients can map to or mount the corporate server.

PLM00075 H Client Customization Programmer’s Guide A-1


Appendix A Glossary

form
Teamcenter workspace object used to display product information (properties) in a
predefined template. Forms are often used to create an electronic facsimile of a
hardcopy form in Teamcenter. See also master form.

four-tier architecture
Teamcenter architecture that includes four tiers: resource tier, client tier, Web tier,
and enterprise tier.

master form
Teamcenter workspace object used to display product information (properties) in
a predefined template. Master forms are used to display product information in
a standardized format.

My Teamcenter
Teamcenter rich client application that is the main access point for managing
product information. My Teamcenter provides the functionality for creating objects
in the Teamcenter database, querying the database for objects, checking in and
checking out objects, and managing tasks. Users can also open objects, automatically
launching the related application.
Each user has a personal My Teamcenter window that displays product information
as graphical objects. Although users share product information across the enterprise,
they organize this information individually in personal workspaces.

navigation pane
Rich client framework component that displays buttons of the applications available
for use in the rich client. Clicking the application button launches the application.

preference
Configuration variable stored in a Teamcenter database and read when a Teamcenter
session is initiated. Preferences allow administrators and users to configure many
aspects of a session, such as user logon names and the columns displayed by default
in a properties table.

properties
Keys and values that specify the configuration settings for an application in the
Teamcenter rich client.

properties file
File containing the attributes (keys and values) that specify how an application is to
behave in the Teamcenter rich client.

A-2 Client Customization Programmer’s Guide PLM00075 H


Glossary

Registry Editor
Teamcenter application that enables editing Teamcenter rich client registry
files. This application is used only for editing registry files that are used for
internationalization, dynamic class invocation, and configuration in the rich client
framework.

registry file
Properties (.properties) file that contains the user-defined configuration settings
(keys and values) that are relative to how the application displays and performs
in the Teamcenter rich client. Each application registered in the rich client has a
.properties file known as a registry file.

rich client
Java-based user interface to Teamcenter installed on user workstations. The rich
client accesses Teamcenter databases using a remote or local server.

rich client framework


Component of the rich client that integrates and runs various applications from a
common platform. These applications can be off-the-shelf applications such as NX
CAD/CAM/CAE, Microsoft Office, custom applications, and Java plug-ins.

server
System software component that performs a specifically defined set of software
services on behalf of one or more clients. In a typical Teamcenter installation,
servers are centralized on dedicated hosts that support a large number of clients.
Clients are distributed on hosts connected to the servers via various networking
techniques. See also Client.

Teamcenter Application Registry


Independent Web-based service that allows a Teamcenter product to look up other
available Teamcenter products for launching a linked object. Administrators can
register and unregister installed instances of a Teamcenter product in the registry.

two-tier architecture
Teamcenter architecture that includes a resource tier and a client tier. The resource
tier comprises the database server and database. The client tier comprises the
Teamcenter rich client, third-party applications that integrate with the rich client,
and a local server. This architecture supports only the Teamcenter rich client.

Web Browser
Teamcenter application that provides access to Internet Web pages from within
the rich client framework. The Web browser is a rich client window that acts as a
Web browser, enabling you to navigate and view Web pages within the rich client
rather than switching to a separate Web browser. The Web browser also provides
the ability to access MIME (Multipurpose Internet Mail Extension) file types and to

PLM00075 H Client Customization Programmer’s Guide A-3


Appendix A Glossary

view files created in other applications, such as Microsoft Word and Excel, through
the Web browser.

A-4 Client Customization Programmer’s Guide PLM00075 H


Index

A buildURL method . . . . . . . . . . . . . . . . . 4-4


Business object icons . . . . . . . . . . . . . . 4-16
Abstract class naming conventions . . . 3-182 Button . . . . . . . . . . . . . . . . . . . . 3-27, 3-30
AbstractDialog class . . . . . . . . . . . . . 3-246 ButtonLayout layout manager . . . . . . 3-222
AbstractPopupButton class . . . 3-208, 3-219
AbstractProgessDialog class . . . . . . . . 3-204
Commands . . . . . . . . . . . . . . . . . . 3-204 C
Features . . . . . . . . . . . . . . . . . . . . 3-202 car helper function . . . . . . . . . . . . . . . 4-40
AbstractProgressDialog class . . 3-202, 3-205 Cascading style sheets . . . . . . . . . . . . . 4-11
AbstractUINode class . . . . . . . . . . . . 3-214 catch TcScript error handling
AccessDialog component . . . . . . . . . . 3-211 statement . . . . . . . . . . . . . . . . . . . . . 4-38
Accessing Teamcenter data . . . . . . . . . 4-34 centerToScreen method . . . . . . . . . . . 3-218
Accessor method naming Changing
conventions . . . . . . . . . . . . . . . . . . . 3-182 Dynamic files . . . . . . . . . . . . . . . . . . . 4-9
Acrobat files . . . . . . . . . . . . . . . . . . . 3-155 Static files . . . . . . . . . . . . . . . . . . . . . 4-9
actionCall function . . . . . . . . . . . . . . . . 4-4 Class helper function . . . . . . . . . . . . . . 4-40
actionDialog code . . . . . . . . . . 4-2, 4-4, 4-6 Classes
actions.properties file . . . . . . . . . . . . 3-253 AbstractAIFContextSensitivity
AIFDesktop component . . . . . . . . . . . 3-251 Handler . . . . . . . . . . . . . . . . . . 3-253
all XML element . . . . . . . . . . . . . . . . . 2-47 AbstractDialog . . . . . . . . . . . 3-218, 3-246
Altering form content . . . . . . . . . . . . . 4-21 AbstractPopupButton . . . . . . 3-208, 3-219
Application banner . . . . . . . . . . . . . . . . 1-4 AbstractProgessDialog . . . . . . . . . . 3-202
Application Integration Framework AbstractProgressDialog . . . . 3-204–3-205
(AIF) . . . . . . . . . . . . . . . . . . . . . . . 3-251 AbstractUINode . . . . . . . . . . . . . . . 3-214
Application pane . . . . . . . . . . . . . . . . . . 1-4 DeleteOperation . . . . . . . . . . . . . . 3-205
Rich client . . . . . . . . . . . . . . . . . . . . . 1-4 GenericTableModel . . . . . . . . . . . . 3-220
application startup option . . . . . . . . . 3-178 InterfaceSignalOnClose . . . . . . . . . 3-173
applyTemplateFilter extension JTextArea . . . . . . . . . . . . . . . . . . . 3-221
point . . . . . . . . . . . . . . . . . . . . . . . 3-110 JTextField . . . . . . . . . . . . . . . . . . . 3-221
arch startup option . . . . . . . . . . . . . . 3-178 MessageBox . . . . . . . . . . . . . . . . . 3-240
Array operators . . . . . . . . . . . . . . . . . 4-33 Naming conventions . . . . . . . . . . . . 3-182
LENGTH . . . . . . . . . . . . . . . . . . . . 4-33 SignalOnClose . . . . . . . . . . . . . . . . 3-173
REVERSE . . . . . . . . . . . . . . . . . . . . 4-33 StringViewerDialog . . . . . . . . . . . . 3-246
SORT . . . . . . . . . . . . . . . . . . . . . . . 4-33 SystemColor . . . . . . . . . . . . . . . . . 3-183
SPLICE . . . . . . . . . . . . . . . . . . . . . 4-34 TCComponentForm . . . . . . . . . . . . 3-148
attachments XML element . . . . . . . . . . 2-49 TCConstants . . . . . . . . . . . . . . . . . 3-214
Automatic forms . . . . . . . . . . . 3-132–3-133 TCFormProperty . . . . . . . . . . . . . . 3-148
TCTypeRenderer . . . . . . . . . . . . . . 3-217
B classificationProperties XML element . . 2-51
classificationTrace XML element . . . . . 2-53
Back and forward buttons . . . . . . . . . . . 1-3 clean startup option . . . . . . . . . . . . . 3-178
Basic concepts . . . . . . . . . . . . . . . . . . . 1-7 CLEARERRORS . . . . . . . . . . . . . . . . . 4-39
Basic tasks . . . . . . . . . . . . . . . . . . . . . . 1-8 Clipboard button
basic.isx file . . . . . . . . . . . . . . . . . . . . 4-40 Description . . . . . . . . . . . . . . . . . . . . 1-4
break XML element . . . . . . . . . . . . . . . 2-50 close() method . . . . . . . . . . . . . . . . . . 3-173

PLM00075 H Client Customization Programmer’s Guide Index-1


Index

closeSignaled() method . . . . . . . . . . . 3-173 Naming . . . . . . . . . . . . . . . . 3-181–3-182


Coding standards . . . . . . . . . . . . . . . 3-181 Property . . . . . . . . . . . . . . . . . . . . 3-182
Colors Source code . . . . . . . . . . . . . . . . . . 3-182
Conventions . . . . . . . . . . . . . . . . . 3-183 Text field . . . . . . . . . . . . . . . . . . . . 3-183
com.teamcenter.rac.stylesheet.stylesheet_ Conventions, syntax definitions . . . . . . . 1-8
user.properties . . . . . . . . . . . . . . . . 3-139 CR_allow_alternate_procedures
Command line startup options . . . . . . 3-178 preference . . . . . . . . . . . . . . . . . . . . . . 4-9
Command Suppression createActionDialog
Constraints . . . . . . . . . . . . . . . . . . 3-154 Function . . . . . . . . . . . . . . . . . . . . . 4-21
Customization . . . . . . . . . . . . . . . . 3-152 Method . . . . . . . . . . . . . . . . . . . . . . . 4-2
Command Suppression application . . . . . 2-2 CSS, see Cascading style sheets
command XML element . . . . . . . . . . . . 2-55 Custom form override . . . . . . . . . . . . . 4-21
Commands, overriding . . . . . . . . . . . . . 3-80 Customizing
Compatibility . . . . . . . . . . . . . . . . . . . . 1-7 Forms . . . . . . . . . . . . . . . . . . . . . . . 4-18
Component pane . . . . . . . . . . . . . . . . . . 1-6 Menus . . . . . . . . . . . . . . . . . . . . . . 4-15
Components . . . . . . . . . . . . . . . . . . . 3-207 customPanel XML element . . . . . . . . . 2-61
AccessDialog . . . . . . . . . . . . . . . . . 3-211
ExpansionRule . . . . . . . . . . . . . . . 3-205 D
GroupPanel . . . . . . . . . . . . . . . . . . 3-215
iTextArea . . . . . . . . . . . . . . . . . . . 3-221 Data islands . . . . . . . . . . . . . . . . . . . . . 4-6
iTextField . . . . . . . . . . . . . . . . . . . 3-221 Data pane . . . . . . . . . . . . . . . . . . . . . . 1-7
JComboBox . . . . . . . . . . . . . . . . . . 3-206 data startup option . . . . . . . . . . . . . . 3-179
LOVComboBox . . . . . . . . . . . . . . . 3-206 Data tabs display, customizing . . . . . . 3-156
LOVDialog . . . . . . . . . . . . . . . . . . 3-206 debug startup option . . . . . . . . . . . . . 3-179
LOVPopupButton . . . . . . . . . . . . . 3-208 def TcScript function . . . . . . . . . . . . . . 4-38
MLabel . . . . . . . . . . . . . . . . . . . . . 3-241 DeleteOperation class . . . . . . . . . . . . 3-205
MRUButton . . . . . . . . . . . . . . . . . 3-209 Deploying changes . . . . . . . . . . . . . . . . 4-8
OpenByNameButton . . . . . . . . . . . 3-209 detach startup option . . . . . . . . . . . . 3-179
OrgSelectionDialog . . . . . . . . . . . . 3-210 dev startup option . . . . . . . . . . . . . . . 3-179
ReferencersPanel . . . . . . . . . . . . . . 3-212 Developing forms using XML style
ReferencerUINode . . . . . . . . . . . . . 3-213 sheets . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
RolePanel . . . . . . . . . . . . . . . . . . . 3-214 Dialog box conventions . . . . . . . . . . . 3-182
Separator . . . . . . . . . . . . . . . . . . . 3-244 dialogDisplayed() method . . . . . . . . . . 3-149
SplitPane . . . . . . . . . . . . . . . . . . . 3-245 Directory structure . . . . . . . . . . . . . . . . 4-7
StringViewerPanel . . . . . . . . . . . . . 3-246 Disabled properties . . . . . . . . . . . . . . 2-117
TableModel . . . . . . . . . . . . . . . . . . 3-220 Disabling the toolbar . . . . . . . . . . . . . 3-156
TCComponentUINode . . . . . . . . . . 3-214 Displaying
UserPanel . . . . . . . . . . . . . . . . . . . 3-216 Files in the viewer . . . . . . . . . . . . . 3-155
conditions XML element . . . . . . . . . . . 2-58 Form properties . . . . . . . . . . . . . . . . 2-26
Configuration settings . . . . . . . . . . . . . 4-17 Regular properties . . . . . . . . . . . . . . 2-26
configuration startup option . . . . . . . . 3-179 Displaying a dialog box . . . . . . . . . . . . . 4-2
Configuring rich client customization . . . 1-2 Distributing customizations with Over-the-
Console . . . . . . . . . . . . . . . . . . . . . . . . 4-6 Web Installer . . . . . . . . . . . . . . . . . . 3-15
consolelog startup option . . . . . . . . . . 3-179 DskipRegReload startup option . . . . . 3-180
Constants . . . . . . . . . . . . . . . . . . . . . . 4-31 Dynamic files . . . . . . . . . . . . . . . . . 4-8–4-9
contains helper function . . . . . . . . . . . 4-41
Context sensitivity . . . . . . . . . . . . . . 3-252 E
Object model . . . . . . . . . . . . . . . . . 3-252
Registration . . . . . . . . . . . . . . . . . 3-253 Eclipse
Conventions Installing . . . . . . . . . . . . . . . . . . . . . 3-9
Color . . . . . . . . . . . . . . . . . . . . . . . 3-183 Project preferences . . . . . . . . . . . . . . 3-10
Dialog box . . . . . . . . . . . . . . . . . . . 3-182 Rich client platform . . . . . . . . . . . . . . 3-2
File organization . . . . . . . . . . . . . . 3-181 Running the rich client . . . . . . . . . . . 3-10
Fonts . . . . . . . . . . . . . . . . . . . . . . 3-183 Setup . . . . . . . . . . . . . . . . . . . . . . . . 3-9

Index-2 Client Customization Programmer’s Guide PLM00075 H


Index

Workbench . . . . . . . . . . . . . . . . . . 3-251 F
ECM_delivered_engine_status
Files
preference . . . . . . . . . . . . . . . . . . . . . . 4-9
actions.properties . . . . . . . . . . . . . . 3-253
ECM_form_relation preference . . . . . . . . 4-9
com.teamcenter.rac.stylesheet.stylesheet_
Enabling rich client customization . . . . . 1-2
user.properties . . . . . . . . . . . . . 3-139
enddef TcScript function . . . . . . . . . . . 4-38
Organization conventions . . . . . . . . 3-181
endtry TcScript error handling
filesSelector extension point . . . . . . . . 3-159
statement . . . . . . . . . . . . . . . . . . . . . 4-38
Firebug . . . . . . . . . . . . . . . . . . . . . . . . 4-6
Environment variables
Firefox . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
IMAN_SDL_MAGIC . . . . . . . . . . . . . 4-40
fireSelectionEvent() method . . . . . . . . 3-254
TC_WEB_NO_CACHE . . . . . . . . 4-9, 4-27
firstcolumn XML element . . . . . . . . . . 2-64
EPM_adhoc_signoffs preference . . . . . . . 4-9
FL_create function . . . . . . . . . . . . . . . . 4-5
Errors . . . . . . . . . . . . . . . . . . . . . . . . 4-39
Font conventions . . . . . . . . . . . . . . . . 3-183
ErrorStack helper function . . . . . . . . . 4-41
for TcScript function . . . . . . . . . . . . . . 4-36
errorstack message . . . . . . . . . . . . . 4-5–4-6
Form content . . . . . . . . . . . . . . . . . . . 4-21
Examples
formrenderer.js file . . . . . . . . . . . . . . . . 4-4
AbstractDialog class . . . . . . . . . . . . 3-218
Forms . . . . . . . . . . . . . . . . . . . . . . . . 4-18
AbstractPopupButton code . . . . . . . 3-219
Abstract rendering . . . . . . . . . . . . . 3-132
AbstractProgressDialog
Automatic . . . . . . . . . . . . . . . . . . . 3-132
component . . . . . . . . . . . . . . . . 3-204
Comments . . . . . . . . . . . . . . . . . . . 3-147
GenericTableModel component . . . . 3-220
Customizing . . . . . . . . . . . . . . . . . 3-131
GroupPanel component . . . . . . . . . . 3-216
Definition . . . . . . . . . . . . . . . . . . . 3-131
HorizontalButtonLayout layout
Developing . . . . . . . . . . . . . 3-133, 3-141
manager . . . . . . . . . . . . . . . . . . 3-222
Developing using XML style sheets . . . 2-2
HorizontalLayout layout manager . . 3-228
Display components . . . . . . . . . . . . 3-149
IDE setup . . . . . . . . . . . . . . . . . . . . . 3-9
Displaying . . . . . . . . . . . . . . . . . . . 3-150
LOVDialog component . . . . . . . . . . 3-206
Events . . . . . . . . . . . . . . . . . . . . . 3-149
LOVPopupButton component . . . . . 3-207
JavaBean . . . . . . . . . . . . . . . . . . . 3-132
MessageBox component . . . . . . . . . 3-240
Performance issues . . . . . . . . . . . . 3-148
MLabel component . . . . . . . . . . . . . 3-241
Property display keys . . . . . . . . . . . . 2-26
MRUButton component . . . . . . . . . 3-209
Rendering . . . . . . . . . . . . . . . . . . . . 2-38
OpenByNameButton component . . . 3-210
Types . . . . . . . . . . . . . . . . . . . . . . 3-132
OrgSelectionDialog component . . . . 3-211
XML style sheet . . . . . . . . . . . . . . . 3-132
PropertyLayout layout manager . . . 3-236
ReferencersPanel component . . . . . . 3-214
Registry file . . . . . . . . . . . . . . . . . . 3-242 G
Registry file references . . . . . . . . . . 3-243 generate_client_meta_cache utility . . . . 2-22
RolePanel component . . . . . . . . . . . 3-215 Generating a page . . . . . . . . . . . . . . . . . 4-1
Separator component . . . . . . . . . . . 3-244 GenericTableModel class . . . . . . . . . . 3-220
SplitPane component . . . . . . . . . . . 3-245 getChildren() method . . . . . . . . . . . . 3-205
StringViewerDialog component . . . . 3-246 getOperations() method . . . . . . . . . . . 3-205
StringViewerPanel component . . . . 3-247 Getting Started button
TCComponentUINode component . . 3-214 Rich client . . . . . . . . . . . . . . . . . . . . . 1-4
TCTypeRenderer class . . . . . . . . . . 3-218 GoverningProperty XML element . . . . . 2-67
UserPanel component . . . . . . . . . . . 3-217 GroupPanel component . . . . . . . . . . . 3-215
VerticalButtonLayout layout
manager . . . . . . . . . . . . . . . . . . 3-225
H
VerticalLayoutManager . . . . . . . . . 3-232
Excel files . . . . . . . . . . . . . . . . . . . . . 3-155 Handlers
Exception class naming conventions . . 3-182 Registering . . . . . . . . . . . . . . . . . . 3-253
ExpansionRule component . . . . . . . . . 3-205 RequiredSelectionHandler . . . . . . . 3-253
Writing . . . . . . . . . . . . . . . . . . . . . 3-254
head.ish file . . . . . . . . . . . . . . . . . . . . . 4-6
header XML element . . . . . . . . . . . . . . 2-68

PLM00075 H Client Customization Programmer’s Guide Index-3


Index

Headless customization . . . . . . . . . . . 3-151 Interface naming conventions . . . . . . . 3-182


Helper functions . . . . . . . . . . . . . . . . . 4-40 InterfaceBufferedPropertyComponent
car . . . . . . . . . . . . . . . . . . . . . . . . . 4-40 component . . . . . . . . . . . . . . . . . . . 3-140
Class . . . . . . . . . . . . . . . . . . . . . . . 4-40 InterfacePropertyComponent
contains . . . . . . . . . . . . . . . . . . . . . 4-41 component . . . . . . . . . . . . . . . . . . . 3-140
ErrorStack . . . . . . . . . . . . . . . . . . . 4-41 Interfaces
HTMLDefaultHeader . . . . . . . . . . . . 4-41 Rich client . . . . . . . . . . . . . . . . . . . . . 1-3
HTMLErrorStack . . . . . . . . . . . . . . 4-42 Thin client . . . . . . . . . . . . . . . . . . . . . 1-6
imanText . . . . . . . . . . . . . . . . . . . . . 4-42 InterfaceSignalOnClose class . . . . . . . 3-173
Message . . . . . . . . . . . . . . . . . . . . . 4-42 Item create panels . . . . . . . . . . . . . . . . 2-34
Preference . . . . . . . . . . . . . . . . . . . . 4-43 Item revision master form . . . . . . . . . . 4-24
quote . . . . . . . . . . . . . . . . . . . . . . . 4-43 iTextArea component . . . . . . . . . . . . . 3-221
quoteImanText . . . . . . . . . . . . . . . . 4-44 iTextField component . . . . . . . . . . . . 3-221
removeArrayElement . . . . . . . . . . . . 4-44 ITK . . . . . . . . . . . . . . . . . . . . . . 4-27, 4-35
replaceArrayElement . . . . . . . . . . . . 4-44
replaceChar . . . . . . . . . . . . . . . . . . . 4-45
replaceString . . . . . . . . . . . . . . . . . . 4-45 J
SetPreference . . . . . . . . . . . . . . . . . 4-46 JavaScript
SinglePreference . . . . . . . . . . . . . . . 4-46 Files . . . . . . . . . . . . . . . . . . . . . . 4-7–4-8
startsWith . . . . . . . . . . . . . . . . . . . . 4-47 Menu customization . . . . . . . . . . . . . . 4-2
throwIfErrorNot . . . . . . . . . . . . . . . 4-47 JComboBox component . . . . . . . . . . . 3-206
throwIfErrorNotArray . . . . . . . . . . . 4-48 JPanel component . . . . . . . . . . . . . . . 3-139
tokenize . . . . . . . . . . . . . . . . . . . . . 4-48 JTextArea class . . . . . . . . . . . . . . . . . 3-221
XMLDefaultHeader . . . . . . . . . . . . . 4-49 JTextField class . . . . . . . . . . . . . . . . 3-221
Hiding perspectives . . . . . . . . . . . . . . 3-164
HorizontalLayout layout manager . . . 3-228
HTML files . . . . . . . . . . . . . . . . . . . . 3-155 L
HTMLDefaultHeader helper function . . 4-41
HTMLErrorStack helper function . . . . . 4-42 label XML element . . . . . . . . . . . . . . . 2-72
Launch Pad . . . . . . . . . . . . . . . . . . . 3-161
Layout managers
I ButtonLayout . . . . . . . . . . . . . . . . 3-222
ICD files . . . . . . . . . . . . . . . . . . . . . . . 3-14 Horizontal ButtonLayout . . . . . . . . 3-222
if TcScript function . . . . . . . . . . . . . . . 4-37 HorizontalLayout . . . . . . . . . . . . . . 3-228
Image file naming conventions . . . . . . 3-181 In general . . . . . . . . . . . . . . . . . . . 3-222
image XML element . . . . . . . . . . . . . . 2-70 PropertyLayout . . . . . . . . . . . . . . . 3-236
IMAN_SDL_MAGIC environment Vertical ButtonLayout . . . . . . . . . . 3-225
variable . . . . . . . . . . . . . . . . . . . . . . 4-40 VerticalLayout . . . . . . . . . . . . . . . . 3-232
imanText helper function . . . . . . . . . . . 4-42 Left-hand navigation toolbar . . . . . . . . 4-13
include TcScript function . . . . . . . . . . . 4-38 LENGTH array operator . . . . . . . . . . . 4-33
initialize startup option . . . . . . . . . . . 3-180 License agreement . . . . . . . . . . . . . . . . 1-7
initializeDialog() method . . . . . . . . . . 3-204 listDisplay XML element . . . . . . . . . . . 2-75
Initiate selection events . . . . . . . . . . . 3-254 Listener leaks . . . . . . . . . . . . . 3-172–3-173
Installable component descriptor file . . . 3-14 Localization . . . . . . . . . . . . . . . 3-83, 3-163
Installing Eclipse . . . . . . . . . . . . . . . . . 3-9 LOG TcScript function . . . . . . . . . . . . . 4-36
insweb . . . . . . . . . . . . . . . . . . . . 3-14–3-15 LOVComboBox component . . . . . . . . . 3-206
Integer operators . . . . . . . . . . . . . . . . 4-32 LOVDialog component . . . . . . . . . . . . 3-206
Integrated development environment LOVPanel . . . . . . . . . . . . . . . . . . . . . 3-207
(IDE) . . . . . . . . . . . . . . . . . . . . . . . . . 3-9 LOVPanel component . . . . . . . . . . . . 3-207
Interface components LOVPopupButton component . . . . . . . 3-208
InterfaceBufferedProperty
Component . . . . . . . . . . . . . . . . 3-140 M
InterfacePropertyComponent . . . . . 3-140
InterfaceRendererEvent . . . . . . . . . 3-149 Mandatory properties . . . . . . . . . . . . 2-117

Index-4 Client Customization Programmer’s Guide PLM00075 H


Index

Manufacturing Process Planner Note attribute . . . . . . . . . . . . . . . . . . 3-147


tabs . . . . . . . . . . . . . . . . . . . . . . . . 3-158
Menu bar . . . . . . . . . . . . . . . . . . . . 1-3, 1-6 O
Rich client . . . . . . . . . . . . . . . . . . . . . 1-3
Thin client . . . . . . . . . . . . . . . . . . . . . 1-6 objectSet tag . . . . . . . . . . . . . . . . . . . . 2-78
Menu commands . . . . . . . . . . . . . . . . . 3-23 objectSet XML element . . . . . . . . . . . . 2-77
Adding . . . . . . . . . . . . . . . . . . . . . . 3-20 okToModify() method . . . . . . . . . . . . . 3-149
Customizing . . . . . . . . . . . . . . . . . . . 4-2 onclick event . . . . . . . . . . . . . . . . . . . . . 4-4
Suppressing . . . . . . . . . . . . . . . . . . . 2-1 OpenByNameButton component . . . . . 3-209
Toggle . . . . . . . . . . . . . . . . . . . . . . . 3-34 Operators . . . . . . . . . . . . . . . . . . 4-32–4-33
View menu . . . . . . . . . . . . . . . . . . . 3-30 Options . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Menus . . . . . . . . . . . . . . . . . . . . 4-13, 4-15 OrgSelectionDialog component . . . . . . 3-210
MEProcess business object . . . . . . . . . 3-158 os startup option . . . . . . . . . . . . . . . . 3-180
Message helper function . . . . . . . . . . . 4-42 Over-the-Web Installer
MessageBox class . . . . . . . . . . . . . . . 3-240 Distributing customizations . . . . . . . 3-15
Methods Removing customizations . . . . . . . . . 3-16
centerToScreen . . . . . . . . . . . . . . . 3-218 Override forms . . . . . . . . . . . . . . . . . . 4-21
close() . . . . . . . . . . . . . . . . . . . . . . 3-173 Overriding commands . . . . . . . . . . . . . 3-80
closeSignaled() . . . . . . . . . . . . . . . . 3-173
componentSelection() . . . . . . . . . . . 3-253 P
dialogDisplayed() . . . . . . . . . . . . . . 3-149
fireSelectionEvent() . . . . . . . . . . . . 3-254 Packages
getChildren() . . . . . . . . . . . . . . . . . 3-205 Naming conventions . . . . . . . . . . . . 3-181
getOperations() . . . . . . . . . . . . . . . 3-205 page XML element . . . . . . . . . . . . . . . 2-80
initializeDialog() . . . . . . . . . . . . . . 3-204 parameter XML element . . . . . . . . . . . 2-85
okToModify() . . . . . . . . . . . . . . . . . 3-149 PDF files . . . . . . . . . . . . . . . . . . . . . 3-155
RenderingLoader.load() . . . . . . . . . 3-151 perspective startup option . . . . . . . . . 3-180
save() . . . . . . . . . . . . . . . . . . . . . . 3-140 Perspectives
saveProperty() . . . . . . . . . . . . . . . . 3-140 Hiding . . . . . . . . . . . . . . . . . . . . . 3-164
setBounds() . . . . . . . . . . . . . . . . . . 3-149 In general . . . . . . . . . . . . . . . . . . . . . 3-1
setEnabled() . . . . . . . . . . . . . . . . . 3-252 Plug-ins . . . . . . . . . . . . . . . . . . . . 3-248
setFormProperties() . . . . . . . . . . . . 3-148 Plug-ins, perspectives . . . . . . . . . . . . 3-248
setReadOnly() . . . . . . . . . . . . . . . . 3-149 plugincustomization startup option . . . 3-180
setStringValue() . . . . . . . . . . . . . . . 3-148 popup method . . . . . . . . . . . . . . . . . . . . 4-2
setStringValueData() . . . . . . . . . . . 3-148 popupNewFolderDialog function . . . . . . . 4-2
setVisible() . . . . . . . . . . . . . . . . . . 3-252 PowerPoint files . . . . . . . . . . . . . . . . 3-155
startOperation() . . . . . . . . . . . . . . . 3-205 Preference helper function . . . . . . . . . . 4-43
startProcess() . . . . . . . . . . . . . . . . 3-205 Preferences . . . . . . . . . . . . . . . . . . . . . . 4-9
MLabel component . . . . . . . . . . . . . . 3-241 CR_allow_alternate_procedures . . . . . 4-9
mpp.properties file . . . . . . . . . . . . . . 3-158 ECM_delivered_engine_status . . . . . . 4-9
MRUButton component . . . . . . . . . . . 3-209 ECM_form_relation . . . . . . . . . . . . . . 4-9
My Teamcenter . . . . . . 2-28, 2-32, 2-34, 2-38 EPM_adhoc_signoffs . . . . . . . . . . . . . 4-9
SecondaryVMUDatasets . . . . . . . . . . 4-10
N VMU_Datasets . . . . . . . . . . . . . . . . 4-10
VMU_FileSearchOrder . . . . . . . . . . . 4-10
Navigation pane . . . . . . . . . . . . . . . 1-4, 1-6 WEB_auto_assign_ds_id . . . . . . . . . . . 4-9
Rich client . . . . . . . . . . . . . . . . . . . . . 1-4 WEB_core_help_server . . . . . . . . . . . . 4-9
Net . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6 WEB_dataset_shown_relations . . . . . . 4-9
New Business Object wizard . . . . . . . . 2-34 WEB_dataset_upload_mode . . . . . . . . 4-9
New menu . . . . . . . . . . . . . . . . . . . . . 4-15 WEB_default_site_server . . . . . . . . . . 4-9
new.js file . . . . . . . . . . . . . . . . . . . . . . . 4-2 WEB_help_server . . . . . . . . . . . . . . . 4-9
newfolder.xml file . . . . . . . . . . . . . . 4-4–4-5 WEB_max_search_results . . . . . . . . . . 4-9
nl startup option . . . . . . . . . . . . . . . . 3-180 WEB_menu_entry_new_window . . . . 4-14
nosplash startup option . . . . . . . . . . . 3-180 WEB_menu_entry_suppressions . . . . . 2-2

PLM00075 H Client Customization Programmer’s Guide Index-5


Index

WEB_processes . . . . . . . . . . . . . . . . . 4-9 TitledPropertySlider . . . . . . . . . . . 3-187


WEB_protocol . . . . . . . . . . . . . . . . . . 4-9 TitledPropertyTextArea . . . . . . . . . 3-186
WEB_style_sheet . . . . . . . . . . . . . . . 4-11 TitledPropertyTextField . . . . . . . . . 3-185
WEB_title_contents . . . . . . . . . . . . . . 4-9 TitledPropertyToggleButton . . . . . . 3-191
WEB_type-name_default_relation . . . . 4-9 TitledPropertyToggleButtonOption
Prerequisites . . . . . . . . . . . . . . . . . . . . 1-2 Lov . . . . . . . . . . . . . . . . . . . . . 3-195
Primary application buttons . . . . . . . . . . 1-4 Using . . . . . . . . . . . . . . . . . . . . . . 3-139
Rich client . . . . . . . . . . . . . . . . . . . . . 1-4 property XML element . . . . . . . . . . . . . 2-86
product startup option . . . . . . . . . . . . 3-180 PropertyArray bean . . . . . . . . . . . . . . 3-199
Project preferences . . . . . . . . . . . . . . . 3-10 propertyChangeListener . . . . . . . . . . 3-211
Properties PropertyCheckbox bean . . . . . . . . . . . 3-188
Dialog box . . . . . . . . . . . . . . . . . . . . 2-32 PropertyImage bean . . . . . . . . . . . . . 3-201
Display . . . . . . . . . . . . . . . . . . 2-2, 3-131 PropertyLabel bean . . . . . . . . . . . . . . 3-186
File conventions . . . . . . . . . . . . . . . 3-182 PropertyLayout layout manager . . . . . 3-236
Files . . . . . . . . . . . . . . . . . . 3-163, 3-182 PropertyLogicalPanel bean . . . . . . . . 3-198
Mandatory . . . . . . . . . . . . . . . . . . 2-117 PropertyLongText bean . . . . . . . . . . . 3-198
Property PropertyLOVButton bean . . . . . . . . . 3-191
Error table . . . . . . . . . . . . . . . . . . . 4-40 PropertyLOVCombobox bean . . . . . . . 3-193
Names . . . . . . . . . . . . . . . . . . . . . . 4-27 PropertyNameLabel bean . . . . . . . . . 3-184
TcScripting . . . . . . . . . . . . . . . . . . . 4-35 PropertyObjectLink bean . . . . . . . . . . 3-196
Property beans PropertyPanel bean . . . . . . . . . . . . . . 3-196
Developing . . . . . . . . . . . . . . . . . . 3-140 PropertyRadioButton bean . . . . . . . . . 3-189
Location . . . . . . . . . . . . . . . . . . . . 3-133 PropertyRadioButtonOptionLov
PropertyArray . . . . . . . . . . . . . . . . 3-199 bean . . . . . . . . . . . . . . . . . . . . . . . . 3-194
PropertyCheckbox . . . . . . . . . . . . . 3-188 PropertySlider bean . . . . . . . . . . . . . 3-187
PropertyImage . . . . . . . . . . . . . . . . 3-201 PropertyTextArea bean . . . . . . . . . . . 3-185
PropertyLabel . . . . . . . . . . . . . . . . 3-186 PropertyTextField bean . . . . . . . . . . . 3-185
PropertyLogicalPanel . . . . . . . . . . . 3-198 PropertyToggleButton bean . . . . . . . . 3-190
PropertyLongText . . . . . . . . . . . . . 3-198 PropertyToggleButtonOptionLov
PropertyLOVButton . . . . . . . . . . . . 3-191 bean . . . . . . . . . . . . . . . . . . . . . . . . 3-195
PropertyLOVCombobox . . . . . . . . . 3-193
PropertyNameLabel . . . . . . . . . . . . 3-184
PropertyObjectLink . . . . . . . . . . . . 3-196 Q
PropertyPanel . . . . . . . . . . . . . . . . 3-196
QAF files . . . . . . . . . . . . . . . . . . . . . 3-156
PropertyRadioButton . . . . . . . . . . . 3-189
Quick Access files . . . . . . . . . . . . . . . 3-156
PropertyRadioButtonOptionLov . . . 3-194
Quick search
PropertySlider . . . . . . . . . . . . . . . . 3-187
Rich client . . . . . . . . . . . . . . . . . . . . . 1-4
PropertyTextArea . . . . . . . . . . . . . 3-185
quote helper function . . . . . . . . . . . . . . 4-43
PropertyTextField . . . . . . . . . . . . . 3-185
quoteImanText helper function . . . . . . . 4-44
PropertyToggleButton . . . . . . . . . . 3-190
PropertyToggleButtonOptionLov . . . 3-195
TitledPropertyArray . . . . . . . . . . . . 3-200 R
TitledPropertyCheckbox . . . . . . . . . 3-189
TitledPropertyCheckboxOptionLov . . 3-194 rac_command_suppression variable . . 3-152
TitledPropertyLabel . . . . . . . . . . . . 3-186 Recommendations . . . . . . . . . . . . . . . . . 4-8
TitledPropertyLogicalPanel . . . . . . 3-198 Referencers layout managers
TitledPropertyLongText . . . . . . . . . 3-198 In general . . . . . . . . . . . . . . . . . . . 3-212
TitledPropertyLOVButton . . . . . . . 3-192 ReferencersReverseHorizontal
TitledPropertyLOVCombobox . . 3-193–3-194 NodeLayout . . . . . . . . . . . . . . . 3-212
TitledPropertyObjectLink . . . . . . . . 3-197 ReferencersTreeLookNodeLayout . . 3-213
TitledPropertyPanel . . . . . . . . . . . . 3-196 ReferencersVerticalNodeLayout . . . 3-213
TitledPropertyRadioButton . . . . . . . 3-190 ReferencersPanel component . . . . . . . 3-212
TitledPropertyRadioButtonOption ReferencersReverseHorizontalNodeLayout
Lov . . . . . . . . . . . . . . . . . . . . . 3-195 layout manager . . . . . . . . . . . . . . . . 3-212

Index-6 Client Customization Programmer’s Guide PLM00075 H


Index

ReferencersTreeLookNodeLayout layout secondcolumn XML element . . . . . . . . . 2-91


manager . . . . . . . . . . . . . . . . . . . . . 3-213 section XML element . . . . . . . . . . . . . . 2-94
ReferencersVerticalNodeLayout layout Separator component . . . . . . . . . . . . . 3-244
manager . . . . . . . . . . . . . . . . . . . . . 3-213 separator XML element . . . . . . . . . . . . 2-97
ReferencerUINode component . . . . . . 3-213 Server condition symbol . . . . . . . . . . . . . 1-5
refresh startup option . . . . . . . . . . . . 3-181 setBounds() method . . . . . . . . . . . . . . 3-149
Registry . . . . . . . . . . . . . . . . . . . . . . 3-242 setEnabled() method . . . . . . . . . . . . . 3-252
Regular property display keys . . . . . . . 2-26 SetPreference helper function . . . . . . . 4-46
removeArrayElement helper function . . 4-44 setReadOnly() method . . . . . . . . . . . . 3-149
Removing customizations with Over-the-Web Setting default options . . . . . . . . . . . . . 4-9
Installer . . . . . . . . . . . . . . . . . . . . . . 3-16 setVisible() method . . . . . . . . . . . . . . 3-252
Rendering hints Shortcut menu . . . . . . . . . . . . . . . . . . 3-23
Custom . . . . . . . . . . . . . . . . . . . . . 2-114 showlocation startup option . . . . . . . . 3-181
Introduction . . . . . . . . . . . . . . . . . 2-106 SignalOnClose class . . . . . . . . . . . . . 3-173
JavaBeans . . . . . . . . . . . . . . . . . . . 2-106 SinglePreference helper function . . . . . 4-46
rendering XML element . . . . . . . . . . . . 2-89 SORT array operator . . . . . . . . . . . . . . 4-33
replaceArrayElement helper function . . 4-44 Source
replaceChar helper function . . . . . . . . . 4-45 Code conventions . . . . . . . . . . . . . . 3-182
replaceString helper function . . . . . . . . 4-45 File naming conventions . . . . . . . . . 3-182
Request URL . . . . . . . . . . . . . . . . . . . . 4-4 SPLICE array operator . . . . . . . . . . . . 4-34
RequiredSelectionHandler handler . . . 3-253 SplitPane component . . . . . . . . . . . . . 3-245
Reserved variables . . . . . . . . . . . . . . . 4-32 startOperation() method . . . . . . . . . . 3-205
REVERSE array operator . . . . . . . . . . 4-33 startProcess() methods . . . . . . . . . . . 3-205
Reverse engineering . . . . . . . . . . . . . . . 1-7 startsWith helper function . . . . . . . . . . 4-47
Rich client Static files . . . . . . . . . . . . . . . . . . . 4-7, 4-9
Application banner . . . . . . . . . . . . . . . 1-4 Strings
Application pane . . . . . . . . . . . . . . . . 1-4 Examples . . . . . . . . . . . . . . . . . . . . 4-31
Back and forward buttons . . . . . . . . . . 1-3 Operators . . . . . . . . . . . . . . . . . . . . 4-32
Clipboard button . . . . . . . . . . . . . . . . 1-4 StringViewerDialog class . . . . . . . . . . 3-246
Debugging tools . . . . . . . . . . . . . . . 3-166 StringViewerPanel component . . . . . . 3-246
Getting Started button . . . . . . . . . . . . 1-4 Style sheets
Menu bar . . . . . . . . . . . . . . . . . . . . . 1-3 Create . . . . . . . . . . . . . . . 2-10, 2-19, 2-22
Navigation pane . . . . . . . . . . . . . . . . 1-4 Form . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
Platform . . . . . . . . . . . . . . . . . . . . . . 3-2 Introduction . . . . . . . . . . . . . . . . . . . 2-2
Primary application buttons . . . . . . . . 1-4 Property . . . . . . . . . . . . . . . . . . . . . . 2-4
Running from Eclipse . . . . . . . . . . . . 3-10 Register . . . . . . . . . . . . . . . . . . . . . 2-23
Search field . . . . . . . . . . . . . . . . . . . . 1-4 Sample customizations . . . . . . . . . . . 2-28
Secondary application buttons . . . . . . . 1-4 Search . . . . . . . . . . . . . . . . . . . . . . 2-15
Server condition symbol . . . . . . . . . . . 1-5 Summary . . . . . . . . . . . . . . . . . . . . . 2-8
Toolbar . . . . . . . . . . . . . . . . . . . . . . . 1-3 Summary 2007 . . . . . . . . . . . . . . . . 2-13
User interface condition symbol . . . . . . 1-5 Types . . . . . . . . . . . . . . . . . . . . . . . . 2-3
Rich client interface . . . . . . . . . . . . . . . 1-3 Success response . . . . . . . . . . . . . . . . . . 4-5
Rich client perspectives and views . . . . . 3-1 Summary view . . . . . . . . . . . . . . . . . . 2-28
RolePanel component . . . . . . . . . . . . 3-214 Suppressing commands . . . . . . . . . . . 3-152
Rule XML element . . . . . . . . . . . . . . . 2-90 Suppressing menu commands . . . . . . . . 2-1
Syntax definition conventions . . . . . . . . . 1-8
S Syntax errors . . . . . . . . . . . . . . . . . . . 4-39
System constants . . . . . . . . . . . . . . . . 4-31
save() method . . . . . . . . . . . . . . . . . . 3-140 system_property_names_locale.xml
saveProperty() method . . . . . . . . . . . . 3-140 file . . . . . . . . . . . . . . . . . . . . . . . . . . 4-27
Script . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
Search field . . . . . . . . . . . . . . . . . . . . . 1-4 T
Secondary application buttons . . . . . . . . 1-4
SecondaryVMUDatasets preference . . . 4-10 Tab customization . . . . . . . . . . . . . . . 3-158

PLM00075 H Client Customization Programmer’s Guide Index-7


Index

Table viewer . . . . . . . . . . . . . . . . . . . . 3-92 TitledPropertyLogicalPanel bean . . . . 3-198


tableDisplay XML element . . . . . . . . . . 2-99 TitledPropertyLongText bean . . . . . . . 3-198
TableModel component . . . . . . . . . . . 3-220 TitledPropertyLOVButton bean . . . . . 3-192
TC_WEB_NO_CACHE environment TitledPropertyLOVCombobox
variable . . . . . . . . . . . . . . . . . . . 4-9, 4-27 bean . . . . . . . . . . . . . . . . . . . 3-193–3-194
TCComponentUINode component . . . . 3-214 TitledPropertyObjectLink bean . . . . . 3-197
TCConstants class . . . . . . . . . . . . . . . 3-214 TitledPropertyPanel bean . . . . . . . . . 3-196
TcScript . . . . . . . . . . . . . . . . . . . . 4-5, 4-27 TitledPropertyRadioButton bean . . . . 3-190
Array operators . . . . . . . . . . . . . . . . 4-33 TitledPropertyRadioButtonOptionLov
Constants . . . . . . . . . . . . . . . . . . . . 4-31 bean . . . . . . . . . . . . . . . . . . . . . . . . 3-195
Error handling statements . . . . . . . . 4-38 TitledPropertySlider bean . . . . . . . . . 3-187
Integer operators . . . . . . . . . . . . . . . 4-32 TitledPropertyTextArea bean . . . . . . . 3-186
Operators . . . . . . . . . . . . . . . . 4-32–4-33 TitledPropertyTextField bean . . . . . . . 3-185
Reserved variables . . . . . . . . . . . . . . 4-32 TitledPropertyToggleButton bean . . . . 3-191
Statements . . . . . . . . . . . . . . . . . . . 4-36 TitledPropertyToggleButtonOptionLov
String operators . . . . . . . . . . . . . . . . 4-32 bean . . . . . . . . . . . . . . . . . . . . . . . . 3-195
Strings . . . . . . . . . . . . . . . . . . . . . . 4-31 Toggle menu . . . . . . . . . . . . . . . . . . . . 3-34
Syntax errors . . . . . . . . . . . . . . . . . . 4-39 tokenize helper function . . . . . . . . . . . 4-48
System constants . . . . . . . . . . . . . . . 4-31 Toolbar . . . . . . . . . . . . . . 1-3, 1-6, 3-27, 3-30
Types . . . . . . . . . . . . . . . . . . . . . . . 4-30 Top-level pages . . . . . . . . . . . . . . . . . . . 4-6
Variables . . . . . . . . . . . . . . . . . 4-31–4-32 Tree viewer . . . . . . . . . . . . . . . . . . . . 3-99
TcScript files . . . . . . . . . . . . . . . . . . . . 4-8 treeDisplay XML element . . . . . . . . . 2-102
TcScript statements treeRenderer code . . . . . . . . . . . . . . . . . 4-4
enddef . . . . . . . . . . . . . . . . . . . . . . . 4-38 try TcScript error handling
tcserver process . . . . . . . . . . . 4-5, 4-8, 4-27 statement . . . . . . . . . . . . . . . . . . . . . 4-38
TCTypeRenderer class . . . . . . . . . . . . 3-217 Types . . . . . . . . . . . . . . . . . . . . . . . . . 4-30
Teamcenter
Data . . . . . . . . . . . . . . . . . . . . . . . . 4-34 U
Errors . . . . . . . . . . . . . . . . . . . . . . . 4-39
Teamcenter interfaces Unpublished APIs and extension
Rich client . . . . . . . . . . . . . . . . . . . . . 1-3 points . . . . . . . . . . . . . . . . . . . . . . . . . 1-7
Thin client . . . . . . . . . . . . . . . . . . . . . 1-6 update.js file . . . . . . . . . . . . . . . . . . . . . 4-6
Text Upgrading customization . . . . . . . . . . 3-164
Field conventions . . . . . . . . . . . . . . 3-183 User interface condition symbol . . . . . . . 1-5
Files . . . . . . . . . . . . . . . . . . . . . . . 3-155 User services
Thin client Registering functions . . . . . . . . . . . 3-155
Component pane . . . . . . . . . . . . . . . . 1-6 user_property_names.xml file . . . . . . . . 4-27
Data pane . . . . . . . . . . . . . . . . . . . . . 1-7 UserPanel component . . . . . . . . . . . . 3-216
Menu bar . . . . . . . . . . . . . . . . . . . . . 1-6
Navigation pane . . . . . . . . . . . . . . . . 1-6 V
Toolbar . . . . . . . . . . . . . . . . . . . . . . . 1-6 Variable naming conventions . . . . . . . 3-182
Thin client interface . . . . . . . . . . . . . . . 1-6 Variables . . . . . . . . . . . . . . . . . . 4-31–4-32
Thin Client window . . . . . . . . . . . . . . . . 1-6 VerticalLayout layout manager . . . . . 3-232
throw TcScript error handling view XML element . . . . . . . . . . . . . . 2-104
statement . . . . . . . . . . . . . . . . . . . . . 4-38 Viewer, displaying files . . . . . . . . . . . 3-155
throwIfErrorNot helper function . . . . . . 4-47 visibleWhen expression . . . . . . . . . . . 3-152
throwIfErrorNotArray helper vm startup option . . . . . . . . . . . . . . . 3-181
function . . . . . . . . . . . . . . . . . . . . . . 4-48 vmargs startup option . . . . . . . . . . . . 3-181
thumbnailDisplay XML element . . . . . 2-101 VMU_Datasets preference . . . . . . . . . . 4-10
TitledPropertyArray bean . . . . . . . . . 3-200 VMU_FileSearchOrder preference . . . . 4-10
TitledPropertyCheckbox bean . . . . . . 3-189
TitledPropertyCheckboxOptionLov
bean . . . . . . . . . . . . . . . . . . . . . . . . 3-194 W
TitledPropertyLabel bean . . . . . . . . . 3-186 Web Application Manager . . . . . . . . . . 3-14

Index-8 Client Customization Programmer’s Guide PLM00075 H


Index

Web files . . . . . . . . . . . . . . . . . . . . . 3-155 WEB_string_to_int function . . . . . . . . . 4-35


WEB_arithmetic function . . . . . . 4-32, 4-35 WEB_style_sheet preference . . . . . . . . 4-11
WEB_auto_assign_ds_id preference . . . . 4-9 WEB_title_contents preference . . . . . . . . 4-9
WEB_compare function . . . . . . . . . . . . 4-35 WEB_type-name_default_relation
WEB_core_help_server preference . . . . . 4-9 preference . . . . . . . . . . . . . . . . . . . . . . 4-9
WEB_dataset_shown_relations Word files . . . . . . . . . . . . . . . . . . . . . 3-155
preference . . . . . . . . . . . . . . . . . . . . . . 4-9 Workflow customization . . . . . . . . . . . 3-110
WEB_dataset_upload_mode wsomenu.xml file . . . . . . . . . . . . . . . . . 4-2
preference . . . . . . . . . . . . . . . . . . . . . . 4-9
WEB_default_site_server preference . . . . 4-9 X
WEB_displayed_new_menu_objects
preference . . . . . . . . . . . . . . . . . . . . . 4-15 XML elements for rendering style
WEB_help_server preference . . . . . . . . . 4-9 sheets . . . . . . . . . . . . . . . . . . . . . . . . 2-45
WEB_max_search_results preference . . . 4-9 XML Rendering Template . . . . . . . . . . . 2-2
WEB_menu_entry_new_window XML style sheets
preference . . . . . . . . . . . . . . . . . . . . . 4-14 Customizing the properties display . . . 2-2
WEB_menu_entry_suppressions Using predefined . . . . . . . . . . . . . . . 2-26
preference . . . . . . . . . . . . . . . . . . . . . . 2-2 XMLDefaultHeader helper function . . . 4-49
WEB_processes preference . . . . . . . . . . . 4-9 XMLRenderingStylesheet dataset . . . . . . 2-2
WEB_protocol preference . . . . . . . . . . . . 4-9

PLM00075 H Client Customization Programmer’s Guide Index-9

You might also like