client_customization_programmers_guide
client_customization_programmers_guide
Teamcenter 12.0
Rich Client
Customization
PLM00075 • 12.0
Contents
Figures
TitledPropertyLOVCombobox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-23
TitledPropertyObjectLink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-23
TitledPropertyRadioButton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-24
TitledPropertyRadioButtonOptionLov . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-24
TitledPropertySlider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-25
TitledPropertyTextArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-25
TitledPropertyTextField . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-25
TitledPropertyToggleButton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-26
TitledPropertyToggleButtonOptionLov . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-26
Context Sensitivity object model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-30
Custom form using JavaBeans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-8
Default form in the item creation wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-12
Custom form in the item creation wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-16
Form user interface display panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-19
Form displayed in a dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-19
Form displayed in the rich client viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-19
Tables
Caution
You must install the 32-bit version of Java if you want to
install and run the 32-bit version of the rich client, or you must
install the 64-bit version of Java if you want to install and run
the 64-bit version of the rich client. You cannot run in mixed
modes.
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.
harvester_jt.pl AssemblyBookmarks
You can control the layout of the user interface based on the type of object being viewed and the
credentials of the user.
• You can customize using configuration instead of coding.
Each commonly-used business object type (such as item revisions, folders, datasets, and so on) has
a style sheet that defines the layout of its properties in the user interface.
Following are the steps Teamcenter takes to render a view using XRT.
1. The object type being viewed and the viewer being used determine the name of the preference
that will be used. For example: if a DocumentRevision object is being viewed in the Summary
viewer, the preference used is DocumentRevision.SUMMARYRENDERING
2. Since the preferences used for style sheet registration are hierarchical, a group, role, or user
preference of the same name would override the site default. For example, if there is a role
preference named DocumentRevision.SUMMARYRENDERING, it would override the site
preference.
4. The XMLRenderingStylesheet dataset is retrieved by name. Its contents are parsed and the
view layout is generated.
• Form display
Preference syntax: .FORMRENDERING
Defines the layout of forms, such as the Item Master form or the Item RevisionMaster form.
• Summary view
Preference syntax: .SUMMARYRENDERING
Defines the layout of the dialog boxe used when the user chooses File→New→Other and some
portions of the dialog box when the user chooses File→New→object.
The preferences that register style sheets have the following generic syntax.
objectType.RENDERINGTYPE
objectType
Refers to the database (non-localized) name of the object, as found in the Business Modeler
IDE. For example, the preference that controls the rendering for the Summary view when
the user selects a Document Revision is DocumentRevision.SUMMARYRENDERING.
If the object type selected does not have a preference, then Teamcenter will look for a
preference for the object's parent in the POM. In this case, the parent of DocumentRevision
is ItemRevision, so if DocumentRevision.SUMMARYRENDERING does not exist, then
ItemRevision.SUMMARYRENDERING will be retrieved instead.
RENDERINGTYPE
One of the supported rendering locations.
Style sheets are XML documents stored in XMLRenderingStylesheet datasets. Even though they
are commonly called style sheets, they are not CSS or XSL style sheets. They are more accurately
called XML rendering templates (XRT), but both terms are used in this documentation. The XML
code allows you to define a subset of properties to display, the display order, the user interface
rendering components to be used, and more.
To see all the available style sheets, search Teamcenter for XMLRenderingStylesheet datasets.
You can use the preferences_manager command line utility to import or modify style sheet
preferences like any other preference.
You can use the Edit→Options interface to register style sheet preferences, just like any other
preference.
The rich client has a special interface for registering style sheets using preferences. When you have
an XMLRenderingTemplate dataset highlighted, the View tab becomes an IDE of sorts for editing
the XML template and registering it using drop-down lists for object type and style sheet type. This
interface saves the XML edits as well as creating or modifying the preference based on the settings.
For example, in a new installation of Teamcenter, If you highlight the ItemSaveAs dataset and switch
to the Viewer tab, you will see that it is registered to the Save As dialog box for the Item object type.
This can be verified by checking the value of the Item.SAVEASRENDERING preference. Its value
will be ItemSaveAs.
Example: I want the summary view's property layout for item revisions to depend on my
users' login information
• You want a default style sheet that everyone will use unless otherwise specified.
• You have users that just need a simplified layout for viewing.
Preference instances
Assign the style sheets to the various groups and roles, and even users if desired, by creating each
preference instance with the value pointing to the respective style sheet. In this example, there
are 6 preference instances created.
User preferences Conner: ConnersIRSum
Role preferences Manager: IRSumMgr
Designer: IRSumDes
Group preferences Engineering: IRSumTech
Manufacturing: IRSumTech
Site preference value: ItemRevSum
The Viewer role and the Tester group have no preference instances created for their location.
In this example, Alice selects a DocumentRevision business object and uses the Summary tab.
When she does this, Teamcenter performs a few steps to determine which style sheet to use.
1. Based on the object type and the view location, the system knows the name of the preference
instances to retrieve.
In this example, DocumentRevision.SUMMARYRENDERING.
There are two instances: one at the Site location, and one at the Manager Role location.
2. Based on the user's current session information, Teamcenter chooses the appropriate preference
instance.
Less specific locations are overridden by more specific locations.
3. The value of the chosen preference instance is read, providing the name of the style sheet
to retrieve.
Result
Your users see a different set of information based on what group or role they are in because the
client uses different style sheets.
• Alice sees the style sheet for Managers because she does not have a user preference set to
supercede it. The site preference is overridden by the Engineering group preference, which is
overridden by the Manager role preference. Ted has the same result; the Manufacturing group
preference is overridden by the Manager preference. Sue doesn't have a group preference, but
she still gets the Manager role preference.
• Bob sees the style sheet for Designers because of his role, similar to the preceding example.
• Carol sees the tech style sheet because there is no role preference for Viewers.
• Pat's group and role do not have preferences associated with them, and neither does she have a
user preference, so she gets the default style sheet defined by the site preference.
• Conner gets Conner's style sheet regardless of which group or role he's in, since a user
preference supercedes all others.
2. Click the arrow on the Select a Search button and choose General.
4. Press the Enter key or click the Execute the Search button .
5. In the Search Results tab, select the style sheet you want to view. Click the Viewer tab to
see the style sheet.
Note
Do not double-click a style sheet (XMLRenderingStylesheet dataset file) in an attempt
to open it. If you do, you receive an Unable to open error message. Instead, select
the style sheet and view its contents in the Viewer view.
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.
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="tc_xrt_General">
<column>
<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"/>
</column>
<column>
<image/>
</column>
</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
4. When you are done making changes, click the Apply button in the lower right corner of the view.
5. To see the two new preferences, choose Edit→Options and at the bottom of the dialog box,
click Search.
6. To see the style sheet changes in the clients, clear the client's cache. 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 –u=infodba –p=infodba –g=dba update stylesheets
c. Locate and select the XML file in your operating system directory and click Add.
Teamcenter displays the XML file in the Named References dialog box.
d. Click Close.
4. To see the style sheet changes in the clients, clear the client cache. Exit the rich client and restart
it using the -clean command argument to remove the old configuration from cache.
Example
When viewing an object's properties, select it and then use the Viewer tab. The properties
displayed in this view are rendered using SWT, but controlled by XML rendering templates
(XRT), also known as style sheets. XRT is easily editable, does not need to be deployed,
and can easily be tailored to any group, role, or user.
.
If you View properties using the context menu, the dialog box presented is controlled
by the same XRT, but the underlying technology is Swing, and therefore limited in its
functionality. Whenever possible, encourage your users to use the Viewer tab instead of
the dialog box.
View rendering
An individual view tab is defined by a <rendering> tag, and consists of two main components, the
header and the page.
<rendering>
<rendering>
<header>
<page titleKey = ...>
<page titleKey = ...>
<page titleKey = ...>
View header
You control what is displayed in the header by modifying what is defined within the <header> tag.
<header>
<header>
<image source = "thumbnail"/>
<property name = "owning_user"/>
<property name = "last_mod_date"/>
<property name = "release_status_list"/>
<property name = "object_type"/>
View page
You control the number of pages within the view, their names, and when they appear using the
<page> tag.
You can use columns, sections, properties, and commands within your page.
<page>
<page>
<page titleKey="tc_xrt_Overview">
<page titleKey = "tc_xrt_Mat1MaterialAndSubstanceInfo"
title = "Material and Substance Information"
visibleWhen = "Mat1UsesMaterial != null">
<page title = "Attachments" titleKey="tc_xrt_attachments">
<page titleKey="tc_xrt_AvailableRevisions">
<page title="Related Links" titleKey="tc_xrt_RelatedLinks"
visibleWhen="{pref:LIS_RelatedLinkTabVisible}==true">
<page titleKey = "tc_xrt_VendorParts" title = "Vendor Parts "
visibleWhen = "VMRepresents==null">
<page titleKey = "tc_xrt_VendorParts*" title = "Vendor Parts *"
visibleWhen = "VMRepresents!=null">
Page section
You may divide your page into sections. Their names and their order on the page is controlled
using the <section> tag.
<section>
<section titleKey="tc_xrt_ItemRevProperties">
<section titleKey="tc_xrt_ClassificationProperties">
<section titleKey="tc_xrt_Preview">
<section titleKey="tc_xrt_actions" commandLayout="vertical">
Page columns
You may divide your sections on your page into columns by wrapping them in <column> tags. If you
choose to use columns, the recommended limit is two.
<column>
<page titleKey="tc_xrt_Overview">
<column>
<section titleKey="tc_xrt_ItemRevProperties">
<section titleKey="tc_xrt_ClassificationProperties">
<column>
<section titleKey="tc_xrt_Preview">
<section titleKey="tc_xrt_actions" commandLayout="vertical">
No columns
<page titleKey="tc_xrt_Overview">
<section titleKey="tc_xrt_ItemRevProperties">
<section titleKey="tc_xrt_ClassificationProperties">
<section titleKey="tc_xrt_Preview">
<section titleKey="tc_xrt_actions" commandLayout="vertical">
You control which properties are displayed within a section or header using the <property> tag.
<property> in a section
<section titleKey="tc_xrt_ItemRevProperties">
<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"/>
<separator/>
<property name = "last_mod_user"/>
<property name="checked_out"/>
<property name = "checked_out_user"/>
<command commandId="com.teamcenter.rac.properties"
titleKey="tc_xrt_moreProperties"/>
</section>
<property> in a header
<property> in a header
<header>
<image source="thumbnail"/>
<classificationTrace/>
<property name = "owning_user"/>
<property name = "last_mod_date"/>
<property name="release_status_list"/>
<property name = "object_type"/>
Property tables
<objectSet>
Commands
<command> in table
<command> in table
<objectSet source = "IMAN_specification.Dataset" ...
<tableDisplay ...
<treeDisplay ...
<thumbnailDisplay/>
<listDisplay/>
<command commandId = "com.teamcenter.rac.common.AddNew"
<command commandId = "com.teamcenter.rac.viewer.pastewithContext"
<command commandId = "org.eclipse.ui.edit.cut"
<command> in a section
You can use these elements to add additional information or visual input to your views.
<break>
You can use this element to add a horizontal space on the page. This is similar to the separator
element, but with no visible line.
<classificationTrace>
You can add the classification category of an object. For example, Home Electronics >
Components > Hard Drives.
<classificationProperties/>
You can add the classification properties of an object.
<label>
You can add static, formatted text to your page.
<customPanel>
You can add your own custom content.
<image>
You can add an image to the page.
XML elements
all
EXAMPLE
Following is sample code from the Folder.xml XML rendering style sheet showing
the all element:
<page title="All" titleKey="tc_xrt_All">
<all type="property"/>
</page>
Note
The <conditions>, <GoverningProperty>, and <Rules> tags are not
supported within the <all> tag.
break
EXAMPLE
<page titleKey=”tc_xrt_General” title=”General”>
<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>
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.
ATTRIBUTES
None.
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 titleKey="tc_xrt_Overview">
<column>
<section titleKey="tc_xrt_AvailableRevisions">
<objectSet source="revision_list.ItemRevision" defaultdisplay="listDisplay"
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 titleKey="tc_xrt_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"
titleKey="tc_xrt_moreProperties"/>
</section>
<section titleKey="tc_xrt_ClassificationProperties">
<classificationProperties/>
</section>
</column>
classificationProperties
classificationTrace
Specifies that the classification traces of the item should be displayed, for example,
Home Care > Cleaners > Detergents.
ATTRIBUTES
None.
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>
classificationTrace
column
EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the column element:
<page titleKey="tc_xrt_Overview">
<column>
<section titleKey="tc_xrt_AvailableRevisions">
<objectSet source="revision_list.ItemRevision" defaultdisplay="listDisplay"
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 titleKey="tc_xrt_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"
titleKey="tc_xrt_moreProperties"/>
</section>
<section titleKey="tc_xrt_ClassificationProperties">
<classificationProperties/>
</section>
</column>
<column>
<section titleKey="tc_xrt_Preview">
<image source="preview"/>
</section>
<section titleKey="tc_xrt_actions" commandLayout="vertical">
<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"
titleKey="tc_xrt_newProc" />
</section>
</column>
</page>
command
Note
The command tag is ignored in the header section. Commands cannot be
added to the toolbar.
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"/>
...
</tableDisplay>
<thumbnailDisplay/>
<treeDisplay>
<property name="object_string"/>
...
</treeDisplay>
<listDisplay/>
<command commandId="com.teamcenter.rac.common.AddNew" renderingHint="commandbutton"/>
<command commandId="org.eclipse.ui.edit.cut" renderingHint="commandbutton">
<parameter name="localSelection" value="true"/>
</command>
In this example, the command element adds the Add New, Cut, Copy, and Paste
buttons in the user interface.
command element
customPanel
You must create your own custom panel to pass to the customPanel tag. Following
is the MyPanel.java file that defines the custom panel:
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
{
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
header
Note
The valid XML elements for this element are:
•
<classificationTrace>
•
<image>
•
<property>
ADDITIONAL
INFORMATION
The <header> element is optional. If it is not included, or if it does not contain any
elements, the header is automatically be populated with the object_string as a label.
This label is not selectable.
image
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
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:
<header>
<image source="thumbnail"/>
<classificationTrace/>
<property name="owning_user"/>
<property name="last_mod_date"/>
<property name="release_status_list"/>
<property name="object_type"/>
</header>
label
textKey
Support is provided for localized values by using the TextServer. 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.
SUPPORTED
STYLE
SHEETS
This tag can be used on all style sheet types.
EXAMPLES
• Text
Following is sample code for the label text element:
<label text="This is a raining day!" />
• 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="tc_xrt_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>
• URL rendering
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" />
listDisplay
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
The tree option is rendered as a thumbnail display.
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.
maxColumnCharCount
Specifies the maximum number of characters for a column. The default is 80. Set
to -1 for unlimited column size.
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. When
using a relation property, you must explicitily specify the relation. Subtypes are not
traversed. This is a string attribute that is required.
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"/>
...
</tableDisplay>
<thumbnailDisplay/>
<treeDisplay>
<property name="object_string"/>
...
</treeDisplay>
<listDisplay/>
<command commandId="com.teamcenter.rac.common.AddNew" renderingHint="commandbutton"/>
<command commandId="org.eclipse.ui.edit.cut" renderingHint="commandbutton">
<parameter name="localSelection" value="true"/>
</command>
<command acommandId="com.teamcenter.rac.copy" renderingHint="commandbutton"/>
<command commandId="com.teamcenter.rac.viewer.pastewithContext" renderingHint="commandbu
</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.
Property tags used in an objectSet are able to display relation properties
of the source objects. Use the relationname.propertyname format to
access them. For example, to display the name of the relation type, use
the following:
<property name = "TC_Attaches.type_string" />
You can use the localSelection parameter to specify the selected object. 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.
Although the localSelection parameter works with all commands defined in
the object set views, it only makes sense to use it with certain commands.
For example, any commands such as Revise, Cut, and Delete that should
operate on objects in the object set view should have the localSelection
parameter set to true, and any commands such as Add New and Paste
that do not operate on the object selected should not use this parameter.
In Systems Engineering, to connect objects with any Trace Link relation
(FND_TraceLink and its subtypes), you can use the runtime properties of
the WorkSpace object:
• fnd0defining_objects (for defining objects)
Following is how the sample code is rendered in the user interface. This object set
shows the contents of a folder.
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.
Caution
As of Teamcenter 10.1, the format attribute is deprecated on the page
tag. It is no longer needed because the firstcolumn and secondcolumn
tags are deprecated.
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.
Caution
As of Teamcenter 10.1, the text attribute is deprecated and is replaced
by the title and titlekey attributes.
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 the conditional display of a tab based on one of three types of expressions
comparing a property or preference to a value. The value can be null or a string,
including a string containing the * wildcard character. Multiple values can be checked
with an array property or preference. When checking an array value, use a comma as
a delimiter for the values. The three types of expressions check the following:
• To check the value of a property on the selected object, use the real (database)
name of the property in the expression.
If you want to show a “Test” page if the object_desc property begins with the
word Testing, use the following:
<page title="Test" titleKey="tc_xrt_testpage"
visibleWhen="object_desc==Testing*">
The following examples show "My Page" based on the value of a property called
myProp.
Display the page if myProp contains "test".
<page titleKey="My Page" visibleWhen="myProp==*test*">
• To check a property on an object related to the selected object, you must include
the reference or relation property name and the property name from the related
object separated by a period.
Display the page when the owner of the selected object is user1.
<page title="Custom User Page"
visibleWhen="owning_user.user_id==user1">
Display the page when the status of the selected object is TCM Released.
<page title="Custom Status Page"
visibleWhen="release_status_list.name==TCM Released">
Display the page when two specific statuses are present on the object — both
TCM Released and Approved.
<page title="Special Status Page"
visibleWhen="release_status_list.name==TCM Released,Approved">
Display the page when there is a PDF dataset attached with a specification relation.
<page title="The PDF Page"
visibleWhen="IMAN_specification.object_type==*PDF*">
Note
If there is only one page, and the visibleWhen condition hides this
page, the rich client ignores this condition and makes the page visible.
SUPPORTED
STYLE
SHEETS
This tag can be used on the following types of style sheets:
Property
Summary
Form
Create
EXAMPLES
• page element
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the page element:
<page titleKey="tc_xrt_Overview">
<column>
<section titleKey="tc_xrt_AvailableRevisions">
<objectSet source="revision_list.ItemRevision" defaultdisplay="listDisplay"
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 titleKey="tc_xrt_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"
titleKey="tc_xrt_moreProperties"/>
</section>
<section titleKey="tc_xrt_ClassificationProperties">
<classificationProperties/>
</section>
</column>
<column>
<section titleKey="tc_xrt_Preview">
<image source="preview"/>
</section>
<section titleKey="tc_xrt_actions" commandLayout="vertical">
<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" titleKey="tc_xrt_newProc" />
</section>
</column>
</page>
• 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="tc_xrt_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.
Now change the description value to Testing my code; the Reservation link
appears after you save your changes, as shown in the following figure.
parameter
Passes in the name/value parameters to the parent command. This is a child element
of the command element. An example of a parameter is localSelection.
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
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="pasteAction" commandId="com.teamcenter.rac.viewer.pastewithContext"
renderingHint="commandbutton"/>
<command actionKey="cutAction" commandId="org.eclipse.ui.edit.cut"
renderingHint="commandbutton">
<parameter name="localSelection" value="true"/>
</command>
CUSTOM
COMMANDS
WITH
PARAMETERS
When you define a custom command for the rich client that uses parameters, you
must add the parameters with the commandParameter tag in the plugin.xml file of
your custom plug-in, for example:
<extension
id="com.myco.command.parameter.test.commands.category"
name="Test Category"
point="org.eclipse.ui.commands">
<command
name="Test command"
categoryId="com.teamcenter.ddp.commands.category"
id="com.myco.command.parameter.test.commands.testCommand">
<commandParameter id="localStage1" name="localStage1" optional="true" />
<commandParameter id="localStage2" name="localStage2" optional="true" />
<commandParameter id="localStage3" name="localStage3" optional="true" />
<commandParameter id="localStage4" name="localStage4" optional="true" />
<commandParameter id="source" name="source" optional="true" />
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
commandId="com.myco.command.parameter.test.commands.testCommand"
class="com.myco.command.parameter.test.handlerTest">
</handler>
</extension>
When you add the custom command to the style sheet, the parameters defined in
the style sheet must match the commandParameter values defined in your plug-in,
for example:
<command commandId="com.myco.command.parameter.test.commands.testCommand"
renderingHint="commandbutton">
<parameter name="localStage1" value="1"/>
<parameter name="localStage2" value="2"/>
<parameter name="localStage3" value="3"/>
<parameter name="localStage4" value="4"/>
</command>
If you add the parameters in the style sheet, but not in the plugin.xml file, then when
you execute the command in the rich client interface you will receive an error that no
parameters are found.
property
Specifies the real (database) name, not the display name, of the object property
you want to display. You must include at least one property in the XML definition,
otherwise, the system displays an empty panel.
Note
You cannot add the same property multiple times in the same style sheet.
ATTRIBUTES
border
Determines whether the border is displayed. Valid values are true and false. This
works only with the titled style.
column
Applies only to the textfield and textarea rendering hints. It sets the number of
columns.
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 database name of a property on the object. This is a required attribute.
Note
When using this attribute on a create style sheet, which is used in the New
Business Object wizard, there is additional functionality. You can specify
a property from another object that is related to the original object by the
revision, IMAN_master_form, or IMAN_master_form_rev relations. To
do this, specify the relation trail followed by the name of the property on the
destination related object, separated by a colon.
For example, if a create style sheet is registered for an item,
• to display the revision ID, you would use
name=revision:item_revision_id
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.
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.
• Headless
This style renders only the property value without displaying the property name
in front of it.
• Titled
The property name is displayed on the top of the property value renderer.
row
Applies only to textarea elements. It sets the number of the rows for the element.
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"
visibleWhen
Defines the conditional display of a property based on one of two types of expressions
comparing a property or preference to a value. The value can be null or a string,
including a string containing wildcard characters. Multiple values can be checked with
an array property or preference. When checking an array value, use a comma as a
delimiter for the values. The two types of expressions check the following:
1. The value of a property on the selected object
<property name="p1" visibleWhen="<Property name>==<Some value>"/>
<property name="p1" visibleWhen="<Property name>!=<Some value>"/>
<property name="p1" visibleWhen="<Property name>==null"/>
<property name="p1" visibleWhen="<Property name>!=null"/>
• To check the value of a property on the selected object, use the real (database)
name of the property in the expression.
If you want to show a "myprop" property only if the object_desc property begins
with the word Testing, use the following:
<property name="myprop" visibleWhen="object_desc==Testing*"/>
Note
Using visibleWhen for properties is only for use in SWT-based style sheet
views in the rich client. For example, Summary (when checked out),
Create, and SaveAs.
It will only work with SWT-based property beans, and will not work with
Swing-based property beans.
In the current implementation of SWT styles aheet rendering in the Summary
view, a plain Label instead of a LabelPropertyBean is used to display
property values in read-only mode (RenderFlat). Since the visibleWhen
framework implementation is based on AbstractPropertyBeans and its
children, the visibleWhen feature will not be available in the Summary view
in read-only mode. It will only be available when the object is checked-out.
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:
<header>
<image source="thumbnail"/>
<classificationTrace/>
<property name="owning_user"/>
<property name="last_mod_date"/>
<property name="release_status_list"/>
<property name="object_type"/>
</header>
• 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.
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
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>
.
.
.
</rendering>
section
Note
This element is a replacement for the view element.
ATTRIBUTES
commandLayout
Controls the layout of commands. Valid values are horizontal or vertical.
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.
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.
Caution
As of Teamcenter 10.1, the text attribute is deprecated and is replaced
by the title and titlekey attributes.
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 titleKey="tc_xrt_Overview">
<column>
<section titleKey="tc_xrt_AvailableRevisions">
<objectSet source="revision_list.ItemRevision"
defaultdisplay="listDisplay" 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 titleKey="tc_xrt_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"
titleKey="tc_xrt_moreProperties"/>
</section>
<section titleKey="tc_xrt_ClassificationProperties">
<classificationProperties/>
</section>
</column>
<column>
<section titleKey="tc_xrt_Preview">
<image source="preview"/>
</section>
<section titleKey="tc_xrt_actions" commandLayout="vertical">
<command commandId="com.teamcenter.rac.copy" />
<command commandId="org.eclipse.ui.file.saveAs" />
<command commandId="com.teamcenter.rac.newProcess" titleKey="tc_xrt_newProc" />
</section>
</column>
</page>
separator
EXAMPLE
Following is sample code from the ItemSummary.xml XML rendering style sheet
showing the separator element:
<section titleKey="tc_xrt_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" titleKey="tc_xrt_moreProperties"/>
</section>
tableDisplay
thumbnailDisplay
thumbnailDisplay
treeDisplay
treeDisplay element
Rendering hints
The renderingHint 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.
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.
Use on
Rendering hint property types JavaBeans
array Used for Headed or
array only: headless
character, date,
double, float, • SWT:
integer, logical, Not
short, string, applicable.
note, typed (Currently
reference, using
typed relation. LegacyPropertyBridgeBean.)
• Swing:
PropertyArray
Titled
(Swing
only)
• TitledPropertyArray
checkbox Logical. Headed or
headless
• SWT:
Not
applicable.
(Currently
using
LegacyPropertyBridgeBean.)
• Swing:
PropertyCheckbox
Titled
(Swing
only)
• TitledPropertyCheckbox
Use on
Rendering hint property types JavaBeans
checkboxoptionlov Used with LOV Headed or
only: character, headless
date, double,
float, integer, • SWT:
short, string, Not
note, typed ref, applicable.
typed relation. (Currently
using
LegacyPropertyBridgeBean.)
• Swing:
PropertyCheckboxOptionLov
Titled
(Swing
only)
• TitledPropertyCheckboxOptionLov
datebutton Date. Headed or
headless
• SWT:
DateControlPropertyBean
• Swing:
PropertyDateButton
Titled
(Swing
only)
• TitledPropertyDateButton
label All types. Used Headed or
for display only; headless
you cannot
change the • SWT:
value. LabelPropertyBean
• Swing:
PropertyLabel
Titled
(Swing
only)
• TitledPropertyLabel
Use on
Rendering hint property types JavaBeans
localizablearray String. Headed or
headless
• SWT:
Not
applicable.
(Currently
using
LegacyPropertyBridgeBean.)
• Swing:
PropertyLocalizableArray
Titled
(Swing
only)
• Not
applicable.
localizablelovuicomp String. Headed or
headless
As of Teamcenter 10.1,
this rendering hint is • SWT:
deprecated and replaced LocalizedLOVUICompPropertyBean
by the lovuicomp
and lovuicomp_titled • Swing:
rendering hints. PropertyLocalizableLOVUIComponent
Titled
(Swing
only)
• TitledPropertyLOVUIComponent
localizabletextarea String. Headed or
headless
• SWT:
LocalizedTextAreaPropertyBean
• Swing:
PropertyLocalizableTextArea
Titled
(Swing
only)
Use on
Rendering hint property types JavaBeans
• Not
applicable.
localizabletextfield String. Headed or
headless
• SWT:
LocalizedTextfieldPropertyBean
• Swing:
PropertyLocalizableTextField
Titled
(Swing
only)
• Not
applicable.
localizablelongtextpanel String, note. Headed or
headless
• SWT:
Not
applicable.
(Currently
using
LegacyPropertyBridgeBean.)
• Swing:
PropertyLocalizableLongTextPanel
Titled
(Swing
only)
• Not
applicable.
Use on
Rendering hint property types JavaBeans
logical Logical. Headed or
headless
• SWT:
LogicalPropertyBean
• Swing:
PropertyLogicalPanel
Titled
(Swing
only)
• TitledPropertyLogicalPanel
longtext Use only for Headed or
string type headless
when the
maximum • SWT:
length is bigger Not
than 2500. applicable.
(Currently
using
LegacyPropertyBridgeBean.)
• Swing:
PropertyLongText
Titled
(Swing
only)
• TitledPropertyLongText
lovbutton Used with LOV Headed or
only: character, headless
As of Teamcenter 10.1, date, double,
this rendering hint is float, integer, • SWT:
deprecated and replaced logical, short, Not
by the lovuicomp string, note, applicable.
and lovuicomp_titled typed ref, typed (Currently
rendering hints. relation. using
LegacyPropertyBridgeBean.)
• Swing:
PropertyLOVButton
Use on
Rendering hint property types JavaBeans
Titled
(Swing
only)
• TitledPropertyLOVButton
lovcombobox Used with LOV Headed or
only: character, headless
As of Teamcenter 10.1, date, double,
this rendering hint is float, integer, • SWT:
deprecated and replaced logical, short, LOVComboBoxPropertyBean
by the lovuicomp string, note,
and lovuicomp_titled typed ref, typed • Swing:
rendering hints. relation. PropertyLOVCombobox
The Titled
column="name" (Swing
argument only)
does not
apply for the • TitledPropertyLOVCombobox
lovcombobox
rendering hint.
You cannot
use the
lovcombobox
rendering hint
in cascading
or hierarchical
LOVs. You
can only use
the lovuicomp
rendering hint.
lovuicomp Used with LOV Headed or
only: character, headless
date, double,
float, integer, • SWT:
logical, short, LOVUIComponentPropertyBean
string, note,
typed ref, typed • Swing:
relation. PropertyLOVUIComponent
Titled
(Swing
only)
• TitledPropertyLOVUIComponent
Use on
Rendering hint property types JavaBeans
objectlink Typed ref, Headed or
typed relation. headless
• SWT:
ObjectLinkPropertyBean
• Swing:
PropertyObjectLink
Titled
(Swing
only)
• TitledPropertyObjectLink
panel Unused. Headed or
headless
• SWT:
Not
applicable.
• Swing:
PropertyPanel
Titled
(Swing
only)
• TitledPropertyPanel
radiobutton Character, Headed or
date, double, headless
float, integer,
logic, short, • SWT:
string, note. Not
applicable.
(Currently
using
LegacyPropertyBridgeBean.)
• Swing:
PropertyRadioButton
Titled
(Swing
only)
• TitledPropertyRadioButton
Use on
Rendering hint property types JavaBeans
radiobuttonoptionlov Used with LOV Headed or
only: character, headless
date, double,
float, integer, • SWT:
short, string, Not
note, typed ref, applicable.
typed relation. (Currently
using
LegacyPropertyBridgeBean.)
• Swing:
PropertyRadioButtonOptionLov
Titled
(Swing
only)
• TitledPropertyRadioButtonOptionLov
slider The Upper and Headed or
Lower bounds headless
as defined in
the Business • SWT:
Modeler IDE SliderPropertyBean
control the
slider minimum • Swing:
and maximum PropertySlider
values.
Titled
SWT (Swing
only)
Integer,
• TitledPropetySlider
short
The
SWT
bean
does
not
support
other
data
types.
Swing
Character,
double,
float,
Use on
Rendering hint property types JavaBeans
integer,
short,
note,
string.
For
types
except
integer
and
short,
this
attribute
converts
the
property
value
to
an
integer.
The
value
defaults
to
0
if
any
errors
occur.
styledtextarea Character, Headed or
date, double, headless
float, integer,
logic, short, • SWT:
string, note. StyledTextAreaPropertyBean
• Swing:
PropertyStyledTextArea
Titled
(Swing
only)
• TitledPropertyStyledTextArea
Use on
Rendering hint property types JavaBeans
styledtextfield Character, Headed or
date, double, headless
float, integer,
logic, short, • SWT:
string, note. StyledTextfieldPropertyBean
• Swing:
PropertyStyledTextField
Titled
(Swing
only)
• TitledPropertyStyledTextField
textarea Character, Headed or
date, double, headless
float, integer,
logic, short, • SWT:
string, note. TextAreaPropertyBean
• Swing:
PropertyTextArea
Titled
(Swing
only)
• TitledPropertyTextArea
textfield Character, Headed or
date, double, headless
float, integer,
logic, short, • SWT:
string, note. TextfieldPropertyBean
• Swing:
PropertyTextField
Titled
(Swing
only)
• TitledPropertyTextField
Use on
Rendering hint property types JavaBeans
togglebutton Character, Headed or
date, double, headless
float, integer,
logic, short, • SWT:
string, note. Not
applicable.
(Currently
using
LegacyPropertyBridgeBean.)
• Swing:
PropertyToggleButton
Titled
(Swing
only)
• TitledPropertyToggleButton
togglebuttonoptionlov Used with LOV Headed or
only: character, headless
date, double,
float, integer, • SWT:
short, string, Not
note, typed ref, applicable.
typed relation. (Currently
using
LegacyPropertyBridgeBean.)
• Swing:
PropertyToggleButtonOptionLov
Titled
(Swing
only)
• TitledPropertyToggleButtonOptionLov
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.
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.
• 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.
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.
The key has the following format for headed or headless beans:
rendering-hint.DEFINITION
For example:
textfield.DEFINITION=com.teamcenter.rac.stylesheet.
PropertyTextField
textfield_titled.DEFINITION=com.teamcenter.rac.stylesheet.
TitledPropertyTextField
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
*
* @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).
• 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.
This style uses only the TitledPropertyrenderingHint JavaBean, for example
TitledPropertyTextField or TitledPropertyTextArea.
Default renderers
The following table displays the default renderer for each type. If the rendering hint is not provided,
the default renderer is used.
1. Edit the Quick_Access_Queries preference and add the name of the query to the list (for
example, Item Revision...).
Item Revision...
2. Edit the Quick_Access_Queries_Attribute preference and add the User Entry L10N Key for
the search attribute to use with the query (for example, Name) for object_name:
Item Revision..._SearchAttribute=Name
3. Test the new quick search by clicking the arrow to the right of the quick search.
Additional information
• The attribute to use for the search must exist in the query. Look at the query in Query Builder to
see the attributes available.
• Any attributes used for quick search must have a localization (L10N) key registered in the
TextServer. All OOTB attributes already have L10N keys. If you are searching with a custom
attribute, you must add it to the TextServer definition.
• System messages
• Buttons
Typically, the administrator checks first in the workflow common_user.properties file for the
appropriate property.
• If the desired property is listed in the common_user.properties file, it is common to all workflow
applications, and you can implement your change across all workflow applications simultaneously.
• If the desired property is not found in the common_user.properties file, it may be listed in the
inbox_user.properties file. Changes made to the properties in this file are unique to the inbox.
Note
To 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
Registry
Note
This registry is not the Windows registry.
The key contained within the registry is contained within the product code, but the value can
be modified. Every key/value pair that appears within the registry falls into one of the following
categories: appearance, structural, instantiation, or localization.
• Appearance
Keys that define colors, fonts, and sizes.
• Structural
Keys that are defined (usually at the top) and are called import statements. Importing allows the
nesting of property files for searching. This allows you to define a key in one place within the
rich client that can be reused without being duplicated. For instance, the OK button text must be
localized in the rich client user interface based on the current locale. Therefore, the text for OK is
placed within the aif_locale.properties file.
• Instantiation
Keys used to construct Java objects. Teamcenter rich client makes use of reflection and dynamic
instantiation within the Java language to construct objects by their string name rather than
hard-coding them within the source code.
For example, each command that appears in the menu bars and toolbars is dynamically
constructed and run. You can subclass a command and replace it with your own by replacing
an entry within a properties file to tell the rich client to use your command rather than the base
command.
• Localization
Keys allow localization of text and messages to be flexibly obtained based on the current locale
of the OS where rich client is running. Teamcenter rich client is delivered with locales that support
English, German, French, Spanish, Italian, Czech, Russian, Korean, Japanese, and Chinese.
Each of these separate property files is based on the convention that JavaSoft has established.
Localization keys are those for which the ResourceBundle class was first designed.
In any given package (directory) that uses registries, there are three property files: base, locale,
and user. These properties files contain structural, instantiation, and appearance keys.
Supported types
Primitive types are supported in the registry as well. The following types are supported: color,
font, integer, float, double, char, boolean, string, string array, and images. Some of the types use
special formats, as follows:
• Color
red, green, blue
255,255,255
• Font
• String array
one,two,three
Registry keys
If a key must contain a blank or space, the space follows the backslash (\) character. If the name of
the type contains a space, such as that found in the Adobe Acrobat type, the entry would be:
Adobe\ Acrobat=images/acrobat.gif
Java treats a space like an equal sign (=). Therefore, if the entry is:
Adobe Acrobat=images/acrobat.gif
Customizing tabs
• 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.
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.
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.
Note
For more information about the jar command, see Sun's Java documentation.
3. In the custom properties file, edit the .TABS line to include the tab you want.
4. Insert the custom properties file into your own custom plug-in.
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. 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.
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.
Note
generate_metadata_cache -force
generate_client_meta_cache -log update all
4. Add the UG NAME value to the IDCStructureColumnsShownPref preference, and add a value
for the new column’s width to the IDCStructureShownColumnWidthsPref preference.
Note
Since these are interdependent preferences, you cannot use the Options dialog box
to make changes.
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).
<extension point="org.eclipse.ui.menus">
...
<menuContribution locationURI="menu:file.new?after=group1">
<command
commandId="com.mycom.newwizard.genericcustomitem"
mnemonic="D"
id="com.mycom.newwizard.genericcustomitem">
</command>
</menuContribution>
...
</extension>
Add the following to the commands extension point in your project's plugin.xml file.
<extension point="org.eclipse.ui.commands">
...
<command
id="com.mycom.newwizard.genericcustomitem"
name="Document">
</command>
...
</extension>
Add the following to the handlers extension point in your project's plugin.xml file.
<extension point="org.eclipse.ui.handlers">
...
<handler
class="com.mycom.newwizard.handlers.CustomWizardHandler"
commandId="com.mycom.newwizard.genericcustomitem">
</handler>
...
</extension>
package com.mycom.newwizard.handlers;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.teamcenter.rac.ui.commands.handlers.NewBOHandler;
<extension
id="extWizard"
point="com.teamcenter.rac.util.extWizard">
<extWizard
class="com.teamcenter.rac.ui.commands.create.bo.NewBOWizard"
id="com.mycom.newwizard.CustomObjectWizard">
</extWizard>
</extension>
The boTypesLoader will find not only the business object type specified as the base_class, but also
any instantiable children of that type.
In the following example, Document happens to be the parent of several other instantiable business
object types, including Email, Marketing Brief, and others.
To remove the children from the list, you must also use the excludeTypes tag to specify which child
types you do not want included. Multiple type names can be entered, separated by a comma.
In this example, the Email and Marketing Brief types are removed from the list.
<BOTypesLoader base_classes="Document"
class="com.teamcenter.rac.ui.commands.create.bo.NewBOTypesLoader"
enableMRU="true"
id="com.teamcenter.rac.ui.commands.create.bo.DocumentTypeloader"
parentId="com.mycom.newwizard.CustomObjectWizard">
<excludeTypes base_class="Document"
exclude_types="Email,CPMarketingBrief"
typesLoaderId="com.teamcenter.rac.ui.commands.create.bo.DocumentTypeloader"
</excludeTypes>
</BOTypesLoader>
DocumentCreate.xml
<extension point="com.teamcenter.rac.ui.commands.operation">
...
<operation class="com.teamcenter.rac.ui.commands.create.bo.NewBOOperation"
id="com.teamcenter.rac.ui.commands.NewItemOperation"
wizardId="com.mycom.newwizard.CustomObjectWizard">
</operation>
...
</extension>
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.
b. Extract the properties file you want to override from the JAR file. For example, extract the
mpp.properties file.
Note
A JAR file uses ZIP compression and can be opened using standard unjar or
unzip tools.
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.
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.
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">
</extension>
</plugin>
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.
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
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.
6. Debug in Eclipse.
a. In Eclipse, choose Run→Debug Configurations.
b. In the Debug dialog box, under Java Application on the left-hand side, select the
configuration you want to debug.
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/indigo/index.jsp
To customize the rich client UI beyond the capabilities of style sheets, you need to use the Eclipse IDE.
Some applications use a perspective with multiple views to arrange how functionality is presented.
Other applications use a perspective with a single view.
You can use the HiddenPerspectives preference to prevent the display of some Teamcenter
perspectives in the rich client.
If your site has online help installed, you can access application and view help from the rich client
Help menu or by pressing F1.
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.
4. Clear the cache and register any new plug-in to ensure the customization appears in the rich
client.
Introduction to SWT
The Standard Widget Toolkit (SWT), maintained by the Eclipse Foundation, is a graphical toolkit for
use with the Java platform. 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.
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.
To become familiar with SWT, you can download SWT samples and run the SWT tutorial in Eclipse.
The following steps are required to customize the rich client with Eclipse:
1. Set up Eclipse.
For the supported versions of Eclipse and Java, see the hardware and software certifications page
on GTAC.
Set up Eclipse
2. Create a batch file that sets the Teamcenter 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=jre-install-directory
set JRE_HOME=jre-install-directory
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
You can use the TC_ROOT\portal\portal.bat file as an example for this batch file.
3. Run the batch file you just created to launch Eclipse in a Teamcenter environment.
1. Verify that the supported Java Runtime Environment (JRE) version is listed and checked.
Find this option in Window→Preferences under the Java node, in the Installed JREs section.
The rich client should launch to the Login page, and you should be able to log in normally.
Note
If you customize the out-of-the-box rich client files, you can lose those customizations
the next time you upgrade.
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. 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 the 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 %HOMEDRIVE%%HOMEPATH%\Teamcenter directory.
On a Linux 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.
The Eclipse 4 Application Platform (E4AP) differs from the Eclipse 3.x platform in the implementation
of the Workbench (i.e. org.eclipse.ui.workbench plugin), and the technologies this new
implementation is based on.
On top of E4AP, the 4.0 Workbench offers an implementation of the 3.x Workbench APIs, called
the compatibility layer, to provide backwards compatibility for existing well-behaved Eclipse 3.x
applications.
contribute new views, commands, handlers through model fragment using the new E4 way or by
migrating your old extension points to model fragments.
Per Eclipse, using the presentation API and extension point to customize the workbench
appearance will no longer have any effect. Clients are encouraged to try out the provisional new
API in Eclipse 4.X for performing equivalent workbench customization. Complete rendering
control can be achieved by supplying an org.eclipse.e4.ui.workbench.IPresentationEngine.
Customization of fonts, spacing, and color can be achieved by supplying custom CSS style
sheets via the org.eclipse.e4.ui.css.swt.theme extension point. Customers using internal
org.eclipse.ui.* APIs need to refactor code to remove API dependency and find replacement.
Other internal APIs may not be guaranteed to work in Eclipse 4.X platform. Test your code
before refactoring.
For convenience, flowing is a list of commonly used patterns that have changed.
visibleWhen checkEnabled
In Teamcenter 11.X based upon Eclipse 3.8 RCP, we could use checkEnabled=“true” in the
<visibleWhen> clause for <menuContribution> to determine the visibility based upon enabled state of
the command, for example handler.isEnabled(). This is specific to Eclipse 3.X-based API and is
no longer supported in Eclipse 4.X.
This will always return false in an Eclipse 4 application with the compatibility layer. In E4, handlers
can be installed on parts, windows, as well as globally on the MApplication. Enablement expressions
are now handled by the handler class itself through @CanExecute methods. To workaround this issue in
the compatibility layer, please add enabledWhen or activeWhen conditions in your handler extension
point in the <visableWhen> block.
See example Customer Command 2 in the examples plugin for reference. Use Case: We contribute
“Custom Command 2” to File menu. The command should be visible and enabled only when
Customer List View is selected and in Customer Example perspective. If Customer Overview is
selected, this command should be removed from File menu.
Following are the menus removed and the Eclipse 4 alternative, if available:
Fast View
No Alternative.
Detached
Drag and drop the view outside the application.
Move
Drag and drop the view inside the application.
Size
No Alternative.
Minimize, Maximize, and Restore
Use the view control buttons in the top right of the view.
CommandContributionItem
In Eclipse 3, the Menu Manager returned a CommandContributionItem. In Eclipse 4, it returns a
HandledContributionItem instead. An example of this, named HandledContribution Item Example,
is in the provided sample customization.
Model fragments
Siemens PLM Software does not recommend modifing the OOTB Teamcenter Application Model to
add a new customized view implemented in custom plugin.
In order to statically contribute a new part using the E4 pattern, you contribute to the Application
Model in a custom plugin using a model fragment. A model fragment statically specifies model
elements and the location in the application model to which they should be contributed. In these
fragments you contribute to an existing model element using model fragment extension points. A
model fragment file typically uses the .e4xmi extension. In the model fragment editor, specify the ID
of the element in the application model you are contributing to.
Dependency injection
Dependency injection separates the configuration of an object from its behavior.
The Eclipse 4 Application Platform has adopted the use of Dependency Injection (DI) to circumvent
several issues:
• Code frequently used global singleton accessors, like Platform and PlatformUI, or required
navigating a deep chain of dependencies.
• Client code needed to know the internals of the Eclipse code base.
• The use of singletons tightly coupled the consumers of things to their producer or provider,
which inhibited reuse.
Rather than require client code to know how to access a service, the client instead describes the
service required, and the platform is responsible for configuring the object with an appropriate service.
DI shields the client code from knowing the origin of the injected objects. With DI, one object supplies
the dependencies of another object.
A dependency is an object that can be used (a service).
An injection is the passing of a dependency to a dependent object (a client) that would use it.
Example
In Eclipse 3, a view accessed the Eclipse Selection Service using the PlatformUI singleton.
public class DetailsView extends ViewPart {
@Override
public void createPartControl(Composite parent) {
//create tableViewer...
final ISelectionService ss = getSite().getWorkbenchWindow().getSelectionService();
ss.addPostSelectionListener(myListener);
myListener.selectionChanged(null, ss.getSelection());
}
protected void setSelection(Contact contact) {
// ... do something with the selection
}
private final ISelectionListener myListener = new ISelectionListener() {
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if (!(selection instanceof IStructuredSelection)) {
setSelection(null);
return;
}
final IStructuredSelection ss = (IStructuredSelection) selection;
if (ss.isEmpty() || !(ss.getFirstElement() instanceof Contact)) {
setSelection(null);
return;
}
setSelection((Contact) ss.getFirstElement());
}
};
}
Example
In Eclipse 4, you can get the activeSelection without accessing the selectionService by
defining a DetailsView.
public class DetailsView {
@Inject
public DetailsView(Composite parent) {
//create tableViewer
...
}
@Inject
public void setSelection( @Optional @Named(IServiceConstants.ACTIVE_SELECTION) Contact contact) {
// ... do something with the selection
}
}
Annotations
Some of E4's injectors are based upon standard JSR 330 annotations. Additional annotations, such
as @Optional or @Persist, are specific for Eclipse 4.
To get an overview of commonly used annotations, the following list shows all described annotations
with the bundle defining them. If you use any of these annotations, you will need a dependency or
a package import to these bundles.
Annotation Bundle
@Active org.eclipse.e4.core.contexts
@Creatable org.eclipse.e4.core.di.annotations
@CanExecute org.eclipse.e4.core.di.annotations
@Execute org.eclipse.e4.core.di.annotations
@Inject javax.inject
@Named javax.inject
@Optional org.eclipse.e4.core.di.annotations
@Persist org.eclipse.e4.ui.di
@PersistState org.eclipse.e4.ui.di
@PostConstruct javax.annotation
@ProcessAdditions org.eclipse.e4.ui.workbench.lifecycle
@ProcessRemovals org.eclipse.e4.ui.workbench.lifecycle
@PostContextCreate org.eclipse.e4.ui.workbench.lifecycle
@PreDestroy javax.annotation
@PreSave org.eclipse.e4.ui.workbench.lifecycle
@Singleton javax.inject
Annotation Bundle
@Focus org.eclipse.e4.ui.di
@AboutToShow, @AboutToHide org.eclipse.e4.ui.di
@EventTopic org.eclipse.e4.core.di.extensions
@UIEventTopic org.eclipse.e4.ui.di
CSS
Eclipse 4 provides an easy way to style the UI widgets using CSS. The new css declarative styling
support provides developers with the flexibility of styling their user interface based on a set of
properties defined within a CSS stylesheet. CSS selectors used in Eclipse are identifiers, which
relate to widgets or other elements, for example predefined pseudo classes. E4 CSS isn't HTML
CSS, E4AP has its own CSS rendering engine which can parse eclipse specific CSS Selector.
CSS style sheets can be used to modify SWT widget properties. The SWT widget class is used as an
element type, such as Shell, Button, Table. Eclipse publishes a table to show the mapping between
CSS properties defined for SWT widgets and SWT widget calls.
Model elements of your Eclipse application, like MPartStack, MPart, or MTrimbar, can also be used
as selectors for styling. The CSS selectors are based on the Java classes for the model elements.
Example
You can hide the minimize and maximize button of a MPartStack via the following CSS rule.
.MPartStack {
swt-maximize-visible: false;
swt-minimize-visible: false;
}
Example
You can assigne a CSS ID tag on SWT widget class directly. In CSS, define the
RACPerspectiveHeader selector.
#RACPerspectiveHeader {
color: #004664;
background-color: #FFFFFF;
}
Example
In the RACPerspectiveHeader.java, set this selector codefuly.
public class RACPerspectiveHeader
extends Composite
{
public RACPerspectiveHeader( final Composite parent, final int style )
{
super( parent, style );
m_parentComposite = parent;
GridLayout gridLayout = new GridLayout( 4, false );
gridLayout.marginBottom = 1;
gridLayout.marginHeight = 0;
setLayout( gridLayout );
GridData gd = new GridData();
gd.minimumWidth = 2048;
setLayoutData( gd );
setData( ICSSConstants.ECLIPSE_CSS_ID, ICSSConstants.ID_RACPerspectiveHeader );
init();
...
}
}
Example
Some SWT widget states are captured in pseudo selectors.
Button:checked {
background-color: #FF0000;
}
Example
The style bits, normally passed through the constructor, are available through the style
attribute.
Button[style~='SWT.CHECK']{
color: #E2E2E2;
}
Import this project into your Eclipse rich client platform (RCP) plugin development environment to
see the examples in action.
The core of any plugin is the plugin.xml file. This contains the information needed to connect the
custom code into Teamcenter.
Example listing
You might want to create your own perspective to the rich client. A perpective is also called an
application, and is a collection of related views. When referring to an existing view, you must not use
viewDef, since the view is already defined, use viewRef instead.
Included with the provided sample project is the perspectives package. This package contains a
custom perspective which is the focus of many of the other customizations provided.
com.teamcenter.rac.customization.examples.perspectives
This custom perspective implements two layout interfaces and extends the AbstractRACPerspective
class. It also loads custom views.
com.teamcenter.rac.customization.examples.views
The definitions for several custom views are contained in the following classes.
• CustomImageView.java
• CustomListView.java
• CustomOverview.java
You can examine them in the rich client by choosing Window→Show View or by opening the
provided perspective.
Custom Image View Demonstrates a custom image viewer, which extends the
Thumbnail2DFileView class.
Custom List View Demonstrates a custom list viewer, which extends the
AbstractContentViewPart, and implements the IContentView
interface.
Custom Overview Demonstrates a custom list viewer, which extends the
AbstractContentViewPart, and implements the IContentView
interface.
Examine the source code to see more details.
• plugin.xml
• build.properties
• component_overview.xml
• OpenServiceComponent.xml
To examine any of these files, double-click them to open the viewer. Opening the plugin.xml file
in the viewer displays several tabs, showing the majority of the configuration for the plugin on a
single location. Changes made on the Extensions tab, for example are reflected in the plugin.xml
file, and vice versa. Using the viewer instead of manually editing is a good way to help validate
your configuration.
Take the time to examine the Extensions and Dependencies tabs, as they contain the most
information.
Example: OSGi
An OSGI (Open Service Gateway Initiative) service is a Java object. It is registered in the Service
Registry under the name of a Java interface. Unlike extensions, which are scanned and registered
during start-up, services are not automatically registered. To register a service, you must create a
Component Definition in the project's OSGI folder, and then make a call to the OSGI API to register
the object as a service.
You will find several OSGI service examples in the sample plugin project.
component_overview.xml
Implemented in the DisplayObjectInOverview class. See that source file for details.
OpenServiceComponent.xml
Implemented in the CustomizationExampleOpenService class. See that source file for details.
These files define the services used in the sample plugin project.
Hide a view
You can hide views based upon user context using the Command Suppression perspective in the rich
client. However, in order to hide a view from all users at all times, you must modify the plugin.xml file
of your Eclipse rich client plug-in project. The visibility is controlled using the org.eclipse.ui.activities
extension point. By binding an empty activity to the view, the view is suppressed regardless of
user context.
In the following example, an empty activity, Hide Custom List View, is created, and then attached to
a Custom List View view.
<extension point="org.eclipse.ui.activities">
<activity
id="com.teamcenter.rac.customization.examples.hidecustomlistview"
name="Hide Custom List View">
</activity>
<activityPatternBinding
activityId="com.teamcenter.rac.customization.examples.hidecustomlistview"
isEqualityPattern="true"
pattern="com.teamcenter.rac.customization.examples/
com.teamcenter.rac.customization.examples.view.CustomListView">
</activityPatternBinding>
</extension>
The actual name and id used for the empty activity are not relevant, however it is recommended to
choose something descriptive.
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.
Bundle-Vendor: MYCOM
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
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"
</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
b. To verify the configuration so far, choose Run→Run Configurations to start the rich client
from your Eclipse environment. Clear the workspace by checking Clear in the launch
configuration dialog box.
However, the message displayed by the custom command is not localized. You localize
the message in the following step.
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.
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.
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 the 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 %HOMEDRIVE%%HOMEPATH%\Teamcenter
directory. On a Linux client, it is typically the $HOME/Teamcenter directory.
</with>
</visibleWhen>
</command>
</menuContribution>
• The command contribution contains a visibleWhen expression with a nested and expression.
• The command contribution contains a visibleWhen expression with nested expressions (not
the and expression).
• 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.
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>
</visibleWhen>
</command>
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 checked.
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.
b. Click the Runtime tab, click the Add button, and select the following:
com.mycom.tableviewer
com.mycom.tableviewer.handlers
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">
<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>
TableViewerExample.java
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(
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);
}
});
To package the project for distribution, export it to a JAR file and place it in the TC_ROOT\portal
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.
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 the 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 %HOMEDRIVE%%HOMEPATH%\Teamcenter
directory. On a Linux client, it is typically the $HOME/Teamcenter directory.
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.
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.
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.
b. Click the Runtime tab, click the Add button, and select the following:
com.mycom.treeviewer
com.mycom.treeviewer.handlers
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"
id="com.mycom.treeviewer.toolbars.sampleCommand"
label="TreeViewer"
tooltip="Explore Treeviewer">
</command>
</toolbar>
</menuContribution>
</extension>
</plugin>
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.
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 %HOMEDRIVE%%HOMEPATH%\Teamcenter
directory. On a Linux client, it is typically the $HOME/Teamcenter/ directory.
The Viewer view in My Teamcenter displays information about the selected object. In
this customization example using SWT, you create two custom Viewer view definitions: a
HelloWorldViewer definition that displays only the text Hello selected-object-name! for the selected
object, and a MyPropertyViewer definition that displays properties and Check In / Check Out
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.
Following is an example of a default Viewer view.
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.
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
com.teamcenter.rac.kernel
com.teamcenter.rac.util
com.teamcenter.rac.viewer
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();
//Viewer SHOW_HEADER event will make this customized view generate viewer header.
ViewerEvent viewerEvent2 = new ViewerEvent( this, IViewerEvent.SHOW_HEADER );
viewerEvent2.queueEvent();
}
@Override
public Control getControl() {
return m_composite;
}
@Override
public void refresh() {
m_composite.layout();
}
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.
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!
package com.mycom.customviewerview.viewer;
import java.util.Arrays;
import java.util.Date;
import org.eclipse.core.runtime.IProgressMonitor;
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 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.controls.LOVComboBox;
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.event.ClientEventDispatcher;
import com.teamcenter.rac.util.event.IClientEvent;
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.utils.CheckInOutComposite;
import com.teamcenter.rac.viewer.view.AbstractSwtSubViewer;
/**
* Example Viewer which shows how to display a list of properties. This example
* contains textfield, textarea, date, integer. If you have a LOV attached, you
* can un-comment the lines for lov related code. (The example uses a string LOV.)
* To use this example, you need to add extension "com.teamcenter.rac.viewer.ViewerViewRegistry" and
* modify preference "defaultViewerConfig.VIEWERCONFIG". For more detail, please refer to
* RAC Customization Guide.
*/
public class MyPropertyViewer
extends AbstractSwtSubViewer implements 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;
AIFUtility.getDefaultSession().addAIFComponentEventListener( this );
}
/*
* 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 )
{
MyPropertyViewerContentProvider cp = (MyPropertyViewerContentProvider) getContentProvider();
m_w2StrLabel.setText( cp.getPropertyDisplayName(STR_PROP) );
m_w2StrProp = cp.getTCPropery(STR_PROP);
m_w2StrText.getTextWidget().setText(m_w2StrProp.getStringValue());
m_w2IntegerLabel.setText(cp.getPropertyDisplayName(INT_PROP));
m_w2IntProp = cp.getTCPropery(INT_PROP);
int ii = m_w2IntProp.getIntValue();
if( !m_w2IntProp.getNullVerdict() )
{
m_w2IntegerText.getTextWidget().setText(Integer.toString(ii));
}
m_w2DateLabel.setText(cp.getPropertyDisplayName(DATE_PROP));
m_w2DateProp = cp.getTCPropery(DATE_PROP);
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());
// m_lovLabel.setText(cp.getPropertyDisplayName("w2Str_e"));
// m_lovProp = cp.getTCPropery("w2Str_e");
// m_lovComboBox.setLOVComponent(m_lovProp.getLOV());
// m_lovComboBox.setSelectedItem( m_lovProp.getPropertyData() );
//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()
{
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);
}
}
// @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
{
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);
// Object obj = m_lovComboBox.getSelectedObject();
// if( obj == null )
// {
// m_lovProp.setNullVerdict(true);
// }
// else
// {
// m_lovProp.setStringValueData(obj.toString());
// }
SoaPropertyHelper.setPropertiesService( m_comp, props );
}
catch( Exception e )
{
ex2 = e;
MessageBox.post(e);
}
finally
{
ClientEventDispatcher.fireEventLater( MyPropertyViewer.this,
IClientEvent.SS_VIEWER_SAVE_COMPLETE, TCComponent.class, m_comp, Exception.class,
ex2 );
}
}
// 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
@Override
public void run()
{
refresh();
}
} );
}
}
}
For the Check-in, Check-out, and Cancel Check-out buttons, you do not need
to implement the IAdaptable or ISaveablePart methods. Instead, create the
CheckInOutComposite component and add it to your viewer, for example:
CheckInOutComposite m_cicoComposite = new CheckInOutComposite( mainComposite );
m_cicoComposite.panelLoaded();
In the doSave() method, run the save complete event so that checkin can be launched
after saving for the Check-in button:
ClientEventDispatcher.fireEventLater( MyPropertyViewer.this,
IClientEvent.SS_VIEWER_SAVE_COMPLETE, TCComponent.class, m_comp, Exception.class,
ex2 );
For Form objects, the form display in the Viewer view is now in SWT tagging. To
use the legacy Swing FormViewer object in the Viewer view for all forms, modify
the defaultViewerConfig.VIEWERCONFIG preference and add the following entry:
Form.FORMViewer. To use the legacy Swing FormViewer object for a certain form type,
add an entry to the defaultViewerConfig.VIEWERCONFIG preference for the form type
that must be displayed in the legacy view, for example, form-type-name.FormViewer.
*/
public String getPropertyDisplayName( String propName )
{
try
{
TCPropertyDescriptor propDesc = m_comp.getTypeComponent()
.getPropertyDescriptor(propName);
return propDesc.getDisplayName();
}
catch (TCException e)
{
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.
If you want to package the project for distribution, export it to a JAR file and place it in the
TC_ROOT\portal 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 %HOMEDRIVE%%HOMEPATH%\Teamcenter
directory. On a Linux client, it is typically the $HOME/Teamcenter/ directory.
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.
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.
b. Click the Runtime tab, click the Add button, and select the following:
com.mycom.toggle
com.mycom.toggle.handlers
</command>
<command
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>
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;
}
}
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 %HOMEDRIVE%%HOMEPATH%\Teamcenter
directory. On a Linux client, it is typically the $HOME/Teamcenter/ directory.
The Teamcenter rich client uses Eclipse’s platform menu contribution mechanism for displaying
menus and toolbars. By default, all available commands are shown on a menu or toolbar unless the
Teamcenter Command Suppression application has been configured by the administrator. Due to the
nature of the platform, Command Suppression is unable to control the contents of a context menu.
Note
A context menu is also referred to as a shortcut menu, right-click menu, or popup menu.
To reduce clutter, context menu suppression allows control over the contents of a context menu using
an XML file. The elements in this file control which commands are suppressed, and in which view,
application context, or with which types of objects.
Implementation
This XML file is stored in the Teamcenter database as a Context Menu Suppression
(Fnd0ContextMenuSuppRuleXML) dataset and is registered using the
TC_ContextMenuSuppression preference. The value of the preference is the name
of the dataset.
Note
Ensure that Context Menu Suppression datasets maintain unique names; however,
this is not required by Teamcenter.
The preference can have a site, group, role, or user protection scope, so suppression rules can be
implemented based on the user’s current credentials. If there are two datasets and two preferences,
one pair for each of two groups, a user may see one set of commands on the context menu while in
one group, and then, after switching groups, see a different set of commands.
The context menu suppression XML rules consist of the following elements.
• Command ID
• View ID
• Type Name
• ApplicationContext ID
• A rule defined for an abstract type is inherited by all of its child types.
Caution
Do not write suppression rules for dynamic types like BOMLine.
When a BOMLine is selected from Structure Manager, if the
underlying component is an item revision for example, the
suppression rules for item revision are applied instead.
ApplicationContext The ApplicationContext ID filter can be defined under the root element.
ID This filter allows the administrator to write a suppression rule with respect to
a specific application like Structure Manager, My Teamcenter, or Systems
Engineering, and so forth. The ApplicationContext ID element can hold view
or type elements.
When elements are nested, it is considered to be an AND grouping, while elements at the same level
are considered to be an OR grouping.
Example 1
<command id ="com.teamcenter.rac.expand">
<view id ="com.teamcenter.rac.ui.views.DetailsView"/>
<view id ="com.teamcenter.rac.ui.views.SummaryView"/>
<type name="Folder"/>
<type name="Dataset"/>
</applicationContext>
</command>
In this example, the expand command is suppressed when the current view is the Details view or
the Summary view or if the object type is Folder or any dataset.
Example 2
<command id ="org.eclipse.ui.edit.cut">
<applicationContext id ="com.teamcenter.rac.ui.perspectives.navigatorContext">
<view id ="com.teamcenter.rac.ui.views.TCComponentView">
<type name="Item"/>
</view>
<view id ="com.teamcenter.rac.ui.views.SummaryView">
<type name="Folder"/>
</view>
<type name="BOMLine">
<view id ="com.teamcenter.rac.pse.PSEView"/>
</type>
</applicationContext>
</command>
In this example, the cut command is suppressed for the My Teamcenter application when:
(type=Item AND view=Teamcenter Component)
OR
(type=Folder AND view=Summary)
OR
(type=BOMLine AND view=Structure Manager)
Because the XML file requires Teamcenter’s internal names for objects, commands, views, and
application contexts, it is important to know how to find them. Using the display name does not work.
Here are a few common examples.
To find complete listings of Teamcenter’s internal names, refer to the following sources:
Objects The Business Modeler IDE is the best place to find the internal names for all
objects.
XML prolog
A full context menu suppression file must have a proper XML prolog, and all suppression elements
must be enclosed within contextMenuSuppression tags.
<?xml version=’1.0’ encoding=’UTF-8’ ?>
<contextMenuSuppression>
<command id =”org.eclipse.ui.edit.cut”>
<applicationContext id =”com.teamcenter.rac.ui.perspectives.navigatorContext”>
<type name=”Item”/>
</applicationContext>
</command>
<command ...>
...
</command>
</contextMenuSuppression>
Caveats
• This is not a hierarchical or inheritance system. Only a single dataset is evaluated at any
given time. If multiple preferences are defined, for example, a group and a role preference,
standard Teamcenter preference evaluation precedence determines which preference is valid,
and therefore which dataset is used. If the user changes group or role, the preferences are
reevaluated, which may result in a different dataset being used.
• The Summary view’s Send To... menu is built using the same rules as the context menu’s
Send To... command. Suppressing one of the Send To... commands from the context menu
also suppresses it from the Summary view’s Send To... menu.
• There is no upgrade mechanism provided for the context menu suppression rule XML. Any of the
contents related to Command ID, View ID, and ApplicationContext ID are subject to change.
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.
c. Export the custom plug-ins from Eclipse to the eclipse\plugins subdirectory on the shared
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.
way, when you upgrade to a newer version of Teamcenter, you can simply install the custom plug-in
without having to alter files in the Teamcenter installation.
Perform the following steps to distribute your rich client customizations created in Eclipse:
1. Package your custom files.
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.
5. Create a feature file so you can install the custom files using TEM.
2. In a text editor, create an XML feature file that points to the ZIP file, for example,
feature_rac_mycust.xml.
Tip
For examples of feature_rac_feature-name.xml files, see the install\modules
directory on the installation source.
<group value="package"/>
<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>
• 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.
Tip
If your customizations include a packaged Business Modeler IDE template project,
you can edit the packaged project’s feature file to include the new rich client feature
by adding a node similar to the following. This is not required; you can still have a
separate feature file for the rich client customizations.
<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>
3. Copy the XML feature file to the TC_ROOT\install\install\modules directory on the installation
source.
4. Open the TC_ROOT\install directory and run Teamcenter Environment Manager (TEM).
9. Under the Extensions 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.
10. In the Confirm Selections panel, click Next to start installing your customization files.
• javadoc\com.teamcenter.rac.util\index.html
Contains generic components, layout managers, and JavaBeans.
For a listing of APIs, see User interface components in the com.teamcenter.rac.util package. (The
list contains a sample of the components available. For a complete list, see the Javadoc.)
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 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. 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.
Delete dialog
1 Components to be deleted.
2 Click Yes to initiate Delete operation.
Progress indicators
Completion indicators
• 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
{
// 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.
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).
Lists of values (LOVs) are lists in property boxes in the user interface. In the end-user client
applications, the format of the LOV box appears as a table rather than a simple list (except for
hierarchical and range LOVs). This allows for the display of columns that show the value's description
and other properties. The LOVDisplayer Java class is the primary class used to define the list of
values display.
• Type in the LOV box to narrow the choices when there are many values to choose from. You can
even use an asterisk (*) for wildcard searching.
Note
If end users type text when looking for a value in the format of an integer, double,
or date, they must type the exact value.
Note
As of Temcenter 10.1, the following list of values Java classes are deprecated:
com.teamcenter.rac.common.lov.InterDependentLOVPanel
com.teamcenter.rac.common.lov.LOVUIComponent
com.teamcenter.rac.common.lov.LOVPanel
com.teamcenter.rac.common.lov.LOVPopupButton
com.teamcenter.rac.common.lov.LOVDialog
com.teamcenter.rac.common.lov.LOVComboBox
com.teamcenter.rac.common.lov.HierarchicalLOVComponent
com.teamcenter.rac.common.lov.LOVHierarchyPanel
com.teamcenter.rac.common.controls.SWTLovPopupButton
com.teamcenter.rac.common.controls.SWTLovPopupDialog
com.teamcenter.rac.common.controls.LOVUIComponent
com.teamcenter.rac.common.controls.LOVComboBox
Note
In rich client forms, the Tab key moves focus from field to field, except for lists of values. To
move focus between lists of values, users can press Ctrl+Tab.
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.
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 Reload button, the tree displays all
top-level groups in the organization. Both figures show the features of the OrgSelectionDialog
component.
ReferencersPanel
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
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. The ReferencersReverseHorizontalNodeLayout layout manager extends from the
ReverseHorizontalNodeLayout component.
• ReferencersTreeLookNodeLayout
Displays the nodes in a JTree manner and can display where-referenced and where-used
information in different colors. The ReferencersTreeLookNodeLayout layout manager extends
from the TreeLookNodeLayout component.
• ReferencersVerticalNodeLayout
Displays the nodes in vertical order expanded from top to bottom and can display
different where-referenced and where-used information in different colors. The
ReferencersVerticalNodeLayout layout manager extends from the VerticalNodeLayout
component.
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.
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 );
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).
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).
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.
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.
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).
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.
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.
}
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
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 a table created with the 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:
• 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:
• Require signaling
You no longer must override the paint method to implement the paint, as required. Instead,
invoke the setRequired(Boolean state) method.
Layout manager
ButtonLayout
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.
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.
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.
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.
{
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.
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.
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.
The following figure shows the ButtonLayout layout manager with vertical orientation and bottom
alignment.
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;
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.
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.
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.
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.
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.
d.show();
}
}
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.
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.
The following figure shows the behavior of the dialog box when resized.
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.
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.
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);
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.
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
Separator
The Separator component visually separates user interface components (as shown in the following
figure). Separators can be oriented either horizontally or vertically.
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();
f.setSize(new Dimension(350,350));
f.show();
}
}
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);
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.
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 );
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.
• DB Walker view
Examines the database. This view is for Siemens PLM Software internal use only.
There are also standard Eclipse views that can help you debug your customization.
Use the Copy button to copy a URL link to this object onto the rich client and Windows clipboards.
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 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.
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.
• 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.
• 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/indigo/index.jsp?topic=
/org.eclipse.platform.doc.isv/guide/runtime_jobs_progress.htm
• 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.
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
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:
• 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.
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.
• 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.
The InterfaceSignalOnClose and SignalOnClose classes 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.
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.
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:
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.
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.)
If you have multiple rich client installations on your system, the constructed URL only
opens the most recently installed rich client because the registry is updated at each
installation.
• -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
• -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
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 %HOMEDRIVE%%HOMEPATH%\Teamcenter
directory. On a Linux 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 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: win64, , or linux.
• -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
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
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.
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
Java
type Rule Example Comment
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(), setFactoryName(), Java
methods for Booleans, where XXX is isReady() standard
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
• 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.
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.
• 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.
• 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.
Property beans
The following table lists JavaBeans that you can use to customize the properties display.
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.
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.
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.
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.
JavaBean Description
PropertyCheckboxOptionLov
Properties:
property
The property name presented by the bean.
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.
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.
JavaBean Description
PropertyImage
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.
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.
Note
For Boolean properties, if neither true or false are
selected, the value of the property is NULL.
JavaBean Description
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.
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.
PropertyLOVButton Used for any property that has an LOV attached to it except logical
type.
As of Teamcenter 10.1,
this bean is deprecated It uses LOVPopupButton to present this property (as shown in
the following figure).
JavaBean Description
and is replaced by the
PropertyLOVDisplayer bean.
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.
PropertyLOVPopupButton
Properties:
JavaBean Description
property
The property name presented by the bean.
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.
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.
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.
JavaBean Description
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.
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.
JavaBean Description
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.
PropertyRadioButton Same as the PropertyCheckboxOptionLov bean, except it uses
OptionLov buttons (as shown in the following figure).
PropertyRadioButtonOptionLov
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.
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.
JavaBean Description
PropetryTextField 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.
modifiable
Indicates whether the property is modifiable. If not modifiable,
the text box cannot be edited.
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.
JavaBean Description
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.
PropertyToggleButton Same as PropertyCheckboxOptionLov, except it uses buttons
OptionLov (as shown in the following figure).
PropertyToggleButtonOptionLov
TitledPropertyArray Displays the property name above the property array (as shown in
the following figure) and is similar to the PropertyArray bean.
TitledPropertyArray
JavaBean Description
bordered
Specifies whether a border is drawn around the panel.
TitledPropertyCheckbox
bordered
Indicates whether a border is drawn around the check box.
TitledPropertyCheckboxOptionLov
bordered
Indicates whether a border is drawn around the check boxes.
In addition, you can apply the properties of the
PropertyCheckboxOptionLov bean.
JavaBean Description
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.
TitledPropertyLogicalPanel
bordered
Indicates whether a border is drawn around the text area.
In addition, you can apply the properties of the
PropertyLongText bean.
Note
For Boolean properties, if neither true or false are
selected, the value of the property is NULL.
JavaBean Description
TitledProperty Displays the property name above the long text panel (as shown in
LongText 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.
TitledProperty Displays the property name above the LOV button (as shown in the
LOVButton following figure). This bean is similar to the PropertyLOVButton
bean and actually contains two beans: PropertyNameLabel and
Caution PropertyLOVButton.
As of Teamcenter
10.1, this bean is
deprecated and is
replaced by the
TitledPropertyLOVDisplayer
bean.
TitledPropertyLOVButton
bordered
Indicates whether a border is drawn around the LOV popup
button.
JavaBean Description
TitledPropertyObjectLink
bordered
Indicates whether a border is drawn around the link.
In addition, you can apply the properties of the
PropertyObjectLink bean.
TitledPropertyPanel Displays the property name above the panel. This is the same as
the PropertyPanel bean.
JavaBean Description
TitledProperty Displays the property name above the button (as shown in the
RadioButton following figure). This bean is similar to the PropertyRadioButton
bean.
TitledPropertyRadioButton
bordered
Indicates whether a border is drawn around the button.
TitledPropertyRadioButtonOptionLov
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.
JavaBean Description
TitledPropertyTextArea
Properties:
bordered
Indicates whether a border is drawn around the text area.
TitledPropertyTextField
Properties:
bordered
Indicates whether a border is drawn around the text box.
JavaBean Description
TitledProperty Displays the property name above the button. This bean is similar
ToggleButton 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.
TitledPropertyToggleButtonOptionLov
Note
• The preferred method to locate commandIDs is to use the rich client command-line
utility DumpCMSConfigInfo. It will generate a CSV file containing an accurate listing of
command IDs for your specific rich client configuration, as well as one for your view
IDs, and one for your application context IDs as well.
teamcenter -application com.teamcenter.rac.util.DumpCMSConfigInfo
• When a command to create a new object is added within the objectSet tag,
only commands for New Item, New Dataset, New Part, and New Other
actions paste the new object with the relation specified in the <objectSet
source="relation.business-object"> tag. All other new object types use the default
paste relation.
The following code example shows creating a new object with the
com.teamcenter.rac.newDesign command ID. However, the default paste relation is
used instead of the IMAN_specification relation in the objectSet source tag:
<objectSet source = "IMAN_specification.Design Revision "
defaultdisplay = "tableDisplay" sortby = "object_string" sortdirection = "ascending">
.
.
.
<command actionKey = "newDesignAction" commandId = "com.teamcenter.rac.NewDesign"
renderingHint = "commandbutton"/>
The following tables show a few common examples of a menu command, and their associated
command Ids.
• Many Teamcenter extension points, services, and SWT controls were added.
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.
http://www.eclipse.org/articles/Article-UI-Workbench/workbench.html
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.
The Application Integration Framework (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.
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.
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.
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 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()).
Instead of using forms, the preferred method is to use style sheets to filter properties for users by
group or role. In this example, the Cost property is only visible to users in the Estimator role.
Another way to restrict the read or write access to a property separately is to place it on an attached
form, and then control the access to the form separately.
This method also has the option of being able to add or modify form properties after the main
business object has been released, if desired.
Custom forms
If you must use forms, there are several ways to modify their layout.
• Style sheets - XML definition, stored in the database, no deploy. Siemens PLM Software
recommends using this method.
• AbstractRendering - requires Java coding, must be deployed. In places where Swing is still used
(double-click a form, for example) you must implement the IOpenService to trigger your code.
Notes
• 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.
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.
Note
The property JavaBeans are located in the com\teamcenter\rac\stylesheets directory.
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
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.
Tip
Type a display name for each of these new properties, for example, Test Date.
• 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.
• 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.
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.
b. In the New Project dialog box, select Plug-in Project. 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.
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.
D. Click Finish.
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.
E. Open the project’s Runtime tab, click the Add button, and add the
com.teamcenter.rac.stylesheet package.
Note that the listed exported packages are com.mycom.custompanel and
com.teamcenter.rac.stylesheet. This ensures that these packages are listed as
exported packages in the MANIFEST.MF file.
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
D. In the rich client, create a preference for this rendering. Choose Edit→Options→Filters
and click the Create a new preference definition button in the upper left corner of the
dialog box. In the Name box, type A5_MyItemRevision.JAVARENDERING and in the
Values box, type com.teamcenter.rac.stylesheet.CustomSamplePanel.
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 %HOMEDRIVE%%HOMEPATH%\Teamcenter
directory. On a Linux client, it is typically the $HOME/Teamcenter/ directory.
b. Select the item revision and click the Viewer tab or choose View→Properties to see your
new panel.
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()
{
}
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.
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 saveProperty() method. If you
choose to override any of the base property beans, Siemens PLM Software recommends that you
override the saveProperty() method.
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.
Note
The isRenderingModified() method is required to use this customized form in the Viewer
view.
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
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.
b. In the New Project dialog box, select Plug-in Project. 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.
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.
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>
comp = c;
loadRendering();
}
public void loadRendering() throws TCException
{
initializeUI();
data1_tcproperty = comp.getTCProperty("user_data_1");
data2_tcproperty = comp.getTCProperty("user_data_2");
data1_jtextfield.setText(data1_tcproperty.getStringValue());
data2_jtextfield.setText(data2_tcproperty.getStringValue());
}
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;
// TcEng legacy used setTCProperties or setFormTCProperties,
// use compnent.setTCProperties(ps);
component.setTCProperties( ps );
}
catch ( Exception ex )
{
MessageBox.post(ex.getMessage(), null, MessageBox.ERROR);
}
}
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);
mainPanel.add("2.1.right.center",new JLabel("User Data Two"));
mainPanel.add("2.2.left.center", data2_jtextfield);
add("unbound.bind", mainPanel);
}
/**
*The following code is optional depending on whether you want to pre-load the
*property data from the original (selected) item revision during a Revise.
* Without it the values are reset/left blank.
*/
@Override
public void setValues(String[] props, Object[] values)
{
if ( props != null && props.length > 1 )
{
for( int i=0; i<props.length; i++ )
{
if( props[i].equals( "user_data_1" ) )
{
data1_jtextfield.setText(values[i].toString());
}
else if( props[i].equals( "user_data_2" ) )
{
data2_jtextfield.setText(values[i].toString());
}
}
}
}
}
Note
Note how this file uses the TCComponent method to set properties on
components. This method uses the underlying Teamcenter Services API. Prior
to Teamcenter 9, the SOAPropertyHelper method, which was a temporary
wrapper on top of legacy code, could be used to set properties on components
even though it was unpublished.
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.
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 %HOMEDRIVE%%HOMEPATH%\Teamcenter
directory. On a Linux client, it is typically the $HOME/Teamcenter/ directory.
d. On the Define additional item revision information page, you should see your new item
revision master form.
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 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 is deprecated. 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.
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.
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.
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.
Headquarters
Europe
Granite Park One
Stephenson House
5800 Granite Parkway
Sir William Siemens Square
Suite 600
Frimley, Camberley
Plano, TX 75024
Surrey, GU16 8QD
USA
+44 (0) 1276 413200
+1 972 987 3000
Asia-Pacific
Americas
Suites 4301-4302, 43/F
Granite Park One
AIA Kowloon Tower, Landmark East
5800 Granite Parkway
100 How Ming Street
Suite 600
Kwun Tong, Kowloon
Plano, TX 75024
Hong Kong
USA
+852 2230 3308
+1 314 264 8499