Saturday, November 10, 2012

Oracle ADF Mobile: adfmf-application.xml and adfmf-feature.xml Part 1

Hi,

In this article we will try to understand the meaning of those file descriptors.
This is the first part of this article regarding those file descriptors. We are going to have a very simple approach on things..

adfmf-application.xml

adfmf-feature.xml


-When are they created?

Those files are created when you create a new ADF Mobile application. (see Hello World Post)
Also check the following link (official Oracle Documentation ):

http://docs.oracle.com/cd/E35521_01/doc.111230/e24475/getting_started.htm#autoId6


According to the above documentation (content extracted from there):


Creating an application results in the generation of the adfmf-application.xml file, which enables you to configure the mobile application and also the adfmf-features.xml file, which you use to add, remove, or edit the application features embedded within the mobile application.

hmmm... What do we get out of it? Is it clear what file is what?

We have both files generated when creating the application. Thats clear so far.

-Can we have more than one of those configuration files?

According to the following section of the documentation (content extracted from the below link) :

http://docs.oracle.com/cd/E35521_01/doc.111230/e24475/define_features.htm#CIHJCABB


An ADF Mobile application can have one or more view controller-type projects, each of which describes a set of features in an adfmf-feature.xml file. As described in Chapter 4, "Getting Started with ADF Mobile Application Development," ADF Mobile provides you with the adfmf-application.xml configuration file for the mobile application itself, and the adfmf-feature.xml file, which you use to define the content of the application. While you can manually change these files, ADF Mobile provides two overview editors that enable you to build these files declaratively.

..........


The adfmf-application.xml configuration file enables you to set the basic configuration of the ADF Mobile application by designating its display name, a unique application ID (to prevent naming collisions) and also by selecting the application features that will display on the application springboard (the equivalent of a home page on a smartphone). Further, this file enables you to create the user preferences pages for the mobile application.

Sorry what? We can have more than one ViewController type projects?
yep! Which means that we can have more than one adfmf-feature.xml files.

Lets do it then!!!!!!!!!!!!!!!!!! ( I actually typed all those !!!! one by one... Lets start a cult... the ! cult!. (exclamation mark cult.. sounds wicket.. doesnt it? )) ( I even placed the parenthesis correct!! wow imagine something like : " correct exclamation mark exclamation mark exclamation mark)

Lets create an ADF Mobile application with more than one ViewController type projects!
(If you dont remember how to start with and ADF Mobile application check the beginning of this  article)



In this example we will have 3 ViewController projects: ViewController, ViewController2 and ViewController3
The result of that creation is the following:


Ok, as we can see we have tree different adfmf-feature.xml files for each ViewController.
Lets create an html page in each ViewController:

in this post, names are going to be dull. There is something retro in this kind of naming.
The pages will be:

page.html
page2.html
page3.html

The result will be the following:


Each page will have an output text.. something to recognisable.

What have we done so far?
Nothing really.. we just created three html pages....
In order to show those pages in the application. we have to add them as features in the corresponding ViewController project.

NOTE: in each addition, make sure that the ids are unique. Keep the other values as default.



After all that is done, we will have the following:


What we have here?
We have created a feature for every html page in each ViewController. Each adfmf-feature.xml file is added as a feature reference in the adfmf-application.xml file.
Lets have a look:


As you can see, adfmf-application.xml has three entries. One for each feature. This was automatically done because we had the checkbox checked two screens ago ("add a corresponding feautre reference to adfmf-application.xml")

So what have we done so far?
Why dont we deploy to see for ourselves!!??

First we have to create a deployment profile for the iOS platform



Lets deploy to simulator now:



As you can see, each feature is displayed as a part of the navigationBar.. Yes that thing at the bottom of the screen is the navigationBar

-Can we remove the navigation Bar? Or at least can we control which feature is going to be displayed??

Yeap! 

This is configured in the adfmf-application.xml file descriptor. With simple declarative development!


So, with those two checkBoxes we control the NavigationBar.
And yes, you can configure which feature will be shown in your navigationBar!



-uhm.. Excuse me, sorry! You
-me?
-Yes you.. no not you, the guy next to you.
- there is only a dog next to me..
-The other side next to you...
-Be specific please..
-On your right
-It is still the dog..
-.... On your left please
-Who?? mee???
-YESS!!! you!
-what? how can I help you?

-What is spring board?
-Spring Board is the so called first wave of your astonishing application! Is the first screen your users will see!
Since it is that important.. you can choose how it can look like.. The below screen shows the default springBar


And the configuration is done in , you guessed it right!!! in the adfmf-application.xml



So what have we learned until now??

adfmf-application.xml is the file descriptor that holds the general behaviour of the application.

adfmf-feature.xml is the file descriptor that holds a feature that is going to be injected in the application.

We can have as many features as we want since it is not mandatory to be part of the application.

In simple words (literally)

1) Create your application (we are going to see more in the near future)
2) Create the feature
3) Add your pages( html etc..)
4) Include the feature in the adfmf-application.xml descriptor in order to be part of the application.


Well thats it for now. Another article is already on its way! We are going to try and answer all questions that might come up and hopefully we will have a better understanding


Regards,
Dimitrios.

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...