Thursday, March 27, 2014

UI framework event handling in Maximo

Application Event Model

Overview

Events are sent to the user interface framework whenever an end user clicks a toolbar button in the application toolbar, selects an action listed in the Select Action menu, clicks a push button within the user interface, or selects an option from a menu next to a field.  Many other types of user interactions also send events to the user interface framework, but those widgets previously listed are the ones that application developers are mostly likely to configure.
This article explains what events are sent to the user Interface framework when your end users interact with those types of widgets. We will also explain how the user interface event handling framework handles those events.  This article should allow you adjust your user interface to use a wide variety of widgets to fire and handle events to best meet your end users usability needs.

Toolbar Button Events

       Example "Save" Toolbar Button
       Find the Signature Option that corresponds to the Save button


Select Action Menu Events

       Example Menu Action “Duplicate Action”
Choosing a Select Action menu item causes the user Interface framework to receive an event that matches the Signature Option id associated with this Select Action menu item.   In the example above, the user Interface framework would receive an event called “DUPLICATE” based on the details of the configured Signature Option as shown below.
       Translating a Select Action to the Underlying Event


Configuring Push Button Events

Example Select Members Push Button
You can associate a push button with an event using the “Event” field in Application Designer or using the “mxevent” attribute in the presentation xml. You can optionally specify the ID of a control that processes the event using the “Target ID” field in Application Designer or “targetid” in the presentation xml.
When an end user clicks the button, the event ID specified in that panel above “selectmembers” is received by the user interface event handling framework.


Popup Menu Events

Each field-level popup menu has underlying mxevents associated with each of the menu choices.
       Example Popup Menu
       Configuration of Popup Menu for this Field
       Actual Popup Menu for this Field (from Menus.xml)
Notice the events listed for each of the choices shown.  That event string is the event that gets sent to the underlying user Interface framework when this menu choice is clicked.


User Interface Framework Event Handling

The user interface framework processes the event received in this order:
  1. First the framework checks to see if the event matches a signature option (sigoption) ID.
    1. If the event does match, the user interface framework checks to see if the user has privileges for that signature option.
    2. If they do have security privileges, the framework checks to see if there is a special flag set to handle the Signature option in an Advanced way.  If the Signature option does have a flag the user interface handles that flag accordingly.  So if the Signature Option is flagged as an Action then the User Interface invokes that action. Here is an example of a menu option that would start a System Configuration->Platform Configuration->Action called “INSERT” for the Action object instead of firing the default INSERT event. 
                      Setting Advanced Options to point a Signature option to an Action
                       The Underlying Action that would get called by the Advanced Sigoption Metadata Above
  1. If there is not an “Advanced” Flag for this sigoption then the framework checks the target control/component to see if it handles such an event (by implementing a method that matches the event name.)  Events sent from Select Action and Toolbar buttons will rarely match this check as the target control/component for the Select Action and Toolbar buttons is the Application Toolbar, and it rarely handles the event directly.
  2. If the control or component doesn’t have a method that matches then the framework will check to see if the DataBean or ApplicationBean associated with the target component/control has such a method; if it does then that method will be called.  The Select Action or Toolbar buttons are bound to the ApplicationBean, so will check there for a method that matches.  Buttons and Button groups can be bound to other Databeans based on where they are placed within the application.
  3. If a targetid is not configured in the Application Designer for the events, the framework will check the Application Bean for the application to find a matching method.
                    Example Application Bean method to handle the INSERT signature option event
  1. If the Application Bean doesn’t contain a matching method, the Mbo and MboSet of the DataBean will be checked for a matching method as well. 
  2. If no such method exists or the method returns the integer constant for EVENT_CONTINUE, the framework will then check to see if there is a dialog in the current application with a dialog id that matches the event name.  If such a dialog exists then that dialog will be displayed.
  3. Finally the framework will check to see if there is a dialog in the System Libraries that has a dialog ID that matches the event, and it will display the dialog in that case.
If all of these checks fail, NOTHING will happen when the event is received by the user Interface framework.

Example

So putting all this information together, let’s go through the use case where an Application Developer may want to add a button to the user interface that would expose a functionality that is also exposed in the Select Action menu.  For example, in the Inventory application, let’s add a button on the main Inventory tab that would trigger the 'Adjust Current Balance' that is typically available only from the Select Action menu.
First we’ll look at the Sigoptions defined in the Inventory application in Application Designer to find the right event:
       Event is CURBALADJ
Drag and drop a button group and push button onto the main Inventory tab and set the event to CURBALADJ to match the signature option above.
       Configuring the Pushbutton Event and Label
Save the Application.
Now from within the Available Balance section, your end users can click the Adjust Current Balance button and pop up that dialog.
       Current Balance Adjustment window
With all the information you learned above, you could even put a field-level menu next to the current balance that let you fire this event (rather than a push button.)
Hopefully this explanation of the event model will help you enhance your user interfaces to meet your end user requirements.

