Update of /cvsroot/qooxdoo/qooxdoo/source/contributed/progressbar_olsson
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5189/progressbar_olsson
Modified Files:
Tag: renderer
ProgressBar_1.html QxProgressBar.js
Log Message:
dos2unix
Index: QxProgressBar.js
===================================================================
RCS file: /cvsroot/qooxdoo/qooxdoo/source/contributed/progressbar_olsson/Attic/QxProgressBar.js,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- QxProgressBar.js 24 Jan 2006 14:18:50 -0000 1.1.2.1
+++ QxProgressBar.js 3 Feb 2006 09:58:00 -0000 1.1.2.2
@@ -1,295 +1,295 @@
-/* ****************************************************************************
-
- qooxdoo - the new era of web interface development
-
- Version:
- $Id$
-
- Copyright:
- (C) 2004-2005 by Schlund + Partner AG, Germany
- All rights reserved
-
- License:
- LGPL 2.1: http://creativecommons.org/licenses/LGPL/2.1/
-
- Internet:
- * http://qooxdoo.oss.schlund.de
-
- Authors:
- * Kent Olsson (kols)
- <kent dot olsson at chello dot se>
-
-**************************************************************************** */
-
-/* ****************************************************************************
-
-#package(form)
-#require(QxRangeManager)
-#require(QxAtom)
-#require(QxTimer)
-
-**************************************************************************** */
-
-QxConst.DIRECTION_UP = "upward";
-QxConst.DIRECTION_RIGHT = "rightward";
-QxConst.DIRECTION_DOWN = "downward";
-QxConst.DIRECTION_LEFT = "leftward";
-
-QxTimer.prototype.wait = function(vMilliseconds)
-{
- var vExitTime = (new Date).valueOf() + vMilliseconds;
- var vCurrentTime;
-
- do {
- vCurrentTime = (new Date).valueOf();
- } while(vExitTime > vCurrentTime);
-};
-
-
-function QxProgressBar(vDirection, vMin, vMax) {
- QxCanvasLayout.call(this);
-
- this.setBorder(QxBorderObject.presets.inset);
- this.setBackgroundColor("white");
-
- // ***********************************************************************
- // RANGE MANAGER
- // ***********************************************************************
- this._manager = new QxRangeManager();
-
- // ***********************************************************************
- // BAR
- // ***********************************************************************
- var barA = this._bar = new QxAtom();
- barA.setBackgroundColor("red");
-
- this.add(barA);
-
- // ***********************************************************************
- // TEXT - removed later, to be replaced with QxFormattedText
- // ***********************************************************************
- var label = new QxText();
- label.setVerticalAlign("middle");
- label.setHorizontalAlign("center");
- label.setColor("white");
-
- this.add(label);
-
- this.setLabel(label);
-
- // ***********************************************************************
- // TIMER
- // ***********************************************************************
- this._timer = new QxTimer();
-
- // ***********************************************************************
- // EVENTS
- // ***********************************************************************
- this._manager.addEventListener(QxConst.INTERNAL_CHANGE, this._onchange, this);
-
- // ***********************************************************************
- // INITIALIZATION
- // ***********************************************************************
- if(QxUtil.isValidString(vDirection)) {
- this.setDirection(vDirection);
- };
-
- if(QxUtil.isValidNumber(vMin)) {
- this.setMin(vMin);
- };
-
- if(QxUtil.isValidNumber(vMax)) {
- this.setMax(vMax);
- };
-};
-
-QxProgressBar.extend(QxCanvasLayout, "QxProgressBar");
-
-/*
-------------------------------------------------------------------------------------
- PROPERTIES
-------------------------------------------------------------------------------------
-*/
-
-/*!
- The direction of growth of the bar.
-*/
-QxProgressBar.addProperty({ name : "direction", type : QxConst.TYPEOF_STRING, possibleValues : [ QxConst.DIRECTION_LEFT, QxConst.DIRECTION_UP, QxConst.DIRECTION_RIGHT, QxConst.DIRECTION_DOWN], defaultValue : QxConst.DIRECTION_RIGHT });
-
-/*!
- The label object.
-*/
-QxProgressBar.addProperty({ name : "label", type : QxConst.TYPEOF_OBJECT, allowNull : true }); //instance : QxFormatField
-
-/*!
- The amount to increment on each call to the function increment.
-*/
-QxProgressBar.addProperty({ name : "incrementAmount", type : QxConst.TYPEOF_NUMBER, defaultValue : 1 });
-
-/*!
- An indeterminate progress bar indicating that an operation of unknown duration is occurring.
-*/
-QxProgressBar.addProperty({ name : "indeterminate", type : QxConst.TYPEOF_BOOLEAN, defaultValue : false });
-
-/*!
- The current value of the wait (this should be used internally only).
-*/
-QxProgressBar.addProperty({ name : "wait", type : QxConst.TYPEOF_NUMBER, defaultValue : 0 });
-
-
-/*
-------------------------------------------------------------------------------------
- OTHER EVENT-HANDLING
-------------------------------------------------------------------------------------
-*/
-
-proto._onchange = function(e)
-{
- if(this.getParent())
- {
- if(this.getIndeterminate())
- {
- }
- else
- {
- var barSizePercent = this.getValue()/this.getMax();
- var barSize;
-
- switch(this.getDirection())
- {
- case QxConst.DIRECTION_LEFT :
- barSize = Math.floor(barSizePercent * this.getInnerWidth());
- this._bar.setHeight(this.getInnerHeight());
- this._bar.setLeft(this.getInnerWidth() - barSize);
- this._bar.setWidth(barSize);
- break;
-
- case QxConst.DIRECTION_RIGHT :
- barSize = Math.floor(barSizePercent * this.getInnerWidth());
- this._bar.setHeight(this.getInnerHeight());
- this._bar.setWidth(barSize);
- break;
-
- case QxConst.DIRECTION_UP :
- barSize = Math.floor(barSizePercent * this.getInnerHeight());
- this._bar.setHeight(barSize);
- this._bar.setTop(this.getInnerHeight() - barSize);
- this._bar.setWidth(this.getInnerWidth());
- break;
-
- case QxConst.DIRECTION_DOWN :
- barSize = Math.floor(barSizePercent * this.getInnerHeight());
- this._bar.setHeight(barSize);
- this._bar.setWidth(this.getInnerWidth());
- break;
- };
- };
-
- this.getLabel().setText(Math.round(100 * barSizePercent) + '%');
-
- QxWidget.flushGlobalQueues();
-
- this._timer.wait(this.getWait());
-
- if (this.hasEventListeners(QxConst.INTERNAL_CHANGE))
- {
- this.dispatchEvent(new QxEvent(QxConst.INTERNAL_CHANGE));
- };
- };
-};
-
-/*
-------------------------------------------------------------------------------------
- MAPPING TO RANGE MANAGER
-------------------------------------------------------------------------------------
-*/
-
-proto.setValue = function(nValue)
-{
- this._manager.setValue(nValue);
-};
-
-proto.getValue = function()
-{
- return this._manager.getValue();
-};
-
-proto.resetValue = function()
-{
- return this._manager.resetValue();
-};
-
-proto.setMax = function(vMax)
-{
- return this._manager.setMax(vMax);
-};
-
-proto.getMax = function()
-{
- return this._manager.getMax();
-};
-
-proto.setMin = function(vMin)
-{
- return this._manager.setMin(vMin);
-};
-
-proto.getMin = function()
-{
- return this._manager.getMin();
-};
-
-/*
-------------------------------------------------------------------------------------
- UTILITIES
-------------------------------------------------------------------------------------
-*/
-
-proto.increment = function()
-{
- var value = this.getValue() + this.getIncrementAmount();
-
- if(value < this.getMax())
- {
- this.setValue(value);
- }
- else
- {
- this.setValue(this.getMax());
- };
-};
-
-/*
-------------------------------------------------------------------------------------
- DISPOSER
-------------------------------------------------------------------------------------
-*/
-
-proto.dispose = function()
-{
- if (this.getDisposed()) {
- return true;
- };
-
- if (this._timer)
- {
- this._timer.stop();
- this._timer.dispose();
- this._timer = null;
- };
-
- if (this._manager)
- {
- this._manager.removeEventListener(QxConst.INTERNAL_CHANGE, this._onchange, this);
- this._manager.dispose();
- this._manager = null;
- };
-
- if (this._bar)
- {
- this._bar.dispose();
- this._bar = null;
- };
-
- return QxCanvasLayout.prototype.dispose.call(this);
+/* ****************************************************************************
+
+ qooxdoo - the new era of web interface development
+
+ Version:
+ $Id$
+
+ Copyright:
+ (C) 2004-2005 by Schlund + Partner AG, Germany
+ All rights reserved
+
+ License:
+ LGPL 2.1: http://creativecommons.org/licenses/LGPL/2.1/
+
+ Internet:
+ * http://qooxdoo.oss.schlund.de
+
+ Authors:
+ * Kent Olsson (kols)
+ <kent dot olsson at chello dot se>
+
+**************************************************************************** */
+
+/* ****************************************************************************
+
+#package(form)
+#require(QxRangeManager)
+#require(QxAtom)
+#require(QxTimer)
+
+**************************************************************************** */
+
+QxConst.DIRECTION_UP = "upward";
+QxConst.DIRECTION_RIGHT = "rightward";
+QxConst.DIRECTION_DOWN = "downward";
+QxConst.DIRECTION_LEFT = "leftward";
+
+QxTimer.prototype.wait = function(vMilliseconds)
+{
+ var vExitTime = (new Date).valueOf() + vMilliseconds;
+ var vCurrentTime;
+
+ do {
+ vCurrentTime = (new Date).valueOf();
+ } while(vExitTime > vCurrentTime);
+};
+
+
+function QxProgressBar(vDirection, vMin, vMax) {
+ QxCanvasLayout.call(this);
+
+ this.setBorder(QxBorderObject.presets.inset);
+ this.setBackgroundColor("white");
+
+ // ***********************************************************************
+ // RANGE MANAGER
+ // ***********************************************************************
+ this._manager = new QxRangeManager();
+
+ // ***********************************************************************
+ // BAR
+ // ***********************************************************************
+ var barA = this._bar = new QxAtom();
+ barA.setBackgroundColor("red");
+
+ this.add(barA);
+
+ // ***********************************************************************
+ // TEXT - removed later, to be replaced with QxFormattedText
+ // ***********************************************************************
+ var label = new QxText();
+ label.setVerticalAlign("middle");
+ label.setHorizontalAlign("center");
+ label.setColor("white");
+
+ this.add(label);
+
+ this.setLabel(label);
+
+ // ***********************************************************************
+ // TIMER
+ // ***********************************************************************
+ this._timer = new QxTimer();
+
+ // ***********************************************************************
+ // EVENTS
+ // ***********************************************************************
+ this._manager.addEventListener(QxConst.INTERNAL_CHANGE, this._onchange, this);
+
+ // ***********************************************************************
+ // INITIALIZATION
+ // ***********************************************************************
+ if(QxUtil.isValidString(vDirection)) {
+ this.setDirection(vDirection);
+ };
+
+ if(QxUtil.isValidNumber(vMin)) {
+ this.setMin(vMin);
+ };
+
+ if(QxUtil.isValidNumber(vMax)) {
+ this.setMax(vMax);
+ };
+};
+
+QxProgressBar.extend(QxCanvasLayout, "QxProgressBar");
+
+/*
+------------------------------------------------------------------------------------
+ PROPERTIES
+------------------------------------------------------------------------------------
+*/
+
+/*!
+ The direction of growth of the bar.
+*/
+QxProgressBar.addProperty({ name : "direction", type : QxConst.TYPEOF_STRING, possibleValues : [ QxConst.DIRECTION_LEFT, QxConst.DIRECTION_UP, QxConst.DIRECTION_RIGHT, QxConst.DIRECTION_DOWN], defaultValue : QxConst.DIRECTION_RIGHT });
+
+/*!
+ The label object.
+*/
+QxProgressBar.addProperty({ name : "label", type : QxConst.TYPEOF_OBJECT, allowNull : true }); //instance : QxFormatField
+
+/*!
+ The amount to increment on each call to the function increment.
+*/
+QxProgressBar.addProperty({ name : "incrementAmount", type : QxConst.TYPEOF_NUMBER, defaultValue : 1 });
+
+/*!
+ An indeterminate progress bar indicating that an operation of unknown duration is occurring.
+*/
+QxProgressBar.addProperty({ name : "indeterminate", type : QxConst.TYPEOF_BOOLEAN, defaultValue : false });
+
+/*!
+ The current value of the wait (this should be used internally only).
+*/
+QxProgressBar.addProperty({ name : "wait", type : QxConst.TYPEOF_NUMBER, defaultValue : 0 });
+
+
+/*
+------------------------------------------------------------------------------------
+ OTHER EVENT-HANDLING
+------------------------------------------------------------------------------------
+*/
+
+proto._onchange = function(e)
+{
+ if(this.getParent())
+ {
+ if(this.getIndeterminate())
+ {
+ }
+ else
+ {
+ var barSizePercent = this.getValue()/this.getMax();
+ var barSize;
+
+ switch(this.getDirection())
+ {
+ case QxConst.DIRECTION_LEFT :
+ barSize = Math.floor(barSizePercent * this.getInnerWidth());
+ this._bar.setHeight(this.getInnerHeight());
+ this._bar.setLeft(this.getInnerWidth() - barSize);
+ this._bar.setWidth(barSize);
+ break;
+
+ case QxConst.DIRECTION_RIGHT :
+ barSize = Math.floor(barSizePercent * this.getInnerWidth());
+ this._bar.setHeight(this.getInnerHeight());
+ this._bar.setWidth(barSize);
+ break;
+
+ case QxConst.DIRECTION_UP :
+ barSize = Math.floor(barSizePercent * this.getInnerHeight());
+ this._bar.setHeight(barSize);
+ this._bar.setTop(this.getInnerHeight() - barSize);
+ this._bar.setWidth(this.getInnerWidth());
+ break;
+
+ case QxConst.DIRECTION_DOWN :
+ barSize = Math.floor(barSizePercent * this.getInnerHeight());
+ this._bar.setHeight(barSize);
+ this._bar.setWidth(this.getInnerWidth());
+ break;
+ };
+ };
+
+ this.getLabel().setText(Math.round(100 * barSizePercent) + '%');
+
+ QxWidget.flushGlobalQueues();
+
+ this._timer.wait(this.getWait());
+
+ if (this.hasEventListeners(QxConst.INTERNAL_CHANGE))
+ {
+ this.dispatchEvent(new QxEvent(QxConst.INTERNAL_CHANGE));
+ };
+ };
+};
+
+/*
+------------------------------------------------------------------------------------
+ MAPPING TO RANGE MANAGER
+------------------------------------------------------------------------------------
+*/
+
+proto.setValue = function(nValue)
+{
+ this._manager.setValue(nValue);
+};
+
+proto.getValue = function()
+{
+ return this._manager.getValue();
+};
+
+proto.resetValue = function()
+{
+ return this._manager.resetValue();
+};
+
+proto.setMax = function(vMax)
+{
+ return this._manager.setMax(vMax);
+};
+
+proto.getMax = function()
+{
+ return this._manager.getMax();
+};
+
+proto.setMin = function(vMin)
+{
+ return this._manager.setMin(vMin);
+};
+
+proto.getMin = function()
+{
+ return this._manager.getMin();
+};
+
+/*
+------------------------------------------------------------------------------------
+ UTILITIES
+------------------------------------------------------------------------------------
+*/
+
+proto.increment = function()
+{
+ var value = this.getValue() + this.getIncrementAmount();
+
+ if(value < this.getMax())
+ {
+ this.setValue(value);
+ }
+ else
+ {
+ this.setValue(this.getMax());
+ };
+};
+
+/*
+------------------------------------------------------------------------------------
+ DISPOSER
+------------------------------------------------------------------------------------
+*/
+
+proto.dispose = function()
+{
+ if (this.getDisposed()) {
+ return true;
+ };
+
+ if (this._timer)
+ {
+ this._timer.stop();
+ this._timer.dispose();
+ this._timer = null;
+ };
+
+ if (this._manager)
+ {
+ this._manager.removeEventListener(QxConst.INTERNAL_CHANGE, this._onchange, this);
+ this._manager.dispose();
+ this._manager = null;
+ };
+
+ if (this._bar)
+ {
+ this._bar.dispose();
+ this._bar = null;
+ };
+
+ return QxCanvasLayout.prototype.dispose.call(this);
};
\ No newline at end of file
Index: ProgressBar_1.html
===================================================================
RCS file: /cvsroot/qooxdoo/qooxdoo/source/contributed/progressbar_olsson/Attic/ProgressBar_1.html,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- ProgressBar_1.html 24 Jan 2006 14:18:50 -0000 1.1.2.1
+++ ProgressBar_1.html 3 Feb 2006 09:58:00 -0000 1.1.2.2
@@ -1,77 +1,77 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
-<head>
- <script type="text/javascript">window._htmlstart=(new Date).valueOf()</script>
-
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
- <meta http-equiv="MsThemeCompatible" content="yes" />
- <meta http-equiv="ImageToolBar" content="no" />
- <meta name="MSSmartTagsPreventParsing" content="yes" />
-
- <title>qooxdoo demo dev</title>
- <link type="text/css" rel="stylesheet" href="../../style/qooxdoo.css"/>
- <link type="text/css" rel="stylesheet" href="../../style/demolayout.css"/>
-
- <script type="text/javascript" src="../../../tools/script/includer.js"></script>
- <script type="text/javascript" src="QxProgressBar.js"></script>
-</head>
-<body>
- <script type="text/javascript" src="../../../tools/script/demolayout.js"></script>
-
- <div id="testDescription">
- <p>Testing ProgressBar implementation.</p>
- <p>The elements of the progress bar will be created on the first open of the QxProgressBar.</p>
- </div>
-
- <script type="text/javascript">
- window.application.main = function()
- {
- var doc = this.getClientWindow().getClientDocument();
-
- // Create components
- var progressPB1 = new QxProgressBar(QxConst.DIRECTION_RIGHT, 1, 100);
- progressPB1.setTop(50);
- progressPB1.setLeft(50);
- progressPB1.setHeight(20);
- progressPB1.setWidth(100);
- progressPB1.setWait(1000);
-
- var progressPB2 = new QxProgressBar(QxConst.DIRECTION_DOWN, 1, 100);
- progressPB2.setTop(50);
- progressPB2.setLeft(200);
- progressPB2.setHeight(100);
- progressPB2.setWidth(20);
-
- var progressPB3 = new QxProgressBar(QxConst.DIRECTION_LEFT, 1, 100);
- progressPB3.setTop(200);
- progressPB3.setLeft(50);
- progressPB3.setHeight(20);
- progressPB3.setWidth(100);
- progressPB3.setWait(5000);
-
- var progressPB4 = new QxProgressBar(QxConst.DIRECTION_UP, 1, 100);
- progressPB4.setTop(200);
- progressPB4.setLeft(200);
- progressPB4.setHeight(100);
- progressPB4.setWidth(20);
-
- var progressPB5 = new QxProgressBar(QxConst.DIRECTION_RIGHT, 1, 100);
- progressPB5.setIndeterminate(true);
- progressPB5.setTop(400);
- progressPB5.setLeft(50);
- progressPB5.setHeight(30);
- progressPB5.setWidth(200);
-
- doc.add(progressPB1, progressPB2, progressPB3, progressPB4, progressPB5);
-
- for(var i=1; i<=100; i++) {
- progressPB1.setValue(i);
- progressPB2.setValue(i);
- progressPB3.setValue(i);
- progressPB4.setValue(i);
- };
- };
- </script>
-</body>
-</html>
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
+<head>
+ <script type="text/javascript">window._htmlstart=(new Date).valueOf()</script>
+
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
+ <meta http-equiv="MsThemeCompatible" content="yes" />
+ <meta http-equiv="ImageToolBar" content="no" />
+ <meta name="MSSmartTagsPreventParsing" content="yes" />
+
+ <title>qooxdoo demo dev</title>
+ <link type="text/css" rel="stylesheet" href="../../style/qooxdoo.css"/>
+ <link type="text/css" rel="stylesheet" href="../../style/demolayout.css"/>
+
+ <script type="text/javascript" src="../../../tools/script/includer.js"></script>
+ <script type="text/javascript" src="QxProgressBar.js"></script>
+</head>
+<body>
+ <script type="text/javascript" src="../../../tools/script/demolayout.js"></script>
+
+ <div id="testDescription">
+ <p>Testing ProgressBar implementation.</p>
+ <p>The elements of the progress bar will be created on the first open of the QxProgressBar.</p>
+ </div>
+
+ <script type="text/javascript">
+ window.application.main = function()
+ {
+ var doc = this.getClientWindow().getClientDocument();
+
+ // Create components
+ var progressPB1 = new QxProgressBar(QxConst.DIRECTION_RIGHT, 1, 100);
+ progressPB1.setTop(50);
+ progressPB1.setLeft(50);
+ progressPB1.setHeight(20);
+ progressPB1.setWidth(100);
+ progressPB1.setWait(1000);
+
+ var progressPB2 = new QxProgressBar(QxConst.DIRECTION_DOWN, 1, 100);
+ progressPB2.setTop(50);
+ progressPB2.setLeft(200);
+ progressPB2.setHeight(100);
+ progressPB2.setWidth(20);
+
+ var progressPB3 = new QxProgressBar(QxConst.DIRECTION_LEFT, 1, 100);
+ progressPB3.setTop(200);
+ progressPB3.setLeft(50);
+ progressPB3.setHeight(20);
+ progressPB3.setWidth(100);
+ progressPB3.setWait(5000);
+
+ var progressPB4 = new QxProgressBar(QxConst.DIRECTION_UP, 1, 100);
+ progressPB4.setTop(200);
+ progressPB4.setLeft(200);
+ progressPB4.setHeight(100);
+ progressPB4.setWidth(20);
+
+ var progressPB5 = new QxProgressBar(QxConst.DIRECTION_RIGHT, 1, 100);
+ progressPB5.setIndeterminate(true);
+ progressPB5.setTop(400);
+ progressPB5.setLeft(50);
+ progressPB5.setHeight(30);
+ progressPB5.setWidth(200);
+
+ doc.add(progressPB1, progressPB2, progressPB3, progressPB4, progressPB5);
+
+ for(var i=1; i<=100; i++) {
+ progressPB1.setValue(i);
+ progressPB2.setValue(i);
+ progressPB3.setValue(i);
+ progressPB4.setValue(i);
+ };
+ };
+ </script>
+</body>
+</html>
|