summaryrefslogtreecommitdiffstats
path: root/qooxdoo/source
diff options
context:
space:
mode:
authorTobi Oetiker <tobi@oetiker.ch>2007-11-21 20:14:50 +0100
committerTobi Oetiker <tobi@oetiker.ch>2007-11-21 20:14:50 +0100
commit6dbc90c295cb0fbf895ac259dabf9dfa22cbe803 (patch)
treeb6332abd85e3556e59054e1f378b34c41be50320 /qooxdoo/source
parent97e7c02aa1ba779325072cdb8dba96f3454de584 (diff)
downloadsmokeping-6dbc90c295cb0fbf895ac259dabf9dfa22cbe803.tar.gz
smokeping-6dbc90c295cb0fbf895ac259dabf9dfa22cbe803.tar.xz
jres2007 work
Diffstat (limited to 'qooxdoo/source')
-rw-r--r--qooxdoo/source/class/Smokeping/Application.js11
-rw-r--r--qooxdoo/source/class/Smokeping/ui/Navigator.js2
-rw-r--r--qooxdoo/source/class/Smokeping/ui/Zoomer.js48
-rwxr-xr-xqooxdoo/source/grapher.cgi15
4 files changed, 28 insertions, 48 deletions
diff --git a/qooxdoo/source/class/Smokeping/Application.js b/qooxdoo/source/class/Smokeping/Application.js
index a84773a..4494930 100644
--- a/qooxdoo/source/class/Smokeping/Application.js
+++ b/qooxdoo/source/class/Smokeping/Application.js
@@ -6,8 +6,8 @@
************************************************************************ */
-qx.Class.define(
- 'Smokeping.Application', {
+qx.Class.define('Smokeping.Application',
+{
extend: qx.application.Gui,
members:
@@ -22,8 +22,8 @@ qx.Class.define(
);
// this will provide access to the server side of this app
-// var rpc = new Smokeping.io.Rpc('http://localhost/~oetiker/smq/');
- var rpc = new Smokeping.io.Rpc('http://johan.oetiker.ch/~oetiker/smq/');
+ var rpc = new Smokeping.io.Rpc('http://localhost/~oetiker/smq/');
+// var rpc = new Smokeping.io.Rpc('http://johan.oetiker.ch/~oetiker/smq/');
var base_url = rpc.getBaseUrl();
@@ -88,6 +88,5 @@ qx.Class.define(
settings : {
'Smokeping.resourceUri' : './resource'
}
- }
-);
+});
diff --git a/qooxdoo/source/class/Smokeping/ui/Navigator.js b/qooxdoo/source/class/Smokeping/ui/Navigator.js
index 4563115..d568e68 100644
--- a/qooxdoo/source/class/Smokeping/ui/Navigator.js
+++ b/qooxdoo/source/class/Smokeping/ui/Navigator.js
@@ -90,6 +90,8 @@ qx.Class.define('Smokeping.ui.Navigator',
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._graph_src,this._graph_width,this._graph_height,33,30);
+ add(mover);
}
}
}
diff --git a/qooxdoo/source/class/Smokeping/ui/Zoomer.js b/qooxdoo/source/class/Smokeping/ui/Zoomer.js
index fcc3559..8d20d88 100644
--- a/qooxdoo/source/class/Smokeping/ui/Zoomer.js
+++ b/qooxdoo/source/class/Smokeping/ui/Zoomer.js
@@ -12,6 +12,7 @@ qx.Class.define('Smokeping.ui.Zoomer',
{
extend: qx.ui.layout.CanvasLayout,
+ include: Smokeping.ui.MPosition,
/*
*****************************************************************************
CONSTRUCTOR
@@ -29,6 +30,9 @@ qx.Class.define('Smokeping.ui.Zoomer',
*
* @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) {
@@ -68,50 +72,16 @@ qx.Class.define('Smokeping.ui.Zoomer',
});
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: {
- _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;
- },
-
_zoom_start: function(e){
+ if (e.isCtrlPressed()) return;
+ this._zooming = true;
var z = this._zoomer;
this._init_cache();
@@ -125,7 +95,7 @@ qx.Class.define('Smokeping.ui.Zoomer',
_zoom_move: function(e){
var z = this._zoomer;
- if (this._target.getCapture()){
+ if (this._target.getCapture() && this._zooming ){
var mouse_x = this._get_mouse_x(e);
@@ -196,9 +166,11 @@ qx.Class.define('Smokeping.ui.Zoomer',
}
},
_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;
diff --git a/qooxdoo/source/grapher.cgi b/qooxdoo/source/grapher.cgi
index 47ce8db..dcc87ed 100755
--- a/qooxdoo/source/grapher.cgi
+++ b/qooxdoo/source/grapher.cgi
@@ -28,14 +28,21 @@ sub main()
# while (my $q = new CGI::Fast) {
my $q = new CGI;
my $graph = $q->param('g');
- my $width = $q->param('w') || 300;
- my $height = $q->param('h') || 150;
+ my $width = $q->param('w');
+ my $height = $q->param('h');
+ my $start = $q->param('s');
+ my $end = $q->param('e');
+ my $top = $q->param('t');
+ my $bottom = $q->param('b');
warn "groesse: $width $height\n";
RRDs::graph("/tmp/$$.tmpgraph",
'--title' => "Demo ".$graph,
'--vertical-label' => "Bytes/s",
- '--start' => '20071101',
- '--end' => '20071112',
+ '--start' => $start,
+ '--end' => $end,
+ '--upper-limit' => $top,
+ '--lower-limit' => $bottom,
+ '--riggid',
# '--zoom' => '0.75',
'--width' => $width,
'--height' => $height,