diff options
author | Tobi Oetiker <tobi@oetiker.ch> | 2011-08-23 15:59:15 +0200 |
---|---|---|
committer | Tobi Oetiker <tobi@oetiker.ch> | 2011-08-23 15:59:15 +0200 |
commit | 55490b1bfb539386b63e25a8fd90e56c0200c1e8 (patch) | |
tree | 8ab5e31b7d1579ae8640dd006c4aa01daf7f8aaa /qooxdoo/source/class | |
parent | a1fbf832f9f0ba3043c3300aa0ca3a3d841ce41c (diff) | |
download | smokeping-55490b1bfb539386b63e25a8fd90e56c0200c1e8.tar.gz smokeping-55490b1bfb539386b63e25a8fd90e56c0200c1e8.tar.xz |
clean out smoketrace
Diffstat (limited to 'qooxdoo/source/class')
-rw-r--r-- | qooxdoo/source/class/Smokeping/Application.js | 92 | ||||
-rw-r--r-- | qooxdoo/source/class/Smokeping/GraphShadow.js | 94 | ||||
-rw-r--r-- | qooxdoo/source/class/Smokeping/Server.js | 76 | ||||
-rw-r--r-- | qooxdoo/source/class/Smokeping/ui/Graph.js | 107 | ||||
-rw-r--r-- | qooxdoo/source/class/Smokeping/ui/GraphList.js | 56 | ||||
-rw-r--r-- | qooxdoo/source/class/Smokeping/ui/LoadingAnimation.js | 52 | ||||
-rw-r--r-- | qooxdoo/source/class/Smokeping/ui/MPosition.js | 53 | ||||
-rw-r--r-- | qooxdoo/source/class/Smokeping/ui/Mover.js | 112 | ||||
-rw-r--r-- | qooxdoo/source/class/Smokeping/ui/Navigator.js | 110 | ||||
-rw-r--r-- | qooxdoo/source/class/Smokeping/ui/TargetTree.js | 85 | ||||
-rw-r--r-- | qooxdoo/source/class/Smokeping/ui/Zoomer.js | 194 | ||||
-rw-r--r-- | qooxdoo/source/class/Tr/Application.js | 90 | ||||
-rw-r--r-- | qooxdoo/source/class/Tr/Server.js | 74 | ||||
-rw-r--r-- | qooxdoo/source/class/Tr/ui/ActionButton.js | 196 | ||||
-rw-r--r-- | qooxdoo/source/class/Tr/ui/Cellrenderer.js | 46 | ||||
-rw-r--r-- | qooxdoo/source/class/Tr/ui/Footer.js | 45 | ||||
-rw-r--r-- | qooxdoo/source/class/Tr/ui/TraceTable.js | 214 |
17 files changed, 0 insertions, 1696 deletions
diff --git a/qooxdoo/source/class/Smokeping/Application.js b/qooxdoo/source/class/Smokeping/Application.js deleted file mode 100644 index 917b608..0000000 --- a/qooxdoo/source/class/Smokeping/Application.js +++ /dev/null @@ -1,92 +0,0 @@ -/* ************************************************************************ - -#module(Smokeping) -#resource(Smokeping.image:image) -#embed(Smokeping.image/*) - -************************************************************************ */ - -qx.Class.define('Smokeping.Application', -{ - extend: qx.application.Gui, - - members: - { - main: function() - { - var self=this; - this.base(arguments); - - qx.io.Alias.getInstance().add( - 'SP', qx.core.Setting.get('Smokeping.resourceUri') - ); - - // if we run with a file:// url make sure - // the app finds the smokeping service (smokeping.cgi) - Smokeping.Server.getInstance().setLocalUrl( - 'http://localhost/~oetiker/smq/' - ); - - var base_layout = new qx.ui.layout.VerticalBoxLayout(); - with(base_layout){ - setPadding(8); - setLocation(0,0); - setWidth('100%'); - setHeight('100%'); - setSpacing(10); - }; - base_layout.addToDocument(); - var title = new qx.ui.basic.Atom(this.tr('Smokeping Viewer')); - with(title){ - setTextColor('#b0b0b0'); - setFont(qx.ui.core.Font.fromString('16px bold sans-serif')); - } - base_layout.add(title); - - var splitpane = new qx.ui.splitpane.HorizontalSplitPane(200, '1*'); - splitpane.setEdge(0); - splitpane.setHeight('1*'); - splitpane.setShowKnob(true); - base_layout.add(splitpane); - - var tree = new Smokeping.ui.TargetTree(); - splitpane.addLeft(tree); - - var graphlist = new Smokeping.ui.GraphList(); - splitpane.addRight(graphlist); - - - }, - - close : function(e) - { - this.base(arguments); - // return "Smokeping Web UI: " - // + "Do you really want to close the application?"; - }, - - - terminate : function(e) { - this.base(arguments); - } - - /******************************************************************** - * Functional Block Methods - ********************************************************************/ - - }, - - - - - /* - ***************************************************************************** - SETTINGS - ***************************************************************************** - */ - - settings : { - 'Smokeping.resourceUri' : './resource' - } -}); - diff --git a/qooxdoo/source/class/Smokeping/GraphShadow.js b/qooxdoo/source/class/Smokeping/GraphShadow.js deleted file mode 100644 index 6460f48..0000000 --- a/qooxdoo/source/class/Smokeping/GraphShadow.js +++ /dev/null @@ -1,94 +0,0 @@ -/* ************************************************************************ -#module(Smokeping) -************************************************************************ */ - -/** - * The data representation of a Smokeping Graph - */ - -qx.Class.define('Smokeping.GraphShadow', -{ - extend: qx.core.Object, - /* - ***************************************************************************** - CONSTRUCTOR - ***************************************************************************** - */ - construct : function() { - this.base(arguments); - }, - - /* - ***************************************************************************** - MEMBERS - ***************************************************************************** - */ - properties: { - /** Width of the graph canvas in pixels */ - width : - { - check : "Number", - nullable : true, - themeable : false - }, - /** height of the graph canvas in pixels */ - height : - { - check : "Number", - nullable : true, - themeable : false - }, - /** start of the graph in seconds since 1970 */ - start : - { - check : "Number", - nullable : true, - themeable : false - }, - /** end of the graph in seconds since 1970 */ - end : - { - check : "Number", - nullable : true, - themeable : false - }, - /** upper border of the graph */ - top : - { - check : "Number", - nullable : true, - themeable : false - }, - /** bottom border of the graph */ - bottom : - { - check : "Number", - nullable : true, - themeable : false - }, - - /** url to the cgi which produces the graphs */ - cgi : - { - check : "String", - nullable : true, - themeable : false - }, - - /** which data source should we use for the graph */ - data : - { - check : "String", - nullable : true, - themeable : false - } - }, - members: { - getSrc: function(){ - with(this){ - return getCgi()+'?g='+getData()+';w='+getWidth()+';h='+getHeight()+';s='+getStart()+';e='+getEnd()+';t='+getTop()+';b='+getBottom(); - } - } - } -}); - diff --git a/qooxdoo/source/class/Smokeping/Server.js b/qooxdoo/source/class/Smokeping/Server.js deleted file mode 100644 index ebc938d..0000000 --- a/qooxdoo/source/class/Smokeping/Server.js +++ /dev/null @@ -1,76 +0,0 @@ -/* ************************************************************************ -#module(Smokeping) -************************************************************************ */ - -/** - * A smokeping specific rpc call which works - */ - -qx.Class.define('Smokeping.Server', -{ - extend: qx.io.remote.Rpc, - type: "singleton", - - /* - ***************************************************************************** - CONSTRUCTOR - ***************************************************************************** - */ - - /** - * @param local_url {String} When running the application in file:// mode. - * where will we find our RPC server. - */ - construct: function (local_url) { - - with(this){ - base(arguments); - setTimeout(7000000); - setUrl('smokeping.cgi'); - setServiceName('Smokeping'); - } - - return this; - }, - - /* - ***************************************************************************** - MEMBERS - ***************************************************************************** - */ - - members : - { - - /* - --------------------------------------------------------------------------- - CORE METHODS - --------------------------------------------------------------------------- - */ - - /** - * Tell about the BaseUrl we found. - * - * @type member - * - * @param {void} - * - * @return BaseUrl {Strings} - */ - - getBaseUrl: function(){ - return this.__base_url; - }, - - setLocalUrl: function(local_url){ - if ( document.location.host === '' ) { - with(this){ - setUrl(local_url+'smokeping.cgi'); - setCrossDomain(true); - } - } - } - - } -}); - diff --git a/qooxdoo/source/class/Smokeping/ui/Graph.js b/qooxdoo/source/class/Smokeping/ui/Graph.js deleted file mode 100644 index 506f158..0000000 --- a/qooxdoo/source/class/Smokeping/ui/Graph.js +++ /dev/null @@ -1,107 +0,0 @@ -/* ************************************************************************ -#module(Smokeping) -************************************************************************ */ - -/** - * a widget showing the smokeping graph overview - */ - -var Smokeping_ui_Graph_default_width = null; -var Smokeping_ui_Graph_default_height = null; - -qx.Class.define('Smokeping.ui.Graph', -{ - extend: qx.ui.layout.BoxLayout, - - /* - ***************************************************************************** - CONSTRUCTOR - ***************************************************************************** - */ - - /** - * @param object {file} What happens when the SNCF conductors tamazing. - * - */ - - construct: function (graph) { - this.base(arguments); - this._graph=graph; - if ( Smokeping_ui_Graph_default_width){ - this.setWidth( Smokeping_ui_Graph_default_width) - this.setHeight( Smokeping_ui_Graph_default_height); - } - else { - this.setWidth('auto'); - this.setHeight('auto'); - }; - this.set({ - border : new qx.ui.core.Border(1,'dotted','#ffffff'), - horizontalChildrenAlign: 'center', - verticalChildrenAlign: 'middle' - }); - this._highlight(); - var loader = new Smokeping.ui.LoadingAnimation(); - this.add(loader); - this._preloader = qx.io.image.PreloaderManager.getInstance().create(Smokeping.Server.getInstance().getUrl() - + '?g='+graph+';s=now-1d;e=now;t=100000;b=0;w=200;h=100'); - if (this._preloader.isLoaded()){ - qx.client.Timer.once(this._image_loader,this,0); - } else { - this._preloader.addEventListener('load', this._image_loader, this); - } - this.addEventListener('mouseover',this._highlight,this); - this.addEventListener('mouseout',this._unhighlight,this); - }, - - members: { - _image_loader: function(e) { - Smokeping_ui_Graph_default_width = this._preloader.getWidth(); - Smokeping_ui_Graph_default_height = this._preloader.getHeight(); - var image = new qx.ui.basic.Image(); - image.setPreloader(this._preloader); - qx.io.image.PreloaderManager.getInstance().remove(this._preloader); - with(this){ - removeAll(); - add(image); - addEventListener('click',this._open_navigator,this); - _unhighlight(); - } - }, - _open_navigator: function(e){ - with(this){ - setEnabled(false); - _unhighlight(); - this._window = new Smokeping.ui.Navigator(this._graph); - _window.addToDocument(); - _window.positionRelativeTo(getElement(),2,-4); - addEventListener('beforeDisappear',_kill_window,this); - _window.open(); - _window.addEventListener('beforeDisappear',_close_window,this); - } - }, - _close_window: function(e){ - this.setEnabled(true); - }, - _kill_window: function(e){ - this._window.close(); - this._window.dispose(); - }, - _highlight: function(e){ - this.setBackgroundColor('#f8f8f8'); - this.getBorder().set({ - color: '#808080' - }); - }, - _unhighlight: function(e){ - this.setBackgroundColor('transparent'); - this.getBorder().set({ - color: '#ffffff' - }); - } - } - - -}); - - diff --git a/qooxdoo/source/class/Smokeping/ui/GraphList.js b/qooxdoo/source/class/Smokeping/ui/GraphList.js deleted file mode 100644 index c49b601..0000000 --- a/qooxdoo/source/class/Smokeping/ui/GraphList.js +++ /dev/null @@ -1,56 +0,0 @@ -/* ************************************************************************ -#module(Smokeping) -************************************************************************ */ - -/** - * a widget showing the smokeping graph overview - */ - -qx.Class.define('Smokeping.ui.GraphList', -{ - extend: qx.ui.layout.FlowLayout, - - /* - ***************************************************************************** - CONSTRUCTOR - ***************************************************************************** - */ - - /** - * @param base_url {String} Path to the location of the image generator - * - */ - - construct: function () { - - with(this){ - base(arguments); - set({ - overflow: 'auto', - backgroundColor: 'white', - border: new qx.ui.core.Border(1,'solid','#a0a0a0'), - width: '100%', - height: '100%', - verticalSpacing: 10, - horizontalSpacing: 10, - padding: 10 - }) - }; - qx.event.message.Bus.subscribe('sp.menu.folder',this._load_graphs,this); - }, - - members: { - _load_graphs: function(m){ - var files = m.getData() - this.removeAll(); - for(var i=0;i<files.length;i++){ - var image = new Smokeping.ui.Graph(files[i]); - this.add(image); - } - } - } - - -}); - - diff --git a/qooxdoo/source/class/Smokeping/ui/LoadingAnimation.js b/qooxdoo/source/class/Smokeping/ui/LoadingAnimation.js deleted file mode 100644 index c06ccc4..0000000 --- a/qooxdoo/source/class/Smokeping/ui/LoadingAnimation.js +++ /dev/null @@ -1,52 +0,0 @@ -/* ************************************************************************ -#module(Smokeping) -************************************************************************ */ - -/** - * The widget showing a detail graph - */ - -qx.Class.define('Smokeping.ui.LoadingAnimation', -{ - extend: qx.ui.layout.CanvasLayout, - - /* - ***************************************************************************** - CONSTRUCTOR - ***************************************************************************** - */ - - /** - * @param graph_url {String} Url to the explorable graph - * - */ - - construct: function () { - this.base(arguments); - this.set({ - width: '100%', - height: '100%' - }); - var plane = new qx.ui.basic.Terminator(); - plane.set({ - width: '100%', - height: '100%', - backgroundColor: '#f0f0f0', - opacity: 1 - }); - this.add(plane); - - var centerbox = new qx.ui.layout.BoxLayout(); - centerbox.set({ - width: '100%', - height: '100%', - horizontalChildrenAlign: 'center', - verticalChildrenAlign: 'middle' - }); - var animation = new qx.ui.basic.Image(qx.io.Alias.getInstance().resolve('SP/image/ajax-loader.gif')); - centerbox.add(animation); - this.add(centerbox); - } -}); - - diff --git a/qooxdoo/source/class/Smokeping/ui/MPosition.js b/qooxdoo/source/class/Smokeping/ui/MPosition.js deleted file mode 100644 index 74b709d..0000000 --- a/qooxdoo/source/class/Smokeping/ui/MPosition.js +++ /dev/null @@ -1,53 +0,0 @@ -/* ************************************************************************ -#module(Smokeping) -************************************************************************ */ - -/** - * some mouse handling routines for thegraph mover and zoomer. - */ - -qx.Mixin.define('Smokeping.ui.MPosition', -{ - - members: { - _init_cache: function(){ - var el = this._target.getElement(); - this._page_left = qx.html.Location.getPageAreaLeft(el); - this._page_top = qx.html.Location.getPageAreaTop(el); - this._image_width = qx.html.Location.getPageAreaRight(el) - this._page_left; - this._image_height = qx.html.Location.getPageAreaBottom(el) - this._page_top ; - this._canvas_top = this._top; - this._canvas_left = this._image_width-this._width-this._right; - this._canvas_right = this._right; - this._canvas_bottom = this._image_height-this._height-this._top; - }, - - _get_mouse_y: function(e){ - var mouse_y = e.getPageY()-this._page_top; - - if (mouse_y < this._canvas_top) { - mouse_y = this._canvas_top; - } - if (mouse_y > this._canvas_top + this._height) { - mouse_y = this._canvas_top + this._height; - } - return mouse_y; - }, - - _get_mouse_x: function(e){ - var mouse_x = e.getPageX()-this._page_left; - - if (mouse_x < this._canvas_left) { - mouse_x = this._canvas_left; - } - if (mouse_x > this._canvas_left + this._width) { - mouse_x = this._canvas_left + this._width; - } - return mouse_x; - } - } - - -}); - - diff --git a/qooxdoo/source/class/Smokeping/ui/Mover.js b/qooxdoo/source/class/Smokeping/ui/Mover.js deleted file mode 100644 index 2d1d5f0..0000000 --- a/qooxdoo/source/class/Smokeping/ui/Mover.js +++ /dev/null @@ -1,112 +0,0 @@ -/* ************************************************************************ -#module(Smokeping) -************************************************************************ */ - -/** - * Lets you do google map like draging of the graph canvas along time axis - * - */ - -qx.Class.define('Smokeping.ui.Mover', -{ - extend: qx.ui.layout.CanvasLayout, - include: Smokeping.ui.MPosition, - - /* - ***************************************************************************** - CONSTRUCTOR - ***************************************************************************** - */ - - /** - * @param target {Widget} What surface should we base our selection on - * - * @param width {Integer} Width of the 'interesting' area of the target - * - * @param height {Integer} Height ot the 'interesting' area of the target - * - * @param right {Integer} Distance from the right edge - * - * @param top {Integer} Distance from the top - * - * The zoomer will not activate if the ctrl key is pressed. This allows - * for the Mover to act on these events - * - */ - - construct: function (target,src,width,height,top,right,start,end) { - this._target = target; - this._src = src; - this._width = width; - this._height = height; - this._top = top; - this._right = right; - this._start = start; - this._end = end; - with(this){ - base(arguments); - set({ - width: width, - height: height+17, - top: top-2, - right: right, - visibility: false, - overflow: 'hidden', - backgroundColor: 'white' - }); - } - // make the canvas large - - this._moveing = false; - this._target.addEventListener("mousedown", this._move_start,this); - this._target.addEventListener("mousemove", this._move_move,this); - this._target.addEventListener("mouseup", this._move_end,this); - }, - - members: { - _move_start: function(e){ - if (!e.isCtrlPressed()) return; - this._init_cache(); - this._moveing = true; - this._start_x = e.getPageX(); - this._target.setCapture(true); - this.removeAll(); - for (var i=0;i<4;i++){ - var duration = (this._end-this._start); - var tile = new qx.ui.basic.Image(); - tile.set({ - top: -(this._top-2), - left: -this._canvas_left, - clipTop: this._top-2, - clipLeft: this._canvas_left, - clipWidth: this._width, - width: this._width, - height: this._height+17, - left: this._width * i, - source: this._src+';w='+this._width+';h='+this._height+';s='+(this._start+(duration*(i-2)))+';e='+(this._end+(duration*(i-2))) - }); - this.add(tile); - } - this.setScrollLeft(2*this._width); - this.setVisibility(true); - this._move_move(e); - }, - - _move_move: function(e){ - if (this._target.getCapture() && this._moveing ){ - var drag_x = e.getPageX() - this._start_x; - this.setScrollLeft(-drag_x+this._width*2); - } - }, - _move_end: function(e){ - if (!this._moveing) return; - this._moveing = false; - this._target.setCapture(false); - this.setVisibility(false); - } - } - - -}); - - diff --git a/qooxdoo/source/class/Smokeping/ui/Navigator.js b/qooxdoo/source/class/Smokeping/ui/Navigator.js deleted file mode 100644 index eb799e7..0000000 --- a/qooxdoo/source/class/Smokeping/ui/Navigator.js +++ /dev/null @@ -1,110 +0,0 @@ -/* ************************************************************************ -#module(Smokeping) -************************************************************************ */ - -/** - * The widget showing a detail graph - */ - -qx.Class.define('Smokeping.ui.Navigator', -{ - extend: qx.ui.window.Window, - - /* - ***************************************************************************** - CONSTRUCTOR - ***************************************************************************** - */ - - /** - * @param graph_url {String} Url to the explorable graph - * - */ - - construct: function (graph) { - this._graph = graph; - with(this){ - base(arguments,tr("Smokeping Graph Navigator")); - set({ - showMaximize: false, - showMinimize: false, - width: 300, - height: 200, - minWidth: 300, - minHeight: 200, - backgroundColor: '#f0f0f0' - }); - } - this._graph_width = 300; - this._graph_height = 200; - this._lastrun = 0; - this._loader = new Smokeping.ui.LoadingAnimation(); - this._url = Smokeping.Server.getInstance().getUrl(); - this._update_image(); - }, - - members: { - // resizable objects have a changeWidth method - // which we can override to take part in the fun - // why I have to access this._graph_width without the this. - // in this case - _changeWidth: function(newWidth) { - var diff = newWidth - this.getBoxWidth(); - this.base(arguments, newWidth); - this.add(this._loader); - this._graph_width = this._graph_width + diff; - qx.client.Timer.once(this._update_image,this,250); - }, - - _changeHeight: function(newHeight) { - var diff = newHeight - this.getBoxHeight(); - this.base(arguments, newHeight); - this.add(this._loader); - this._graph_height = this._graph_height + diff; - qx.client.Timer.once(this._update_image,this,250); - - }, - - _get_url: function(){ - return this._url+ '?g='+this._graph+';s=now-1d;e=now;t=100000;b=0;w='+this._graph_width+';h='+this._graph_height; - }, - - _update_image: function(){ - var now = (new Date()).getTime(); - if (this._lastrun + 1000 < now) { - this._preloader = qx.io.image.PreloaderManager.getInstance().create(this._get_url()) - if (this._preloader.isLoaded()){ - qx.client.Timer.once(this._show_image,this,0); - } else { - this._preloader.addEventListener('load', this._show_image, this); - } - this._lastrun = now; - } - else { - this.debug('Skipping update since previous update less tahn 1 second') - } - }, - - _show_image: function(e){ - with(this){ - set({ - width: 'auto', - height: 'auto' - }); - var image = new qx.ui.basic.Image(); - image.setPreloader(this._preloader); - qx.io.image.PreloaderManager.getInstance().remove(this._preloader); - removeAll(); - add(image); - var zoomer = new Smokeping.ui.Zoomer(image,this._graph_width,this._graph_height,33,30); - add(zoomer); - var mover = new Smokeping.ui.Mover(image,this._url+ '?g='+this._graph,this._graph_width,this._graph_height,33,30,1201680005,1201686005); - add(mover); - } - } - } - - -}); - - diff --git a/qooxdoo/source/class/Smokeping/ui/TargetTree.js b/qooxdoo/source/class/Smokeping/ui/TargetTree.js deleted file mode 100644 index 0e97a08..0000000 --- a/qooxdoo/source/class/Smokeping/ui/TargetTree.js +++ /dev/null @@ -1,85 +0,0 @@ -/* ************************************************************************ -#module(Smokeping) -************************************************************************ */ - -/** - * a widget showing the smokeping target tree - */ - -qx.Class.define('Smokeping.ui.TargetTree', -{ - extend: qx.ui.tree.Tree, - - /* - ***************************************************************************** - CONSTRUCTOR - ***************************************************************************** - */ - - - construct: function () { - with(this){ - base(arguments,'root node'); - set({ - backgroundColor: 'white', - border: new qx.ui.core.Border(1,'solid','#a0a0a0'), - overflow: 'auto', - width: '100%', - height: '100%', - padding: 5, - hideNode: true - }); - getManager().addEventListener('changeSelection', this._send_event,this) - }; - var self = this; - var fill_tree = function(data,exc,id){ - if (exc == null){ - var nodes = data.length; - for(var i=0;i<nodes;i++){ - self._fill_folder(self,data[i]); - } - } - else { - alert(exc); - } - }; - Smokeping.Server.getInstance().callAsync(fill_tree,'get_tree'); - }, - - /* - ***************************************************************************** - Statics - ***************************************************************************** - */ - members: { - - _fill_folder: function(node,data){ - // in data[0] we have the id of the folder - var folder = new qx.ui.tree.TreeFolder(data[1]); - node.add(folder); - var files = new Array(); - var length = data.length; - for (var i=2;i<length;i++){ - if(qx.util.Validation.isValidArray(data[i])){ - this._fill_folder(folder,data[i]); - } else { - i++; // skip the node id for now - var file = new qx.ui.tree.TreeFile(data[i]); - files.push(data[i-1]); - folder.add(file); - } - } - folder.setUserData('ids',files); - }, - - _send_event: function(e) { - if (e.getData().length > 0) { - if ( e.getData()[0].basename == 'TreeFolder' ){ - qx.event.message.Bus.dispatch('sp.menu.folder',e.getData()[0].getUserData('ids')); - } - } - } - } -}); - - diff --git a/qooxdoo/source/class/Smokeping/ui/Zoomer.js b/qooxdoo/source/class/Smokeping/ui/Zoomer.js deleted file mode 100644 index 8d20d88..0000000 --- a/qooxdoo/source/class/Smokeping/ui/Zoomer.js +++ /dev/null @@ -1,194 +0,0 @@ -/* ************************************************************************ -#module(Smokeping) -************************************************************************ */ - -/** - * Lets you selcet an Area. Depending on the angel of your selection you get - * a time, a range or both. - * - */ - -qx.Class.define('Smokeping.ui.Zoomer', -{ - extend: qx.ui.layout.CanvasLayout, - - include: Smokeping.ui.MPosition, - /* - ***************************************************************************** - CONSTRUCTOR - ***************************************************************************** - */ - - /** - * @param target {Widget} What surface should we base our selection on - * - * @param width {Integer} Width of the 'interesting' area of the target - * - * @param height {Integer} Height ot the 'interesting' area of the target - * - * @param right {Integer} Distance from the right edge - * - * @param top {Integer} Distance from the top - * - * The zoomer will not activate if the ctrl key is pressed. This allows - * for the Mover to act on these events - * - */ - - construct: function (target,width,height,top,right) { - this._target = target; - this._width = width; - this._height = height+1; // some where the calc is 1 off. this fixes it - this._top = top; - this._right = right; - with(this){ - base(arguments); - set({ - width: '100%', - height: '100%', - visibility: false - }); - } - var zoomer_defaults = { - backgroundColor: 'black', - opacity: 0.1, - overflow: 'hidden' // important to make box go to 'zero height' on ie6 - }; - var dir = ['left','right','top','bottom' ]; - var z = []; - this._zoomer = z; - for(var i=0;i<dir.length;i++){ - z[dir[i]] = new qx.ui.basic.Terminator(); - z[dir[i]].set(zoomer_defaults); - this.add(z[dir[i]]); - } - - z['frame'] = new qx.ui.basic.Terminator(); - z['frame'].set(zoomer_defaults); - z['frame'].set({ - opacity: 1, - backgroundColor: 'transparent', - border: new qx.ui.core.Border(1,'dotted','#808080') - }); - - this.add(z['frame']); - this._zooming = false; // we are not curently in zoom mode - this._target.addEventListener("mousedown", this._zoom_start,this); - this._target.addEventListener("mousemove", this._zoom_move,this); - this._target.addEventListener("mouseup", this._zoom_end,this); - }, - - members: { - _zoom_start: function(e){ - if (e.isCtrlPressed()) return; - this._zooming = true; - var z = this._zoomer; - this._init_cache(); - - this._selector_start_x = this._get_mouse_x(e); - this._selector_start_y = this._get_mouse_y(e); - - this._target.setCapture(true); - this._zoom_move(e); - this.setVisibility(true); - }, - - _zoom_move: function(e){ - var z = this._zoomer; - if (this._target.getCapture() && this._zooming ){ - - var mouse_x = this._get_mouse_x(e); - - var mouse_left_x; - var mouse_right_x; - if (mouse_x > this._selector_start_x){ - mouse_left_x = this._selector_start_x; - mouse_right_x = mouse_x; - } - else { - mouse_right_x = this._selector_start_x; - mouse_left_x = mouse_x; - } - - var mouse_y = this._get_mouse_y(e); - var mouse_top_y; - var mouse_bottom_y; - if (mouse_y > this._selector_start_y){ - mouse_top_y = this._selector_start_y; - mouse_bottom_y = mouse_y; - } - else { - mouse_bottom_y = this._selector_start_y; - mouse_top_y = mouse_y; - } - - var time_sel = 1; - var range_sel = 1; - var pi = 3.14159265; - var angle = Math.atan ((mouse_right_x - mouse_left_x) / (mouse_bottom_y - mouse_top_y)); - if ( angle > Math.PI/2 * 0.85){ - range_sel = 0; - } - if ( angle < Math.PI/2 * 0.15){ - time_sel = 0; - } - - z['top'].set({ - left: time_sel ? mouse_left_x : this._canvas_left, - width: time_sel ? mouse_right_x - mouse_left_x : this._width, - top: 0, - height: range_sel ? mouse_top_y : this._canvas_top - }); - - z['bottom'].set({ - left: time_sel ? mouse_left_x : this._canvas_left, - width: time_sel ? mouse_right_x - mouse_left_x : this._width, - top: range_sel ? mouse_bottom_y : this._canvas_top + this._height, - height: range_sel ? this._image_height - mouse_bottom_y : this._canvas_bottom - }); - - z['left'].set({ - width: time_sel ? mouse_left_x: this._canvas_left, - height: this._image_height - }); - - z['right'].set({ - left: time_sel ? mouse_right_x : this._image_width - this._canvas_right, - width: time_sel ? this._image_width - mouse_right_x : this._canvas_right, - height: this._image_height - }); - z['frame'].set({ - left: time_sel ? mouse_left_x : this._canvas_left, - width: time_sel ? mouse_right_x - mouse_left_x : this._width, - top: range_sel ? mouse_top_y : this._canvas_top, - height: range_sel ? mouse_bottom_y - mouse_top_y : this._height - }); - } - }, - _zoom_end: function(e){ - if (!this._zooming) return; - var z = this._zoomer; - this._target.setCapture(false); - this.setVisibility(false); - this._zooming = false; - - if (z['bottom'].getTop() == z['top'].getTop()+z['top'].getHeight()){ - this._zoom_factor_top = 0; - this._zoom_factor_bottom = 0; - } - else { - var prev_factor = 1 - this._zoom_factor_top - this._zoom_factor_bottom; - this._zoom_factor_top = - (z['top'].getHeight()-this._canvas_top)/this._height * prev_factor - + this._zoom_factor_top; - this.zoom_factor_bottom = - (z['bottom'].getHeight()-this._canvas_bottom)/this._height * prev_factor - + this._zoom_factor_bottom; - } - } - } - - -}); - - diff --git a/qooxdoo/source/class/Tr/Application.js b/qooxdoo/source/class/Tr/Application.js deleted file mode 100644 index 79293e3..0000000 --- a/qooxdoo/source/class/Tr/Application.js +++ /dev/null @@ -1,90 +0,0 @@ -/* ************************************************************************ - -#module(Tr) -#resource(Tr.image:image) -#embed(Tr.image/*) - -************************************************************************ */ - -qx.Class.define('Tr.Application', -{ - extend: qx.application.Gui, - - members: - { - main: function() - { - var self=this; - this.base(arguments); - - qx.io.Alias.getInstance().add( - 'MT', qx.core.Setting.get('Tr.resourceUri') - ); - - // if we run with a file:// url make sure - // the app finds the Tr service (Tr.cgi) - - Tr.Server.getInstance().setLocalUrl( - 'http://johan.oetiker.ch/~oetiker/tr/' - ); - - var base_layout = new qx.ui.layout.VerticalBoxLayout(); - with(base_layout){ - setPadding(8); - setLocation(0,0); - setWidth('100%'); - setHeight('100%'); - setSpacing(2); - setBackgroundColor('white'); - }; - base_layout.addToDocument(); - var top = new qx.ui.layout.HorizontalBoxLayout(); - top.set({ - height: 'auto' - }); - var title = new qx.ui.basic.Atom('SmokeTrace 2.4.2'); - 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 Tr.ui.ActionButton()); - base_layout.add(top); - var trace = new Tr.ui.TraceTable(); - base_layout.add(trace); - base_layout.add(new Tr.ui.Footer(this.tr("SmokeTrace is part of the SmokePing suite created by Tobi Oetiker, Copyright 2008."),'http://oss.oetiker.ch/smokeping')); - }, - - close : function(e) - { - this.base(arguments); - // return "Tr Web UI: " - // + "Do you really want to close the application?"; - }, - - - terminate : function(e) { - this.base(arguments); - } - - /******************************************************************** - * Functional Block Methods - ********************************************************************/ - - }, - - - - - /* - ***************************************************************************** - SETTINGS - ***************************************************************************** - */ - - settings : { - 'Tr.resourceUri' : './resource' - } -}); - diff --git a/qooxdoo/source/class/Tr/Server.js b/qooxdoo/source/class/Tr/Server.js deleted file mode 100644 index f17e54b..0000000 --- a/qooxdoo/source/class/Tr/Server.js +++ /dev/null @@ -1,74 +0,0 @@ -/* ************************************************************************ -#module(Tr) -************************************************************************ */ - -/** - * A Tr specific rpc call which works - */ - -qx.Class.define('Tr.Server', { - extend: qx.io.remote.Rpc, - type: "singleton", - - /* - ***************************************************************************** - CONSTRUCTOR - ***************************************************************************** - */ - - /** - * @param local_url {String} When running the application in file:// mode. - * where will we find our RPC server. - */ - construct: function (local_url) { - - with(this){ - base(arguments); - setTimeout(7000000); - setUrl('tr.cgi'); - setServiceName('Tr'); - setCrossDomain(true); - } - - return this; - }, - - /* - ***************************************************************************** - MEMBERS - ***************************************************************************** - */ - - members : - { - - /* - --------------------------------------------------------------------------- - CORE METHODS - --------------------------------------------------------------------------- - */ - - /** - * Tell about the BaseUrl we found. - * - * @type member - * - * @param {void} - * - * @return BaseUrl {Strings} - */ - - getBaseUrl: function(){ - return this.__base_url; - }, - - setLocalUrl: function(local_url){ - if ( document.location.host === '' ) { - with(this){ - setUrl(local_url+'tr.cgi'); - } - } - } - - } -}); diff --git a/qooxdoo/source/class/Tr/ui/ActionButton.js b/qooxdoo/source/class/Tr/ui/ActionButton.js deleted file mode 100644 index 5633d99..0000000 --- a/qooxdoo/source/class/Tr/ui/ActionButton.js +++ /dev/null @@ -1,196 +0,0 @@ -/* ************************************************************************ -#module(Tr) -************************************************************************ */ - -/** - * a widget showing the Tr graph overview - */ - -qx.Class.define('Tr.ui.ActionButton', -{ - extend: qx.ui.layout.VerticalBoxLayout, - - /* - ***************************************************************************** - CONSTRUCTOR - ***************************************************************************** - */ - - construct: function () { - this.base(arguments); - - this.set({ - height: 'auto', - width: 'auto', - horizontalChildrenAlign: 'left' - }); - var hbox = new qx.ui.layout.HorizontalBoxLayout; - hbox.set({ - height: 'auto', - width: 'auto', - verticalChildrenAlign: 'middle' - }); - var lab1 = new qx.ui.basic.Label(this.tr("Host")); - lab1.set({ - paddingRight: 6 - }); - hbox.add(lab1); - var host = new qx.ui.form.TextField(); - host.set({ - width: 200, - height: 'auto', - border: 'dark-shadow', - padding: 1 - }); - hbox.add(host); - this.__host = host; - var lab2 = new qx.ui.basic.Label(this.tr("Delay")); - lab2.set({ - paddingRight: 6, - paddingLeft: 12 - }); - hbox.add(lab2); - var delay = new qx.ui.form.Spinner(1,2,60); - delay.set({ - border: 'dark-shadow', - width: 45 - }); - hbox.add(delay); - this.__delay = delay; - - var lab3 = new qx.ui.basic.Label(this.tr("Rounds")); - lab3.set({ - paddingRight: 6, - paddingLeft: 12 - }); - hbox.add(lab3); - var rounds = new qx.ui.form.Spinner(1,20,200); - rounds.set({ - border: 'dark-shadow', - width: 45 - }); - hbox.add(rounds); - this.__rounds = rounds; - - var button = new qx.ui.form.Button(''); - this.__button = button; - button.set({ - marginLeft: 10, - width: 60, - height: 'auto', - border: 'dark-shadow', - padding: 2 - }); - hbox.add(button); - this.add(hbox); - var info = new qx.ui.basic.Atom(); - info.set({ - marginTop: 3, - padding: 3, - textColor: 'red', - width: '100%', - height: 'auto', - backgroundColor: '#f0f0f0', - visibility: false - }); - qx.event.message.Bus.subscribe('tr.info',this.__set_info,this); - this.add(info); - this.__info = info; - - 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('tr.cmd',{ - action: button.getUserData('action'), - host: host.getValue(), - delay: delay.getValue(), - rounds: rounds.getValue() - }); - }; - -// var self=this; -// host.addEventListener('keyup',function(e){if(e.getKeyIdentifier() == 'Enter'){start_trace()}}); - host.addEventListener('execute',start_trace); - button.addEventListener('execute', start_trace ); - - var history = qx.client.History.getInstance(); - var history_action = function(event){ - var targ = event.getData(); - host.setValue(targ); - history.addToHistory(targ,'SmokeTrace to '+targ); - start_trace(); - } - 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,'SmokeTrace to '+initial_host); - // dispatch this task once all the initializations are done - qx.client.Timer.once(start_trace,this,0); - } - }, - - members: { - __set_info: function(e){ - this.__info.set({ - label: e.getData(), - visibility: true - }); - }, - __set_status: function(m){ - var host = this.__host; - var rounds = this.__rounds; - var delay = this.__delay; - with(this.__button){ - // this.debug(m.getData()); - switch(m.getData()){ - case 'starting': - if (getUserData('action') == 'go') { - setLabel(this.tr("Starting")); - this.__info.setVisibility(false); - border: 'dark-shadow' - setEnabled(false); - host.setEnabled(false); - rounds.setEnabled(false); - delay.setEnabled(false); - } - break; - case 'stopping': - if (getUserData('action') == 'stop') { - setLabel(this.tr("Stopping")); - setEnabled(false); - host.setEnabled(false); - rounds.setEnabled(false); - delay.setEnabled(false); - } - break; - case 'stopped': - setUserData('action','go'); - setLabel(this.tr("Go")); - setEnabled(true); - host.setEnabled(true); - rounds.setEnabled(true); - delay.setEnabled(true); - break; - case 'started': - setUserData('action','stop'); - setLabel(this.tr("Stop")); - setEnabled(true); - host.setEnabled(false); - rounds.setEnabled(false); - delay.setEnabled(false); - break; - default: - alert('Unknown Status Message: '+m.getData()); - } - } - } - } - - -}); - - diff --git a/qooxdoo/source/class/Tr/ui/Cellrenderer.js b/qooxdoo/source/class/Tr/ui/Cellrenderer.js deleted file mode 100644 index f18672d..0000000 --- a/qooxdoo/source/class/Tr/ui/Cellrenderer.js +++ /dev/null @@ -1,46 +0,0 @@ -/* ************************************************************************ - - Tr Frontend - - Author: - * Tobias Oetiker - -************************************************************************ */ -/* ************************************************************************ -#module(Tr) -************************************************************************ */ - -/** - * A configurable cell renderre - */ - -qx.Class.define('Tr.ui.Cellrenderer', -{ - extend: qx.ui.table.cellrenderer.Number, - /** - * Format a number with a configurable number of fraction digits - * and add optional pre and postfix. - * @param digits {Integer} how many digits should there be. Default is 0. - * @param prefix {String} optional prefix. - * @param postfix {String} optional postfix. - */ - - construct: function (digits,postfix,prefix) { - if (digits == undefined){ - digits = 0; - } - this.base(arguments) - var format = new qx.util.format.NumberFormat(); - format.set({ - maximumFractionDigits: digits, - minimumFractionDigits: digits - }); - if (postfix != undefined){ - format.setPostfix(postfix); - } - if (prefix != undefined){ - format.setPrefix(prefix); - } - this.setNumberFormat(format); - } -}); diff --git a/qooxdoo/source/class/Tr/ui/Footer.js b/qooxdoo/source/class/Tr/ui/Footer.js deleted file mode 100644 index 1882043..0000000 --- a/qooxdoo/source/class/Tr/ui/Footer.js +++ /dev/null @@ -1,45 +0,0 @@ -/* ************************************************************************ -#module(Tr) -************************************************************************ */ - -/** - * a widget showing the footer - */ - -qx.Class.define('Tr.ui.Footer', -{ - extend: qx.ui.layout.HorizontalBoxLayout, - - /* - ***************************************************************************** - CONSTRUCTOR - ***************************************************************************** - */ - - construct: function (text,url) { - this.base(arguments); - this.set({ - horizontalChildrenAlign: 'right', - height: 'auto' - }); - var logo = new qx.ui.form.Button(text); - logo.set({ - textColor: '#b0b0b0', - backgroundColor: null, - font: qx.ui.core.Font.fromString('10px sans-serif'), - border: null - }); - - logo.addEventListener('execute', function(e){ - var w = new qx.client.NativeWindow(url); - w.set({ - width: 1000, - height: 800 - }); - w.open() - }); - this.add(logo); - } -}); - - diff --git a/qooxdoo/source/class/Tr/ui/TraceTable.js b/qooxdoo/source/class/Tr/ui/TraceTable.js deleted file mode 100644 index 446cbad..0000000 --- a/qooxdoo/source/class/Tr/ui/TraceTable.js +++ /dev/null @@ -1,214 +0,0 @@ -/* ************************************************************************ -#module(Tr) -************************************************************************ */ - -/** - * a widget showing the Tr target tree - */ - -qx.Class.define('Tr.ui.TraceTable', -{ - extend: qx.ui.table.Table, - - /* - ***************************************************************************** - CONSTRUCTOR - ***************************************************************************** - */ - - - construct: function () { - - var tableModel = new qx.ui.table.model.Simple(); - this.__tableModel = tableModel; - tableModel.setColumns([ this.tr("Hop"), this.tr("Host"),this.tr("Ip"), - this.tr("Loss [%]"), this.tr("Sent"), this.tr("Last [ms]"), //"; help syntax highliter - this.tr("Avg [ms]"), this.tr("Best [ms]"), this.tr("Worst [ms]"), this.tr("StDev [ms]") ]); - var custom = { - tableColumnModel: function(obj) { - return new qx.ui.table.columnmodel.Resize(obj); - } - }; - with(this){ - base(arguments,tableModel,custom); - set({ - width: '100%', - height: '1*', - border: 'dark-shadow', - showCellFocusIndicator: false, - statusBarVisible: false - }); - }; - var tcm = this.getTableColumnModel(); - this.__tcm = tcm; - - tcm.setDataCellRenderer(0, new Tr.ui.Cellrenderer(1)); - tcm.setDataCellRenderer(3, new Tr.ui.Cellrenderer(0,' %')); - tcm.setDataCellRenderer(4, new Tr.ui.Cellrenderer(0)); - - var render_ms = new Tr.ui.Cellrenderer(1); - - for (var i=5;i<10;i++){ - tcm.setDataCellRenderer(i, render_ms); - } - - - // Obtain the behavior object to manipulate - var resizeBehavior = tcm.getBehavior(); - // This uses the set() method to set all attriutes at once; uses flex - resizeBehavior.set(0, { width:"2*"}); - resizeBehavior.set(1, { width:"9*"}); - resizeBehavior.set(2, { width:"5*"}); - - for (var i=3;i<10;i++){ - resizeBehavior.set(i, { width:"3*"}); - } - qx.event.message.Bus.subscribe('tr.cmd',this.__handle_tr,this); - }, - - /* - ***************************************************************************** - Statics - ***************************************************************************** - */ - members: { - __make_empty_row: function (){ - return ([undefined,undefined,undefined,0,0,undefined,undefined,undefined,undefined,undefined,0,0,0]); - }, - __stop_table: function (){ - var tableModel = this.__tableModel; - for (var i=0;i<10;i++){ - tableModel.setColumnSortable(i,true); - } - qx.event.message.Bus.dispatch('tr.status','stopped'); - this.__handle = undefined; - }, - __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('tr.status','started'); - } - self.__handle = retval['handle']; - var tableModel = self.__tableModel; - var lines = retval['output'].length; - var data = self.__data; - var sleep = 0; - for(var i=0;i<lines;i++){ - sleep = 0; - var hop = retval['output'][i][0]; - if (hop == 'SLEEP'){ - sleep = retval['output'][i][1]; - continue; - } - else if (hop == 'INFO'){ - qx.event.message.Bus.dispatch('tr.info',retval['output'][i][1]); - continue; - } - var host = retval['output'][i][1]; - var ip = retval['output'][i][2]; - var value = retval['output'][i][3]; - var ii = 0; - var max = data.length; - while (true){ - if ( ii == max ) break; - if ( Math.floor(data[ii][0]) > hop) break; - if ( Math.floor(data[ii][0]) == hop ){ - if ( ip == undefined ) break; - if ( ip == data[ii][2] ) break; - } - ii++; - } - if (ii == max || Math.floor(data[ii][0]) > hop ){ - if (ii > 0 && Math.floor(data[ii-1][0]) == hop ){ - hop = data[ii-1][0] + 0.1; - } - data.splice(ii,0,self.__make_empty_row()); - data[ii][0] = hop; - } - - var drow = data[ii]; - if (drow[f_host] == undefined && host != undefined){ - drow[f_host] = host; - } - if (drow[f_ip] == undefined && ip != undefined){ - drow[f_ip] = ip; - } - drow[f_snt]++; - drow[f_last] = value; - - - if (value != undefined){ - var best = drow[f_best]; - if (best == undefined || best > value){ - drow[f_best] = value; - } - var worst = drow[f_worst]; - if (worst == undefined || worst < value){ - drow[f_worst] = value; - } - drow[f_sum] += value; - var sum = drow[f_sum]; - drow[f_cnt] ++; - var cnt = drow[f_cnt]; - var sqsum = drow[f_sqsum]+value*value; - drow[f_sqsum] = sqsum; - drow[f_avg] = drow[f_sum]/drow[f_cnt]; - drow[f_stdev] = Math.sqrt((cnt*sqsum-sum*sum)/(cnt*(cnt-1))) - } - drow[f_loss] = ((drow[f_snt]-drow[f_cnt])/drow[f_snt])*100; - } - - tableModel.setData(data); - if (retval['again']){ - 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,sleep*1000); - } - else { - self.__stop_table(); - } - } - else { - alert(exc); - self.__stop_table(); - } - }; - - var stop_handler = function (data,exc,id){ - if (exc == null){ - qx.event.message.Bus.dispatch('tr.status','stopped'); - } - else { - alert(exc); - } - }; - - var cmd = m.getData(); - switch(cmd['action']){ - case 'stop': - qx.event.message.Bus.dispatch('tr.status','stopping'); - Tr.Server.getInstance().callAsync(stop_handler,'stop_tr',this.__handle); - break; - case 'go': - this.__data = []; - this.__tableModel.setData(this.__data); - this.__delay = cmd['delay']; - for (var i=0;i<10;i++){ - this.__tableModel.setColumnSortable(i,false); - } - 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']); - } - } - } -}); - - |