************************************************************************ */\r
\r
/**\r
- * This is the main application class of your custom application "slc"\r
+ * This is the main application class of an Argeo RIA.\r
*/\r
qx.Class.define("org.argeo.ria.Application",\r
{\r
--- /dev/null
+/**\r
+ * Generic package for the Argeo Rich Internet Application based on qooxdoo (www.qooxdoo.org).\r
+ * This is an empty application in itself, since it requires at least a basic implementation to be useful.\r
+ * \r
+ * \r
+ * The skeleton of an ArgeoRIA is the following : \r
+ * \r
+ * + GUI Application containing a menubar, a toolbar, and an empty space for custom Perspective.\r
+ * \r
+ * + Various managers : org.argeo.ria.components.ViewsManager for manipulating IView (VIEW), org.argeo.ria.event.CommandsManager \r
+ * for automatically wiring commands inside the application (CONTROLLER), and org.argeo.ria.remote.RequestManager for accessing the data (MODEL).\r
+ * \r
+ * + A simple configuration will allow to start your own Perspective inside the application.\r
+ *\r
+ */
\ No newline at end of file
/**\r
- * @author Charles du Jeu\r
* \r
+ * Any component implementing this interface will generally be a user-interface indicating \r
+ * a "loading" status (button enabled/disabled, animated loading gif, etc...).\r
+ * The RequestManager can handle such an array of ILoadStatusable at the beginning/end of a Request.\r
+ * \r
+ * @author Charles du Jeu\r
*/\r
qx.Interface.define("org.argeo.ria.components.ILoadStatusable", {\r
\r
members : {\r
- setOnLoad : function(status){\r
- return true;\r
- }\r
+ /**\r
+ * Sets the current status of the component.\r
+ * @param status {boolean} load status\r
+ * @return {Boolean}\r
+ */\r
+ setOnLoad : function(status){return true;}\r
}\r
});
\ No newline at end of file
/**\r
- * @author Charles du Jeu\r
+ * This interface defines the main methods of an application Perpective.\r
+ * See the org.argeo.ria package documentation for more info on how to build an Application\r
+ * with this framework. \r
* \r
+ * @author Charles du Jeu\r
*/\r
qx.Interface.define("org.argeo.ria.components.IPerspective", {\r
\r
members : {\r
+ /**\r
+ * Initialize the available zones that will later contain IView implementations.\r
+ * This method is <b>in charge</b> of your panel to the main application zone \r
+ * (just below the toolbar).\r
+ * \r
+ * @param viewsManager {org.argeo.components.ViewsManager} the pane manager\r
+ * \r
+ */\r
initViewPanes : function(viewsManager){return true;},\r
+ /**\r
+ * Once the zones are available and initialized, initialize the views here\r
+ * and add them to viewPanes. Trigger initial data loading, etc.\r
+ * \r
+ * @param viewsManager {org.argeo.components.ViewsManager} the pane manager\r
+ * \r
+ */\r
initViews : function(viewsManager){return true}\r
}\r
});
\ No newline at end of file
/**\r
- * @author Charles du Jeu\r
+ * Interface for a standard 'view' of an argeo RIA. A view is an independant applet that \r
+ * will be integrated inside a ViewPane. \r
+ * \r
+ * The typical lifecycle of an IView will be the following :\r
+ * <br>+ init(viewPane) : initialize basic GUI in the viewPane\r
+ * <br>+ getCommands() : wire the commands and add them to the toolbars/menubars\r
+ * <br>+ load(data) : loads the data itself.\r
* \r
+ * @author Charles du Jeu\r
*/\r
qx.Interface.define("org.argeo.ria.components.IView", {\r
\r
},\r
\r
members : {\r
- init : function(viewPane){\r
- return true;\r
- },\r
- load : function(data){\r
- return true;\r
- },\r
- addScroll : function(){\r
- return true;\r
- }\r
+ /**\r
+ * The implementation should contain the GUI initialisation.\r
+ * @param viewPane {org.argeo.ria.components.ViewPane} The pane manager\r
+ * @return {Boolean}\r
+ */\r
+ init : function(viewPane){return true;},\r
+ /**\r
+ * The implementation should contain the real data loading (i.o. query...)\r
+ * @param data {mixed} Any data in any format\r
+ * @return {Boolean}\r
+ */\r
+ load : function(data){return true;},\r
+ /**\r
+ * Whether this component is already contained in a scroller \r
+ * (return false) or not (return true).\r
+ * @return {Boolean}\r
+ */\r
+ addScroll : function(){return true;}\r
}\r
});
\ No newline at end of file
-/* ************************************************************************\r
-\r
- Copyright: 2008 Argeo\r
-\r
- License: \r
-\r
- Authors: Charles du Jeu\r
-\r
-************************************************************************ */\r
+/**\r
+ * A modal window like console for the logs. \r
+ * Also opens a small alert window (qooxdoo, not native) on errors.\r
+ * \r
+ * @author : Charles du Jeu\r
+ */\r
qx.Class.define("org.argeo.ria.components.Logger",\r
{\r
type : "singleton",\r
},\r
\r
members : {\r
+ /**\r
+ * Adds a log in the GUI component.\r
+ * @param entry {Map} A log entry\r
+ */\r
process : function(entry){\r
var wrapper = qx.log.appender.Util.toHtml(entry);\r
var label = new qx.ui.basic.Label('<div class="messages"><div class="'+wrapper.className+'">'+wrapper.innerHTML+'</div></div>');\r
}\r
this._logPane.addAt(label, 0);\r
},\r
+ /**\r
+ * Shows the GUI console and center it.\r
+ */\r
toggle : function(){\r
this.show();\r
this.center();\r
-/* ************************************************************************\r
-\r
- Copyright: 2008 Argeo\r
-\r
- License: \r
-\r
- Authors: Charles du Jeu\r
-\r
-************************************************************************ */\r
+/**\r
+ * Generic modal popup window.\r
+ * It is layed out with a dock layout. When adding components to it, they are added as "center".\r
+ * @author Charles du Jeu\r
+ */\r
qx.Class.define("org.argeo.ria.components.Modal",\r
{\r
extend : qx.ui.window.Window,\r
\r
+ /**\r
+ * \r
+ * @param caption {String} Title of the window\r
+ * @param icon {String} Icon of the window\r
+ * @param text {String} Default content of the window.\r
+ */\r
construct : function(caption, icon, text){\r
this.base(arguments);\r
this.set({\r
},\r
\r
members : {\r
+ /**\r
+ * Display text inside the popup\r
+ * @param text {String} A string content for the popup\r
+ */\r
addLabel:function(text){\r
this.add(new qx.ui.basic.Label(text), {edge:'center', width:'100%'}); \r
},\r
+ /**\r
+ * Display a component (panel) in the center of the popup\r
+ * @param panel {qx.ui.core.Widget} A gui component (will be set at width 100%).\r
+ */\r
addContent: function(panel){\r
this.add(panel, {edge:'center', width:'100%'});\r
},\r
+ /**\r
+ * Automatically attach to the application root, then show.\r
+ */\r
attachAndShow:function(){\r
org.argeo.ria.components.ViewsManager.getInstance().getApplicationRoot().add(this); \r
this.show();\r
/**
+ * A standard view container, referenced in the application by its unique id.
+ * It is managed by the ViewsManager singleton that works as the "View" part of an MVC model.
+ * @see org.argeo.ria.components.ViewsManager
* @author Charles
*/
-/**
- * This is the main application class of your custom application "sparta"
- */
qx.Class.define("org.argeo.ria.components.ViewPane",
{
extend : qx.ui.container.Composite,
implement : [org.argeo.ria.components.ILoadStatusable],
- construct : function(application, viewId, viewTitle, splitPaneData){
+ /**
+ * @param viewId {String} Unique id of this viewPane
+ * @param viewTitle {String} Readable Title of this viewPane
+ * @param splitPaneData {Map} Additionnal data to be used by splitpanes implementations.
+ */
+ construct : function(viewId, viewTitle, splitPaneData){
this.base(arguments);
- this.setApplication(application);
this.setViewId(viewId);
this._defaultViewTitle = viewTitle;
this.setViewTitle(viewTitle);
properties :
{
- application : {init : null},
+ /**
+ * Unique id of the pane
+ */
viewId : {init:""},
+ /**
+ * Human-readable title for this view
+ */
viewTitle : {init:"", event:"changeViewTitle"},
- viewSelection : { nullable:false },
- ownScrollable : {init: false},
- splitPaneData : {init : null},
- commands : {init : null, nullable:true}
+ /**
+ * Selection model for this view
+ */
+ viewSelection : { nullable:false, check:"org.argeo.ria.components.ViewSelection" },
+ /**
+ * Has its own scrollable content
+ */
+ ownScrollable : {init: false, check:"Boolean"},
+ /**
+ * Data concerning the split pane
+ */
+ splitPaneData : {init : null, check:"Map"},
+ /**
+ * Map of commands definition
+ * @see org.argeo.ria.event.Command
+ */
+ commands : {init : null, nullable:true, check:"Map"}
},
/*
members :
{
+ /**
+ * Creates a standard GUI for the viewPane, including a container for an IView.
+ */
createGui : function(){
this.setLayout(new qx.ui.layout.VBox());
this.header = new qx.ui.container.Composite();
*/
},
+ /**
+ * Sets the content of this pane.
+ * @param content {org.argeo.ria.components.IView} An IView implementation
+ */
setContent : function(content){
var addScrollable = (content.addScroll?content.addScroll():false);
if(addScrollable){
}
},
+ /**
+ * Implementation of the ILoadStatusable interface.
+ * @see org.argeo.ria.components.ILoadStatusable
+ * @param load {Boolean} The loading status
+ */
setOnLoad : function(load){
if(!this.loadImage){
this.loadImage = new qx.ui.basic.Image('resource/slc/ajax-loader.gif');
}
},
+ /**
+ * Removes and destroy the IView content of this viewPane.
+ */
empty: function(){
if(this.getOwnScrollable() && this.scrollable){
this.remove(this.scrollable);
+/**\r
+ * Generic selection model associated to an IView content opened in a given ViewPane.\r
+ * It contains in an array any row/data/node, and triggers changeSelection data events.\r
+ * @author Charles du Jeu\r
+ */\r
qx.Class.define("org.argeo.ria.components.ViewSelection",\r
{\r
extend : qx.core.Object,\r
\r
+ /**\r
+ * @param viewId {String} The ViewPane unique id\r
+ */\r
construct : function(viewId){\r
this.base(arguments);\r
this.nodes = [];\r
},\r
\r
properties : {\r
+ /**\r
+ * The viewPane unique id \r
+ */\r
viewId : {\r
check : "String",\r
nullable: false\r
},\r
\r
events : {\r
+ /**\r
+ * Triggered each time the selection changes.\r
+ */\r
"changeSelection" : "qx.event.type.Data"\r
},\r
\r
\r
members :\r
{\r
+ /**\r
+ * Empty the selection\r
+ */\r
clear : function(){\r
this.nodes = [];\r
this.triggerEvent();\r
},\r
\r
+ /**\r
+ * Add a row or xml node or whatever\r
+ * @param node {mixed} Data to add to the selection\r
+ */\r
addNode : function(node) {\r
this.nodes.push(node);\r
this.triggerEvent();\r
},\r
\r
+ /**\r
+ * The number of rows/nodes selected\r
+ * @return {Integer}\r
+ */\r
getCount : function() {\r
return this.nodes.length;\r
},\r
\r
+ /**\r
+ * Returns the content of the selection \r
+ * @return {Array}\r
+ */\r
getNodes : function(){\r
return this.nodes;\r
},\r
\r
+ /**\r
+ * Creates and fire a data event changeSelection\r
+ */\r
triggerEvent : function(){\r
this.fireDataEvent("changeSelection", this);\r
}\r
/**\r
+ * The main "view" manager (in a standard MVC conception) of the application.\r
+ * It register various containers org.argeo.ria.components.viewPane and feed them with org.argeo.ria.components.IView implementations.\r
+ * It is a singleton and can thus be called by any part of the application.\r
+ * \r
* @author Charles du Jeu\r
*/\r
qx.Class.define("org.argeo.ria.components.ViewsManager",\r
extend : qx.core.Object,\r
\r
properties : {\r
+ /**\r
+ * The application root (like Application.getRoot()), used to attach and show modal windows.\r
+ */\r
applicationRoot : {init : null},\r
+ /**\r
+ * The main container for the org.argeo.ria.components.ViewPane instances. \r
+ */\r
viewPanesContainer : {init: null}\r
},\r
construct : function(){\r
this.views = {};\r
},\r
members : {\r
- \r
+ /**\r
+ * Initialize and load a given IView implementation into a viewPane.\r
+ * The IView itself is returned.\r
+ * \r
+ * @param classObj {Clazz} The class object to instantiate\r
+ * @param viewPaneId {String} The unique ID of the view pane\r
+ * @return {org.argeo.ria.components.IView}\r
+ */\r
initIViewClass: function(classObj, viewPaneId){\r
//var iView = eval("new "+iViewClass+"()");\r
//var classObj = qx.Class.getByName(iViewClass);\r
return iView;\r
},\r
\r
+ /**\r
+ * Registers a new viewPane\r
+ * @param viewPane {org.argeo.ria.components.ViewPane} The new ViewPane instance\r
+ */\r
registerViewPane : function(viewPane){\r
this.views[viewPane.getViewId()] = viewPane;\r
viewPane.getViewSelection().addListener("changeSelection", function(e){\r
org.argeo.ria.event.CommandsManager.getInstance().refreshCommands(e.getData());\r
}); \r
},\r
+ /**\r
+ * Returns a viewPane by its unique id.\r
+ * @param viewPaneId {String} The unique id\r
+ * @return {org.argeo.ria.components.ViewPane}\r
+ */\r
getViewPaneById : function(viewPaneId){\r
if(this.views[viewPaneId]) return this.views[viewPaneId];\r
throw new Error("Cannot find view '"+viewPaneId+"'"); \r
},\r
+ /**\r
+ * Returns a viewPane current viewSelection object\r
+ * @param viewPaneId {String} The unique id. \r
+ * @return {org.argeo.ria.components.ViewSelection}\r
+ */\r
getViewPaneSelection : function(viewPaneId){\r
return this.getViewPaneById(viewPaneId).getViewSelection();\r
},\r
+ /**\r
+ * Changes a viewPane title dynamically.\r
+ * @param viewPaneId {String} ViewPane unique Id. \r
+ * @param viewTitle {String} the new title for this viewPane.\r
+ */\r
setViewPaneTitle : function(viewPaneId, viewTitle){\r
this.getViewPaneById(viewPaneId).setViewTitle(viewTitle);\r
}\r
+/**\r
+ * Basic helper for SLC XML results to be displayed in a qx.ui.table.\r
+ * Overrides the html of the standard qx.ui.table.cellrenderer.String\r
+ * \r
+ * TODO : put in org.argeo.slc.ria package\r
+ * \r
+ */\r
qx.Class.define("org.argeo.ria.components.XmlRenderer",\r
{\r
extend : qx.ui.table.cellrenderer.String,\r
\r
members :\r
{\r
- // overridden\r
- // TODO : Put this in org.argeo.slc.ria\r
+ /**\r
+ * Overrides the parent method.\r
+ * @param cellInfo {Map} The current cell data \r
+ * @return {String}\r
+ */\r
_getContentHtml : function(cellInfo) {\r
var xmlNode = cellInfo.rowData;\r
if(!xmlNode) return "";\r
},\r
\r
// overridden\r
+ /**\r
+ * Overrides parent method\r
+ * @param cellInfo {Map} Current cell data\r
+ * @return {String}\r
+ */\r
_getCellClass : function(cellInfo) {\r
return this.base(arguments, cellInfo);\r
}\r
--- /dev/null
+/**\r
+ * Package containing GUI components and main interfaces for GUI components to \r
+ * be used by any argeo RIA application.\r
+ *\r
+ */
\ No newline at end of file
-qx.Class.define("org.argeo.ria.event.Command",\r
+/**\r
+ * The standard command for all actions. It registers keyboard shortcuts, centralizes \r
+ * command state, callback, etc. It is defined by command definitions that can be found \r
+ * in the CommandsManager. \r
+ */\r
+ qx.Class.define("org.argeo.ria.event.Command",\r
{\r
extend : qx.event.Command,\r
implement : [org.argeo.ria.components.ILoadStatusable],\r
\r
properties : {\r
+ /**\r
+ * Unique id of the command \r
+ */\r
id : {init:""},\r
+ /**\r
+ * Label of the command \r
+ */\r
label : {init:""},\r
+ /**\r
+ * Icon of the command \r
+ */\r
icon : {init:""},\r
+ /**\r
+ * Sub menu if needed \r
+ */\r
menu : {\r
nullable: true,\r
event : "changeMenu"\r
},\r
+ /**\r
+ * Callback associated to the submenu of the command \r
+ */\r
menuCallback : {nullable:true},\r
+ /**\r
+ * Context used when triggering menuCallback \r
+ */\r
menuContext : {nullable:true}\r
},\r
\r
+ /**\r
+ * @param id {String} Id of the command\r
+ * @param label {String} Label of the command\r
+ * @param icon {String} Icon of the command\r
+ * @param shortcut {String} Keyboard Shortcut (like alt+o, ctrl+z, etc..)\r
+ */\r
construct : function(id, label, icon, shortcut){\r
this.base(arguments, shortcut);\r
this.setId(id);\r
\r
members :\r
{\r
+ /**\r
+ * Create a Button that suits a qx.ui.menu.MenuBar linked to this command\r
+ * @return {qx.ui.menu.Button}\r
+ */\r
getMenuButton : function(){\r
var button = new qx.ui.menu.Button(\r
this.getLabel(), \r
return button;\r
},\r
\r
+ /**\r
+ * Create a Button that suits a qx.ui.toolbar.Toolbar part linked to this command.\r
+ * @return {qx.ui.toolbar.MenuButton}\r
+ */\r
getToolbarButton : function(){\r
var button;\r
if(this.getMenu()){\r
return button;\r
},\r
\r
+ /**\r
+ * Clones the command menu\r
+ * @return {qx.ui.menu.Menu}\r
+ */\r
getMenuClone : function(){\r
if(!this.menuClone){\r
this.menuClone = new qx.ui.menu.Menu();\r
return this.menuClone;\r
},\r
\r
+ /**\r
+ * Remove all existing menus and their clones.\r
+ */\r
clearMenus : function(){\r
this.getMenu().removeAll();\r
this.getMenuClone().removeAll();\r
},\r
\r
+ /**\r
+ * Add button to a given submenu.\r
+ * @param label {String} The label of the button\r
+ * @param icon {String} The icon of the button\r
+ * @param commandId {String} The associated command id.\r
+ * @param menu {qx.ui.menu.Menu} The menu to which add the button\r
+ */\r
addSubMenuButton : function(label, icon, commandId, menu){\r
var button = new qx.ui.menu.Button(label, icon);\r
button.setUserData("commandId", commandId);\r
}\r
},\r
\r
+ /**\r
+ * Triggers the menuCallback property in the right context.\r
+ * @param event {qx.event.type.Event} The firing event.\r
+ */\r
executeSubMenuCallback : function(event){\r
var button = event.getTarget();\r
var callback = this.getMenuCallback();\r
callback = qx.lang.Function.bind(callback, this.getMenuContext() || this);\r
callback(button.getUserData("commandId")); \r
}, \r
- \r
+ /**\r
+ * Adds a tooltip to a button.\r
+ * @param element {qx.ui.core.Widget} The element to which the command tooltip is added. \r
+ */\r
addTooltip : function(element){\r
if(this.getShortcut() != null){\r
element.setToolTip(new qx.ui.tooltip.ToolTip(this.getShortcut()));\r
} \r
},\r
\r
+ /**\r
+ * Implementation of the ILoadStatusable interface.\r
+ * Sets the whole command enabled if not loading and disabled if loading.\r
+ * @param status {Boolean} The loading status of the button. \r
+ */\r
setOnLoad : function(status){\r
this.setEnabled(!status);\r
}\r
/**\r
- * @author Charles\r
+ * The main controller (in a standard MVC point of view) of the application. It is a singleton\r
+ * thus can be called by any part of the application.\r
+ * This will wire all the commands that can be defined dynamically by any IView, and add their\r
+ * corresponding buttons to the application menubar and toolbars.\r
* \r
+ * @author Charles du Jeu\r
*/\r
qx.Class.define("org.argeo.ria.event.CommandsManager",\r
{\r
\r
properties : \r
{\r
+ /**\r
+ * Commands definitions\r
+ * @see org.argeo.ria.event.Command for the definition Map details. \r
+ */\r
definitions : {\r
init : {\r
"stop" : {\r
}\r
}\r
},\r
+ /**\r
+ * For internal use \r
+ */\r
initialDefinitions : {\r
init : {}\r
}\r
},\r
\r
events : {\r
+ /**\r
+ * Triggered when the whole commands list is changed.\r
+ */\r
"changedCommands" : "qx.event.type.Event"\r
},\r
\r
\r
members :\r
{\r
+ /**\r
+ * Creates all the objects (if they are not already existing) from the definitions maps.\r
+ */\r
createCommands : function(){\r
this.menus = {};\r
this.toolbars = {};\r
}\r
this.setDefinitions(defs);\r
},\r
- \r
+ \r
+ /**\r
+ * Refresh the current commands status depending on the viewSelection.\r
+ * @param viewSelection {org.argeo.ria.components.ViewSelection} The current ViewSelection\r
+ */\r
refreshCommands : function(viewSelection){\r
var defs = this.getDefinitions();\r
var xmlNodes = null;\r
}\r
},\r
\r
+ /**\r
+ * Record a menubar for the application\r
+ * @param menuBar {qx.ui.menubar.MenuBar} The application menubar\r
+ */\r
registerMenuBar : function(menuBar){\r
this.addListener("changedCommands", function(){\r
this.createMenuButtons(menuBar);\r
this.createMenuButtons(menuBar);\r
},\r
\r
+ /**\r
+ * Record a toolbar for the application\r
+ * @param toolBar {qx.ui.toolbar.ToolBar} The application toolbar\r
+ */\r
registerToolBar : function(toolBar){\r
this.addListener("changedCommands", function(){\r
this.createToolbarParts(toolBar);\r
this.createToolbarParts(toolBar);\r
}, \r
\r
+ /**\r
+ * Creates the real buttons and add them to the passed menuBar. \r
+ * @param menuBar {qx.ui.menubar.MenuBar} The application menubar\r
+ */\r
createMenuButtons : function(menuBar){\r
menuBar.removeAll();\r
var anchors = {};\r
menuBar.add(anchors.last);\r
}\r
},\r
+ \r
+ /**\r
+ * Creates the real buttons and add them to the passed toolbar. \r
+ * @param toolbar {qx.ui.toolbar.ToolBar} The application toolbar\r
+ */\r
createToolbarParts : function(toolbar){\r
toolbar.removeAll();\r
for(var key in this.toolbars){\r
});\r
}\r
},\r
+ /**\r
+ * Creates a context menu from an array of commands ids.\r
+ * @param commandIdsArray {Array} An array of string\r
+ * @return {qx.ui.menu.Menu}\r
+ */\r
createMenuFromIds : function(commandIdsArray){\r
var defs = this.getDefinitions();\r
var contextMenu = new qx.ui.menu.Menu();\r
}\r
return contextMenu;\r
},\r
- \r
+ /**\r
+ * Add a new set of commands definitions\r
+ * @param definitions {Map} a set of commands definitions.\r
+ * @param callbackContext {qx.ui.core.Object} The context used inside the commands callbacks.\r
+ */\r
addCommands : function(definitions, callbackContext){\r
var crtDefs = this.getDefinitions(); \r
for(var key in definitions){\r
this.setDefinitions(crtDefs);\r
this.fireEvent("changedCommands");\r
},\r
+ /**\r
+ * Removes a whole set of commands by their definitions maps.\r
+ * @param definitions {Map} a set of commands definitions\r
+ */\r
removeCommands : function(definitions){\r
var crtDefs = this.getDefinitions();\r
var initDefs = this.getInitialDefinitions();\r
this.setDefinitions(crtDefs);\r
this.fireEvent("changedCommands");\r
},\r
- \r
+ /**\r
+ * Executes a command by its id.\r
+ * @param commandId {String} The command id.\r
+ */\r
executeCommand : function(commandId){\r
var defs = this.getDefinitions();\r
if(defs[commandId] && defs[commandId].command.getEnabled()){\r
defs[commandId].command.execute();\r
}\r
},\r
+ /**\r
+ * Retrieves a command by its id.\r
+ * @param commandId {String} The command id.\r
+ */\r
getCommandById : function(commandId){\r
var defs = this.getDefinitions();\r
if(defs[commandId] && defs[commandId].command){\r
return defs[commandId].command;\r
} \r
},\r
+ /**\r
+ * Add a standard context menu to a toolbar for button look and feel (show icon, text, both).\r
+ * @param toolbar {qx.ui.toolbar.ToolBar} The toolbar\r
+ */\r
addToolbarContextMenu : function(toolbar){\r
var menu = new qx.ui.menu.Menu();\r
var icon = new qx.ui.menu.RadioButton("Show Icons");\r
-/* ************************************************************************\r
-\r
- Copyright: 2008 Argeo\r
-\r
- License: \r
-\r
- Authors: Charles du Jeu\r
-\r
-************************************************************************ */\r
+/**\r
+ * This can be triggered at the end of a IO Request. In that case, it contains\r
+ * a data type as an identifier, and the request response itself.\r
+ * Can be used this way to listen for data changes from various parts of the application.\r
+ */\r
qx.Class.define("org.argeo.ria.event.ReloadEvent",\r
{\r
extend : qx.event.type.Event,\r
this.base(arguments);\r
},\r
members : {\r
+ /**\r
+ * Basic initialisation of event\r
+ * @param dataType {String} a unique data identifier\r
+ * @param content {mixed} the retrieved data\r
+ */\r
init: function(dataType, content){\r
this.setDataType(dataType);\r
this.setContent(content); \r
}\r
},\r
properties :{\r
- dataType : {init:null},\r
+ /**\r
+ * A unique data identifier \r
+ */\r
+ dataType : {init:null, check:"String"},\r
+ /**\r
+ * The new data content \r
+ */\r
content : {init:null}\r
}\r
});
\ No newline at end of file
--- /dev/null
+/**\r
+ * Event utilities, this package is the "controller" part of the application (in an classic MVC view).\r
+ * The commandsManager singleton is in charge of wiring all the commands inside the application.\r
+ *\r
+ */
\ No newline at end of file
+/**\r
+ * A management class for all request sent to the server\r
+ * Basically, to access the server, always get a new Request object from this class.\r
+ * It will then trigger various user-interface events during the Request lifecycle. \r
+ * \r
+ * For the moment, it's about the "Stop" button command, handling any passed ILoadStatusable states, \r
+ * and logging the Request status/errors.\r
+ * \r
+ * @author Charles du Jeu\r
+ */\r
qx.Class.define("org.argeo.ria.remote.RequestManager",\r
{\r
type : "singleton",\r
extend : qx.core.Object,\r
\r
events : {\r
+ /**\r
+ * Triggered on the user demand at the end of the Request \r
+ */\r
"reload" : "org.argeo.ria.event.ReloadEvent"\r
},\r
\r
},\r
\r
members : {\r
- \r
+ /**\r
+ * Sets the unique "stop" command of the application.\r
+ * @param stopCommand {org.argeo.ria.event.Command} The command\r
+ */\r
setStopCommand : function(stopCommand){\r
this.command = stopCommand;\r
},\r
\r
+ /**\r
+ * Creates a Request and handle various parts of its lifecycle.\r
+ * @see org.argeo.ria.event.ReloadEvent\r
+ * @see org.argeo.ria.components.ILoadStatusable\r
+ * \r
+ * @param url {String} The server url\r
+ * @param method {String} Connexion method (POST, GET, etc.)\r
+ * @param responseType {String} Expected response mime type (application/xml, etc...).\r
+ * @param fireReloadEventType {String} On user-demand, if this parameter is not null, a org.argeo.ria.event.ReloadEvent will be triggered when the request is completed. \r
+ * @param iLoadStatusables {Array} An array of ILoadStatusable implementations that need to be updated by the Request state (loading/ended).\r
+ * @return {qx.io.remote.Request}\r
+ */\r
getRequest : function(url, method, responseType, fireReloadEventType, iLoadStatusables){\r
var request = new qx.io.remote.Request(url, method, responseType);\r
if(iLoadStatusables){\r
return request;\r
}, \r
\r
+ /**\r
+ * Creates a ReloadEvent and fire it.\r
+ * @param dataType {String} The data type \r
+ * @param content {mixed} The content of the request response.\r
+ */\r
fireReloadEvent : function(dataType, content){\r
this.fireEvent("reload", org.argeo.ria.event.ReloadEvent, [dataType, content]); \r
},\r
\r
+ /**\r
+ * Triggered when request is created\r
+ * @param e {qx.event.type.Event} The event\r
+ */\r
requestCreated : function(e){\r
var request = e.getTarget();\r
this.enableCommand(request);\r
},\r
\r
+ /**\r
+ * Triggered when request is completed normally\r
+ * @param e {qx.event.type.Event} The event\r
+ */\r
requestCompleted : function(e){\r
var request = e.getTarget();\r
this.disableCommand(request);\r
},\r
\r
+ /**\r
+ * Triggered when request is completed abnormally\r
+ * @param e {qx.event.type.Event} The event\r
+ */\r
requestTerminated : function(e){\r
var request = e.getTarget();\r
var errorType = e.getType();\r
this.error(message);\r
},\r
\r
+ /**\r
+ * Triggered by a request creation. Update the GUI parts according to its status. \r
+ * @param request {qx.io.remote.Request} The current Request \r
+ */\r
disableCommand : function(request){\r
this.command.setEnabled(false);\r
if(request.getUserData("iLoadStatusables")){\r
}\r
},\r
\r
+ /**\r
+ * Triggered by a request ending. Update the GUI parts according to its status. \r
+ * @param request {qx.io.remote.Request} The current Request \r
+ */\r
enableCommand : function(request){\r
this.command.setEnabled(true);\r
if(request.getUserData("iLoadStatusables")){\r
this.command.addListener("execute", listener, request);\r
},\r
\r
+ /**\r
+ * Update the ILoadStatusable implementations\r
+ * @param iLoadStatusables {Array} An array of ILoadStatusable \r
+ * @param loadStatus {Boolean} The current status of a request \r
+ */\r
updateGuiParts : function(iLoadStatusables, loadStatus){\r
for(var i=0;i<iLoadStatusables.length;i++){\r
if(qx.Class.implementsInterface(qx.Class.getByName(iLoadStatusables[i].classname), org.argeo.ria.components.ILoadStatusable)){\r
--- /dev/null
+/**\r
+ * Communication with server package. \r
+ *\r
+ */
\ No newline at end of file
--- /dev/null
+/**\r
+ * Unit tests to be executed by the TestRunner application.\r
+ *\r
+ */
\ No newline at end of file
-/* ************************************************************************\r
-\r
- Overrides the Qooxdoo qx.xml.Element to handle the namespace prefixes!!\r
-\r
-************************************************************************ */\r
-\r
/**\r
* Cross browser XML Element API\r
+ * \r
+ * Overrides the Qooxdoo qx.xml.Element to handle the namespace prefixes\r
*\r
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/81f3de54-3b79-46dc-8e01-73ca2d94cdb5.asp\r
* http://developer.mozilla.org/en/docs/Parsing_and_serializing_XML\r
* @param query {String} XPath query\r
* @param NSMap (Object) A map matching namespace prefixes to namespace URIS;\r
* @return {Element} first matching element\r
- * @signature function(element, query)\r
+ * @signature function(element, query, NSMap)\r
*/\r
selectSingleNode : qx.core.Variant.select("qx.client",\r
{\r
* @param query {String} XPath query\r
* @param NSMap {Map} Mapping between namespaces prefixes and URI.\r
* @return {Element[]} List of matching elements\r
- * @signature function(element, query)\r
+ * @signature function(element, query, NSMap)\r
*/\r
selectNodes : qx.core.Variant.select("qx.client",\r
{\r
--- /dev/null
+/**\r
+ * Various utilitary classes, especially qooxdoo framework extensions \r
+ * to fix various bugs or missing features.\r
+ *\r
+ */
\ No newline at end of file
initViewPanes : function(viewsManager){\r
\r
var splitPane = new qx.ui.splitpane.Pane("horizontal");\r
- var topLeft = new org.argeo.ria.components.ViewPane(this, "list", "Collection", {\r
+ var topLeft = new org.argeo.ria.components.ViewPane("list", "Collection", {\r
orientation : "horizontal",\r
min : 36\r
});\r
viewsManager.registerViewPane(topLeft);\r
\r
splitPane.add(topLeft, 0);\r
- var rightPane = new org.argeo.ria.components.ViewPane(this, "applet", "Test Detail"); \r
+ var rightPane = new org.argeo.ria.components.ViewPane("applet", "Test Detail"); \r
viewsManager.registerViewPane(rightPane);\r
splitPane.add(rightPane, 1);\r
\r