<-----Google Analytics Code Start----> <-----Google Analytics Code Close---->
Skip to content

Green

color

Default screen resolution  Wide screen resolution  Increase font size  Decrease font size  Default font size  Skip to content Default color Pink color Green color Green color
Home arrow Home arrow Hello World Mobile Supply Chain Application Framework
This website has now moved to http://apps2fusion.com





Hello World Mobile Supply Chain Application Framework | Print |  E-mail
Written by Senthilkumar Shanmugam   
Wednesday, 30 January 2008

Hello World Program in Mobile Applications
In this article, we will create a Hello World page which gets the name from the user and prints the same with the string “Hello World”
We have to create 3 Java Class for the same. They are

1. CustomTestFunction.java: This Class is for Application level initialization and this class is registered as the Function in AOL. This extends the base class MenuItemBean

2. CustomTestPage.java: This Class is for Page initialization. It just creates the layout and adds the beans to the page. It extends PageBean Class

3. CustomTestFListener.java: This Class is the event listener class. It listens to the events on each bean on the page and calls appropriate method to handle the event.

 

1) CustomTestFunction.java

 

/* Function class - this links the page with FND Function in AOL */

package xxx.custom.server;

import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.inv.utilities.server.UtilFns;
import oracle.apps.mwa.beans.MenuItemBean;
import oracle.apps.mwa.eventmodel.MWAAppListener;
import oracle.apps.mwa.eventmodel.MWAEvent;


public class CustomTestFunction extends MenuItemBean implements MWAAppListener

{


public CustomTestFunction()

{

//Link the page with the function

setFirstPageName("xxx.custom.server.CustomTestPage");

addListener(this);

}


public void appEntered(MWAEvent mwaevent)

{

// Code here to initialize Application Level

 

// Logging Functions

UtilFns.trace("Application Entered");

}


public void appExited(MWAEvent mwaevent)

{

// Code to be executed when the user exits the application

 

// Logging Functions

UtilFns.trace("Application Exited");

}


public static final String RCS_ID = "$Header:$";

public static final boolean RCS_ID_RECORDED = VersionInfo.recordClassVersion("$Header:$", "%packageheader%");


}




2. CustomTestPage.java


/* Page Class - Which has the Page Layout. We create and add beans to it */

package xxx.custom.server;


import oracle.apps.fnd.common.VersionInfo;

import oracle.apps.inv.utilities.server.UtilFns;

import oracle.apps.mwa.beans.ButtonFieldBean;

import oracle.apps.mwa.beans.PageBean;

import oracle.apps.mwa.beans.TextFieldBean;

import oracle.apps.mwa.eventmodel.AbortHandlerException;

import oracle.apps.mwa.eventmodel.DefaultOnlyHandlerException;

import oracle.apps.mwa.eventmodel.InterruptedHandlerException;

import oracle.apps.mwa.eventmodel.MWAEvent;


import xxx.custom.server.CustomTestFListener;



//Page Listener Class



public class CustomTestPage extends PageBean {



/**

* Default constructor which just initialises the layout.

*/

public CustomTestPage() {

//Method to initialize the layout

initLayout();

}



/**

* Does the initialization of all the fields. Creates new instances

* and calls the method to set the prompts which may have to be later

* moved to the page enter event if we were using AK prompts as we

* require the session for the same.

*/

private void initLayout() {

 

//Logging

if (UtilFns.isTraceOn)

UtilFns.trace("CustomPage initLayout");

 

//Create a Text Filed and Set an ID

mHelloWorld = new TextFieldBean();

mHelloWorld.setName("TEST.HELLO");

 

// Create a Submit Button and set an ID

mSubmit = new ButtonFieldBean();

mSubmit.setName("TEST.SUBMIT");

 

//add the fields

addFieldBean(mHelloWorld);

addFieldBean(mSubmit);

 

//add field listener to all necessary fields

CustomTestFListener fieldListener =

new CustomTestFListener();


mHelloWorld.addListener(fieldListener);

mSubmit.addListener(fieldListener);

 

//call this method to initializa the prompts

this.initPrompts();

}

 

 

/**

* Method that sets all the prompts up.

*/

private void initPrompts() {

 

UtilFns.trace(" Custom Page - Init Prompts");

 

// sets the page title

this.setPrompt("Test Custom Page");

 

// set the prompts for all the remaining fields

mHelloWorld.setPrompt("Enter Your Name");

mSubmit.setPrompt("Submit");

 

//please note that we should not hard code page name and prompts

//as it may cause translation problems

//we have an different procedure to overcome this


}

 

// This method is called when the user clicks the submit button


public void print(MWAEvent mwaevent, TextFieldBean mTextBean) throws AbortHandlerException

{

UtilFns.trace(" Custom Page - print ");

 

// Get the value from Text bean and append hello world

// and display it to user on the same field

String s = mTextBean.getValue();

mTextBean.setValue(s+" Hello World");

}

 

// Method to get handle of TextBean

public TextFieldBean getHelloWorld() {

return mHelloWorld;

}

 

//Method called when the page is entered

 

public void pageEntered(MWAEvent e) throws AbortHandlerException,

InterruptedHandlerException,

DefaultOnlyHandlerException {

 

UtilFns.trace(" Custom Page - pageEntered ");

 

}

 

//Method called when the page is exited


public void pageExited(MWAEvent e) throws AbortHandlerException,

InterruptedHandlerException,

DefaultOnlyHandlerException {

 

UtilFns.trace(" Custom Page - pageExited ");

 

}


// Create the Bean Variables

TextFieldBean mHelloWorld;

protected ButtonFieldBean mSubmit;


}




