members :
{
- /**
- * Called at applet creation. Just registers viewPane.
- * @param viewPane {org.argeo.ria.components.ViewPane} The viewPane.
- */
init : function(viewPane, xmlNode){
this.setView(viewPane);
this.setViewSelection(new org.argeo.ria.components.ViewSelection(viewPane.getViewId()));
}
},
- /**
- * 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(){
if(!this.data) return;
if(this.loaded) return;
}
}
},
+ /**
+ * A map containing all currently registered agents.
+ */
registeredTopics : {
init : {},
check : "Map",
this._amqClient.stopPolling();
},
+ /**
+ * Creates the main applet layout.
+ */
_createLayout : function(){
this.formPane = new qx.ui.container.Composite(new qx.ui.layout.VBox(5));
this.scroll = new qx.ui.container.Scroll(this.formPane);
},
+ /**
+ * Creates the form.
+ */
_createForm : function(){
this.fields = {};
this.hiddenFields = {};
this._showSelectedPart(qx.lang.Object.getKeys(this.parts)[0]);
},
+ /**
+ * Show a form part given its id.
+ * @param partId {String} The part id
+ */
_showSelectedPart : function(partId){
if(!this.parts) return;
if(!this.partsContainer){
}
},
+ /**
+ * Init a form part : creates a pane, a set of fields, etc.
+ * @param formId {String} A unique ID
+ * @param label {String} A label
+ * @return {Map} The form part.
+ */
_initFormPart : function(formId, label){
if(!this.parts) this.parts = {};
var formObject = {};
return formObject;
},
+ /**
+ * To be overriden by this class children.
+ */
_createFormVariableParts : function(){
var standard = this._initFormPart("standard", "Canonical");
this._createStandardForm(standard);
this._createSimpleForm(simple);
},
+ /**
+ * Creates a form for SLC demo
+ * @param formObject {Map} The form part
+ */
_createSimpleForm : function(formObject){
this._addFormInputText(formObject, "ant.file", "File", "Category1/SubCategory2/build.xml");
},
+ /**
+ * Create a canonical form.
+ * @param formObject {Map} The form part
+ */
_createStandardForm : function(formObject){
this._addFormHeader(formObject, "Set Execution Parameters");
this._addFormInputText(formObject);
},
+ /**
+ * Add an hidden field to the form
+ * @param formObject {Map} The form part
+ * @param fieldName {String} Name
+ * @param fieldValue {String} Value
+ */
_addFormHiddenField : function(formObject, fieldName, fieldValue){
formObject.hiddenFields[fieldName] = fieldValue;
},
+ /**
+ * Creates a simple label/input form entry.
+ * @param formObject {Map} The form part
+ * @param fieldName {String} Name
+ * @param fieldLabel {String} Label of the field
+ * @param defaultValue {String} The default value
+ * @param choiceValues {Map} An map of values
+ */
_addFormInputText : function(formObject, fieldName, fieldLabel, defaultValue, choiceValues){
var labelElement;
if(choiceValues){
this._addFormEntry(formObject, labelElement, fieldElement);
},
+ /**
+ * Add an header
+ * @param formObject {Map} The form part
+ * @param content {Mixed} Content to add.
+ * @param additionnalButton {Mixed} Any widget to add on the east.
+ */
_addFormHeader : function(formObject, content, additionnalButton){
var header = new qx.ui.basic.Label('<b>'+content+'</b>');
header.setRich(true);
}
},
+ /**
+ * Adds a label/input like entry in the form.
+ * @param formObject {Map} The form part
+ * @param labelElement {Object} Either a label or an input
+ * @param fieldElement {Object} Any form input.
+ */
_addFormEntry : function(formObject, labelElement, fieldElement){
var entryPane = new qx.ui.container.Composite(new qx.ui.layout.HBox(5));
labelElement.setWidth(100);
},
*/
+ /**
+ * Refresh the selector when the topics are updated.
+ * @param changeTopicsEvent {qx.event.type.DataEvent} The reload event.
+ */
_feedSelector : function(changeTopicsEvent){
var topics = changeTopicsEvent.getData();
this.agentSelector.removeAll();
},
*/
+ /**
+ * Make an SlcExecutionMessage from the currently displayed form.
+ * @param crtPartId {String} The form part currently displayed
+ * @param slcExec {org.argeo.slc.ria.SlcExecutionMessage} The message to fill.
+ * @param fields {Map} The fields of the form
+ * @param hiddenFields {Map} The hidden ones
+ * @param freeFields {Array} The free fields.
+ */
_prepareSlcExecutionMessage : function(crtPartId, slcExec, fields, hiddenFields, freeFields){
if(crtPartId == "standard"){
slcExec.setStatus(fields.status.getValue());
}
},
+ /**
+ * Called when the user clicks the "Execute" button.
+ */
submitForm : function(){
var currentUuid = this.agentSelector.getValue();
if(!currentUuid) return;
this.timer.stop();\r
},\r
\r
+ /**\r
+ * Creates the applet layout\r
+ */\r
_createLayout : function(){\r
this.logModel = new qx.ui.table.model.Simple();\r
this.logModel.setColumns(["Date", "Host", "Id", "Status"]);\r
this.add(this.logPane, {edge:'center'});\r
},\r
\r
+ /**\r
+ * Initialize the log table.\r
+ */\r
_initLogger : function(){\r
this.logPane.set({ \r
statusBarVisible: false,\r
columnModel.getBehavior().setWidth(3, "12%"); \r
},\r
\r
+ /**\r
+ * Refresh the data model.\r
+ */\r
_reloadLogger : function(){\r
var request = org.argeo.slc.ria.SlcApi.getListSlcExecutionsService();\r
request.addListener("completed", function(response){ \r
*/\r
qx.Class.define("org.argeo.slc.ria.SlcExecutionMessage", {\r
extend : qx.core.Object,\r
+ /**\r
+ * New instance\r
+ * @param uuid {String} The Uuid of the message. If none is passed, one is generated.\r
+ */\r
construct : function(uuid){\r
this.base(arguments);\r
if(uuid){\r
check : "String",\r
init : "user"\r
},\r
+ /**\r
+ * Date of the message. now() by default.\r
+ */\r
date : {\r
check : "String", \r
init : new Date().toString()\r
},\r
members : {\r
\r
+ /**\r
+ * Add a free attribute to the message\r
+ * @param attName {String} Name\r
+ * @param attValue {String} Value\r
+ */\r
addAttribute: function(attName, attValue){\r
var attr = this.getAttributes();\r
attr[attName] = attValue;\r
return builder.get();\r
},\r
\r
+ /**\r
+ * Parse an XML answer and fill the object with it.\r
+ * @param slcExecXml {String} An slcExecMessage mapped in XML.\r
+ */\r
fromXml : function(slcExecXml){\r
var NSMap = {slc:"http://argeo.org/projects/slc/schemas"}; \r
this.setStatus(org.argeo.ria.util.Element.getSingleNodeText(slcExecXml, "slc:status", NSMap));\r
},\r
\r
properties : {\r
+ /**\r
+ * Available perspective detected in the current compilation.\r
+ */\r
perspectives : {\r
check : "Map",\r
init : {}\r
},\r
+ /**\r
+ * Currently layouted perspective label\r
+ */\r
activePerspectiveName : {\r
check : "String",\r
init : ""\r
},\r
+ /**\r
+ * Currently layouted perspective.\r
+ */\r
activePerspective : {\r
init : null\r
},\r
+ /**\r
+ * Basic command associated to the application, applicable to all perspectives.\r
+ */\r
commandsDefinitions : {\r
init : {\r
"stop" : {\r
this.loadPerspective();\r
},\r
\r
+ /**\r
+ * Load a given perspective by its name.\r
+ * @param perspectiveName {String} Perspective to load\r
+ */\r
loadPerspective : function(perspectiveName){\r
if(perspectiveName){\r
this.setActivePerspectiveName(perspectiveName);\r
this.setActivePerspective(perspective);\r
},\r
\r
+ /**\r
+ * After switching perspective, call this function to rebuild menu with the right selected.\r
+ */\r
rebuildPerspectiveMenus : function(){\r
var switchCommand = this.getCommandsDefinitions()["switchperspective"];\r
switchCommand.submenu = [];\r
}\r
},\r
\r
+ /**\r
+ * Specific action of calling an external URL without triggering the "close()" method\r
+ * of Application.\r
+ * @param hrefValue {String} A download url that should reply with specific "attachment" header to avoid leaving the application.\r
+ */\r
javascriptDownloadLocation: function(hrefValue){\r
this.interruptClose = true;\r
document.location.href = hrefValue;\r
this.interruptClose = false;\r
},\r
\r
+ /**\r
+ * Called at Application ending (closing the browser).\r
+ */\r
close : function(){\r
if(this.interruptClose) return ; \r
if(this.getActivePerspective()){\r
qx.Interface.define("org.argeo.ria.components.IPerspective", {\r
\r
statics : {\r
+ /**\r
+ * The human readable name of the perspective\r
+ */\r
LABEL : "",\r
+ /**\r
+ * An image resource associated to the perspective\r
+ */\r
ICON : ""\r
},\r
\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
+ * @param data {Mixed} Any object or data passed by the initiator of the view\r
* @return {Boolean}\r
*/\r
init : function(viewPane, data){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
+ load : function(){return true;},\r
/**\r
* Whether this component is already contained in a scroller (return false) or not (return true).\r
* @return {Boolean}\r
extend : qx.ui.window.Window,\r
\r
events : {\r
+ /**\r
+ * Triggered when the user clicks the "ok" button. \r
+ */\r
"ok" : "qx.event.type.Event"\r
},\r
/**\r
this.add(label, {edge:'center', width:'100%'});\r
this.addCloseButton();\r
},\r
+ /**\r
+ * Add a question and ok / cancel buttons\r
+ * @param text {String} The question to ask to the user\r
+ */\r
addConfirm : function(text){\r
var label = new qx.ui.basic.Label(text);\r
label.setRich(true);\r
+/**\r
+ * A more elaborate views container than ViewPane, as it can handle multiple contents\r
+ * at once via a TabView.\r
+ * See {@link org.argeo.ria.components.ViewPane}.\r
+ */\r
qx.Class.define("org.argeo.ria.components.TabbedViewPane",\r
{\r
extend : qx.ui.container.Composite,\r
/**\r
* @param viewId {String} Unique id of this viewPane\r
* @param viewTitle {String} Readable Title of this viewPane\r
- * @param splitPaneData {Map} Additionnal data to be used by splitpanes implementations.\r
*/\r
construct : function(viewId, viewTitle){\r
this.base(arguments);\r
},\r
\r
members : {\r
+ /**\r
+ * Checks if the pane already contains a given view, identified by its instance id\r
+ * @param contentId {Mixed} The instance id to check\r
+ * @return {Boolean}\r
+ */\r
contentExists : function(contentId){\r
if(this.pageIds[contentId]){\r
this.tabView.setSelected(this.pageIds[contentId]);\r
return this.pageIds[contentId].getUserData("argeoria.iview");\r
} \r
},\r
+ /**\r
+ * Sets a new instance in the tabbed pane.\r
+ * @param content {org.argeo.ria.components.IView} The applet to add.\r
+ */\r
setContent : function(content){\r
if(!this.tabView.getChildren().length){\r
this.tabView.setBackgroundColor("transparent");\r
}, this);\r
this.tabView.setSelected(page);\r
},\r
+ /**\r
+ * Get the currently selected tab content, if any.\r
+ * @return {org.argeo.ria.components.IView} The currently selected view.\r
+ */\r
getContent : function(){\r
if(this._getCrtPage()){\r
return this._getCrtPage().getUserData("argeoria.iview");\r
}\r
return null;\r
},\r
+ /**\r
+ * Get the currently selected tab ViewSelection object.\r
+ * @return {org.argeo.ria.components.ViewSelection} The view selection object of the currently selected view.\r
+ */\r
getViewSelection : function(){\r
if(!this.getContent()) return null;\r
return this.getContent().getViewSelection();\r
},\r
+ /**\r
+ * Return the currently selected tab Page.\r
+ * @return {qx.ui.tabview.Page} The page\r
+ */\r
_getCrtPage : function(){\r
return this.tabView.getSelected();\r
},\r
+ /**\r
+ * Closes the currently selected view and remove all tabs components (button, page).\r
+ */\r
closeCurrent : function(){\r
var crtPage = this._getCrtPage();\r
if(!crtPage) return;\r
this.tabView.setMarginTop(27);\r
} \r
},\r
+ /**\r
+ * Call closeCurrent() recursively until there is no more page.\r
+ */\r
empty : function(){\r
var crtPage = this._getCrtPage();\r
while(crtPage){\r
crtPage = this._getCrtPage();\r
}\r
},\r
+ /**\r
+ * Sets the tabView on "load" state. Nothing is done at the moment.\r
+ * @param load {Boolean} Load status\r
+ */\r
setOnLoad : function(load){\r
\r
},\r
+ /**\r
+ * Sets a graphical indicator that this pane has the focus. A blue border.\r
+ */\r
focus : function(){\r
if(this.hasFocus) return;\r
this.fireEvent("changeSelection");\r
this.setDecorator(this.focusedDecorator);\r
this.hasFocus = true;\r
}, \r
+ /**\r
+ * Remove a graphical focus indicator on this pane.\r
+ */\r
blur : function(){\r
this.hasFocus = false;\r
this.setDecorator(this.blurredDecorator);\r
},
events : {
+ /**
+ * Trigger when the focus is changing
+ */
"changeFocus" : "qx.event.type.Data",
+ /**
+ * Triggered when selection of content has changed.
+ */
"changeSelection" : "qx.event.type.Event"
},
*/
},
+ /**
+ * Get the content ViewSelection object.
+ * @return {org.argeo.ria.components.ViewSelection} The view selection
+ */
getViewSelection : function(){
if(this.getContent()){
return this.getContent().getViewSelection();
}
return null;
},
-
+ /**
+ * Checks if the pane already contains a given view, identified by its instance id
+ * @param iViewId {Mixed} The instance id to check
+ * @return {Boolean}
+ */
contentExists : function(iViewId){
if(this.getContent()){
this.empty();
}
},
+ /**
+ * Call empty() method, since this pane can only handle one view.
+ */
closeCurrent : function(){
this.empty();
},
this.setViewTitle(this._defaultViewTitle);
this.setContent(null);
},
-
+ /**
+ * Sets a graphical indicator that this pane has the focus. A blue border.
+ */
focus : function(){
if(this.hasFocus) return;
this.setDecorator(new qx.ui.decoration.Single(1,"solid","#065fb2"));
this.fireEvent("changeSelection");
this.hasFocus = true;
},
+ /**
+ * Remove a graphical focus indicator on this pane.
+ */
blur : function(){
this.hasFocus = false;
this.setDecorator(new qx.ui.decoration.Single(1,"solid","#000"));
* The main container for the org.argeo.ria.components.ViewPane instances. \r
*/\r
viewPanesContainer : {init: null},\r
+ /**\r
+ * Keeps the currently focused viewPane. \r
+ */\r
currentFocus : {init :null}\r
},\r
construct : function(){\r
* \r
* @param classObj {Clazz} The class object to instantiate\r
* @param viewPaneId {String} The unique ID of the view pane\r
+ * @param data {Mixed} Any data provided by the opener.\r
* @return {org.argeo.ria.components.IView}\r
*/\r
initIViewClass: function(classObj, viewPaneId, data){\r
this.setViewPaneFocus(e.getTarget());\r
}, this);\r
},\r
+ /**\r
+ * Sets a given viewPane as the currently focused one. Blur the others.\r
+ * @param viewPane {org.argeo.ria.components.ViewPane} The viewPane (or TabbedViewPane) to focus on.\r
+ */\r
setViewPaneFocus : function(viewPane){\r
for(var key in this.views){\r
this.views[key].blur();\r
return button;\r
},\r
\r
+ /**\r
+ * Register a given callback to be shared by one or more focusable part.\r
+ * @param callback {Function} A callback function\r
+ * @param focusablePartId {String} A string identifiing a focusable part. At the moment, it can only be "view:viewId"\r
+ */\r
registerCallback : function(callback, focusablePartId){\r
this.callbacks[focusablePartId] = callback;\r
},\r
+ /**\r
+ * Return all the registered callbacks for this command.\r
+ * @return {Map} A map of callback, viewId => callBack.\r
+ */\r
getCallbacks : function(){\r
return this.callbacks;\r
},\r
+ /**\r
+ * Remove a callback for a given focusable part.\r
+ * @param focusablePartId {String} A id like "view:viewId".\r
+ */\r
removeCallback : function(focusablePartId){\r
if(this.callbacks[focusablePartId]){\r
delete this.callbacks[focusablePartId];\r
init : {},\r
check : "Map"\r
},\r
+ /**\r
+ * Special command definitions that are shared between focusable parts. \r
+ */\r
sharedDefinitions : {\r
init: {},\r
check: "Map"\r
\r
members :\r
{\r
+ /**\r
+ * Initialize the manager with basic definitions.\r
+ * @param initDefinitions {Map} A map of commands definitions.\r
+ */\r
init : function(initDefinitions){\r
this.setDefinitions(initDefinitions);\r
this.setInitialDefinitions(qx.lang.Object.copy(initDefinitions));\r
/**\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
+ * @param focusablePartId {String} A string identifying the associated focusable part, like "view:viewId". \r
*/\r
addCommands : function(definitions, callbackContext, focusablePartId){\r
var crtDefs = this.getDefinitions(); \r
/**\r
* Removes a whole set of commands by their definitions maps.\r
* @param definitions {Map} a set of commands definitions\r
+ * @param focusablePartId {String} A string identifying the associated focusable part, like "view:viewId". \r
*/\r
removeCommands : function(definitions, focusablePartId){\r
var crtDefs = this.getDefinitions();\r
+/**\r
+ * A standard client for sending/receiving JMS message.\r
+ * It is based on ActiveMQ Ajax implementation.\r
+ */\r
qx.Class.define("org.argeo.ria.remote.JmsClient", {\r
\r
type : "singleton",\r
_pollDelay : 0,\r
\r
_first : true,\r
+ /**\r
+ * Trigger at each poll event.\r
+ * @param first {Boolean} Whether it is the first event to be triggered. \r
+ */\r
_pollEvent : function(first) {},\r
_handlers : new Array(),\r
\r
+ /**\r
+ * Parses the XML response to a message POST.\r
+ * @param response {qx.io.remote.Response} The query response\r
+ */\r
_messageHandler : function(response) {\r
var doc = response.getContent(); \r
var messages = org.argeo.ria.util.Element.selectNodes(doc, "//response");\r
}\r
},\r
\r
+ /**\r
+ * Parses the empty response of a poll GET query.\r
+ * @param response {qx.io.remote.Response} The query response\r
+ */\r
_pollHandler : function(response) {\r
try {\r
this._messageHandler(response);\r
this._sendPoll();\r
},\r
\r
+ /**\r
+ * Send a poll query : GET query and no paramter at all. \r
+ * @param request {qx.io.remote.Request} A request object\r
+ */\r
_sendPoll : function(request) {\r
if(this.interrupt) return;\r
var request = new qx.io.remote.Request(this.uri, "GET", "application/xml");\r
request.send();\r
},\r
\r
- // Add a function that gets called on every poll response, after all received\r
- // messages have been handled. The poll handler is past a boolean that indicates\r
- // if this is the first poll for the page.\r
+ /**\r
+ * Add a function that gets called on every poll response, after all received\r
+ * messages have been handled. The poll handler is past a boolean that indicates\r
+ * if this is the first poll for the page.\r
+ * \r
+ * @param func {Function} The handler to be called. \r
+ */\r
addPollHandler : function(func) {\r
var old = this._pollEvent;\r
this._pollEvent = function(first) {\r
}\r
},\r
\r
- // Send a JMS message to a destination (eg topic://MY.TOPIC). Message should be xml or encoded\r
- // xml content.\r
+ /**\r
+ * Send a JMS message to a destination (eg topic://MY.TOPIC). \r
+ * Message should be xml or encoded xml content.\r
+ * \r
+ * @param destination {String} The topic destination\r
+ * @param message {String} XML encoded message\r
+ * @param properties {Map} A map of additional parameters to add to the query.\r
+ */\r
sendMessage : function(destination, message, properties) {\r
this._sendMessage(destination, message, 'send', properties);\r
},\r
\r
- // Listen on a channel or topic. handler must be a function taking a message arguement\r
+ /**\r
+ * Listen on a channel or topic. handler must be a function taking a message arguement\r
+ * @param id {String} A unique identifier for this handler\r
+ * @param destination {String} The topic to listen to (topic://MY.TOPIC) \r
+ * @param handler {Function} The handler to trigger when receiving a message \r
+ * @param context {Object} An object to bind on the handler.\r
+ */\r
addListener : function(id, destination, handler, context) {\r
this._handlers[id] = qx.lang.Function.bind(handler, context);\r
this._sendMessage(destination, id, 'listen');\r
},\r
\r
- // remove Listener from channel or topic.\r
+ /**\r
+ * Remove Listener from channel or topic.\r
+ * @param id {String} identifier of the handler to remove.\r
+ * @param destination {String} The topic to listen to (topic://MY.TOPIC) \r
+ */ \r
removeListener : function(id, destination) {\r
this._handlers[id] = null;\r
this._sendMessage(destination, id, 'unlisten');\r
},\r
-\r
+ \r
+ /**\r
+ * Send a message of a given type.\r
+ * @param destination {String} The topic to listen to (topic://MY.TOPIC) \r
+ * @param message {String} XML encoded message\r
+ * @param type {String} The JMS-Type of message (listen, unlisten, send).\r
+ * @param properties {Map} A map of additional parameters to add to the query.\r
+ */\r
_sendMessage : function(destination, message, type, properties) {\r
var req = new qx.io.remote.Request(this.uri, "POST", "text/plain");\r
req.setParameter("destination", destination);\r
req.send();\r
},\r
\r
+ /**\r
+ * Starts a poll on the JMS server.\r
+ */\r
startPolling : function() {\r
if (this.poll){\r
this.interrupt = false;\r
}\r
},\r
\r
+ /**\r
+ * Stops polling the JMS server.\r
+ */\r
stopPolling : function(){\r
this.interrupt = true;\r
}\r