From 55490b1bfb539386b63e25a8fd90e56c0200c1e8 Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Tue, 23 Aug 2011 13:59:15 +0000 Subject: clean out smoketrace --- qooxdoo/source/class/Smokeping/Application.js | 92 ---------- qooxdoo/source/class/Smokeping/GraphShadow.js | 94 ---------- qooxdoo/source/class/Smokeping/Server.js | 76 -------- qooxdoo/source/class/Smokeping/ui/Graph.js | 107 ------------ qooxdoo/source/class/Smokeping/ui/GraphList.js | 56 ------ .../source/class/Smokeping/ui/LoadingAnimation.js | 52 ------ qooxdoo/source/class/Smokeping/ui/MPosition.js | 53 ------ qooxdoo/source/class/Smokeping/ui/Mover.js | 112 ------------ qooxdoo/source/class/Smokeping/ui/Navigator.js | 110 ------------ qooxdoo/source/class/Smokeping/ui/TargetTree.js | 85 --------- qooxdoo/source/class/Smokeping/ui/Zoomer.js | 194 --------------------- 11 files changed, 1031 deletions(-) delete mode 100644 qooxdoo/source/class/Smokeping/Application.js delete mode 100644 qooxdoo/source/class/Smokeping/GraphShadow.js delete mode 100644 qooxdoo/source/class/Smokeping/Server.js delete mode 100644 qooxdoo/source/class/Smokeping/ui/Graph.js delete mode 100644 qooxdoo/source/class/Smokeping/ui/GraphList.js delete mode 100644 qooxdoo/source/class/Smokeping/ui/LoadingAnimation.js delete mode 100644 qooxdoo/source/class/Smokeping/ui/MPosition.js delete mode 100644 qooxdoo/source/class/Smokeping/ui/Mover.js delete mode 100644 qooxdoo/source/class/Smokeping/ui/Navigator.js delete mode 100644 qooxdoo/source/class/Smokeping/ui/TargetTree.js delete mode 100644 qooxdoo/source/class/Smokeping/ui/Zoomer.js (limited to 'qooxdoo/source/class/Smokeping') 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 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 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 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; - } - } - } - - -}); - - -- cgit v1.2.3-24-g4f1b