/**\r
- * @author Charles\r
+ * IPerspective Implementation : Horizontal split pane defining two panes, "list" and "applet".\r
*/\r
qx.Class.define("org.argeo.slc.web.Perspective",\r
{\r
initViews : function(viewsManager){\r
var view = viewsManager.initIViewClass(org.argeo.slc.web.TestList, "list");\r
view.load();\r
- //var command = org.argeo.ria.event.CommandsManager.getInstance().executeCommand("loadtestlist");\r
- view.loadCollections(); // We know it is a TestList!\r
+ view.loadCollections();\r
view.loadList();\r
}\r
\r
/**\r
- * @author Charles\r
+ * Basic IView implementation for displaying the test results list, by collection.\r
+ * \r
+ * This component creates a Table object and feed it with the results. It adds a collection chooser to its viewPane header.\r
+ * \r
+ * It creates the following commands : "loadtestlist", "polllistloading", "opentest", "download", "copytocollection", "deletetest".\r
*/\r
qx.Class.define("org.argeo.slc.web.TestList",\r
{\r
\r
properties : \r
{\r
+ /**\r
+ * The viewPane containing this applet.\r
+ */\r
view : {\r
init : null\r
},\r
+ /**\r
+ * The load list of available collection (Map of ids => labels)\r
+ */\r
collectionList : {\r
init : {},\r
check : "Map"\r
},\r
+ /**\r
+ * The current collection id selected.\r
+ */\r
collectionId:{\r
init : 'My Collection',\r
check : "String"\r
},\r
+ /**\r
+ * The applet commands.\r
+ */\r
commands : {\r
init : {\r
"loadtestlist" : {\r
\r
},\r
\r
+ /**\r
+ * Use SlcApi to load the available collections.\r
+ */\r
loadCollections : function(){\r
var request = org.argeo.slc.ria.SlcApi.getListCollectionsService();\r
var NSMap = {slc:"http://argeo.org/projects/slc/schemas"};\r
request.send();\r
},\r
\r
+ /**\r
+ * Load the results of the currently selected collection.\r
+ */\r
loadList : function(){\r
var model = this.table.getTableModel();\r
model.removeRows(0, model.getRowCount());\r
request.send(); \r
},\r
\r
+ /**\r
+ * Enable/disable the automatic reloading of the list.\r
+ * @param state {Boolean} Whether the automatic reloading must be started or stopped.\r
+ */\r
pollListLoading : function(state){\r
if(!this.timer){\r
this.timer = new qx.event.Timer(5000);\r
}\r
},\r
\r
+ /**\r
+ * Creates a menu gui component from the currently loaded collectionList.\r
+ * @param command {qx.event.Command} The command on which to attach the created menu. \r
+ * @param checkSelection {Boolean} Whether at the end, we must check the current viewSelection to enable/disable the command accordingly. \r
+ */\r
collectionListToMenu : function(command, checkSelection){\r
command.setEnabled(false);\r
command.clearMenus();\r
command.setEnabled(true);\r
}\r
},\r
- \r
+ /**\r
+ * Use SlcApi "addResult" service to add selected results to a given collection.\r
+ * If collectionId is "slc.client.create", first triggers a modal dialog to enter a new collection name, then retrigger itself with the new id.\r
+ * @param collectionId {String} The id of the destination collection, or "slc.client.create".\r
+ * @param selectionType {String} "current_collection"|"current_selection". The first adds the whole collection content to the destination, the second only selected results.\r
+ */\r
copySelectionToCollection:function(collectionId, selectionType){\r
if(collectionId == "slc.client.create"){\r
var modal = new org.argeo.ria.components.Modal("Create collection", "resource/slc/folder-new.png");\r
}\r
},\r
\r
+ /**\r
+ * Utilitary function to extract test unique id from the currently selected node.\r
+ * @return {String} The test unique id.\r
+ */\r
extractTestUuid: function(){\r
var NSMap = {slc:"http://argeo.org/projects/slc/schemas"};\r
var xmlNodes = this.getView().getViewSelection().getNodes();\r
return uuid;\r
},\r
\r
- collectionSelectorListener : function(event){\r
+ /**\r
+ * Listener of the collection selector (select box added to the viewpane header). \r
+ * @param event {qx.event.type.Event} The event.\r
+ */\r
+ collectionSelectorListener : function(event){\r
this.setCollectionId(event.getData());\r
this.loadList(); \r
},\r
/**
- * @author Charles
+ * The canonical SLC applet for test result viewing. It will display a TreeTestResult in a TreeVirtual component
+ * composed of four columns : test name, state (passed/failed/error), message and date.
+ *
+ * It makes use of the StatusCellRenderer class for the "state" cell being a background-colored cell, the color depending on the FAILED or PASSED state message.
+ * The only associated command is the "Close" command.
*/
qx.Class.define("org.argeo.slc.ria.Applet",
{
properties :
{
+ /**
+ * The viewPane inside which this applet is added.
+ */
view : {
init : null
},
+ /**
+ * Commands definition, see {@link org.argeo.ria.event.CommandsManager#definitions}
+ */
commands : {
init : {
"close" : {
}
},
- /*
- *****************************************************************************
- MEMBERS
- *****************************************************************************
- */
-
members :
{
+ /**
+ * Called at applet creation. Just registers viewPane.
+ * @param viewPane {org.argeo.ria.components.ViewPane} The viewPane.
+ */
init : function(viewPane){
this.setView(viewPane);
},
+ /**
+ * Load a given test : the data passed must be an XML node containing the test unique ID.
+ * @param xmlNode {Element} The text xml description.
+ */
load : function(xmlNode){
this.data = xmlNode;
if(!xmlNode) return;
addScroll : function(){
return false;
},
-
+
+ /**
+ * Creates the GUI.
+ * @param responseXml {Document} The xml response of the "load" query.
+ */
createXmlGui : function(responseXml){
var NSMap = {
"slc" : "http://argeo.org/projects/slc/schemas"
},
+ /**
+ * Goes up the parents recursively to set a whole tree branch in "failed" mode.
+ * @param id {Integer} The id of the child node.
+ */
_setParentBranchAsFailed : function(id){
var model = this.tree.getDataModel();
while(id != null && id!=0){
}
},
+ /**
+ * Recursively make sur the last children are of qx.ui.treevirtual.SimpleTreeDataModel.Type.LEAF type.
+ *
+ * @param tree {qx.ui.treevirtual.TreeVirtual} The main tree of the applet.
+ * @param nodeId {Integer} Current node id.
+ */
_refineLeaves : function(tree, nodeId){
var node = tree.nodeGet(nodeId);
if(node.children && node.children.length){
}
},
+ /**
+ * Alternatively to the createXmlGui, create a simple HtmlElement and append the query responseText.
+ * Not used but sample.
+ * @param responseText {String} Html code to display.
+ */
createHtmlGui : function(responseText){
var htmlElement = new qx.ui.embed.Html(responseText);
htmlElement.setOverflowX("auto");
+/**\r
+ * SLC API Client implementation :\r
+ * This class encapsulate the various SLC services available. It just creates the Request object\r
+ * and return them, it does not execute them. \r
+ * Available services are : \r
+ * + loadResult / removeResult / addResult\r
+ * + listCollection / listResults\r
+ * When using it, be sure the static constant DEFAULT_CONTEXT is pointing to the right URL.\r
+ */\r
qx.Class.define("org.argeo.slc.ria.SlcApi",\r
{\r
extend : qx.core.Object,\r
/**\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
+ * If this view is to implement a selection (a list, a tree, etc) that will trigger changes on commands, \r
+ * it must trigger a viewSelection#changeSelection event.\r
* \r
* The typical lifecycle of an IView will be the following :\r
* <br>+ init(viewPane) : initialize basic GUI in the viewPane\r
qx.Interface.define("org.argeo.ria.components.IView", {\r
\r
properties : {\r
+ /**\r
+ * The commands definition Map that will be automatically added and wired to the menubar and toolbar.\r
+ * See {@link org.argeo.ria.event.CommandsManager#definitions} for the keys to use for defining commands.\r
+ */\r
commands : {}\r
},\r
\r
members : {\r
/**\r
* The implementation should contain the GUI initialisation.\r
+ * This is the role of the manager to actually add the graphical component to the pane, \r
+ * so it's not necessary to do it here. \r
* @param viewPane {org.argeo.ria.components.ViewPane} The pane manager\r
* @return {Boolean}\r
*/\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
+ * Whether this component is already contained in a scroller (return false) or not (return true).\r
* @return {Boolean}\r
*/\r
addScroll : function(){return true;}\r
this.center();\r
},\r
\r
+ /**\r
+ * Show a given info log in a small popup right-top aligned. \r
+ * The popup will disappear after 5 seconds.\r
+ * @param content {qx.ui.basic.Label} The content of the popup to display \r
+ */\r
showLogAsPopup:function(content){\r
if(!this.popup){\r
this.popup = new qx.ui.popup.Popup(new qx.ui.layout.Canvas()).set({\r
org.argeo.ria.components.ViewsManager.getInstance().getApplicationRoot().add(this); \r
this.show();\r
},\r
+ /**\r
+ * Adds a close button bottom-center aligned to the popup\r
+ */\r
addCloseButton : function(){\r
this.closeButton = new qx.ui.form.Button("Close");\r
this.closeButton.addListener("execute", this._closeAndDestroy, this);\r
this.add(this.closeButton, {edge:'south'}); \r
},\r
+ /**\r
+ * Adds two buttons bottom-center aligned (Ok and Cancel). \r
+ * Ok button has no listener by default, Cancel will close and destroy the popup.\r
+ */\r
addOkCancel : function(){\r
var buttonPane = new qx.ui.container.Composite(new qx.ui.layout.HBox(5, 'right'));\r
buttonPane.setAlignX("center");\r
buttonPane.add(this.cancelButton);\r
buttonPane.add(this.okButton);\r
},\r
+ /**\r
+ * Adds a prompt form to the popup : a question, followed by a text input.\r
+ * @param questionString {String} The question to ask to the user \r
+ * @param validationCallback {Function} Callback to apply : takes the text input value as unique argument.\r
+ * @param callbackContext {Object} Context for the callback, optional.\r
+ */\r
makePromptForm:function(questionString, validationCallback, callbackContext){\r
this.add(new qx.ui.basic.Label(questionString), {edge:'north'});\r
var textField = new qx.ui.form.TextField();\r
if(valid) this._closeAndDestroy();\r
}, this);\r
},\r
+ /**\r
+ * Close this modal window and destroy it.\r
+ */\r
_closeAndDestroy : function(){\r
this.hide();\r
this.destroy(); \r
this.add(this.guiContent, {flex:1});
}
},
-
+ /**
+ * Adds a graphical component too the header of the view pane.
+ * It is added as "center" in the dock layout, and will override the view pane title label.
+ * For example, you can add your own title, or add a switch, or buttons, etc.
+ * @param component {qx.ui.core.Widget} The graphical component to add.
+ */
addHeaderComponent : function(component){
this.header.setPadding(4);
this.header.add(component, {edge:"center"});
* @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
var iView = new classObj;\r
var viewPane = this.getViewPaneById(viewPaneId);\r
iView.init(viewPane); \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
+ * See the "definitions" property documentation below for more info on how to define new commands.\r
* \r
* @author Charles du Jeu\r
*/\r
properties : \r
{\r
/**\r
- * Commands definitions\r
+ * The commands definitions is a Map described as below\r
+ * <pre>\r
+ * {\r
+ * <b>label : "",</b> \r
+ * | The label of the action\r
+ * \r
+ * <b>icon : "",</b> \r
+ * | The icon image\r
+ * \r
+ * <b>shortcut : "",</b>\r
+ * | The keyboard shortcut, as defined in qooxdoo (Control+s, Alt+k, etc.). Warning, the letter must be lowercase.\r
+ * \r
+ * <b>enabled : true,</b>\r
+ * | Whether it is enabled or disabled at creation\r
+ * \r
+ * <b>menu : ""|null,</b>\r
+ * | The menu group to which the command will be added. If null, will not appear in the menus.\r
+ * \r
+ * <b>menuPosition : "first"|"last"</b>\r
+ * | Optional : force the menu group to be first or last in the menubar.\r
+ * \r
+ * <b>toolbar : ""|null,</b>\r
+ * | The toolbar group to which the command will be added. If null, will not appear in the toolbars.\r
+ * \r
+ * <b>init : function(){},</b>\r
+ * | Optional function called at command creation.\r
+ * | Function context : the command itself\r
+ * \r
+ * <b>callback : function(e){},</b>\r
+ * | The main callback to be triggered when command is executed.\r
+ * | Function context : the current class (not the command!)\r
+ * \r
+ * <b>selectionChange : function(viewPaneId, xmlNodes){},</b>\r
+ * | Optional function called each time a selectionChange is detected in one of the active viewPane.\r
+ * | The origin viewPaneId and the new selection as a map of nodes are passed as arguments.\r
+ * | Function context : the command itself.\r
+ * \r
+ * <b>submenu : [{label:"", icon:"", commandId:""}, ...],</b>\r
+ * | If set, the command will create a submenu, being in a menu or in the toolbar.\r
+ * | The submenu is created with the various array entries, and the submenuCallback function\r
+ * | will be called with the 'commandId' parameter when a submenu entry is selected.\r
+ * \r
+ * <b>submenuCallback : function(commandId){},</b>\r
+ * | Callback if command is a submenu (cf. above).\r
+ * | Function context : the current class/\r
+ * \r
+ * <b>command : null</b>\r
+ * | For internal use only, caching the actual org.argeo.ria.event.Command object.\r
+ * }\r
+ * </pre>\r
* @see org.argeo.ria.event.Command for the definition Map details. \r
*/\r
definitions : {\r
\r
events : {\r
/**\r
- * Triggered when the whole commands list is changed.\r
+ * Triggered when the whole commands list is changed. Mainly used internally by the manager.\r
*/\r
"changedCommands" : "qx.event.type.Event"\r
},\r
return contextMenu;\r
},\r
/**\r
- * Add a new set of commands definitions\r
+ * Add a new set of commands definitions. See the definitions property of this class.\r
* @param definitions {Map} a set of commands definitions.\r
- * @param callbackContext {qx.ui.core.Object} The context used inside the commands callbacks.\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