0% found this document useful (0 votes)
49 views

Development - Client Customization - Draft

Uploaded by

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

Development - Client Customization - Draft

Uploaded by

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

Teamcenter Rich Client

Customization
Cognizant Technology Solutions
Teamcenter Rich Client Customization

Agenda
• What is client customization?

• Codeful Extensions
• Setup Integrated Development Environment (IDE)
• Create Plugin
• Contributing Commands
• Create Custom Application and View
What is client customization?

• The client is the user interface (UI) layer and is built and customized using the Java language (rich
client) or JavaScript (thin client) and other methods.

• The rich client is based on Eclipse, your customizations have access to all Eclipse extension points
and OSGi services

• To customize the rich client, you can use:


• Base Eclipse extension points and services (for example, the org.eclipse.ui.menus extension
point).

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

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


Teamcenter Rich Client Customization
Setup Integrated Development Environment (IDE)
• Download Eclipse
• Extract Zip to desired Install Directory
• Create a batch file with below commands in the box to,
 Setup the environment
 Start the Server
 Launch Eclipse
rem Setup Environment Variables
set FMS_HOME=%TC_ROOT%\fcc
set JAVA_HOME <jdk-install-directory>
set JRE_HOME <jdk-install-directory>\jre
set CLASSPATH=%TC_ROOT%\portal;
set PATH=%FMS_HOME%\bin;%FMS_HOME%\lib;%TC_ROOT%\portal;%PATH%

rem Start Servers for 2-Tier


start "TAO ImR" /min cmd /c “%TC_ROOT%\iiopservers\start_imr.bat"
rem Launch Eclipse
<Eclipse-install-directory>\eclipse.exe -vm <jdk-install-directory>\bin\javaw
Note: Wherever TC_ROOT appears replace it with Teamcenter local installation directory path, (e.g.)C:\Siemens\LOCAL_2T\
Setup Integrated Development Environment
(IDE)
Start Eclipse

• Run Batch File to Launch Eclipse

• Select a Location for the Workspace

• Close Welcome Page


Setup Integrated Development Environment
(IDE)
Set Target Platform

• Setup Target Platform


 The Target Platform refers to the plug-ins which your workspace will be built and run against.
It describes the platform that you are developing for.
 Plug-ins in the workspace are built against the target platform so you do not have to have
everything in your workspace
 When using Plug-in Development Environment's launchers you can choose the set of plug-ins
you want to launch. By default the Eclipse Application Launcher will start with all plug-ins in
the target, but will use workspace plug-ins instead when available.
• To use Teamcenter plug-ins,
Configure “TC_ROOT/portal” as new Target Platform directory and make it as
Active.
Setup Integrated Development Environment
(IDE)
Set Target Platform
Setup Integrated Development Environment
(IDE)
Set Target Platform
Setup Integrated Development Environment
(IDE)
Set Target Platform
Create Rich Client Plugin
Create Plug-in project

• To use any Eclipse extension point, you must first create a plug-in project using the
plug-in development environment (PDE), which you will do shortly.

• A plug-in project requires,


 MANIFEST.MF file describing the plugin and its dependencies.
 Plugin.xml file identifying the extension points being implemented.
 Java classes implementing those extension points. e.g., SampleHandler.java.

• We'll develop a very simple plug-in implementing the Eclipse version of the classic
Hello World sample.
• We're going to add a button to the Tools menu that when pressed, displays
an information dialog containing the string "Hello, Eclipse world".
Pressing OK dismisses the dialog.
Create Rich Client Plugin
Create Plug-in project

• Create a New Plugin Project


Create Rich Client Plugin
Create Plug-in project
Create Rich Client Plugin
Create Plug-in project

• After creating a plugin project successfully


the project explorer displays the
corresponding project structure.

• Hierarchy of the project can be viewed by


expanding the folder.
Create Rich Client Plugin
Create Plug-in project
• Add required Dependencies
Project->Plugin.xml->Dependencies->Add
 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
Contributing Commands to Rich Client
Contributing a custom Menu Item to the Menu Bar

