Вы находитесь на странице: 1из 5

Creating a Dialog Box in Maximo

Maximo provides many ways to add functionality to an application designer, from sub tables to tabs. Another way is to add a dialog box. In Maximo a dialog box is a pop up screen that appears on top of the current screen. You can use these to allow users to add more data to the current record or even as a way to generate new records based on the current record. How to create a new one is described here as follows. The first step is to add any fields you will need for the screen. For a maximo screen a input field must be defined on an underlying MBO.If it is a value that you will only use for a calculation on the screen and do not want to store then add the field as a non persistent field. Next we need to add a dialog box to the screen, for this we had to export application XML and we have to edit in any text editor. <dialog id=my dialog label=My New Dialog Box mboname=ASSET bean class=psdi.webclient.beans.asset.MydialogBean> <section id=my dialog_grid1> <text box id=my dialog_new_teaxtbox_1 data attribute=assetnum label=Asset Number input mode=REQUIRED/> </section> <button group id=mydialog_2> <pushbutton id=mydialog_2_1 default=true mxevent=do action label=Action/> <pushbutton id=mydialog_2_2 mxevent=dialog cancel label=Cancel/> </button group> </dialog> Make sure this is not nested in another dialog box. Also you need to make sure that all ID attributes have unique names with in the entire XML document. It really does not matter what the content of dialog is at this point as you can edit it using the Application Designer. Now Re-import your new XML Screen. Before you edit the dialog box you need to make it so you can actually access it. The first step is to create Signature option for your new Dialog. To do this, Select Action->Add/Modify Signature options

Add a new option. For the Option field ,make sure you give it same name as the ID attribute on your <DIALOG> tag .The description is what will be displayed in the security screen(Yes, adding this means that your dialog box will have its own security ).Now Click on OK. Next you will need some way for the user to access your dialog box. If you want them to use the Select Action menu, then add an entry to the Add/Modify Select Action Menu. If you want it to appear on the tool bar, then add an entry to the Add/Modify Tool Bar Menu. If you want to add a button to the main screen that users can click on to access your dialog box, then in the properties of the button ,for the EVENT attribute, enter the name of your Signature Option you created.(Which is the same as the ID attribute of your <DIALOG> tag. Now you can edit your new Dialog box. In Application Designer, click on the EDIT Dialog button ( )you will see an entry for my dialog (or what ever you put for the ID attribute on the <>).

Click On your dialog box from the list to edit it.

Now use the Application Designer to modify the screen as you need to. Unless this is just extra data entry screen, you will want the screen to so something special when the user clicks one of the buttons. To do this, you will need to do java programming. If you look at our XML for our Dialog, you will notice that the <DIALOG> has a bean class attribute. This is going to be the name of your custom bean class. But for the button to execute your custom code, you need to look at the properties for the button.

The Event property is going to be the name of the method in the java bean to execute. Since this is a java method, case does matter. Now that we have created our dialog box, we need to program our custom functionality. To do this we can use Eclipse. You will want to create a new project. Create it like you would for MBO. Customizations but with the following changes. Output folder: <Maximo Root>->Applications->maximo->maximouiweb->webmodule->WEBINF>classes

Add the External Class Folder: <Maximo Root>->applications->maximo->maximouiweb->webmodule->WEBINF>classes

Now create a new Java Class.

Now you need to add your method. In this case we will add one called do action. Package psdi.webclient.beans.asset; import java.rmi.RemoteException; import psdi.webclient.system.controller.Utility; import psdi.webclient.system.controller.WebClientEvent; import psdi.webclient.system.beans.*; import psdi.server.MXServer; import psdi.util.logging.FixedLoggerNames; import psdi.util.logging.MXLogger; import psdi.util.logging.MXLoggerFactory; import psdi.util.MXApplicationException; import psdi.util.MXException; public class MyDialogBean extends DataBean { MXLogger appLog=MXLoggerFactory.getLogger(FixedLoggerNames.LOGGERNAME_APP+ASS ET); Public int doaction () throws RemoteException, MXException, ParseException { appLog.info (MyDialogBean::Enter doaction.);

//put your business logic return 1; } } Once you compile it, you will need to rebuild and redeploy the ear. The last thing to do is to grant your self access to the signature option to the screen. Now you can test it.