Migration to jQuery UI
From AlohaWiki
This is a working draft for a new Aloha feature. See the Roadmap for a list of things we're currently working on.
| Topic | ... |
|---|---|
| Version | {{{version}}} |
| Status | ... |
| Responsible Persons | ... |
| Documentation | ... |
| Demo | ... |
Contents |
Latest Thoughts - DevCon Developments
- completely extract the ui & implement it in an own ui plugin
- define events and very basic configuration like toolbar [ B, I ] and addButton
- do not use logic inside of anonymous functions that are event handlers - expose everything
Talk
You can find the talk and discussion here: Video
Requirements
- Selected layout will depend on mobile or desktop - can be overwritten
- Toolbar layouts: fixed, floating
- Buttons will be able to specify which layouts they supprt
- If a button has not specified a layout, it is included in all
- Implementors will be able to over-ride which buttons show in which layouts
API Draft Implementation
API Draft is found here - please use here for all code development: https://gist.github.com/838449
Feature set assessment
A migration to another UI should be optional. Define an interface so ExtJS, jQueryUI and any other implementation can coexist (of course one implementation only could be used at a time and could also be necessary).
Currently Aloha is being developed using ExtJS for rendering the UI. Migration to the jQuery UI Project would eliminate license hassle, considerably slim Aloha down and bring the chance to benefit from one of the most brilliant UI frameworks to come.
Deriving from Aloha's current implementation state, a set of form fields is required.
Floating Menu UI Elements
The following UI elements should be available, to enable migration to jQuery UI.
- Buttons OK http://jqueryui.com/demos/button/
- Buttons with Icons OK http://jqueryui.com/demos/button/#icons
- Groups of Buttons MISSING - no big deal - just wrap in a fieldset or div
- Button Menus MISSING but in development http://wiki.jqueryui.com/w/page/12137997/Menu
- Multisplit Button (huge, word-like formatting interface) MISSING
- Tabs OK http://jqueryui.com/demos/tabs/
Link Plugin
The link plugin requires some special UI eLements.
- Input field MISSING
- Autocompletion with templates - OK http://jqueryui.com/demos/autocomplete/#custom-data
- Resource Selector
- Modal Dialog OK http://jqueryui.com/demos/dialog/
- Tree MISSING but http://wiki.jqueryui.com/w/page/12138128/Tree is planned
- Object List MISSING but GridTable is planned http://wiki.jqueryui.com/w/page/12137949/GridTable
- maybe http://wiki.jqueryui.com/w/page/12137759/Panel (in development) would also do the trick
For Data-Repositories see #Data Repositories
Other UI Elements
Please note that there are also requirements for other UI Elements, not only for the Floating Menu. These are:
- Split Buttons OK http://jqueryui.com/demos/button/#splitbutton
- Draggable Floating Menu OK http://jqueryui.com/demos/draggable/
- Progress Bar OK http://jqueryui.com/demos/progressbar/
Other stuff
Aloha Repository API is based on Ext Store/Ext Tree.
the HTML5 local storage may be an alternative for Ext.Store
- Selectables could help when implementing Aloha blocks http://wiki.jqueryui.com/w/page/12138039/Selectable
- Interesting plugin to consider for validating input elements http://jquery-ui.googlecode.com/svn/branches/labs/mask/demos/mask/default.html
- Toolbar is very much like our ribbon http://wiki.jqueryui.com/w/page/12138094/Toolbar
- Consider http://plugins.jquery.com/project/jqueryStorage for local data storage
- Have a look at Lawnchair. It should Provide local Storage on many Clients
Data Repositories
The Link Plugin also relies heavily on Repositories (like some other Plugins like the Product Plugin). A possible substitute for this is http://wiki.jqueryui.com/w/page/12137773/Data-Library which is still work-in-progress, or Backbone.js
Data repositories are a major issue to consider when migrating from ExtJS to jQueryUI, as there is no such thing available for jQueryUI atm. The jQueryUI Data-Library seems to provide similar functionality, but is far from being ready yet. Implementing an Aloha-Data-Repository does not seem to be too complicated either, so maybe that's a possible way to go.
Also keep in mind that the Repositories have to provide data in a way, that the repository browser (see above) can be implemented.
Abstracting the UI
Implementation approach
A very important point of adding a new UI to Aloha is proper abstraction. The goal is not to bind Aloha to another UI implementation, but to abstract all UI components in a clean way, so that various UI systems may be implemented and used.
There should be an interface so developers know what to implement.
/**
* "Abstract" Button definition
*/
Aloha.ui.Button = function () {
obj: {},
text: string,
icon: string, // css class
size: string, // smal, medium, big
click: function(e) {},
enableToggle: boolean,
pressed: boolean,
toggle: function (b),
parameters: [], // generic parameters passed from the settings
...
};
There should be provided a suitable way to provide a UI implementation which may be used by plugins using the Aloha.ui Components.
/**
* "Abstract" Button definition
*/
jQuery.extend({Aloha.ui.Button, {
init: {
//create button with UI
// set this.obj
},
toggle: function (b) {
// toggle button
},
...
});
A new instance of button in a plugin could look like UI object, like:
/**
* Button implementation
*/
var myButton = new Aloha.ui.Button({
text: 'bold',
icon: 'aloha-button-bold', // css class
size: 'small', // smal, medium, big
enableToggle: true,
});
If you follow the API draft below, the FloatingMenu then would be Implemented with like creating new Tab objects, which contain Button Groups, which contain buttons and other input elements.
API draft
These are the objects and methods that have to be provided
Button
- Constructor (an init function should not be needed, if we've got a constructor)
- onClick
- getObj // some method to retrieve the underlying dom object
- setPressed
- isPressed
- show
- hide
- isVisible
- enable
- disable
- isEnabled
- // handle menus somehow? like get menu?
Button Group
- Constructor
- addItem / removeIItem
- show / hide
Tab
- Constructor
- addItem / removeIItem
- show / hide
MultiSplitButton
- Constructor
- setActiveItem
- isVisible
- showItem
- hideItem
- addItem // maybe you can't just add buttons?
AttributeField
This is one of the UI elements which are linked very close to ExtJS. Maybe this field should derive from a more general input field component or sth?
- Constructor
- setTargetObject
- focus
- addListener
- setAttribute
- setObjectTypeFilter
- setItem
- getItem
- getValue
- setValue
- onChange / onFocus - some event handlers
Browser
- Constructor
- setObjectTypeFilter
- getObjectTypeFilter
- show / hide