Add “Sample Command” to “Tool” menu in My Teamcenter Perspective


• In plugin.xml create extension point to specify
command id for ”Sample Command”.
• Create extension point to define the handler class
associated for the corresponding command.
• Create extension point to define menu contribution
where locationURI , icon, etc., cab be defined.
Contributing Commands to Rich Client
Understanding the locationURI
<menuContribution locationURI=“[scheme]:[id]?[argument-list]”
menu:org.eclipse.ui.main.menu?after=additions

Contribution to Eclipse RCP main menu:

The Eclipse menu bar unique ID?

The location within the menu bar where the contribution should be added
scheme = the „type‟ of the UI component into which the
contributions will be added
• menu = the main application menu or view pull-down menu
• toolbar = the main application or view toolbar
• popup = a context menu in view or editor
id = the unique identifier of menu, toolbar or popup into
which the contributions should be added
• Eclipse RCP main menu: org.eclipse.ui.main.menu
• Eclipse RCP main toolbar: org.eclipse.ui.main.toolbar
• “Any” context menu: org.eclipse.ui.main.popup.any
Example: <menuContribution locationURI="menu:tools?after=additions">
Contributing Commands to Rich Client
Understanding the When Clauses

Visible, Active and Enabled When


 MenuContribution: visibleWhen
• visibleWhen: This clause is responsible for visibility of command. If the command is visible in the user
interface then we can see the effect of enabledWhen clause as if command is not visible you cannot see whether
it is disable or enabled.

 Handler: activeWhen, enabledWhen


• activeWhen: One command can have many handler but at a time only one handler can activated. If
activeWhen returns true, it means particular handler for the command is activated. Important point here is that it
will just activate the handler, it does not have any relation with whether command is visible or is visible but not
enabled.
• enabledWhen: This clause is responsible for enabling and disabling commands. enabledWhen gets evaluated
only if activeWhen for the particular handler. If command has only one associated handler and activeWhen is not
written then it will evaluate enabledWhen. Effect of enabledWhen happens only if command is visible in menu
contribution.
Contributing Commands to Rich Client
Understanding the When Clauses

 A MenuContribution associated with Command without an active handler will


appear Disabled.

 A Menu without any visible MenuContributions will itself not be visible: Empty
Menus are invisible.

 A Handler without activeWhen clause is the same as DefaultHandler attribute


associated with a Command.

 The Handler with the most specific activeWhen clause that is true will win
control of referenced Command.
Contributing Commands to Rich Client
Contributing a custom Menu Item to the Menu Bar

Here is the handler class for the “Sample Command”, it is coded to display
“Hello, Eclipse world” in a message box that opens on click of the command.
Create Rich Client Plugin
Test by exporting jar file

• Export the Plug-in by, project-> right click-> Export


• Copy the Exported Plug-in jar file to
TC_ROOT/portal/plugins folder
Create Rich Client Plugin
Run the genregxml script

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

• Configure the Debug Configurations to launch the rich client


Launch the rich client from Eclipse
Create Launch Configuration

In environment tab of debug configurations create two new variables


• FMS_HOME , Value=%TC_ROOT%\tccs
• PATH , Value=%FMS_HOME%\bin;%FMS_HOME%\lib ;%FMS_HOME%\jar
Launch the rich client from Eclipse
Verify the customization

• Project -> Right Click -> RunAs -> RunConfigurations -> Run
Note: Debug configuration settings done will apply for run configuration also, can be launched in either ways.
• Teamcenter is launched
• Enter User ID , Password and Server to Login
Launch the rich client from Eclipse
Verify the customization

Here you can find the customized changes reflecting in My Teamcenter


My Teamcenter -> Tools -> Sample Command , On Click opens a message box.
Contributing Commands to Rich Client
Creating custom item

Here we are going to see an example to create custom item


For this,
 plugin.xml must be updated to include the extension points for the new command “Sample Item” that is to be
added in tools menu.
 Handler class “SampleItemHandler.java” is created for the corresponding command.
 Dialog class “SampleItemDialog.java” is created to get the user inputs for setting the Item attributes.
