3d com |
Adding a New Query DialogHow to add a new dialog and execute a query from it |
|
Use Case |
AbstractThis article shows how to add a new panel in the Portal transient area and execute a Query from it. |
This use case is intended to help you add a new dialog in the Portal transient area. This dialog is created with the CATJDialog APIs. It is displayed by selecting one row in a list and clicking a new icon added to the Toolbar and the Contextual Menu.
[Top]
CAALCANavCustoQuery is a use case of the CAALCANavigator.edu framework that illustrates the LCANavigator customization capabilities.
[Top]
For CAALCANavCustoQuery create a new command named custoquery and associate a new icon with it.
For the command to be executed, implement the execute
function in a class extending LCANavCommand.
Finally create a new CATJDialog panel named CustoQuery which controller is CAALcnCustoqueryController.java
[Top]
To launch CAALCANavCustoQuery, you will need to set up the build time environment, then compile CAALCANavCustoQuery along with its prerequisites, set up the run time environment, and then execute the use case [1].
Customize the untime view: Replace in the runtime view CustoTestGeneric.xml and rename it to Generic.xml
[Top]
The CAALCANavCustoQuery use case is made of a single module CAALcnCustoQuery.mj module of the CAALCANavigator.edu framework:
Windows | InstallRootDirectory\CAALCANavigator.edu\CAALcnCustoQuery.mj\ |
Unix | InstallRootDirectory/CAALCANavigator.edu/CAALcnCustoQuery.mj/ |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
[Top]
To create the custoquery command and its panel, there are four steps:
[Top]
Name the new command: custoquery.
To map the new command to the desired action defined in the new command class :
Create/Update manually the properties files to be deployed in the runtime view.
Name the new command: custoquery.
Create:/resources/pprregistry/command/definition/custoquery.xml with the following content:
<Command name="custoquery" readonly="true" icon="$/I_CMD_custoquery.gif" msgcatalog="CustoQuery"/>
Update (for this new command to apply to all LCA types): /resources/pprregistry/command/ENOVIA/assignment/Generic.xml
Add the following line:
<Command name="custoquery" multiRowEnabled="false" enablement="true" visibility="true"/>
[Top]
Create a new icon of 16x16 pixels identifying the new command on the Toolbar/Contextual menu:
[Top]
In the new class CAALcnCustobase.CAALcnCustocmds.command.custoquery.Generic.java
extending LCANavCommand implements the
execute
function:
This new class implement the "custoquery" command for
the object type "Generic" (the parent of all types.)
... public class Generic extends LCANavCommand { public void execute( CATSession iSession ) { String[] uuids = getUUIDs( iSession ); if( uuids == null || uuids.length == 0 ) { MessageStack.pushInfoMessage( "custoQuery", "NoObjectSelected", null, iSession ); showStatusMessage( iSession, false ); return; } else if ( uuids.length > 1 ) { MessageStack.pushInfoMessage( "custoQuery", "MoreThenOneObjectSelected", null, iSession ); showStatusMessage( iSession, false ); return; } String parms = "UUIDPARAM="+uuids[0]; this.stackSingleObjectDialog( iSession, "CustoQuery", parms ); } } ... |
[Top]
Create the new CATJDialog panel CustoProperties to be displayed in the transient area. The new controller extends LCANavDialogController
Call super in Create for the controller to automatically retrieve the document: ... public void onCreate( CATDialog iDialog, CATNotification iNotification, Object iData ) { super.onCreate( iDialog, iNotification, iData ); } ... |
Implement the onDocumentChanged method:
... public void onDocumentChanged(CATDialog iDialog, CATNotification iNotification, Object iData) { String uuid = (String)getParameter("UUIDPARAM"); _dob = LCANavUtils.getDataObject( iDialog.getSession(), uuid, ENOVTypeMask.READ_MASK); _key.setTitle(_dob.getObjectName()); } ... |
Callbak implementation for OK (Run Query):
... public void onOK(CATDialog iDialog, CATNotification iNotification, Object iData) { ENOVIQuery query = ENOVQueryFactory.getQueryEngine(LCANavUtils.getLogonToken(iDialog)); query.initialize(_dob.getObjectType()); String val = _dob.getObjectName(); query.addCriteria("V_name", val); try { query.runQuery(); _queryResults = query.getQueryResults(); fillTable(); } catch (ENOVWebException e){;} } ... |
Fill list table with query result:
... private void fillTable() { if( _queryResults == null || _queryResults.length == 0 ) return; String type = _dob.getObjectType(); ENOVILogonToken token = LCANavUtils.getLogonToken(_tableResults); _model = new ENOVDataPPRTableModel( _tableResults, type, _queryResults, token, true); _model.setPreferencePrefix("custoquerylist");//List specific Preferences for the list _tableResults.setKeyModel( _model ); _tableResults.setMultipleSelection( true ); } ... |
Create the CustoQuery.CATNls file with the following content for all new NLS values
Title="My Customized Query";
Frame1.FrameInfo.Info.Title="Click OK to query :";
Command.custoquery.title = "Customized Query";
[Top]
This use case shows hwo to create a command that can be executed from a new CATJDialog
panel in the Portal transient area. First a new comand is created thanks to RADE,
and a new icon is associated with it. Then the command code is created by extending
LCANavCommand to implement the execute
function. The CATJDialog
panel is finally created along with its different callbacks to allow for triggering
the server command.
[Top]
[1] | Building and Launching a CAA V5 Use Case |
[Top] |
Version: 1 [Jun 2005] | Document created |
[Top] |
Copyright © 1994-2005, Dassault Systèmes. All rights reserved.