MyMobileWeb Eclipse Plugin User Guide
From Morfeo Wiki
Contents |
Install
Requirements
Before installing MyMobileWeb Eclipse Plugin, you must:
- Have installed:
- A working copy of Eclipse.
- Apache Tomcat Web server with support for servlets and JSP pages.
- Tomcat Plugin Plugin for Eclipse to integrate Tomcat web server into Eclipse development platform.
- Plugin Colorer (Optional). Color syntax xml source files, to ease writting xml presentations.
- Download:
- MyMobileWeb SDK
- Plugin MyMobileWeb Plugin to ease MyMobileWeb development inside the Eclipse platform.
How to install and configure
- To install MyMobileWeb Eclipse Plugin, just uncompress the file inside your eclipse/plugins directory.
- For more detailed install and configuring instructions you may want to have a look to MyMobileWeb Getting Started.
How to add new Elements
This section will show you how to add the different elements available in the MyMobileWeb platform directly from Eclipse environment. Each of these elements has his own wizard which guides the developer asking for most important properties. To avoid problems, we recommend to use always these wizards to add new elements, because they update succesfully all needed config files and presentations.
How to create a new Project
There are two places to start new Project Wizard inside eclipse.
- In the "File" menu, select "New" and "Project".
- Right click anywhere in the workspace tree, then select "New" and "Project".
Once inside New Project Wizard:
- Select "MyMobileWeb" folder, or "MyMobileWeb Examples", depending if you want to create a new empty project, or one of the existing examples to test them.
- Choose a name for the new project being created.
- In the first entry called "Context Name", write a name for a new Tomcat Context.
- If you don't want that the plugin updates automatically Tomcat's context, just unmark option "Can update context definition"
- The second entry specifies the directory where the new project is being created, usually it can be left unchanged.
- Press next to show next presentation.
- In this presentation you can select:
- The base package name for the application.
- The base package name for event handlers.
- Select the first OP that will be started on application launch. (You must mark the tick to activate it)
- Then you click on finish, and the system will create the tree and files needed for the application, for example:
How to create new CSS stylesheet
- Right click on the project we want to add a new stylesheet, a context menu will appear.
- Select "MyMobileWeb" menu and "New Css".
- Then a small wizard will appear, select:
- Name for the family or technology. If it didn't exist it will be automatically created.
- Name for the new stylesheet.
How to create new OP (Presentation Operation or Use Case)
- Right click on the project we want to add a new stylesheet, a context menu will appear.
- Select "MyMobileWeb" menu and "New OP".
- Then a small wizard will appear, to select:
- The new OP name.
- You can check de option "Generate manager event package" to add a new package to the event handler package for this OP.
- If you want to create another presentation click Next to create the current one and return to the wizard.
- If you don't want more presentations, click Finish to create the current one and exit.
- Internal changes performed when creating a OP:
- Add the new OP dir.
- Add a constant to the class WEB-INF/src/basepackage/MyOps.java to refer the new OP inside application source code.
- Add a new event handler in WEB-INF/src/basepackage.event.NewOP/NewOPHandlerEvent.java for OP if option was set.
How to create new Presentation
These are the steps to create a new presentation:
- Right click on the project we want to add a new stylesheet, a context menu will appear.
- Select "MyMobileWeb" menu and "New Presentation".
- Select in which OP the presentation should be generated. You can select one of the existing OPs from the list, or write a new OP name (it will be automatically created).
- Select the family or technology for the new presentation from the list, or write a name for a new one.
- Select the new Presentation name.
- If you want a new Event Handler for this presentation to be created, mark the checkbutton.
- Click on Finish to apply results and create the new Presentation
- Internal changes performed when creating a Presentation
- Create OP if it didn't exist.
- Create family/technology dir if it didn't exist.
- Create presentation from a pattern.
- If selected, create new Event Handler for the new presentation in WEB-INF/src/basepackage.event.OP/NewPresentationHandlerEvent.java
- Incorporar una constante en el fichero de constantes: WEB-INF/src/basepackage/MyPresentations.java
How to create new OA (Operation Application)
OAs are procedures that the programmer can define and that are usually called from event handlers, to read user input from previous presentation and then perform context updates or whatever the developer decides. It can access another components to fetch or save data, like databases, xml files, access web services, etc.
To create a new OA:
- Right click on the project we want to add a new stylesheet, a context menu will appear.
- Select "MyMobileWeb" menu and "New OA".
- Select the name of the new OA we are going to generate:
- Click on "Finish" to create the OA.
- Internal changes performed when creating a OA:
- A new Class will be created in the default package for the OAs. It will implement the Interface ApplicationOperation with a default pattern. Then the developer can modify this file to implement his own behaviour.
- A new constant in MyOAs with the name to refere to this OA within the application code.
- A new entry in config/OAConfig.xml specifying the OA constant and full qualified name.
Code Generator
MyMobileWeb platform includes a generator, which transforms xml presentations, css and config files to JSP files. During application execution, MyMobileWeb platform will redirect to these JSP when needed to render the presentations according to developer preferences and user's device.
To test in a browser or emulator the appearance of presentations at develop time, you need to run the generator each time you modify a presentation so it updates all JSP files to reflect new changes. This can be a time consuming task, so there are 3 levels of generation.
How to generate Full Application
It will regenerate all JSPs from current application. This option is recommended when deep changes are made to the application, for example changing generic css properties.
To generate the full application from within Eclipse:
- Right click on the project we want to generate.
- In the context menu, select "MyMobileWeb" and then "Generate Application".
- A progress bar will be shown while processing is done, allowing the developer to cancel the operation.
How to generate selected OP
It will regenerate all JSPs related to selected OP:
- Right click on the OP directory in the workspace.
- In the "MyMobileWeb" context menu, select "Generate OP".
- A progress bar will be shown while processing is done, allowing the developer to cancel the operation.
How to generate selected presentation
It will regenerate all JSPs related to selected Presentation:
- Make sure you have saved latest changes on presentations and CSS or they won't take effect.
- Right click on the presentation in the workspace.
- In the "MyMobileWeb" context menu, select "Generate Presentation".
- A progress bar will be shown while processing is done, allowing the developer to cancel the operation.
Automatic Generator
To ease development, when a presentation is saved (For example using Ctrl+S) that presentation is automatically generated.
This option is very useful but it may overhead slow computers. You can disable it at any time in MyMobileWeb Eclipse Plugin Preferences page, from Window/Preferences/MyMobileWeb by disabling option "Generate presentations automatically".
When a CSS file is saved, it will detect which presentations are affected and it will regenerate all of them.
Literal Extractor
The Literal Extractor search all text strings found in Presentations and generates a few structures. Then the user can for example make translations or modify strings for selected families.
There is only one level in literal extraction, extract literals for all Presentations of the application.
It is recommended to extract literals before generation, because the generator may need some localized string to generate JavaScript validations.
To extract literals within Eclipse.
- Right click on the Project in the workspace.
- In the "MyMobileWeb" context menu, select "Literals Extractor".
- Seleccionar el menĂș "MyMobileWeb" y dentro de el submenĂș "Literals Extractor".
- A progress bar will be shown while processing is done, allowing the developer to cancel the operation.
Error management
MyMobileWeb platform has an error management tool, to help the developer in finding and correcting errors in presentations.
Also a syntax coloring tool is recommended to simplify the correction of XML syntax. For example http://colorer.sourceforge.net/ plugin will do the trick.
To know wether a presentation is correct or not, you just need to regenerate it (For example by saving it if you have Autogenerating enabled) Then the generator makes a list with all detected mistakes and where are they located:
To show MyMobileWeb error list, you may need to activate it in Windows/Show Views/Other and then selectin MyMobileWeb view.
