More Detailed Information

Technically when the end user interacts with each of those widgets above, a click event is sent to the component, and the component translates that click event into a queued event that matches the description given above.  Sometimes to help debug issues in the field, the user interface team might turn on javascript event tracking and you might see these click events being sent from the client.

Customizing Headers with corporate colors and logo in Maximo

Steps

  1. Locate your images in the folder structure - Within the folder structure there may be multiple image locations that are used for different skins and screen mirroring in bi-directional language scenarios.
    We have 3 general locations for left to right images. They are:
    applications\maximo\maximouiweb\webmodule\webclient\images
    applications\maximo\maximouiweb\webmodule\webclient\skins\mobile\images
    applications\maximo\maximouiweb\webmodule\webclient\skins\tivoli09\images
    Each of these folders also contains an rtl folder which holds the right-to-left version of the images for bi-directionality.
    The mobile folder is used for mobile implementations and can be treated the same as the others.
  2. Determine the skin your system is using - In 7.x, prior to 7.5 the default skin uses the css and images in the folders directly under the webclient folder. From 7.5 the tivoli09 skin is used and the corresponding folder will contain the images and css. If you are not sure which skin you are using see the skin images above to help you identify.
  3. Locate and backup the images. Navigate to the folder for the skin you are using and backup the two images discussed earlier as well as applink images depending on skin:
    tivoli09 - banner_bkg.png and banner_swoosh.png. banner_swoosh_applink.png and banner_bkg_applink.png
    classic - bg_navbar.jpg and bg_navbar_applink.jpg
  4. Modify the images to have the coloring and look you desire - Open the images in the image editor of your choice and edit them as desired. Maintain the size of the images so that the layout will work correctly. (for classic, you should also modify the 'bgnb' class and change the background color to match with your new image)
  5. Modify css classes to change text color if desired - Locate the appropriate css file within the same path as your used skin. Find maximo.css and look for the following classes:
    powerwhite, goto, txtappname.
    Change the color of these classes to the text color you desire. For classic skin, the application images can also be hidden by adding css:
    #appimage
    { display: none; }

    and link images can be removed by adding
    pwimg { display:none;}
  6. Rebuild your ear file and re-deploy.

A Maximo Scripting Solution to a Plain Text Problem

Create a Lookup with table domain in Maximo 7.5.0.5



Step 1 - Create Table domain

Go the Domains application (located in Sytem Configuration -> Platform Configuration) and click on the 'Add New Domain' button at the bottom right and choose ‘Add New Table Domain’

In the ‘Validation Where Clause’ we state that the entered Workorder number (Will be stored in GNZ_LQWONUM, look below in this post for the configuration of this field) is compared to the workorder number in the workorder table.

WONUM=:GNZ_LQWONUM

In the list the user will get we only want to show workorders that do not have the status WAPPR. Therefor we we fill in the ‘List Where Clause’

STATUS<>'WAPPR'



Click [OK] and click on the Save icon in the Domains application

Step 2 - Create a Lookup

Now we need to create the lookup which will show the values of the table domain. Go to the Application Designer application (located in System Configuraion -> Platform Configuration) and in the ‘Select Action’ menu choose ‘Export System XML’
Click on the export arrow behind the LOOKUPS rows


Make sure your browser allows popups so the LOOKUPS.XML can be showed by Maximo. Or maybe your browser wants to save the file directly, if so, do so. 
Otherwise, safe the opened LOOKUPS.XML to a location where you can easily locate it again (e.g. desktop)
Now we open the LOOKUPS.XML for editing. (I use Notepad++)
Scroll all the way down and add the following table: 









Essentially I copy-pasted the existing 'workorder' table in the LOOKUPS.XML and changed the 'workorder' names to 'GNZ_WONUM'


Save the LOOKUPS.XML and in Maximo go to the Application Designer.
Click on the 'Import Application Definition' icon. 



Browse to the modified LOOKUPS.XML and import it.




Step 3 - Configure the (Object) Database Attribute

Next we add a database attribute on the Labor - Qualification in which we store the workorder number.

Open the 'Database Configuration' application (located in System Configuration -> Platform Configuration) and in there open the LABORQUAL object and go to the 'Attributes' tab.
In the bottom right click the [New Row]  button



Fill in the attribute like in the screenshot below




I use the 'Same as Object' and 'Same as Attribute' fields so the 'Type' and 'Length' will always be able to store Work Order numbers. When the WORKORDER.WONUM field should be modified, this field is modified automically.

Click on the Save icon and go back to the 'List' tab. Do an empty search and the LABORQUAL obejct will come out on top with the status 'To Be Changed' 




In the 'Select Action' menu choose 'Manage Admin Mode' and click on the [Turn Admin Mode ON] button.




Wait until the Admin mode is on and click [Close]

