IBM Support

Scheduler - how to add "right click" action to the gantt view

Technical Blog Post


Abstract

Scheduler - how to add "right click" action to the gantt view

Body

It might be that you want to add some custom “right click” actions to gantt view in one of Scheduler, Graphical Assignment, or Graphical Crew Manager applications.

To do so you need:

1. Register an action: insert a new record into skdaction table.

For example:

insert into skdaction(skdobjectname,objectname,appletactclass,skdactclass,title,remark,actionname,ismenubased,skdactionid, multirec, dlgname, menuorder, usewithvalues ('SKDACTIVITY','WORKORDER','com.ibm.tivoli.maximo.skd.applet.skdaction.workorder.WorkOrderModifyWOAppletAction',

'com.ibm.tivoli.maximo.skd.skdaction.workorder.WorkOrderSkdAction','Modify Work Details','Modify Work Details','MODIFYWO',1,skdactionseq.nextval, 1, 'modifywo', 2, 'GRPASSIGN');

skdobjectname - always SKDACTIVITY

objectname - is a name of the object, which data you want to explore or update

appletactclass - is a java class that handles the action (if the action is available, set action context, process action response). For most cases this is just a place holder and extends base class (for example, for WorkOrderSkdAction it's a WorkOrderSelectOwnerAppletAction extends WorkOrderAppletAction

skdactclass – class to set action context and execute action. For most cases it looks like below

public class WorkOrderSkdAction implements SKDActionInterface

{

SKDActionContext actioncontext = null;

/**

* Sets Context of the action.The context can be accessed in action class to do necessary logic

* @param - context object

*/

public void setSKDActionContext(SKDActionContext context)

{

actioncontext = context;

}

public Object executeAction(Object actionObject) throws Exception

{

// TODO Auto-generated method stub

return null;

}

}

title – the title of action to display on right click

remark – tooltip for the action

actionname – name of the action (will be explained later on)

ismenubased – always 1

multirec – if the action is available when you select multiple records

dlgname – dialog to open when action is invoked

menuorder – order of this action in the list of actions

usewith – application that has this action

2. Create two classes defined above: appletclass and skdclass

3. Create custom application bean extends base application bean and add new method for the action there. Don't forget to change your application xmk to use your custom application bean

For example,

/**

* Validates if the user has security access to perform the Modify Work Detail action.

* Calls the action to perform the Modify Work Detail action.

*/

public int MODIFYWO() throws MXException, RemoteException

{

//validate access

checkActionAccess("MODIFYWO");

String selection = clientSession.getRequestParameter("selection");

selection = selection.substring(1,selection.length()-1);

String[] selectedRecords = selection.split(",");

//Show same dialog for multiple record selection, since only one dialog is defined in XML

if (selectedRecords.length>1)

{

clientSession.loadDialog("modifywo");

return EVENT_HANDLED;

}

return EVENT_CONTINUE;

}

and if action allows to select multiple records – create another method in the application bean like

/**

* Validates if the user has security access to perform the Modify Work Detail action.

* Calls the action to perform the Modify Work Detail Action

*/

public int LIST_MODIFYWO() throws MXException, RemoteException

{

//validate if the records are the same

checkSameType(false);

return MODIFYWO();

}

4. Add a dialog to the application.xml to perform your action.

In our example it's

<dialog id="modifywo" label="Modify Work Details" mboname="SKDWOModifyDetail" beanclass="com.ibm.tivoli.maximo.skd.beans.SKDWOModifyDetailBean" savemode="ONLOADUNLOAD">

and create all needed objects (and classes) and beans to handle that dialog.

 

[{"Business Unit":{"code":"BU005","label":"IoT"}, "Product":{"code":"SSLKT6","label":"Maximo Asset Management"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":""}]

UID

ibm11133199