You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2013/06/28 22:59:08 UTC
git commit: [flex-asjs] [refs/heads/develop] - Early version of
NumericStepper for JavaScript. Internal layout needs work and is missing some
properties.
Updated Branches:
refs/heads/develop b82ee1a04 -> 65dd0552b
Early version of NumericStepper for JavaScript. Internal layout needs work and is missing some properties.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/65dd0552
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/65dd0552
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/65dd0552
Branch: refs/heads/develop
Commit: 65dd0552bcbb2e8c42869206996bf6a13e57c836
Parents: b82ee1a
Author: Peter Ent <pe...@apache.org>
Authored: Fri Jun 28 16:58:58 2013 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Fri Jun 28 16:58:58 2013 -0400
----------------------------------------------------------------------
.../flex/html/staticControls/NumericStepper.js | 75 ++++++++++++++++++++
1 file changed, 75 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65dd0552/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/NumericStepper.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/NumericStepper.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/NumericStepper.js
new file mode 100644
index 0000000..4cb3d9a
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/NumericStepper.js
@@ -0,0 +1,75 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the 'License');
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an 'AS IS' BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('org.apache.flex.html.staticControls.NumericStepper');
+
+goog.require('org.apache.flex.core.UIBase');
+goog.require('org.apache.flex.html.staticControls.TextInput');
+goog.require('org.apache.flex.html.staticControls.Spinner');
+
+
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.core.UIBase}
+ */
+org.apache.flex.html.staticControls.NumericStepper = function() {
+ goog.base(this);
+
+ this.minimum_ = 0;
+ this.maximum_ = 100;
+ this.value_ = 1;
+ this.stepSize_ = 1;
+ this.snapInterval_ = 1;
+};
+goog.inherits(org.apache.flex.html.staticControls.NumericStepper,
+ org.apache.flex.core.UIBase);
+
+
+/**
+ * @override
+ * @this {org.apache.flex.html.staticControls.NumericStepper}
+ * @param {Object} p The parent element.
+ */
+org.apache.flex.html.staticControls.NumericStepper.prototype.addToParent = function(p) {
+ goog.base(this, 'addToParent', p);
+
+ this.element = document.createElement('div');
+ this.positioner = this.element;
+
+ this.input = new org.apache.flex.html.staticControls.TextInput();
+ this.input.addToParent(this);
+ this.input.positioner.style.display = "inline-block";
+
+ this.spinner = new org.apache.flex.html.staticControls.Spinner();
+ this.spinner.addToParent(this);
+ this.spinner.positioner.style.display = "inline-block";
+ goog.events.listen(this.spinner, 'valueChanged', goog.bind(this.handleSpinnerChange, this));
+
+ p.internalAddChild(this.element);
+
+ this.element.flexjs_wrapper = this;
+
+ this.input.set_text( String(this.spinner.get_value()) );
+}
+
+/**
+ * @this {org.apache.flex.html.staticControls.Spinner}
+ * @return {void} Handles click on increment button.
+ */
+org.apache.flex.html.staticControls.NumericStepper.prototype.handleSpinnerChange = function(event)
+{
+ this.input.set_text( String(this.spinner.get_value()) );
+ this.dispatchEvent(new org.apache.flex.events.Event("valueChanged"));
+}
\ No newline at end of file