Now in the 'Select Action' menu choose 'Apply Configuration Changes' 
Check the 'Do you have a current backup?' box and click on the [Start Configuring the Database] 




When completed, click on the [OK]  button.
Choose 'Manage Admin Mode' again from the 'Select Action' menu and turn admin mode off.


Step 4 - Configure the MAXLOOKUPMAP

Open the LABORQUAL Object again and go to the Attributes tab.
At the far right of the GNZ_LQWONUM field, click on the 'Edit Lookup Map' icon.




Fill in the information required to link the fields:




Click [OK]  when done and make sure to save the Object.

Login to the Websphere Integrated Solution Console and restart the 'MXServer' 





Step 5 - Configure the field in Application Designer

Open the Application Designer application. and open the LABOR application.

Go to the Qualification tab and make a copy of the Certificate# field. Edit the properties of the field to match them as in the screenshot below.




Save the Application.
Now for the check if everything works.
Go to the Labor application and open an Active labor.

Go to the Qualifications tab. Add a new row and check the Work Order field with the lookup:


Maximo 7.5 - Use button with Automation Script

Example:
A button on the Work Order Tracking application that triggers a script. The script will read the Target Start Date from the Work Order, add the Duration to it and will automatically fill in the Target Finish Date.

How to:
Open the Automation Scripts application.  Create a new ‘Script with Action Launch Point’
Fill in the name of the Launch Point, the Object and the Name of the Action. 

We will see this Actionname later when we configure the button and an Action with this name will automatically be created. We choose to use a New script. Click [Next] to continue

Next give the New Script a name and description. I use jython as the script language. We will add variabeles later on, so leave them for now and click [Next] to continue.

We need to fill in the script here. As we cannot test it here we will fill in a ‘1’ (cannot leave it blank for some reason) We will return later to add the correct script. Click the [Create] button


Open the script and go to the ‘Variables’ tab.

Add the following variables by pressing the [New Row] button

Variable:             TARGSTART_IN
Description:       Target Start Date            
Variable Type:   IN
Override:            Checked
Binding Type:    Attribute

Variable:             ESTDUR_IN
Description:       Estimated Duration        
Variable Type:   IN
Override:            Checked
Binding Type:    Attribute

Variable:             TARGFINISH_OUT
Description:       Target Finish Date          
Variable Type:   OUT
Override:            Checked
Binding Type:    Attribute



Click the ‘Save’ icon at the top of the screen and go to the ‘Launch Points’ tab. Click on the ‘Edit Launch Point Detail’ button.

In this screen we bind the created variables to Attributes. This can be done per Launch point. So if you create multiple launch points you can use the same variables but bind them to different Attributes.

Open the Details of the attribute and click on the ‘Select Attribute Name’ button.

Check the Action application to see the configuration of the Action that was created.

Do not change anything here, this is configured by creating the launch point, we will just check it here.

Next we will add the button to the screen. Open the Application Designer en open the WOTRACK application.

Add a Signature Option to the WOTRACK application by going to the ‘Select Action’ menu and clicking on ‘Add/Modify Signature Options’



Create a new Signature with the same name as the Action.

Open the ‘Advanced Signature Options’ at the bottom of the dialog and make sure that “This is an action that must be invoked by use in the UI”  is selected.



Click [OK] and Save the ‘WOTRACK’ application.
Now we add a ‘Pushbutton’ to the Work Order tab. Just somewhere near the Target Start and Target Finish Date fields.




Open the properties of the Pushbutton. Give the Pushbutton a label and enter the Signature name as Event.
Save the WOTRACK application.
Now we need to give rights to the authorized groups on the button. Open the Security Groups application. Open the MAXADMIN group, go to the ‘Applications’ tab and filter for the ‘Work Order Tracking’ application.

Next filter or search for the Signature option we created and check the ‘Grant Access?’ option.
Save the group.


Now we need to create the actual script. Go to the ‘Automation Scripting’ application. Open the script we created earlier.

We will replace the current code with the code below;

from java.util import Date
TARGFINISH_OUT = Date(TARGSTART_IN.getTime() + long(ESTDUR_IN * 60 * 60 *1000))
In short the code does the following;
Coverting the TargetStartDate to milliseconds, converting the estimated Duration to milliseconds and adding them up, converting the total of milliseconds to a date and storing that in the Target Finish Data.

Click the ‘Save’ button, and to test the script, click the ‘Run’ button.
Result of the ‘Run’ button;

This isn’t telling us much as the variabele is empty, so the calculation is not working…

To properly test the configuration, we will go to the Workorder Tracking application, and actually push the button.



Push the button, and the date will be calculated.

Maximo Mobile - Receives error "The app does not exist" during data download

  STEPS: 1) Install Maximo Mobile from Google play store app 2) Enter URL 3) Click Log In RESULTS: On the Setting up page, navigator shows “...