Contributing Commands to Rich Client
Creating custom item
Following are the extension points to be added in plugin.xml
<extension point="org.eclipse.ui.commands">
<command name="Sample Item" id="sample.commands.sampleItem">
</command>
</extension>
<extension point="org.eclipse.ui.handlers">
<handler commandId="sample.commands.sampleItem"
class="sample.handlers.SampleItemHandler">
</handler>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution locationURI="menu:tools?after=additions">
<command commandId="sample.commands.sampleItem" mnemonic="S" icon="icons/sample.png"
id="sample.menus.sampleItem">
<visibleWhen> <reference definitionId="com.teamcenter.rac.ui.inMainPerspective"> </reference>
</visibleWhen>
</command>
</menuContribution>
</extension>
Contributing Commands to Rich Client
Creating custom item

SampleItemDialog.java
Contributing Commands to Rich Client
Creating custom item

 SampleItemDialog Class extends AbstractSWTDialog which extends org.eclipse.jface.dialogs.Dialog


to create your own Dialog implementation.
This class creates an area in which you place controls and add an ok and cancel button (or other custom buttons).

 Your class needs to override the createDialogArea() method to customize your dialog. This method gets a Composite wh
expects to get a GridData object assigned as its layout data Via the super.createDialogArea(parent) method call, you can
create a composite to which you can add your controls.

 You can override the createButtonsForButtonBar() to add your customized buttons to your dialog’s Button bar.
Contributing Commands to Rich Client
Creating custom item

The TC Session is responsible for logging into TC.


It extends AbstractAIFSession so that the AIF Session Manager can manage this session.
It returns the current instance of the Teamcenter.

 In creatItem() method TCComponentItem is created and returned.


ItemID, ItemName and ItemDesc are the arguments passed to the method.
ItemId is the autogenerated value , itemName and ItemDesc are assigned with the input given by the user.
Launch the rich client from Eclipse
Verify the customization
 Project -> Right Click -> RunAs -> RunConfigurations -> Run.
 After Teamcenter is launched Enter User ID , Password and Server to Login.
 Navigate to My Teamcenter -> Tools -> Sample Item, On Click opens a dialog box.
 Enter name and description and click Finish button.
Launch the rich client from Eclipse
Verify the customization

 A new item is created under Newstuff folder in My Teamcenter.

 Expanding the Item Shows the item revisions associated with that item. Likewise here the Sample Item
contains the item revision (i.e.) 075121/A.
Create Custom Application and View
Define packages and custom perspective class

 Create packages for storing the custom perspective and views.

 Create custom Perspective class


in the perspective package.
Create Custom Application and View
Define packages and custom perspective class

 Create custom view class


Create Custom Application and View
Register the Custom Perspective and Custom View

Following are the extension points to be added in plugin.xml


<extension point="com.teamcenter.rac.aifrcp.application">
<aif_app_item displayMode="Primary" groupName="Mycompany" name="Custom Application"
id="com.mycom.customapp"
perspective_id="sample.richclient.perspectives.CustomPerspective" ordinality="0"
session="com.teamcenter.rac.kernal.TCSession" tooltip="Custom Application"/>
</extension>

<extension point="org.eclipse.ui.perspectives">
<perspective id="sample.richclient.perspectives.CustomPerspective"
class="sample.richclient.perspectives.CustomPerspective" name="Custom
Application"/>
</extension>

<extension point="org.eclipse.ui.views">
<view id="sample.richclient.views.CustomView"
class="sample.richclient.views.CustomView" name="Custom View"/>
</extension>
Create Custom Application and View
Test the Changes
 Your custom perspective will be found in navigation pane if it is not found you can open it by,
Window->Open perspective->Custom Application.
 Custom Application will be opened with it’s associated custom view.
Exercise

Here is simple task for you !

 Try adding “Custom Item” command in File menu , selecting the command should open a dialog box.
Dialog box should contain following,
 Name Label with text field.
 Description Label with text field vertical scroll enabled.
 Type Label with text field.
 Ok and Cancel Buttons.

 Clicking Ok button should create an item of type you have given as input.

You might also like