}
}
},
+ /**
+ * A map containing all currently registered agents.
+ */
registeredTopics : {
init : {},
check : "Map",
load : function(){
this.getView().setViewTitle("Execution Launcher");
this.addListener("changeRegisteredTopics", function(event){
- this._refreshTopicsSubscriptions(event);
+ //this._refreshTopicsSubscriptions(event);
this._feedSelector(event);
}, this);
var reloadHandler = function(message){
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");
moreButton.setToolTip(new qx.ui.tooltip.ToolTip("Add a parameter"));
moreButton.setCursor("pointer");
moreButton.addListener("click", function(){
- this._addFormInputText();
+ this._addFormInputText(formObject);
}, this);
this._addFormHeader(formObject, "Add optionnal parameters", moreButton);
this._addFormInputText(formObject);
},
+ /**
+ * Create a canonical form.
+ * @param formObject {Map} The form part
+ */
_createStandardForm : function(formObject){
this._addFormHeader(formObject, "Set Execution Parameters");
moreButton.setToolTip(new qx.ui.tooltip.ToolTip("Add a parameter"));
moreButton.setCursor("pointer");
moreButton.addListener("click", function(){
- this._addFormInputText();
+ this._addFormInputText(formObject);
}, this);
this._addFormHeader(formObject, "Add optionnal parameters", moreButton);
this._addFormInputText(formObject);
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);
formObject.pane.add(entryPane);
},
+ /*
_refreshTopicsSubscriptions : function(changeTopicsEvent){
var oldTopics = changeTopicsEvent.getOldData() || {};
var newTopics = changeTopicsEvent.getData();
}
}
},
+ */
+ /**
+ * 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();
}
},
+ /*
_addAmqListener: function(uuid){
this._amqClient.addListener("slcExec", "topic://agent."+uuid+".newExecution", function(response){
var message = org.argeo.ria.util.Element.selectSingleNode(response, "slc:slc-execution");
_removeAmqListener : function(uuid){
this._amqClient.removeListener("slcExec", "topic://agent."+uuid+".newExecution");
},
+ */
+ /**
+ * 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._prepareSlcExecutionMessage(crtPartId, slcExec, fields, hiddenFields, freeFields);
-
- var destination = "topic://agent."+currentUuid+".newExecution";
- this._amqClient.sendMessage(destination, slcExec.toXml());
+
+ this._amqClient.sendMessage(
+ "topic://agent.newExecution",
+ slcExec.toXml(),
+ {"slc-agentId":currentUuid}
+ );
// Force logs refresh right now!
qx.event.Timer.once(function(){
var command = org.argeo.ria.event.CommandsManager.getInstance().getCommandById("reloadlogs");