diff options
author | Tobi Oetiker <tobi@oetiker.ch> | 2008-06-04 23:33:02 +0200 |
---|---|---|
committer | Tobi Oetiker <tobi@oetiker.ch> | 2008-06-04 23:33:02 +0200 |
commit | 8364e6bbedf919008da50cc1b54dbb8a49dee88d (patch) | |
tree | 43000d161c268f626badf9723ff97b3e0e8527ee /qooxdoo/source/class | |
parent | 4940f51d54f1f4b994c02138defbcd8ff36a95ec (diff) | |
download | smokeping-8364e6bbedf919008da50cc1b54dbb8a49dee88d.tar.gz smokeping-8364e6bbedf919008da50cc1b54dbb8a49dee88d.tar.xz |
alter name to Tr since we do not use mtr anmore
Diffstat (limited to 'qooxdoo/source/class')
-rw-r--r-- | qooxdoo/source/class/Tr/Application.js (renamed from qooxdoo/source/class/Mtr/Application.js) | 26 | ||||
-rw-r--r-- | qooxdoo/source/class/Tr/Server.js (renamed from qooxdoo/source/class/Mtr/Server.js) | 12 | ||||
-rw-r--r-- | qooxdoo/source/class/Tr/ui/ActionButton.js (renamed from qooxdoo/source/class/Mtr/ui/ActionButton.js) | 22 | ||||
-rw-r--r-- | qooxdoo/source/class/Tr/ui/Cellrenderer.js (renamed from qooxdoo/source/class/Mtr/ui/Cellrenderer.js) | 6 | ||||
-rw-r--r-- | qooxdoo/source/class/Tr/ui/TraceTable.js (renamed from qooxdoo/source/class/Mtr/ui/TraceTable.js) | 42 |
5 files changed, 58 insertions, 50 deletions
diff --git a/qooxdoo/source/class/Mtr/Application.js b/qooxdoo/source/class/Tr/Application.js index 7d28f59..9e07dbe 100644 --- a/qooxdoo/source/class/Mtr/Application.js +++ b/qooxdoo/source/class/Tr/Application.js @@ -1,12 +1,12 @@ /* ************************************************************************ -#module(Mtr) -#resource(Mtr.image:image) -#embed(Mtr.image/*) +#module(Tr) +#resource(Tr.image:image) +#embed(Tr.image/*) ************************************************************************ */ -qx.Class.define('Mtr.Application', +qx.Class.define('Tr.Application', { extend: qx.application.Gui, @@ -18,14 +18,14 @@ qx.Class.define('Mtr.Application', this.base(arguments); qx.io.Alias.getInstance().add( - 'MT', qx.core.Setting.get('Mtr.resourceUri') + 'MT', qx.core.Setting.get('Tr.resourceUri') ); // if we run with a file:// url make sure - // the app finds the Mtr service (Mtr.cgi) + // the app finds the Tr service (Tr.cgi) - Mtr.Server.getInstance().setLocalUrl( - 'http://johan.oetiker.ch/~oetiker/mtr/' + Tr.Server.getInstance().setLocalUrl( + 'http://johan.oetiker.ch/~oetiker/tr/' ); var base_layout = new qx.ui.layout.VerticalBoxLayout(); @@ -42,23 +42,23 @@ qx.Class.define('Mtr.Application', top.set({ height: 'auto' }); - var title = new qx.ui.basic.Atom(this.tr("MTR AJAX Frontend")); + var title = new qx.ui.basic.Atom(this.tr("Smokeping Traceroute Frontend")); with(title){ setTextColor('#b0b0b0'); setFont(qx.ui.core.Font.fromString('20px bold sans-serif')); } top.add(title); top.add(new qx.ui.basic.HorizontalSpacer()); - top.add(new Mtr.ui.ActionButton()); + top.add(new Tr.ui.ActionButton()); base_layout.add(top); - var trace = new Mtr.ui.TraceTable(); + var trace = new Tr.ui.TraceTable(); base_layout.add(trace); }, close : function(e) { this.base(arguments); - // return "Mtr Web UI: " + // return "Tr Web UI: " // + "Do you really want to close the application?"; }, @@ -83,7 +83,7 @@ qx.Class.define('Mtr.Application', */ settings : { - 'Mtr.resourceUri' : './resource' + 'Tr.resourceUri' : './resource' } }); diff --git a/qooxdoo/source/class/Mtr/Server.js b/qooxdoo/source/class/Tr/Server.js index 3e77047..f17e54b 100644 --- a/qooxdoo/source/class/Mtr/Server.js +++ b/qooxdoo/source/class/Tr/Server.js @@ -1,12 +1,12 @@ /* ************************************************************************ -#module(Mtr) +#module(Tr) ************************************************************************ */ /** - * A Mtr specific rpc call which works + * A Tr specific rpc call which works */ -qx.Class.define('Mtr.Server', { +qx.Class.define('Tr.Server', { extend: qx.io.remote.Rpc, type: "singleton", @@ -25,8 +25,8 @@ qx.Class.define('Mtr.Server', { with(this){ base(arguments); setTimeout(7000000); - setUrl('mtr.cgi'); - setServiceName('Mtr'); + setUrl('tr.cgi'); + setServiceName('Tr'); setCrossDomain(true); } @@ -65,7 +65,7 @@ qx.Class.define('Mtr.Server', { setLocalUrl: function(local_url){ if ( document.location.host === '' ) { with(this){ - setUrl(local_url+'mtr.cgi'); + setUrl(local_url+'tr.cgi'); } } } diff --git a/qooxdoo/source/class/Mtr/ui/ActionButton.js b/qooxdoo/source/class/Tr/ui/ActionButton.js index 0c02598..a9c60b3 100644 --- a/qooxdoo/source/class/Mtr/ui/ActionButton.js +++ b/qooxdoo/source/class/Tr/ui/ActionButton.js @@ -1,12 +1,12 @@ /* ************************************************************************ -#module(Mtr) +#module(Tr) ************************************************************************ */ /** - * a widget showing the Mtr graph overview + * a widget showing the Tr graph overview */ -qx.Class.define('Mtr.ui.ActionButton', +qx.Class.define('Tr.ui.ActionButton', { extend: qx.ui.layout.HorizontalBoxLayout, @@ -38,7 +38,6 @@ qx.Class.define('Mtr.ui.ActionButton', }); this.add(host); this.__host = host; - var lab2 = new qx.ui.basic.Label(this.tr("Delay")); lab2.set({ paddingRight: 6, @@ -76,11 +75,11 @@ qx.Class.define('Mtr.ui.ActionButton', }); this.add(button); - qx.event.message.Bus.subscribe('mtr.status',this.__set_status,this); - qx.event.message.Bus.dispatch('mtr.status','stopped'); + qx.event.message.Bus.subscribe('tr.status',this.__set_status,this); + qx.event.message.Bus.dispatch('tr.status','stopped'); var start_trace = function(event) { - qx.event.message.Bus.dispatch('mtr.cmd',{ + qx.event.message.Bus.dispatch('tr.cmd',{ action: button.getUserData('action'), host: host.getValue(), delay: delay.getValue(), @@ -88,18 +87,23 @@ qx.Class.define('Mtr.ui.ActionButton', }); }; + host.addEventListener('keyup',function(e){if(e.keyCode = 13){start_trace()}}); button.addEventListener('execute', start_trace ); + var history = qx.client.History.getInstance(); var history_action = function(event){ - host.setValue(event.getData()); + var targ = event.getData(); + host.setValue(targ); + history.addToHistory(targ,'Smokeping Tracerout to '+targ); start_trace(); } - qx.client.History.getInstance().addEventListener('request', history_action); + history.addEventListener('request', history_action); // if we got called with a host on the commandline var initial_host = qx.client.History.getInstance().getState(); if (initial_host){ host.setValue(initial_host); + history.addToHistory(initial_host,'Smokeping Tracerout to '+initial_host); // dispatch this task once all the initializations are done qx.client.Timer.once(start_trace,this,0); } diff --git a/qooxdoo/source/class/Mtr/ui/Cellrenderer.js b/qooxdoo/source/class/Tr/ui/Cellrenderer.js index 2b2e45e..f18672d 100644 --- a/qooxdoo/source/class/Mtr/ui/Cellrenderer.js +++ b/qooxdoo/source/class/Tr/ui/Cellrenderer.js @@ -1,20 +1,20 @@ /* ************************************************************************ - Mtr Frontend + Tr Frontend Author: * Tobias Oetiker ************************************************************************ */ /* ************************************************************************ -#module(Mtr) +#module(Tr) ************************************************************************ */ /** * A configurable cell renderre */ -qx.Class.define('Mtr.ui.Cellrenderer', +qx.Class.define('Tr.ui.Cellrenderer', { extend: qx.ui.table.cellrenderer.Number, /** diff --git a/qooxdoo/source/class/Mtr/ui/TraceTable.js b/qooxdoo/source/class/Tr/ui/TraceTable.js index bce6998..c25a82e 100644 --- a/qooxdoo/source/class/Mtr/ui/TraceTable.js +++ b/qooxdoo/source/class/Tr/ui/TraceTable.js @@ -1,12 +1,12 @@ /* ************************************************************************ -#module(Mtr) +#module(Tr) ************************************************************************ */ /** - * a widget showing the Mtr target tree + * a widget showing the Tr target tree */ -qx.Class.define('Mtr.ui.TraceTable', +qx.Class.define('Tr.ui.TraceTable', { extend: qx.ui.table.Table, @@ -41,11 +41,11 @@ qx.Class.define('Mtr.ui.TraceTable', }; var tcm = this.getTableColumnModel(); - tcm.setDataCellRenderer(0, new Mtr.ui.Cellrenderer(2)); - tcm.setDataCellRenderer(3, new Mtr.ui.Cellrenderer(0,' %')); - tcm.setDataCellRenderer(4, new Mtr.ui.Cellrenderer(0)); + tcm.setDataCellRenderer(0, new Tr.ui.Cellrenderer(2)); + tcm.setDataCellRenderer(3, new Tr.ui.Cellrenderer(0,' %')); + tcm.setDataCellRenderer(4, new Tr.ui.Cellrenderer(0)); - var render_ms = new Mtr.ui.Cellrenderer(1); + var render_ms = new Tr.ui.Cellrenderer(1); for (var i=5;i<10;i++){ tcm.setDataCellRenderer(i, render_ms); @@ -62,7 +62,7 @@ qx.Class.define('Mtr.ui.TraceTable', for (var i=3;i<10;i++){ resizeBehavior.set(i, { width:"2*"}); } - qx.event.message.Bus.subscribe('mtr.cmd',this.__handle_mtr,this); + qx.event.message.Bus.subscribe('tr.cmd',this.__handle_tr,this); }, /* @@ -74,14 +74,14 @@ qx.Class.define('Mtr.ui.TraceTable', __make_empty_row: function (){ return ([undefined,undefined,undefined,0,0,undefined,undefined,undefined,undefined,undefined,0,0,0]); }, - __handle_mtr: function(m){ + __handle_tr: function(m){ var self = this; var f_hop = 0,f_host=1,f_ip=2,f_loss=3,f_snt=4,f_last=5,f_avg=6,f_best=7,f_worst=8,f_stdev=9,f_cnt=10,f_sum=11,f_sqsum=12; var fill_table; fill_table = function(retval,exc,id){ if (exc == null){ if ( self.__handle == undefined ) { - qx.event.message.Bus.dispatch('mtr.status','started'); + qx.event.message.Bus.dispatch('tr.status','started'); } self.__handle = retval['handle']; var tableModel = self.__tableModel; @@ -94,7 +94,11 @@ qx.Class.define('Mtr.ui.TraceTable', var value = retval['output'][i][3]; var ii = 0; var max = data.length; - while (ii < max && ( Math.floor(data[ii][0]) < hop || ( Math.floor(data[ii][0]) == hop && data[ii][1] != host))){ + while ( ii < max + && ( Math.floor(data[ii][0]) < hop + || ( Math.floor(data[ii][0]) == hop && data[ii][1] != host) + ) + ){ ii++; } if (ii == max || ( Math.floor(data[ii][0]) == hop && data[ii][1] != host) ){ @@ -139,8 +143,8 @@ qx.Class.define('Mtr.ui.TraceTable', tableModel.setData(data); if (retval['again']){ - var next_round = function (){Mtr.Server.getInstance().callAsync( - fill_table,'run_mtr',{ handle: retval['handle'], + var next_round = function (){Tr.Server.getInstance().callAsync( + fill_table,'run_tr',{ handle: retval['handle'], point: retval['point']})}; qx.client.Timer.once(next_round,self,0); } else @@ -148,7 +152,7 @@ qx.Class.define('Mtr.ui.TraceTable', for (var i=0;i<10;i++){ tableModel.setColumnSortable(i,true); } - qx.event.message.Bus.dispatch('mtr.status','stopped'); + qx.event.message.Bus.dispatch('tr.status','stopped'); self.__handle = undefined; } } @@ -160,7 +164,7 @@ qx.Class.define('Mtr.ui.TraceTable', for (var i=0;i<10;i++){ self.__tableModel.setColumnSortable(i,true); } - qx.event.message.Bus.dispatch('mtr.status','stopped'); + qx.event.message.Bus.dispatch('tr.status','stopped'); } }; @@ -173,8 +177,8 @@ qx.Class.define('Mtr.ui.TraceTable', var cmd = m.getData(); switch(cmd['action']){ case 'stop': - qx.event.message.Bus.dispatch('mtr.status','stopping'); - Mtr.Server.getInstance().callAsync(handle_returns,'stop_mtr',this.__handle); + qx.event.message.Bus.dispatch('tr.status','stopping'); + Tr.Server.getInstance().callAsync(handle_returns,'stop_tr',this.__handle); break; case 'go': this.__data = []; @@ -183,8 +187,8 @@ qx.Class.define('Mtr.ui.TraceTable', for (var i=0;i<10;i++){ this.__tableModel.setColumnSortable(i,false); } - qx.event.message.Bus.dispatch('mtr.status','starting'); - Mtr.Server.getInstance().callAsync(fill_table,'run_mtr',{host: cmd['host'], rounds: cmd['rounds'], delay: cmd['delay']}); + qx.event.message.Bus.dispatch('tr.status','starting'); + Tr.Server.getInstance().callAsync(fill_table,'run_tr',{host: cmd['host'], rounds: cmd['rounds'], delay: cmd['delay']}); break; default: alert('Unknown Command '+cmd['action']); |