You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/11/11 23:08:41 UTC
[25/28] git commit: [flex-asjs] [refs/heads/develop] - more new JS
components and beads
more new JS components and beads
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a27a897e
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a27a897e
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a27a897e
Branch: refs/heads/develop
Commit: a27a897e0cd10f0e9fa0daa52732bf327aa051f7
Parents: e70257a
Author: Alex Harui <ah...@apache.org>
Authored: Mon Nov 10 09:15:31 2014 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 11 14:08:00 2014 -0800
----------------------------------------------------------------------
.../org/apache/flex/html/ImageAndTextButton.js | 105 +++++++++++++++++++
.../src/org/apache/flex/html/MultilineLabel.js | 79 ++++++++++++++
.../org/apache/flex/html/ToggleTextButton.js | 103 ++++++++++++++++++
.../flex/html/beads/ScrollingContainerView.js | 89 ++++++++++++++++
.../html/beads/layouts/NonVirtualBasicLayout.js | 64 +++++++++++
.../layouts/NonVirtualBasicScrollingLayout.js | 64 +++++++++++
6 files changed, 504 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a27a897e/frameworks/js/FlexJS/src/org/apache/flex/html/ImageAndTextButton.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/ImageAndTextButton.js b/frameworks/js/FlexJS/src/org/apache/flex/html/ImageAndTextButton.js
new file mode 100644
index 0000000..2d1efa8
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/ImageAndTextButton.js
@@ -0,0 +1,105 @@
+/**
+ * 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.ImageAndTextButton');
+
+goog.require('org.apache.flex.html.Button');
+
+
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.html.Button}
+ */
+org.apache.flex.html.ImageAndTextButton = function() {
+ org.apache.flex.html.ImageAndTextButton.base(this, 'constructor');
+
+ /**
+ * @type {Object>}
+ */
+ this.img;
+
+};
+goog.inherits(org.apache.flex.html.ImageAndTextButton,
+ org.apache.flex.html.Button);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.html.ImageAndTextButton.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'ImageAndTextButton',
+ qName: 'org.apache.flex.html.ImageAndTextButton'}] };
+
+
+/**
+ * @override
+ */
+org.apache.flex.html.ImageAndTextButton.prototype.createElement =
+ function() {
+ this.element = document.createElement('button');
+ this.element.setAttribute('type', 'button');
+ this.img = document.createElement('img');
+ this.element.appendChild(img);
+
+ this.positioner = this.element;
+ this.element.flexjs_wrapper = this;
+
+ if (org.apache.flex.core.ValuesManager.valuesImpl.getValue) {
+ var impl = org.apache.flex.core.ValuesManager.valuesImpl.
+ getValue(this, 'iStatesImpl');
+ }
+
+ return this.element;
+};
+
+
+/**
+ * @expose
+ * @return {string} The text getter.
+ */
+org.apache.flex.html.ImageAndTextButton.prototype.get_text = function() {
+ return this.element.innerHTML;
+};
+
+
+/**
+ * @expose
+ * @param {string} value The text setter.
+ */
+org.apache.flex.html.ImageAndTextButton.prototype.set_text =
+ function(value) {
+ this.element.innerHTML = value;
+};
+
+
+/**
+ * @expose
+ * @return {string} The text getter.
+ */
+org.apache.flex.html.ImageAndTextButton.prototype.get_image = function() {
+ return this.img.src;
+};
+
+
+/**
+ * @expose
+ * @param {string} value The text setter.
+ */
+org.apache.flex.html.ImageAndTextButton.prototype.set_text =
+ function(value) {
+ this.img.src = value;
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a27a897e/frameworks/js/FlexJS/src/org/apache/flex/html/MultilineLabel.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/MultilineLabel.js b/frameworks/js/FlexJS/src/org/apache/flex/html/MultilineLabel.js
new file mode 100644
index 0000000..674c003
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/MultilineLabel.js
@@ -0,0 +1,79 @@
+/**
+ * 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.MultilineLabel');
+
+goog.require('org.apache.flex.core.UIBase');
+
+
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.core.UIBase}
+ */
+org.apache.flex.html.MultilineLabel = function() {
+ org.apache.flex.html.MultilineLabel.base(this, 'constructor');
+
+ this.element = document.createElement('div');
+ this.positioner = this.element;
+ this.element.flexjs_wrapper = this;
+};
+goog.inherits(org.apache.flex.html.MultilineLabel,
+ org.apache.flex.core.UIBase);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.html.MultilineLabel.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'MultilineLabel',
+ qName: 'org.apache.flex.html.MultilineLabel' }] };
+
+
+/**
+ * @expose
+ * @return {string} The text getter.
+ */
+org.apache.flex.html.MultilineLabel.prototype.get_text = function() {
+ return this.element.innerHTML;
+};
+
+
+/**
+ * @expose
+ * @param {string} value The text setter.
+ */
+org.apache.flex.html.MultilineLabel.prototype.set_text = function(value) {
+ this.element.innerHTML = value;
+};
+
+
+/**
+ * @expose
+ * @return {string} The html getter.
+ */
+org.apache.flex.html.MultilineLabel.prototype.get_html = function() {
+ return this.element.innerHTML;
+};
+
+
+/**
+ * @expose
+ * @param {string} value The html setter.
+ */
+org.apache.flex.html.MultilineLabel.prototype.set_html = function(value) {
+ this.element.innerHTML = value;
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a27a897e/frameworks/js/FlexJS/src/org/apache/flex/html/ToggleTextButton.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/ToggleTextButton.js b/frameworks/js/FlexJS/src/org/apache/flex/html/ToggleTextButton.js
new file mode 100644
index 0000000..281b144
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/ToggleTextButton.js
@@ -0,0 +1,103 @@
+/**
+ * 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.ToggleTextButton');
+
+goog.require('org.apache.flex.html.Button');
+
+
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.html.Button}
+ */
+org.apache.flex.html.ToggleTextButton = function() {
+ org.apache.flex.html.ToggleTextButton.base(this, 'constructor');
+
+
+
+ /**
+ * @type {boolean}
+ */
+ this.selected_ = false;
+};
+goog.inherits(org.apache.flex.html.ToggleTextButton,
+ org.apache.flex.html.Button);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.html.ToggleTextButton.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'ToggleTextButton',
+ qName: 'org.apache.flex.html.ToggleTextButton'}] };
+
+
+/**
+ * @expose
+ * @return {string} The text getter.
+ */
+org.apache.flex.html.ToggleTextButton.prototype.get_text = function() {
+ return this.element.innerHTML;
+};
+
+
+/**
+ * @expose
+ * @param {string} value The text setter.
+ */
+org.apache.flex.html.ToggleTextButton.prototype.set_text =
+ function(value) {
+ this.element.innerHTML = value;
+};
+
+/**
+ * @expose
+ * @return {boolean} The selected getter.
+ */
+org.apache.flex.html.ToggleTextButton.prototype.get_selected =
+ function() {
+ return this.selected_;
+};
+
+/**
+ * @expose
+ * @param {boolean} value The selected setter.
+ */
+org.apache.flex.html.ToggleTextButton.prototype.set_selected =
+ function(value) {
+ if (this.selected_ != value) {
+ this.selected_ = value;
+
+ var className = this._strand.className;
+ if (value) {
+ if (className.indexOf(this.SELECTED) == className.length - this.SELECTED.length)
+ this._strand.className = className.substring(0, className.length - this.SELECTED.length);
+ }
+ else {
+ if (className.indexOf(this.SELECTED) == -1)
+ this._strand.className += this.SELECTED;
+ }
+
+ }
+};
+
+
+/**
+ * @type {string} The selected setter.
+ */
+org.apache.flex.html.ToggleTextButton.prototype.SELECTED = "_Selected";
+
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a27a897e/frameworks/js/FlexJS/src/org/apache/flex/html/beads/ScrollingContainerView.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/beads/ScrollingContainerView.js b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/ScrollingContainerView.js
new file mode 100644
index 0000000..dcf4aad
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/ScrollingContainerView.js
@@ -0,0 +1,89 @@
+/**
+ * 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.beads.ScrollingContainerView');
+
+goog.require('org.apache.flex.html.beads.ContainerView');
+
+
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.html.beads.ContainerView}
+ */
+org.apache.flex.html.beads.ScrollingContainerView = function() {
+ this.lastSelectedIndex = -1;
+ org.apache.flex.html.beads.ScrollingContainerView.base(this, 'constructor');
+
+ this.className = 'ScrollingContainerView';
+};
+goog.inherits(
+ org.apache.flex.html.beads.ScrollingContainerView,
+ org.apache.flex.html.beads.ContainerView);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.html.beads.ScrollingContainerView.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'ScrollingContainerView',
+ qName: 'org.apache.flex.html.beads.ScrollingContainerView' }],
+ interfaces: [org.apache.flex.core.ILayoutParent]
+ };
+
+
+/**
+ * @expose
+ * @return {Object} value The content view.
+ */
+org.apache.flex.html.beads.ScrollingContainerView.prototype.get_contentView =
+ function() {
+
+ return this._strand;
+};
+
+
+/**
+ * @expose
+ * @return {Object} value The resizeable view.
+ */
+org.apache.flex.html.beads.ScrollingContainerView.prototype.get_resizableView =
+function() {
+
+ return this._strand;
+};
+
+
+/**
+ * @expose
+ * @return {Object} value The resizeable view.
+ */
+org.apache.flex.html.beads.ScrollingContainerView.prototype.get_verticalScrollPosition =
+function() {
+
+ return this._strand.scrollTop;
+};
+
+
+/**
+ * @expose
+ * @return {Object} value The resizeable view.
+ */
+org.apache.flex.html.beads.ScrollingContainerView.prototype.get_maxVerticalScrollPosition =
+function() {
+
+ return this._strand.scrollHeight - this._strand.clientHeight;
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a27a897e/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/NonVirtualBasicLayout.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/NonVirtualBasicLayout.js b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/NonVirtualBasicLayout.js
new file mode 100644
index 0000000..cc0d36c
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/NonVirtualBasicLayout.js
@@ -0,0 +1,64 @@
+/**
+ * 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.beads.layouts.NonVirtualBasicLayout');
+
+goog.require('org.apache.flex.core.IBeadLayout');
+
+
+
+/**
+ * @constructor
+ * @implements {org.apache.flex.core.IBeadLayout}
+ */
+org.apache.flex.html.beads.layouts.NonVirtualBasicLayout =
+ function() {
+ this.strand_ = null;
+ this.className = 'NonVirtualBasicLayout';
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.html.beads.layouts.NonVirtualBasicLayout.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'NonVirtualBasicLayout',
+ qName: 'org.apache.flex.html.beads.layouts.NonVirtualBasicLayout'}],
+ interfaces: [org.apache.flex.core.IBeadLayout] };
+
+
+/**
+ * @expose
+ * @param {Object} value The new host.
+ */
+org.apache.flex.html.beads.layouts.NonVirtualBasicLayout.
+ prototype.set_strand = function(value) {
+ if (this.strand_ !== value) {
+ this.strand_ = value;
+ this.strand_.addEventListener('childrenAdded',
+ goog.bind(this.changeHandler, this));
+ this.strand_.addEventListener('layoutNeeded',
+ goog.bind(this.changeHandler, this));
+ }
+};
+
+
+/**
+ * @param {org.apache.flex.events.Event} event The text getter.
+ */
+org.apache.flex.html.beads.layouts.NonVirtualBasicLayout.
+ prototype.changeHandler = function(event) {
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a27a897e/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/NonVirtualBasicScrollingLayout.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/NonVirtualBasicScrollingLayout.js b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/NonVirtualBasicScrollingLayout.js
new file mode 100644
index 0000000..97e4700
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/NonVirtualBasicScrollingLayout.js
@@ -0,0 +1,64 @@
+/**
+ * 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.beads.layouts.NonVirtualBasicScrollingLayout');
+
+goog.require('org.apache.flex.core.IBeadLayout');
+
+
+
+/**
+ * @constructor
+ * @implements {org.apache.flex.core.IBeadLayout}
+ */
+org.apache.flex.html.beads.layouts.NonVirtualBasicScrollingLayout =
+ function() {
+ this.strand_ = null;
+ this.className = 'NonVirtualBasicScrollingLayout';
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.html.beads.layouts.NonVirtualBasicScrollingLayout.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'NonVirtualBasicScrollingLayout',
+ qName: 'org.apache.flex.html.beads.layouts.NonVirtualBasicScrollingLayout'}],
+ interfaces: [org.apache.flex.core.IBeadLayout] };
+
+
+/**
+ * @expose
+ * @param {Object} value The new host.
+ */
+org.apache.flex.html.beads.layouts.NonVirtualBasicScrollingLayout.
+ prototype.set_strand = function(value) {
+ if (this.strand_ !== value) {
+ this.strand_ = value;
+ this.strand_.addEventListener('childrenAdded',
+ goog.bind(this.changeHandler, this));
+ this.strand_.addEventListener('layoutNeeded',
+ goog.bind(this.changeHandler, this));
+ }
+};
+
+
+/**
+ * @param {org.apache.flex.events.Event} event The text getter.
+ */
+org.apache.flex.html.beads.layouts.NonVirtualBasicScrollingLayout.
+ prototype.changeHandler = function(event) {
+};