Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AE0A817601 for ; Wed, 15 Apr 2015 21:43:14 +0000 (UTC) Received: (qmail 87141 invoked by uid 500); 15 Apr 2015 21:43:09 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 87110 invoked by uid 500); 15 Apr 2015 21:43:09 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 87068 invoked by uid 99); 15 Apr 2015 21:43:08 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Apr 2015 21:43:08 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9DEB2E0921; Wed, 15 Apr 2015 21:43:08 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aharui@apache.org To: commits@flex.apache.org Date: Wed, 15 Apr 2015 21:43:29 -0000 Message-Id: <9969e2868d4145d2885345b20176ffd4@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [24/55] [abbrv] git commit: [flex-asjs] [refs/heads/develop] - move handwritten JS code to final home. Build scripts still need fixing up http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/ILayoutParent.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/ILayoutParent.js b/frameworks/projects/Core/js/src/org/apache/flex/core/ILayoutParent.js new file mode 100644 index 0000000..0c2e3f2 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/ILayoutParent.js @@ -0,0 +1,59 @@ +/** + * 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. + */ + +/** + * @fileoverview + * @suppress {checkTypes} + */ + +goog.provide('org_apache_flex_core_ILayoutParent'); + + + +/** + * @interface + */ +org_apache_flex_core_ILayoutParent = function() { +}; + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_ILayoutParent.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'ILayoutParent', + qName: 'org_apache_flex_core_ILayoutParent' }] }; + + +Object.defineProperties(org_apache_flex_core_ILayoutParent.prototype, { + /** @expose */ + contentView: { + get: function() {} + }, + /** @expose */ + border: { + get: function() {} + }, + /** @expose */ + vScrollBar: { + get: function() {}, + set: function(value) {} + }, + /** @expose */ + resizeableView: { + get: function() {} + } +}); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/IListPresentationModel.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/IListPresentationModel.js b/frameworks/projects/Core/js/src/org/apache/flex/core/IListPresentationModel.js new file mode 100644 index 0000000..f2583fa --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/IListPresentationModel.js @@ -0,0 +1,54 @@ +/** + * 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. + */ + +/** + * org_apache_flex_core_IListPresentationModel + * + * @fileoverview + * + * @suppress {checkTypes} + */ + +goog.provide('org_apache_flex_core_IListPresentationModel'); + +goog.require('org_apache_flex_core_IBead'); + + + +/** + * @interface + * @extends {org_apache_flex_events_IEventDispatcher} + * @extends {org_apache_flex_core_IBead} + */ +org_apache_flex_core_IListPresentationModel = function() { +}; + + +Object.defineProperties(org_apache_flex_core_IListPresentationModel.prototype, { + /** @expose */ + rowHeight: { + set: function(value) {}, + get: function() {} + } +}); + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_IListPresentationModel.prototype.FLEXJS_CLASS_INFO = +{ names: [{ name: 'IListPresentationModel', qName: 'org_apache_flex_core_IListPresentationModel'}], + interfaces: [org_apache_flex_events_IEventDispatcher, org_apache_flex_core_IBead] }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/IMXMLDocument.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/IMXMLDocument.js b/frameworks/projects/Core/js/src/org/apache/flex/core/IMXMLDocument.js new file mode 100644 index 0000000..01c2adc --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/IMXMLDocument.js @@ -0,0 +1,41 @@ +/** + * 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. + */ + +/** + * @fileoverview + * @suppress {checkTypes} + */ + +goog.provide('org_apache_flex_core_IMXMLDocument'); + + + +/** + * IMXMLDocument + * + * @interface + */ +org_apache_flex_core_IMXMLDocument = function() { +}; + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_IMXMLDocument.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'IMXMLDocument', + qName: 'org_apache_flex_core_IMXMLDocument' }] }; + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/IMeasurementBead.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/IMeasurementBead.js b/frameworks/projects/Core/js/src/org/apache/flex/core/IMeasurementBead.js new file mode 100644 index 0000000..3465b92 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/IMeasurementBead.js @@ -0,0 +1,38 @@ +/** + * 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. + */ + +/** + * @fileoverview + * @suppress {checkTypes} + */ + +goog.provide('org_apache_flex_core_IMeasurementBead'); + + + +/** + * @interface + */ +org_apache_flex_core_IMeasurementBead = function() { +}; + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_IMeasurementBead.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'IMeasurementBead', + qName: 'org_apache_flex_core_IMeasurementBead' }] }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/IParent.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/IParent.js b/frameworks/projects/Core/js/src/org/apache/flex/core/IParent.js new file mode 100644 index 0000000..ac0baff --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/IParent.js @@ -0,0 +1,67 @@ +/** + * 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. + */ + +/** + * org_apache_flex_core_IParent + * + * @fileoverview + * + * @suppress {checkTypes} + */ + +goog.provide('org_apache_flex_core_IParent'); + + + +/** + * @interface + */ +org_apache_flex_core_IParent = function() { +}; + + +/** + * @param {Object} c + */ +org_apache_flex_core_IParent.prototype.addElement = function(c) {}; + + +/** + * @param {Object} c + * @param {number} index + */ +org_apache_flex_core_IParent.prototype.addElementAt = function(c, index) {}; + + +/** + * @return {number} + * @param {Object} c + */ +org_apache_flex_core_IParent.prototype.getElementIndex = function(c) {}; + + +/** + * @param {Object} c + */ +org_apache_flex_core_IParent.prototype.removeElement = function(c) {}; + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_IParent.prototype.FLEXJS_CLASS_INFO = { + names: [{ name: 'IParent', qName: 'org_apache_flex_core_IParent'}] +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/IParentIUIBase.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/IParentIUIBase.js b/frameworks/projects/Core/js/src/org/apache/flex/core/IParentIUIBase.js new file mode 100644 index 0000000..fc7d7c0 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/IParentIUIBase.js @@ -0,0 +1,46 @@ +/** + * 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. + */ + +/** + * org_apache_flex_core_IParentIUIBase + * + * @fileoverview + * + * @suppress {checkTypes} + */ + +goog.provide('org_apache_flex_core_IParentIUIBase'); + +goog.require('org_apache_flex_core_IParent'); +goog.require('org_apache_flex_core_IUIBase'); + + + +/** + * @interface + */ +org_apache_flex_core_IParentIUIBase = function() { +}; + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_IParentIUIBase.prototype.FLEXJS_CLASS_INFO = { + names: [{ name: 'IParentIUIBase', qName: 'org_apache_flex_core_IParentIUIBase'}], + interfaces: [org_apache_flex_core_IParent, + org_apache_flex_core_IUIBase] +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/IPopUpHost.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/IPopUpHost.js b/frameworks/projects/Core/js/src/org/apache/flex/core/IPopUpHost.js new file mode 100644 index 0000000..b1613cf --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/IPopUpHost.js @@ -0,0 +1,45 @@ +/** + * 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. + */ + +/** + * org_apache_flex_core_IPopUpHost + * + * @fileoverview + * + * @suppress {checkTypes} + */ + +goog.provide('org_apache_flex_core_IPopUpHost'); + +goog.require('org_apache_flex_core_IParent'); + + + +/** + * @interface + * @extends {org_apache_flex_core_IParent} + */ +org_apache_flex_core_IPopUpHost = function() { +}; + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_IPopUpHost.prototype.FLEXJS_CLASS_INFO = { + names: [{ name: 'IPopUpHost', qName: 'org_apache_flex_core_IPopUpHost'}], + interfaces: [org_apache_flex_core_IParent] +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/ISelectableItemRenderer.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/ISelectableItemRenderer.js b/frameworks/projects/Core/js/src/org/apache/flex/core/ISelectableItemRenderer.js new file mode 100644 index 0000000..ca759e8 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/ISelectableItemRenderer.js @@ -0,0 +1,74 @@ +/** + * 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. + */ + +/** + * org_apache_flex_core_ISelectableItemRenderer + * + * @fileoverview + * + * @suppress {checkTypes} + */ + +goog.provide('org_apache_flex_core_ISelectableItemRenderer'); + +goog.require('org_apache_flex_core_IItemRenderer'); + + + +/** + * @interface + * @extends {org_apache_flex_events_IEventDispatcher} + * @extends {org_apache_flex_core_IItemRenderer} + */ +org_apache_flex_core_ISelectableItemRenderer = function() { +}; + + +Object.defineProperties(org_apache_flex_core_ISelectableItemRenderer.prototype, { + /** @expose */ + labelField: { + set: function(value) {}, + get: function() {} + }, + /** @expose */ + index: { + set: function(value) {}, + get: function() {} + }, + /** @expose */ + selected: { + set: function(value) {}, + get: function() {} + }, + /** @expose */ + hovered: { + set: function(value) {}, + get: function() {} + }, + /** @expose */ + down: { + set: function(value) {}, + get: function() {} + } +}); + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_ISelectableItemRenderer.prototype.FLEXJS_CLASS_INFO = +{ names: [{ name: 'ISelectableItemRenderer', qName: 'org_apache_flex_core_ISelectableItemRenderer'}], + interfaces: [org_apache_flex_core_IItemRenderer] }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/ISelectionModel.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/ISelectionModel.js b/frameworks/projects/Core/js/src/org/apache/flex/core/ISelectionModel.js new file mode 100644 index 0000000..b0e20fe --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/ISelectionModel.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. + */ + +/** + * org_apache_flex_core_ISelectionModel + * + * @fileoverview + * + * @suppress {checkTypes} + */ + +goog.provide('org_apache_flex_core_ISelectionModel'); + +goog.require('org_apache_flex_core_IBeadModel'); + + + +/** + * @interface + * @extends {org_apache_flex_events_IEventDispatcher} + * @extends {org_apache_flex_core_IBeadModel} + */ +org_apache_flex_core_ISelectionModel = function() { +}; + + +Object.defineProperties(org_apache_flex_core_ISelectionModel.prototype, { + /** @expose */ + dataProvider: { + set: function(value) {}, + get: function() {} + }, + /** @expose */ + selectedIndex: { + set: function(value) {}, + get: function() {} + }, + /** @expose */ + selectedItem: { + set: function(value) {}, + get: function() {} + } +}); + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_ISelectionModel.prototype.FLEXJS_CLASS_INFO = +{ names: [{ name: 'ISelectionModel', qName: 'org_apache_flex_core_ISelectionModel'}], + interfaces: [org_apache_flex_events_IEventDispatcher, org_apache_flex_core_IBeadModel] }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/IStatesImpl.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/IStatesImpl.js b/frameworks/projects/Core/js/src/org/apache/flex/core/IStatesImpl.js new file mode 100644 index 0000000..d98ccae --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/IStatesImpl.js @@ -0,0 +1,47 @@ +/** + * 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. + */ + +/** + * @fileoverview + * @suppress {checkTypes} + */ + +goog.provide('org_apache_flex_core_IStatesImpl'); + +goog.require('org_apache_flex_core_IBead'); +goog.require('org_apache_flex_events_IEventDispatcher'); + + + +/** + * IStatesImpl + * + * @interface + * @extends {org_apache_flex_core_IBead} + * @extends {org_apache_flex_events_IEventDispatcher} + */ +org_apache_flex_core_IStatesImpl = function() { +}; + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_IStatesImpl.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'IStatesImpl', + qName: 'org_apache_flex_core_IStatesImpl' }], + interfaces: [org_apache_flex_core_IBead, + org_apache_flex_events_IEventDispatcher] }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/IStrand.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/IStrand.js b/frameworks/projects/Core/js/src/org/apache/flex/core/IStrand.js new file mode 100644 index 0000000..558efbc --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/IStrand.js @@ -0,0 +1,70 @@ +/** + * 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. + */ + +/** + * @fileoverview + * @suppress {checkTypes} + */ + +goog.provide('org_apache_flex_core_IStrand'); + + + +/** + * IStrand + * + * @interface + */ +org_apache_flex_core_IStrand = function() { +}; + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_IStrand.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'IStrand', + qName: 'org_apache_flex_core_IStrand' }] }; + + +/** + * addBead() + * + * @expose + * @param {org_apache_flex_core_IBead} bead The bead to add. + */ +org_apache_flex_core_IStrand.prototype.addBead = function(bead) {}; + + +/** + * getBeadByType() + * + * @expose + * @param {Object} classOrInterface The type of bead to look for. + * @return {org_apache_flex_core_IBead} The bead. + */ +org_apache_flex_core_IStrand.prototype.getBeadByType = + function(classOrInterface) {}; + + +/** + * removeBead() + * + * @expose + * @param {org_apache_flex_core_IBead} bead The bead to remove. + * @return {org_apache_flex_core_IBead} The bead that was removed. + */ +org_apache_flex_core_IStrand.prototype.removeBead = function(bead) {}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/IStyleableObject.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/IStyleableObject.js b/frameworks/projects/Core/js/src/org/apache/flex/core/IStyleableObject.js new file mode 100644 index 0000000..57be8b1 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/IStyleableObject.js @@ -0,0 +1,46 @@ +/** + * 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. + */ + +/** + * org_apache_flex_core_IStyleableObject + * + * @fileoverview + * + * @suppress {checkTypes} + */ + +goog.provide('org_apache_flex_core_IStyleableObject'); + +goog.require('org_apache_flex_events_IEventDispatcher'); + + + +/** + * @interface + * @extends {org_apache_flex_events_IEventDispatcher} + */ +org_apache_flex_core_IStyleableObject = function() { +}; + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_IStyleableObject.prototype.FLEXJS_CLASS_INFO = { + names: [{ name: 'IStyleableObject', + qName: 'org_apache_flex_core_IStyleableObject'}], + interfaces: [org_apache_flex_events_IEventDispatcher] +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/ITextModel.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/ITextModel.js b/frameworks/projects/Core/js/src/org/apache/flex/core/ITextModel.js new file mode 100644 index 0000000..78368cc --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/ITextModel.js @@ -0,0 +1,54 @@ +/** + * 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. + */ + +/** + * org_apache_flex_core_ITextModel + * + * @fileoverview + * + * @suppress {checkTypes} + */ + +goog.provide('org_apache_flex_core_ITextModel'); + +goog.require('org_apache_flex_core_IBeadModel'); + + + +/** + * @interface + * @extends {org_apache_flex_events_IEventDispatcher} + * @extends {org_apache_flex_core_IBeadModel} + */ +org_apache_flex_core_ITextModel = function() { +}; + + +Object.defineProperties(org_apache_flex_core_ITextModel.prototype, { + /** @expose */ + text: { + set: function(value) {}, + get: function() {} + } +}); + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_ITextModel.prototype.FLEXJS_CLASS_INFO = +{ names: [{ name: 'ITextModel', qName: 'org_apache_flex_core_ITextModel'}], + interfaces: [org_apache_flex_events_IEventDispatcher, org_apache_flex_core_IBeadModel] }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/IUIBase.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/IUIBase.js b/frameworks/projects/Core/js/src/org/apache/flex/core/IUIBase.js new file mode 100644 index 0000000..f810184 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/IUIBase.js @@ -0,0 +1,40 @@ +/** + * 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. + */ + +/** + * @fileoverview + * @suppress {checkTypes} + */ + +goog.provide('org_apache_flex_core_IUIBase'); + + + +/** + * IUIBase + * + * @interface + */ +org_apache_flex_core_IUIBase = function() { +}; + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_IUIBase.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'IUIBase', + qName: 'org_apache_flex_core_IUIBase' }] }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/IValuesImpl.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/IValuesImpl.js b/frameworks/projects/Core/js/src/org/apache/flex/core/IValuesImpl.js new file mode 100644 index 0000000..319eb3e --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/IValuesImpl.js @@ -0,0 +1,73 @@ +/** + * 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. + */ + +/** + * @fileoverview + * @suppress {checkTypes} + */ + +goog.provide('org_apache_flex_core_IValuesImpl'); + + + +/** + * IValuesImpl + * + * @interface + */ +org_apache_flex_core_IValuesImpl = function() { +}; + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_IValuesImpl.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'IValuesImpl', + qName: 'org_apache_flex_core_IValuesImpl' }]}; + + +/** + * @expose + * @param {Object} thisObject The object to fetch a value for. + * @param {string} valueName The name of the value to fetch. + * @param {string=} opt_state The psuedo-state if any for. + * @param {Object=} opt_attrs The object with name value pairs that + * might make a difference. + * @return {?Object} The value. + */ +org_apache_flex_core_IValuesImpl.prototype.getValue = + function(thisObject, valueName, opt_state, opt_attrs) {}; + + +/** + * @expose + * @param {Object} thisObject The object to fetch a value for. + * @param {string} valueName The name of the value to fetch. + * @param {string=} opt_state The psuedo-state if any for. + * @param {Object=} opt_attrs The object with name value pairs that + * might make a difference. + * @return {Object} The new instance. + */ +org_apache_flex_core_IValuesImpl.prototype.newInstance = +function(thisObject, valueName, opt_state, opt_attrs) {}; + + +/** + * @expose + * @param {Object} mainclass The main class for the application. + */ +org_apache_flex_core_IValuesImpl.prototype.init = function(mainclass) {}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/ItemRendererClassFactory.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/ItemRendererClassFactory.js b/frameworks/projects/Core/js/src/org/apache/flex/core/ItemRendererClassFactory.js new file mode 100644 index 0000000..84b16c4 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/ItemRendererClassFactory.js @@ -0,0 +1,99 @@ +/** + * 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_core_ItemRendererClassFactory'); + +goog.require('mx_core_ClassFactory'); +goog.require('org_apache_flex_core_IItemRendererClassFactory'); +goog.require('org_apache_flex_core_ValuesManager'); + + + +/** + * @constructor + * @implements {org_apache_flex_core_IItemRendererClassFactory} + */ +org_apache_flex_core_ItemRendererClassFactory = function() { + /** + * @type {Function} + */ + this.itemRendererClass = null; +}; + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_ItemRendererClassFactory. + prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'ItemRendererClassFactory', + qName: 'org_apache_flex_core_ItemRendererClassFactory'}], + interfaces: [org_apache_flex_core_IItemRendererClassFactory] }; + + +Object.defineProperties(org_apache_flex_core_ItemRendererClassFactory.prototype, { + /** @expose */ + strand: { + /** @this {org_apache_flex_core_ItemRendererClassFactory} */ + set: function(value) { + this.strand_ = value; + + // see if the _strand has an itemRenderer property that isn't empty. if that's + // true, use that value instead of pulling it from the the style + if (this.strand_.hasOwnProperty('itemRenderer')) { + this.itemRendererClassFactory = this.strand_.itemRenderer; + if (this.itemRendererClassFactory) { + this.createFunction = this.createFromClass; + return; + } + } + + if (org_apache_flex_core_ValuesManager.valuesImpl.getValue) { + this.itemRendererClass = + /** @type {Function} */ (org_apache_flex_core_ValuesManager.valuesImpl. + getValue(this.strand_, 'iItemRenderer')); + if (this.itemRendererClass) { + this.itemRendererClassFactory = new mx_core_ClassFactory(this.itemRendererClass); + this.createFunction = this.createFromClass; + } + } + } + } +}); + + +/** + * @expose + * @param {Object} parent The display parent of the new item renderer. + * @return {Object} The new item renderer. + */ +org_apache_flex_core_ItemRendererClassFactory. + prototype.createItemRenderer = function(parent) { + return this.createFunction(parent); +}; + + +/** + * @expose + * @param {Object} parent The parent of the new item renderer. + * @return {Object} The new item renderer. + */ +org_apache_flex_core_ItemRendererClassFactory. + prototype.createFromClass = function(parent) { + var renderer = this.itemRendererClassFactory.newInstance(); + parent.addElement(renderer); + return renderer; +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/ListBase.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/ListBase.js b/frameworks/projects/Core/js/src/org/apache/flex/core/ListBase.js new file mode 100644 index 0000000..c392332 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/ListBase.js @@ -0,0 +1,111 @@ +/** + * 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_core_ListBase'); + +goog.require('org_apache_flex_core_UIBase'); +goog.require('org_apache_flex_html_supportClasses_StringItemRenderer'); + + + +/** + * @constructor + * @extends {org_apache_flex_core_UIBase} + */ +org_apache_flex_core_ListBase = function() { + org_apache_flex_core_ListBase.base(this, 'constructor'); + + /** + * @private + * @type {number} + */ + this.selectedIndex_ = -1; +}; +goog.inherits(org_apache_flex_core_ListBase, + org_apache_flex_core_UIBase); + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_ListBase.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'ListBase', + qName: 'org_apache_flex_core_ListBase' }] }; + + +/** + * @override + */ +org_apache_flex_core_ListBase.prototype.createElement = function() { + // this.element = document.createElement('select'); + // goog.events.listen(this.element, 'change', + // goog.bind(this.changeHandler, this)); + this.element = document.createElement('div'); + this.element.style.overflow = 'auto'; + this.element.style.border = 'solid'; + this.element.style.borderWidth = '1px'; + this.element.style.borderColor = '#333333'; + this.positioner = this.element; + this.element.flexjs_wrapper = this; + + return this.element; +}; + + +Object.defineProperties(org_apache_flex_core_ListBase.prototype, { + /** @expose */ + dataProvider: { + /** @this {org_apache_flex_core_ListBase} */ + get: function() { + return this.model.dataProvider; + }, + /** @this {org_apache_flex_core_ListBase} */ + set: function(value) { + this.model.dataProvider = value; + } + }, + /** @expose */ + selectedIndex: { + /** @this {org_apache_flex_core_ListBase} */ + get: function() { + return this.model.selectedIndex; + }, + /** @this {org_apache_flex_core_ListBase} */ + set: function(value) { + this.model.selectedIndex = value; + } + }, + /** @expose */ + selectedItem: { + /** @this {org_apache_flex_core_ListBase} */ + get: function() { + return this.model.selectedItem; + }, + /** @this {org_apache_flex_core_ListBase} */ + set: function(value) { + this.model.selectedItem = value; + } + } +}); + + +/** + * @protected + */ +org_apache_flex_core_ListBase.prototype.changeHandler = + function() { + this.dispatchEvent('change'); +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/SimpleCSSValuesImpl.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/SimpleCSSValuesImpl.js b/frameworks/projects/Core/js/src/org/apache/flex/core/SimpleCSSValuesImpl.js new file mode 100644 index 0000000..4799569 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/SimpleCSSValuesImpl.js @@ -0,0 +1,321 @@ +/** + * 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_core_SimpleCSSValuesImpl'); + +goog.require('org_apache_flex_core_IValuesImpl'); + + + +/** + * @constructor + * @implements {org_apache_flex_core_IValuesImpl}; + */ +org_apache_flex_core_SimpleCSSValuesImpl = function() { +}; + + +/** + * @type {string} + */ +org_apache_flex_core_SimpleCSSValuesImpl.GLOBAL_SELECTOR = 'global'; + + +/** + * @type {string} + */ +org_apache_flex_core_SimpleCSSValuesImpl.UNIVERSAL_SELECTOR = '*'; + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_SimpleCSSValuesImpl.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'SimpleCSSValuesImpl', + qName: 'org_apache_flex_core_SimpleCSSValuesImpl'}], + interfaces: [org_apache_flex_core_IValuesImpl]}; + + +/** + * @param {Object} thisObject The object to fetch a value for. + * @param {string} valueName The name of the value to fetch. + * @param {string=} opt_state The psuedo-state if any for. + * @param {Object=} opt_attrs The object with name value pairs that + * might make a difference. + * @return {Object} The value. + */ +org_apache_flex_core_SimpleCSSValuesImpl.prototype.getValue = + function(thisObject, valueName, opt_state, opt_attrs) { + var c = valueName.indexOf('-'); + while (c != -1) + { + valueName = valueName.substr(0, c) + + valueName.charAt(c + 1).toUpperCase() + + valueName.substr(c + 2); + c = valueName.indexOf('-'); + } + + var values = this.values; + var value; + var o; + var cName; + var selectorName; + + try { + var style = thisObject.style; + if (style != null) { + value = style[valueName]; + if (value !== undefined) + return value; + } + } + catch (e) {} + + if ('className' in thisObject) + { + cName = thisObject.className; + if (opt_state) + { + selectorName = cName + ':' + opt_state; + o = values['.' + selectorName]; + if (o) + { + value = o[valueName]; + if (value !== undefined) + return value; + } + } + + o = values['.' + cName]; + if (o) + { + value = o[valueName]; + if (value !== undefined) + return value; + } + } + + cName = thisObject.FLEXJS_CLASS_INFO.names[0].qName; + if (opt_state) + { + selectorName = cName + ':' + opt_state; + o = values['.' + selectorName]; + if (o) + { + value = o[valueName]; + if (value !== undefined) + return value; + } + } + + o = values['.' + cName]; + if (o) + { + value = o[valueName]; + if (value !== undefined) + return value; + } + + while (cName != 'Object') + { + if (opt_state) + { + selectorName = cName + ':' + opt_state; + o = values[selectorName]; + if (o) + { + value = o[valueName]; + if (value !== undefined) + return value; + } + } + + o = values[cName]; + if (o) + { + value = o[valueName]; + if (value !== undefined) + return value; + } + thisObject = thisObject.constructor.superClass_; + if (!thisObject || !thisObject.FLEXJS_CLASS_INFO) + break; + + cName = thisObject.FLEXJS_CLASS_INFO.names[0].qName; + } + o = values[org_apache_flex_core_SimpleCSSValuesImpl.GLOBAL_SELECTOR]; + if (o) + return o[valueName]; + o = values[org_apache_flex_core_SimpleCSSValuesImpl.UNIVERSAL_SELECTOR]; + if (o) + return o[valueName]; + return undefined; +}; + + +/** + * @param {Object} thisObject The object to fetch a value for. + * @param {string} valueName The name of the value to fetch. + * @param {string=} opt_state The psuedo-state if any for. + * @param {Object=} opt_attrs The object with name value pairs that + * might make a difference. + * @return {Object} The value. + * @suppress {checkTypes} + */ +org_apache_flex_core_SimpleCSSValuesImpl.prototype.newInstance = +function(thisObject, valueName, opt_state, opt_attrs) { + var f = this.getValue(thisObject, valueName, opt_state, opt_attrs); + if (f) + return new f(); + return null; +}; + + +/** + * @param {Object} mainclass The main class for the application. + */ +org_apache_flex_core_SimpleCSSValuesImpl.prototype.init = function(mainclass) { + var cssData = mainclass.cssData; + var values = this.values; + if (values == null) + values = {}; + + if (cssData) { + var n = cssData.length; + var i = 0; + while (i < n) + { + var numMQ = cssData[i++]; + if (numMQ > 0) + { + // skip MediaQuery tests for now + i += numMQ; + } + var numSel = cssData[i++]; + var props = {}; + for (var j = 0; j < numSel; j++) + { + var selName = cssData[i++]; + if (values[selName]) + props = values[selName]; + values[selName] = props; + } + var numProps = cssData[i++]; + for (j = 0; j < numProps; j++) + { + var propName = cssData[i++]; + var propValue = cssData[i++]; + props[propName] = propValue; + } + } + } + + this.values = values; +}; + + +/** + * @param {string} styles The styles as HTML style syntax. + * @return {Object} The styles object. + */ +org_apache_flex_core_SimpleCSSValuesImpl.prototype.parseStyles = function(styles) { + var obj = {}; + var parts = styles.split(';'); + var l = parts.length; + for (var i = 0; i < l; i++) { + var part = parts[i]; + var pieces = part.split(':'); + var value = pieces[1]; + if (value == 'null') + obj[pieces[0]] = null; + else if (value == 'true') + obj[pieces[0]] = true; + else if (value == 'false') + obj[pieces[0]] = false; + else { + var n = Number(value); + if (isNaN(n)) { + if (value.indexOf("'") === 0) + value = value.substring(1, value.length - 1); + obj[pieces[0]] = value; + } + else + obj[pieces[0]] = n; + } + } + return obj; +}; + + +/** + * The styles that apply to each UI widget + */ +org_apache_flex_core_SimpleCSSValuesImpl.perInstanceStyles = { + 'backgroundColor': 1, + 'backgroundImage': 1, + 'color': 1, + 'fontFamily': 1, + 'fontWeight': 1, + 'fontSize': 1, + 'fontStyle': 1 +}; + + +/** + * The styles that use color format #RRGGBB + */ +org_apache_flex_core_SimpleCSSValuesImpl.colorStyles = { + 'backgroundColor': 1, + 'borderColor': 1, + 'color': 1 +}; + + +/** + * The properties that enumerate that we skip + */ +org_apache_flex_core_SimpleCSSValuesImpl.skipStyles = { + 'constructor': 1 +}; + + +/** + * @param {Object} thisObject The object to apply styles to; + * @param {Object} styles The styles. + */ +org_apache_flex_core_SimpleCSSValuesImpl.prototype.applyStyles = + function(thisObject, styles) { + var styleList = org_apache_flex_core_SimpleCSSValuesImpl.perInstanceStyles; + var colorStyles = org_apache_flex_core_SimpleCSSValuesImpl.colorStyles; + var skipStyles = org_apache_flex_core_SimpleCSSValuesImpl.skipStyles; + for (var p in styles) { + //if (styleList[p]) + if (skipStyles[p]) + continue; + var value = styles[p]; + if (typeof(value) == 'number') { + if (colorStyles[p]) + value = '#' + value.toString(16); + else + value = value.toString() + 'px'; + } + else if (p == 'backgroundImage') { + if (p.indexOf('url') !== 0) + value = 'url(' + value + ')'; + } + thisObject.element.style[p] = value; + } +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/SimpleStatesImpl.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/SimpleStatesImpl.js b/frameworks/projects/Core/js/src/org/apache/flex/core/SimpleStatesImpl.js new file mode 100644 index 0000000..34ecf93 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/SimpleStatesImpl.js @@ -0,0 +1,219 @@ +/** + * 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_core_SimpleStatesImpl'); + +goog.require('mx_states_AddItems'); +goog.require('mx_states_SetEventHandler'); +goog.require('mx_states_SetProperty'); +goog.require('mx_states_State'); +goog.require('org_apache_flex_core_IBead'); +goog.require('org_apache_flex_core_IStatesImpl'); +goog.require('org_apache_flex_core_IStrand'); +goog.require('org_apache_flex_core_UIBase'); +goog.require('org_apache_flex_events_EventDispatcher'); + + + +/** + * @constructor + * @extends {org_apache_flex_events_EventDispatcher} + * @implements {org_apache_flex_core_IBead} + * @implements {org_apache_flex_core_IStatesImpl} + */ +org_apache_flex_core_SimpleStatesImpl = function() { + org_apache_flex_core_SimpleStatesImpl.base(this, 'constructor'); + + /** + * @private + * @type {org_apache_flex_core_IStrand} + */ + this.strand_ = null; +}; +goog.inherits(org_apache_flex_core_SimpleStatesImpl, + org_apache_flex_events_EventDispatcher); + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_SimpleStatesImpl.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'SimpleStatesImpl', + qName: 'org_apache_flex_core_SimpleStatesImpl' }], + interfaces: [org_apache_flex_core_IBead, + org_apache_flex_core_IStatesImpl] }; + + +Object.defineProperties(org_apache_flex_core_SimpleStatesImpl.prototype, { + /** @expose */ + strand: { + /** @this {org_apache_flex_core_SimpleStatesImpl} */ + set: function(value) { + if (this.strand_ !== value) { + this.strand_ = value; + if (this.strand_.addEventListener) { + this.strand_.addEventListener('currentStateChange', + goog.bind(this.stateChangeHandler_, this)); + this.strand_.addEventListener('initComplete', + goog.bind(this.initialStateHandler_, this)); + } + } + } + } +}); + + +/** + * @private + * @param {Object} event The event. + */ +org_apache_flex_core_SimpleStatesImpl.prototype.initialStateHandler_ = + function(event) { + /** + * @type {Object} + **/ + var host = this.strand_; + this.dispatchEvent(new org_apache_flex_events_ValueChangeEvent('currentStateChange', + false, false, null, + host.currentState)); + }; + + +/** + * @private + * @param {Object} event The event. + */ +org_apache_flex_core_SimpleStatesImpl.prototype.stateChangeHandler_ = + function(event) { + var arr, doc, p, s; + + doc = event.target; + arr = doc.states; + for (p in arr) { + s = arr[p]; + if (s.name === event.oldValue) { + this.revert_(s); + break; + } + } + + for (p in arr) { + s = arr[p]; + if (s.name === event.newValue) { + this.apply_(s); + break; + } + } +}; + + +/** + * @private + * @param {mx_states_State} s The State to revert. + */ +org_apache_flex_core_SimpleStatesImpl.prototype.revert_ = function(s) { + var arr, item, o, p, q, target; + /** + * @type {org_apache_flex_core_UIBase} + */ + var parent; + arr = s.overrides; + for (p in arr) { + o = arr[p]; + if (org_apache_flex_utils_Language.is(o, mx_states_AddItems)) { + for (q in o.items) { + item = o.items[q]; + + parent = o.document; + if (o.destination) { + parent = o.document[o.destination]; + } + + parent.removeElement(item); + parent.dispatchEvent( + new org_apache_flex_events_Event('childrenAdded')); + } + } else if (org_apache_flex_utils_Language.is(o, mx_states_SetProperty)) { + target = o.document[o.target]; + target[o.name] = o.previousValue; + } else if (org_apache_flex_utils_Language.is(o, mx_states_SetEventHandler)) { + target = o.document[o.target]; + target.removeEventListener(o.name, o.handlerFunction); + } + } +}; + + +/** + * @private + * @param {mx_states_State} s The State to apply. + */ +org_apache_flex_core_SimpleStatesImpl.prototype.apply_ = function(s) { + var arr, child, index, item, o, p, q, target; + /** + * type {org_apache_flex_core_UIBase} + */ + var parent; + arr = s.overrides; + for (p in arr) { + o = arr[p]; + if (org_apache_flex_utils_Language.is(o, mx_states_AddItems)) { + if (!o.items) { + o.items = o.itemsDescriptor.items; + if (o.items == null) { + o.items = + org_apache_flex_utils_MXMLDataInterpreter.generateMXMLArray(o.document, + null, o.itemsDescriptor.descriptor); + o.itemsDescriptor.items = o.items; + } + } + + for (q in o.items) { + item = o.items[q]; + + parent = o.document; + if (o.destination) { + parent = o.document[o.destination]; + } + + if (o.relativeTo) { + child = o.document[o.relativeTo]; + + index = parent.getElementIndex(child); + if (o.position === 'after') { + index++; + } + + parent.addElementAt(item, index); + } else { + parent.addElement(item); + } + + parent.dispatchEvent( + new org_apache_flex_events_Event('childrenAdded')); + } + } + else if (org_apache_flex_utils_Language.is(o, mx_states_SetProperty)) + { + target = o.document[o.target]; + o.previousValue = target[o.name]; + target[o.name] = o.value; + } else if (org_apache_flex_utils_Language.is(o, mx_states_SetEventHandler)) { + target = o.document[o.target]; + target.addEventListener(o.name, o.handlerFunction); + } + } +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/SimpleValuesImpl.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/SimpleValuesImpl.js b/frameworks/projects/Core/js/src/org/apache/flex/core/SimpleValuesImpl.js new file mode 100644 index 0000000..39ca383 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/SimpleValuesImpl.js @@ -0,0 +1,33 @@ +/** + * 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_core_SimpleValuesImpl'); + + + +/** + * @constructor + */ +org_apache_flex_core_SimpleValuesImpl = function() { +}; + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_SimpleValuesImpl.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'SimpleValuesImpl', + qName: 'org_apache_flex_core_SimpleValuesImpl' }] }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/UIBase.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/UIBase.js b/frameworks/projects/Core/js/src/org/apache/flex/core/UIBase.js new file mode 100644 index 0000000..61a0015 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/UIBase.js @@ -0,0 +1,744 @@ +/** + * 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_core_UIBase'); + +goog.require('org_apache_flex_core_HTMLElementWrapper'); +goog.require('org_apache_flex_core_IBeadController'); +goog.require('org_apache_flex_core_IBeadLayout'); +goog.require('org_apache_flex_core_IBeadModel'); +goog.require('org_apache_flex_core_IBeadView'); +goog.require('org_apache_flex_core_ILayoutChild'); +goog.require('org_apache_flex_core_IParentIUIBase'); +goog.require('org_apache_flex_core_IStyleableObject'); +goog.require('org_apache_flex_core_IUIBase'); +goog.require('org_apache_flex_core_ValuesManager'); +goog.require('org_apache_flex_events_ValueChangeEvent'); + + + +/** + * @constructor + * @implements {org_apache_flex_core_IUIBase} + * @implements {org_apache_flex_core_ILayoutChild} + * @implements {org_apache_flex_core_IParentIUIBase} + * @extends {org_apache_flex_core_HTMLElementWrapper} + */ +org_apache_flex_core_UIBase = function() { + org_apache_flex_core_UIBase.base(this, 'constructor'); + + /** + * @private + * @type {string} + */ + this.lastDisplay_ = ''; + + /** + * @private + * @type {number} + */ + this.explicitWidth_ = NaN; + + /** + * @private + * @type {number} + */ + this.explicitHeight_ = NaN; + + + /** + * @private + * @type {number} + */ + this.percentWidth_ = NaN; + + + /** + * @private + * @type {number} + */ + this.percentHeight_ = NaN; + + /** + * @private + * @type {Array.} + */ + this.mxmlBeads_ = null; + + /** + * @private + * @type {Object} + */ + this.style_ = null; + + /** + * @private + * @type {?string} + */ + this.id_ = null; + + /** + * @private + * @type {?string} + */ + this.className_ = ''; + + /** + * @private + * @type {Object} + */ + this.model_ = null; + + this.createElement(); +}; +goog.inherits(org_apache_flex_core_UIBase, + org_apache_flex_core_HTMLElementWrapper); + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_UIBase.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'UIBase', + qName: 'org_apache_flex_core_UIBase' }], + interfaces: [org_apache_flex_core_IUIBase, + org_apache_flex_core_IParentIUIBase, + org_apache_flex_core_ILayoutChild, + org_apache_flex_core_IStyleableObject] }; + + +/** + * @expose + * @type {Object} + */ +org_apache_flex_core_UIBase.prototype.positioner = null; + + +/** + * @return {Object} The array of children. + */ +org_apache_flex_core_UIBase.prototype.internalChildren = + function() { + return this.element.childNodes; +}; + + +/** + * @protected + * @return {Object} The actual element to be parented. + */ +org_apache_flex_core_UIBase.prototype.createElement = function() { + if (this.element == null) + this.element = document.createElement('div'); + if (this.positioner == null) + this.positioner = this.element; + this.positioner.style.display = 'block'; + + this.element.flexjs_wrapper = this; + + return this.positioner; +}; + + +/** + * @protected + * @type {?function()} + */ +org_apache_flex_core_UIBase.prototype.finalizeElement = null; + + +/** + * @param {Object} c The child element. + */ +org_apache_flex_core_UIBase.prototype.addElement = function(c) { + this.element.appendChild(c.positioner); + c.addedToParent(); +}; + + +/** + * @param {Object} c The child element. + * @param {number} index The index. + */ +org_apache_flex_core_UIBase.prototype.addElementAt = function(c, index) { + var children = this.internalChildren(); + if (index >= children.length) + this.addElement(c); + else + { + this.element.insertBefore(c.positioner, + children[index]); + c.addedToParent(); + } +}; + + +/** + * @param {number} index The index in parent. + * @return {Object} The child element. + */ +org_apache_flex_core_UIBase.prototype.getElementAt = function(index) { + var children = this.internalChildren(); + return children[index].flexjs_wrapper; +}; + + +/** + * @param {Object} c The child element. + * @return {number} The index in parent. + */ +org_apache_flex_core_UIBase.prototype.getElementIndex = function(c) { + var children = this.internalChildren(); + var n = children.length; + for (var i = 0; i < n; i++) + { + if (children[i] == c.element) + return i; + } + return -1; +}; + + +/** + * @param {Object} c The child element. + */ +org_apache_flex_core_UIBase.prototype.removeElement = function(c) { + this.element.removeChild(c.element); +}; + + +/** + */ +org_apache_flex_core_UIBase.prototype.addedToParent = function() { + + var styles = this.style; + if (styles) + org_apache_flex_core_ValuesManager.valuesImpl.applyStyles(this, styles); + + if (this.mxmlBeads_) { + var n = this.mxmlBeads_.length; + for (var i = 0; i < n; i++) { + this.addBead(this.mxmlBeads_[i]); + } + } + + /** + * @type {Function} + */ + var c; + if (this.getBeadByType(org_apache_flex_core_IBeadModel) == null) + { + if (org_apache_flex_core_ValuesManager.valuesImpl.getValue) { + c = /** @type {Function} */ (org_apache_flex_core_ValuesManager.valuesImpl. + getValue(this, 'iBeadModel')); + if (c) + { + var model = new c(); + if (model) + this.addBead(model); + } + } + } + if (this.getBeadByType(org_apache_flex_core_IBeadView) == null) + { + if (org_apache_flex_core_ValuesManager.valuesImpl.getValue) { + c = /** @type {Function} */ (org_apache_flex_core_ValuesManager.valuesImpl. + getValue(this, 'iBeadView')); + if (c) + { + var view = new c(); + if (view) + this.addBead(view); + } + } + } + if (this.getBeadByType(org_apache_flex_core_IBeadLayout) == null) + { + if (org_apache_flex_core_ValuesManager.valuesImpl.getValue) { + c = /** @type {Function} */ (org_apache_flex_core_ValuesManager.valuesImpl. + getValue(this, 'iBeadLayout')); + if (c) + { + var layout = new c(); + if (layout) + this.addBead(layout); + } + } + } + if (this.getBeadByType(org_apache_flex_core_IBeadController) == null) + { + if (org_apache_flex_core_ValuesManager.valuesImpl.getValue) { + c = /** @type {Function} */ (org_apache_flex_core_ValuesManager.valuesImpl. + getValue(this, 'iBeadController')); + if (c) + { + var controller = new c(); + if (controller) + this.addBead(controller); + } + } + } +}; + + +/** + * @param {Object} bead The bead to be added. + */ +org_apache_flex_core_UIBase.prototype.addBead = function(bead) { + if (!this.beads_) { + this.beads_ = []; + } + this.beads_.push(bead); + + if (org_apache_flex_utils_Language.is(bead, org_apache_flex_core_IBeadModel)) + this.model_ = bead; + + if (org_apache_flex_utils_Language.is(bead, org_apache_flex_core_IBeadView)) { + this.dispatchEvent(new org_apache_flex_events_Event('viewChanged')); + } + + bead.strand = this; +}; + + +/** + * @param {Object} classOrInterface A type or interface. + * @return {Object} The bead of the given type or null. + */ +org_apache_flex_core_UIBase.prototype.getBeadByType = + function(classOrInterface) { + if (!this.beads_) { + this.beads_ = []; + } + for (var i = 0; i < this.beads_.length; i++) { + var bead = this.beads_[i]; + if (org_apache_flex_utils_Language.is(bead, classOrInterface)) { + return bead; + } + } + return null; +}; + + +/** + * @param {Object} value The bead to be removed. + * @return {Object} The bead that was removed. + */ +org_apache_flex_core_UIBase.prototype.removeBead = + function(value) { + if (!this.beads_) return null; + var n = this.beads_.length; + for (var i = 0; i < n; i++) { + var bead = this.beads_[i]; + if (bead == value) { + this.beads_.splice(i, 1); + return bead; + } + } + + return null; +}; + + +Object.defineProperties(org_apache_flex_core_UIBase.prototype, { + /** @expose */ + beads: { + /** @this {org_apache_flex_core_UIBase} */ + set: function(value) { + this.mxmlBeads_ = value; + } + }, + /** @expose */ + numElements: { + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + var children = this.internalChildren(); + return children.length; + } + }, + /** @expose */ + parent: { + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + var p = this.positioner.parentNode; + var wrapper = p.flexjs_wrapper; + return wrapper; + } + }, + /** @expose */ + alpha: { + /** @this {org_apache_flex_core_UIBase} */ + set: function(alpha) { + this.positioner.style.opacity = alpha; + }, + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + var stralpha = this.positioner.style.opacity; + var alpha = parseFloat(stralpha); + return alpha; + } + }, + /** @expose */ + x: { + /** @this {org_apache_flex_core_UIBase} */ + set: function(pixels) { + this.positioner.style.position = 'absolute'; + this.positioner.style.left = pixels.toString() + 'px'; + }, + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + var strpixels = this.positioner.style.left; + var pixels = parseFloat(strpixels); + if (isNaN(pixels)) + pixels = this.positioner.offsetLeft; + return pixels; + } + }, + /** @expose */ + y: { + /** @this {org_apache_flex_core_UIBase} */ + set: function(pixels) { + this.positioner.style.position = 'absolute'; + this.positioner.style.top = pixels.toString() + 'px'; + }, + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + var strpixels = this.positioner.style.top; + var pixels = parseFloat(strpixels); + if (isNaN(pixels)) + pixels = this.positioner.offsetTop; + return pixels; + } + }, + /** @expose */ + width: { + /** @this {org_apache_flex_core_UIBase} */ + set: function(pixels) { + this.explicitWidth = pixels; + this.setWidth(pixels); + }, + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + var pixels; + var strpixels = this.positioner.style.width; + if (strpixels !== null && strpixels.indexOf('%') != -1) + pixels = NaN; + else + pixels = parseFloat(strpixels); + if (isNaN(pixels)) { + pixels = this.positioner.offsetWidth; + if (pixels === 0 && this.positioner.scrollWidth !== 0) { + // invisible child elements cause offsetWidth to be 0. + pixels = this.positioner.scrollWidth; + } + } + return pixels; + } + }, + /** @expose */ + explicitWidth: { + /** @this {org_apache_flex_core_UIBase} */ + set: function(pixels) { + this.explicitWidth_ = pixels; + if (!isNaN(pixels)) + this.percentWidth_ = NaN; + }, + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + return this.explicitWidth_; + } + }, + /** @expose */ + percentWidth: { + /** @this {org_apache_flex_core_UIBase} */ + set: function(pixels) { + this.percentWidth_ = pixels; + this.positioner.style.width = pixels.toString() + '%'; + if (!isNaN(pixels)) + this.explicitWidth_ = NaN; + }, + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + return this.percentWidth_; + } + }, + /** @expose */ + height: { + /** @this {org_apache_flex_core_UIBase} */ + set: function(pixels) { + this.explicitHeight = pixels; + this.setHeight(pixels); + }, + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + var pixels; + var strpixels = this.positioner.style.height; + if (strpixels !== null && strpixels.indexOf('%') != -1) + pixels = NaN; + else + pixels = parseFloat(strpixels); + if (isNaN(pixels)) { + pixels = this.positioner.offsetHeight; + if (pixels === 0 && this.positioner.scrollHeight !== 0) { + // invisible child elements cause offsetHeight to be 0. + pixels = this.positioner.scrollHeight; + } + } + return pixels; + } + }, + /** @expose */ + explicitHeight: { + /** @this {org_apache_flex_core_UIBase} */ + set: function(pixels) { + this.explicitHeight_ = pixels; + if (!isNaN(pixels)) + this.percentHeight_ = NaN; + }, + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + return this.explicitHeight_; + } + }, + /** @expose */ + percentHeight: { + /** @this {org_apache_flex_core_UIBase} */ + set: function(pixels) { + this.percentHeight_ = pixels; + this.positioner.style.height = pixels.toString() + '%'; + if (!isNaN(pixels)) + this.explicitHeight_ = NaN; + }, + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + return this.percentHeight_; + } + }, + /** @expose */ + id: { + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + return this.id_; + }, + /** @this {org_apache_flex_core_UIBase} */ + set: function(value) { + if (this.id_ !== value) { + this.element.id = value; + this.id_ = value; + this.dispatchEvent('idChanged'); + } + } + }, + /** @expose */ + className: { + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + return this.className_; + }, + /** @this {org_apache_flex_core_UIBase} */ + set: function(value) { + if (this.className_ !== value) { + this.element.className = this.typeNames ? value + ' ' + this.typeNames : value; + this.className_ = value; + this.dispatchEvent('classNameChanged'); + } + } + }, + /** @expose */ + model: { + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + if (this.model_ == null) { + // addbead will set _model + if (org_apache_flex_core_ValuesManager.valuesImpl.getValue) { + /** + * @type {Function} + */ + var m = /** @type {Function} */ (org_apache_flex_core_ValuesManager.valuesImpl. + getValue(this, 'iBeadModel')); + var b = new m(); + this.addBead(b); + } + } + return this.model_; + }, + /** @this {org_apache_flex_core_UIBase} */ + set: function(value) { + if (this.model_ !== value) { + this.addBead(value); + this.dispatchEvent('modelChanged'); + } + } + }, + /** @expose */ + style: { + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + return this.style_; + }, + /** @this {org_apache_flex_core_UIBase} */ + set: function(value) { + if (this.style_ !== value) { + if (typeof(value) == 'string') + value = org_apache_flex_core_ValuesManager.valuesImpl.parseStyles(value); + this.style_ = value; + if (value.addEventListener) + value.addEventListener(org_apache_flex_events_ValueChangeEvent.VALUE_CHANGE, + goog.bind(this.styleChangeHandler, this)); + this.dispatchEvent('stylesChanged'); + } + } + }, + /** @expose */ + visible: { + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + return this.positioner.style.display !== 'none'; + }, + /** @this {org_apache_flex_core_UIBase} */ + set: function(value) { + var oldValue = this.positioner.style.display !== 'none'; + if (value !== oldValue) { + if (!value) { + this.lastDisplay_ = this.positioner.style.display; + this.positioner.style.display = 'none'; + this.dispatchEvent(new org_apache_flex_events_Event('hide')); + } else { + if (this.lastDisplay_) { + this.positioner.style.display = this.lastDisplay_; + } else { + this.positioner.style.display = this.positioner.internalDisplay; + } + this.dispatchEvent(new org_apache_flex_events_Event('show')); + } + this.dispatchEvent(new org_apache_flex_events_Event('visibleChanged')); + } + } + }, + /** @expose */ + topMostEventDispatcher: { + /** @this {org_apache_flex_core_UIBase} */ + get: function() { + return document.body.flexjs_wrapper; + } + } +}); + + +/** + * @expose + * @param {number} value The height of the object in pixels. + * @param {boolean=} opt_noEvent Whether to skip sending a change event. + */ +org_apache_flex_core_UIBase.prototype.setHeight = + function(value, opt_noEvent) +{ + if (opt_noEvent === undefined) + opt_noEvent = false; + + var _height = this.height; + if (_height != value) { + this.positioner.style.height = value.toString() + 'px'; + if (!opt_noEvent) + this.dispatchEvent('heightChanged'); + } +}; + + +/** + * @expose + * @param {number} value The width of the object in pixels. + * @param {boolean=} opt_noEvent Whether to skip sending a change event. + */ +org_apache_flex_core_UIBase.prototype.setWidth = + function(value, opt_noEvent) +{ + if (opt_noEvent === undefined) + opt_noEvent = false; + + var _width = this.width; + if (_width != value) { + this.positioner.style.width = value.toString() + 'px'; + if (!opt_noEvent) + this.dispatchEvent('widthChanged'); + } +}; + + +/** + * @expose + * @param {number} newWidth The width of the object in pixels. + * @param {number} newHeight The height of the object in pixels. + * @param {boolean=} opt_noEvent Whether to skip sending a change event. + */ +org_apache_flex_core_UIBase.prototype.setWidthAndHeight = + function(newWidth, newHeight, opt_noEvent) +{ + if (opt_noEvent === undefined) + opt_noEvent = false; + + var _width = this.width; + if (_width != newWidth) { + this.positioner.style.width = newWidth.toString() + 'px'; + if (!opt_noEvent) + this.dispatchEvent('widthChanged'); + } + var _height = this.height; + if (_height != newHeight) { + this.positioner.style.height = newHeight.toString() + 'px'; + if (!opt_noEvent) + this.dispatchEvent('heightChanged'); + } + this.dispatchEvent('sizeChanged'); +}; + + +/** + * @expose + * @return {boolean} True if width sized to content. + */ +org_apache_flex_core_UIBase.prototype.isWidthSizedToContent = function() +{ + return (isNaN(this.explicitWidth_) && isNaN(this.percentWidth_)); +}; + + +/** + * @expose + * @return {boolean} True if height sized to content. + */ +org_apache_flex_core_UIBase.prototype.isHeightSizedToContent = function() +{ + return (isNaN(this.explicitHeight_) && isNaN(this.percentHeight_)); +}; + + +/** + * @expose + * @type {string} + */ +org_apache_flex_core_UIBase.prototype.typeNames = ''; + + +/** + * @expose + * @param {org_apache_flex_events_ValueChangeEvent} value The new style properties. + */ +org_apache_flex_core_UIBase.prototype.styleChangeHandler = function(value) { + var newStyle = {}; + newStyle[value.propertyName] = value.newValue; + org_apache_flex_core_ValuesManager.valuesImpl.applyStyles(this, newStyle); +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/UIMetrics.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/UIMetrics.js b/frameworks/projects/Core/js/src/org/apache/flex/core/UIMetrics.js new file mode 100644 index 0000000..026e8ee --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/UIMetrics.js @@ -0,0 +1,51 @@ +/** + * 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_core_UIMetrics'); + + + +/** + * @constructor + */ +org_apache_flex_core_UIMetrics = function() { +}; + + +/** + * @expose + * @type {number} + */ +org_apache_flex_core_UIMetrics.prototype.top = 0; + + +/** + * @expose + * @type {number} + */ +org_apache_flex_core_UIMetrics.prototype.left = 0; + + +/** + * @expose + * @type {number} + */ +org_apache_flex_core_UIMetrics.prototype.bottom = 0; + + +/** + * @expose + * @type {number} + */ +org_apache_flex_core_UIMetrics.prototype.right = 0; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/ValuesManager.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/ValuesManager.js b/frameworks/projects/Core/js/src/org/apache/flex/core/ValuesManager.js new file mode 100644 index 0000000..7b3172c --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/ValuesManager.js @@ -0,0 +1,57 @@ +/** + * 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_core_ValuesManager'); + +goog.require('org_apache_flex_core_IValuesImpl'); + + + +/** + * @constructor + */ +org_apache_flex_core_ValuesManager = function() { +}; + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_ValuesManager.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'ValuesManager', + qName: 'org_apache_flex_core_ValuesManager' }] }; + + +/** + * @expose + * @type {org_apache_flex_core_IValuesImpl} + */ +org_apache_flex_core_ValuesManager.prototype.valuesImpl = null; + + +Object.defineProperties(org_apache_flex_core_ValuesManager.prototype, { + /** @expose */ + valuesImpl: { + /** @this {org_apache_flex_core_ValuesManager} */ + get: function() { + return org_apache_flex_core_ValuesManager.valuesImpl; + }, + /** @this {org_apache_flex_core_ValuesManager} */ + set: function(value) { + org_apache_flex_core_ValuesManager.valuesImpl = value; + } + } +}); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/core/ViewBase.js ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/ViewBase.js b/frameworks/projects/Core/js/src/org/apache/flex/core/ViewBase.js new file mode 100644 index 0000000..3ed0349 --- /dev/null +++ b/frameworks/projects/Core/js/src/org/apache/flex/core/ViewBase.js @@ -0,0 +1,221 @@ +/** + * 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_core_ViewBase'); + +goog.require('org_apache_flex_core_IPopUpHost'); +goog.require('org_apache_flex_core_UIBase'); +goog.require('org_apache_flex_core_ValuesManager'); +goog.require('org_apache_flex_events_Event'); +goog.require('org_apache_flex_events_ValueChangeEvent'); +goog.require('org_apache_flex_utils_MXMLDataInterpreter'); + + + +/** + * @constructor + * @implements {org_apache_flex_core_IPopUpHost} + * @extends {org_apache_flex_core_UIBase} + */ +org_apache_flex_core_ViewBase = function() { + org_apache_flex_core_ViewBase.base(this, 'constructor'); + + /** + * @private + * @type {Array} + */ + this.states_ = null; + + /** + * @private + * @type {Array} + */ + this.transitions_ = null; + + /** + * @private + * @type {string} + */ + this.currentState_ = ''; + + /** + * @private + * @type {boolean} + */ + this.initialized_ = false; + + this.document = this; + +}; +goog.inherits(org_apache_flex_core_ViewBase, org_apache_flex_core_UIBase); + + +/** + * Metadata + * + * @type {Object.>} + */ +org_apache_flex_core_ViewBase.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'ViewBase', + qName: 'org_apache_flex_core_ViewBase' }], + interfaces: [org_apache_flex_core_IPopUpHost] }; + + +/** + * @private + * @type {Object} + */ +org_apache_flex_core_ViewBase.prototype.applicationModel_ = null; + + +/** + * @expose + * @param {Array} data The data for the attributes. + */ +org_apache_flex_core_ViewBase.prototype.generateMXMLAttributes = function(data) { + org_apache_flex_utils_MXMLDataInterpreter.generateMXMLProperties(this, data); +}; + + +/** + * @expose + * @type {Object} The document. + */ +org_apache_flex_core_ViewBase.prototype.document = null; + + +/** + * @expose + * @param {Object} doc The document. + * @param {Array} desc The descriptor data; + */ +org_apache_flex_core_ViewBase.prototype.setMXMLDescriptor = + function(doc, desc) { + this.MXMLDescriptor = desc; + this.document = doc; +}; + + +/** + * @expose + */ +org_apache_flex_core_ViewBase.prototype.addedToParent = function() { + + //org_apache_flex_core_ViewBase.base(this,'addedToParent'); + this.element.flexjs_wrapper = this; + if (org_apache_flex_core_ValuesManager.valuesImpl.init) { + org_apache_flex_core_ValuesManager.valuesImpl.init(this); + } + + org_apache_flex_core_ViewBase.base(this, 'addedToParent'); + + if (!this.initialized_) { + org_apache_flex_utils_MXMLDataInterpreter.generateMXMLInstances(this.document, + this, this.MXMLDescriptor); + + this.dispatchEvent(new org_apache_flex_events_Event('initBindings')); + this.dispatchEvent(new org_apache_flex_events_Event('initComplete')); + this.initialized_ = true; + } + this.dispatchEvent(new org_apache_flex_events_Event('childrenAdded')); +}; + + +/** + * @expose + * @param {string} state The name of the state. + * @return {boolean} True if state in states array. + */ +org_apache_flex_core_ViewBase.prototype.hasState = function(state) { + for (var p in this.states_) + { + var s = this.states_[p]; + if (s.name == state) + return true; + } + return false; +}; + + +Object.defineProperties(org_apache_flex_core_ViewBase.prototype, { + /** @expose */ + MXMLDescriptor: { + /** @this {org_apache_flex_core_ViewBase} */ + get: function() { + return this.mxmldd; + }, + /** @this {org_apache_flex_core_ViewBase} */ + set: function(value) { + this.mxmldd = value; + } + }, + /** @expose */ + applicationModel: { + /** @this {org_apache_flex_core_ViewBase} */ + get: function() { + return this.applicationModel_; + }, + /** @this {org_apache_flex_core_ViewBase} */ + set: function(value) { + this.applicationModel_ = value; + } + }, + /** @expose */ + states: { + /** @this {org_apache_flex_core_ViewBase} */ + get: function() { + return this.states_; + }, + /** @this {org_apache_flex_core_ViewBase} */ + set: function(value) { + this.states_ = value; + this.currentState_ = value[0].name; + + if (org_apache_flex_core_ValuesManager.valuesImpl.getValue) { + /** + * @type {Function} + */ + var impl = /** @type {Function} */ (org_apache_flex_core_ValuesManager.valuesImpl. + getValue(this, 'iStatesImpl')); + // TODO: (aharui) check if bead already exists + this.addBead(new impl()); + } + } + }, + /** @expose */ + currentState: { + /** @this {org_apache_flex_core_ViewBase} */ + get: function() { + return this.currentState_; + }, + /** @this {org_apache_flex_core_ViewBase} */ + set: function(value) { + var event = new org_apache_flex_events_ValueChangeEvent( + 'currentStateChange', false, false, this.currentState_, value); + this.currentState_ = value; + this.dispatchEvent(event); + } + }, + /** @expose */ + transitions: { + /** @this {org_apache_flex_core_ViewBase} */ + get: function() { + return this.transitions_; + }, + /** @this {org_apache_flex_core_ViewBase} */ + set: function(value) { + this.transitions_ = value; + } + } +});