Showing posts with label ADF mobile. Show all posts
Showing posts with label ADF mobile. Show all posts

Wednesday, December 19, 2012

ADF Mobile: Displaying error, warning, info messages


Every application will have scenarios to display different kinds of error and information messages on the screen. ADF Messages on mobile devices are displayed as a popup with a single close button

This demo application RedstackLogicMessagesDemo.rar has simple code to throw different kind of messages on to the screen when some buttons are clicked.

to create an error that is thrown onto the screen you can throw a new oracle.adfmf.framework.exception.AdfException. This lets you throw either of  FATAL, ERROR, WARNING, INFO messages on to the screen.

for e.g. to show messages you can create exceptions like this


image




Below is how messages will look in the mobile






image
imageimage
image



Tuesday, December 18, 2012

ADF Mobile : Consuming a Restful service



Simple way to consume a restful service in ADF Mobile is to create a URL Service Data Control.

I have created two applications. The first one RestServices.rar is a simple restful service which does a begins with search of Employees. The second one RedStackMobileRestfulDemo.rar is a ADF mobile application to consume the restful service.

First I create an XSD locally in the project to represent the response. We can also refer this remotely. But this will cause the mobile application to make a call every time the application runs.


Employees.xsd
<?xml version="1.0" encoding="windows-1252" ?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="employees">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="employee" maxOccurs="unbounded" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element type="xs:string" name="department"/>
              <xs:element type="xs:byte" name="employeeId"/>
              <xs:element type="xs:string" name="name"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>







We can now create a URL Service Data Control. Below are the steps to create a URL service data control

1

image

2 give the
URL Endpoint : get url without the query
Source: give the query with param values in ## ## as illustrated below

image

3 Here it mandates the query to have a defaultvalue

image

4 Select the Employees.xsd and finish

image

You can now see the data control in the data control pallet

image





You can now drag and drop  loaddata Action into the amx page as ADF Mobile Parameter Form . Drag and drop employee as ADF Mobile List View.

image

image















You can now preview and run the app. For reference you can also download the source code