]>
git.argeo.org Git - gpl/argeo-slc.git/blob - server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcExecLoggerApplet.js
2 * A simple Hello World applet for documentation purpose.
3 * The only associated command is the "Close" command.
5 qx
.Class
.define("org.argeo.slc.ria.SlcExecLoggerApplet",
7 extend
: qx
.ui
.container
.Composite
,
8 implement
: [org
.argeo
.ria
.components
.IView
],
10 construct : function(){
12 this.setLayout(new qx
.ui
.layout
.Dock());
18 * The viewPane inside which this applet is added.
25 check
:"org.argeo.ria.components.ViewSelection"
27 instanceId
: {init
:""},
28 instanceLabel
: {init
:""},
30 * Commands definition, see {@link org.argeo.ria.event.CommandsManager#definitions}
35 label
: "Reload Logs",
36 icon
: "resource/slc/view-refresh.png",
37 shortcut
: "Control+r",
41 callback : function(e
){
53 * Called at applet creation. Just registers viewPane.
54 * @param viewPane {org.argeo.ria.components.ViewPane} The viewPane.
56 init : function(viewPane
){
57 this.setView(viewPane
);
58 this.setViewSelection(new org
.argeo
.ria
.components
.ViewSelection(viewPane
.getViewId()));
60 this.UIBus
= org
.argeo
.ria
.event
.UIBus
.getInstance();
68 this.UIBus
.addListener("newSlcExecution", this._reloadLogger
, this);
69 this.UIBus
.addListener("updateSlcExecutionStatus", this._reloadLogger
, this);
72 addScroll : function(){
77 this.UIBus
.removeListener("newSlcExecution", this._reloadLogger
, this);
78 this.UIBus
.removeListener("updateSlcExecutionStatus", this._reloadLogger
, this);
82 * Creates the applet layout
84 _createLayout : function(){
85 this.logModel
= new qx
.ui
.table
.model
.Simple();
86 this.logModel
.setColumns(["Date", "Host", "Id", "Status"]);
87 this.logPane
= new qx
.ui
.table
.Table(this.logModel
, {
88 tableColumnModel: function(obj
){
89 return new qx
.ui
.table
.columnmodel
.Resize(obj
)
92 this.logPane
.setDecorator(null);
94 this.add(this.logPane
, {edge
:'center'});
98 * Initialize the log table.
100 _initLogger : function(){
102 statusBarVisible
: false,
103 showCellFocusIndicator
:false
105 var columnModel
= this.logPane
.getTableColumnModel();
106 columnModel
.getBehavior().setWidth(0, "30%");
107 columnModel
.getBehavior().setWidth(1, "15%");
108 columnModel
.getBehavior().setWidth(3, "12%");
112 * Refresh the data model.
114 _reloadLogger : function(){
115 var request
= org
.argeo
.slc
.ria
.SlcApi
.getListSlcExecutionsService();
116 request
.addListener("completed", function(response
){
117 var messages
= org
.argeo
.ria
.util
.Element
.selectNodes(response
.getContent(), "//slc:slc-execution");
118 this.logModel
.setData([]);
119 for(var i
=0;i
<messages
.length
;i
++){
120 var message
= messages
[i
];
121 var slcExec
= new org
.argeo
.slc
.ria
.SlcExecutionMessage(message
.getAttribute("uuid"));
122 slcExec
.fromXml(message
);
123 this.logModel
.addRows([
124 [slcExec
.getDate(), slcExec
.getHost(), slcExec
.getUuid(), slcExec
.getStatus()]