3) CustomTestFListener.java


/* Listener Class - Handles all events */


package xxx.custom.server;

import oracle.apps.inv.utilities.server.UtilFns;
import oracle.apps.mwa.beans.FieldBean;
import oracle.apps.mwa.container.Session;
import oracle.apps.mwa.eventmodel.AbortHandlerException;
import oracle.apps.mwa.eventmodel.DefaultOnlyHandlerException;
import oracle.apps.mwa.eventmodel.InterruptedHandlerException;
import oracle.apps.mwa.eventmodel.MWAEvent;
import oracle.apps.mwa.eventmodel.MWAFieldListener;



public class CustomTestFListener implements MWAFieldListener {

public CustomTestFListener() {

}


public void fieldEntered(MWAEvent mwaevent) throws AbortHandlerException,InterruptedHandlerException, DefaultOnlyHandlerException {

UtilFns.trace("Inside Field Entered");

 ses = mwaevent.getSession();

String s = UtilFns.fieldEnterSource(ses);

// Prints the Current Bean's ID

UtilFns.trace("CustomFListener:fieldEntered:fldName = " + s);

}


public void fieldExited(MWAEvent mwaevent) throws AbortHandlerException, InterruptedHandlerException, DefaultOnlyHandlerException {

String s = ((FieldBean)mwaevent.getSource()).getName();

// Prints the Current Bean's ID

UtilFns.trace("CustomFListener:fieldExited:fldName = " + s);

 

// Get handle to session and page
Session ses = mwaevent.getSession();
pg = (CustomTestPage)ses.getCurrentPage();


// when the user clicks the Submit button call the method to print
// Hello world with the text entered in text box

 

if (s.equals("TEST.SUBMIT")) {

 pg.print(mwaevent,pg.getHelloWorld());

return;

 }

}

// Varibale declaration
CustomTestPage pg;
Session ses;

}



 

 

Screen shots:


Fig 1: Choose the Responsibility in the Mobile Device

Image


Fig 2: Choose the Function from main menu
Image




Fig 3: The Hello World Page appears

Image


Fig 4: Enter your name

Image


Fig 5: When you click submit button, Your name is appended with Hello world and displayed in the Text Box

Image

 


Comments (4)add
MWA
written by Amar@genpacts/w , February 10, 2008
Hi Senthil,

Thanks for the detailed description on creating a Test page. Senthil, I have one question, Iam new to MWA so if I want to know about the various classes that we use in creating and customising the pages, for example this statement

import oracle.apps.mwa.eventmodel.MWAEvent;

I want to know the functionality of the methods in this clase, is there any Developer guide or any doc that has detailed informtion like these. Kindly Please help me on this.

Thanks in Anticipation.
Amar
...
written by SenthilKumar , February 13, 2008
Hi Amar,

As far as I know, there is no developer guide made available to public by Oracle. However you can find some documents related to customizing/extending the Mobile Applications using MWA in metalink.

As you have requested, I plan to write some articles regarding the Beans available for MWA/MSCA and some APIs related to it in near future.

Thanks and Regards,
Senthil
Setup dev environment for MWA
written by brad , March 10, 2008
Hi Senthil,

Great info! I've been looking for just this sort of tutorial for quite some time. I was hoping you could share some environment setup info for the java novice. I'm a pl/sql, forms, and reports programmer with a pretty rudimentary knowledge of java. It would be great if you could walk throught he steps required to create a new package with Jdeveloper that includes all of the referenced classes so we can take your sample .java and compile

Thanks!!!
Brad
...
written by SenthilKumar , March 10, 2008
Hi Brad,

I am in process of writing a Java Doc for MWA. I will also try to include some sort of information along with that which you are looking for.

Thanks and Regards,
Senthil
You must be logged in to a comment. Please register if you do not have an account yet.

busy