You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2013/05/28 22:53:18 UTC

git commit: [flex-asjs] [refs/heads/develop] - Added Panel and TitleBar javascript components. Modified SolidBackgroundColorBead to extract its own background color.

Updated Branches:
  refs/heads/develop b0201c8f7 -> b1ece45de


Added Panel and TitleBar javascript components. Modified SolidBackgroundColorBead to extract its own background color.


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/b1ece45d
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/b1ece45d
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/b1ece45d

Branch: refs/heads/develop
Commit: b1ece45de8119e4cd217b9ef475eddbc684c699f
Parents: b0201c8
Author: Peter Ent <pe...@apache.org>
Authored: Tue May 28 16:53:07 2013 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Tue May 28 16:53:07 2013 -0400

----------------------------------------------------------------------
 .../apache/flex/html/staticControls/TitleBar.as    |    4 +
 .../staticControls/beads/SolidBackgroundBead.as    |    6 +
 .../org/apache/flex/html/staticControls/Panel.js   |   73 ++++++++++
 .../apache/flex/html/staticControls/TitleBar.js    |  107 +++++++++++++++
 4 files changed, 190 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b1ece45d/frameworks/as/src/org/apache/flex/html/staticControls/TitleBar.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/TitleBar.as b/frameworks/as/src/org/apache/flex/html/staticControls/TitleBar.as
index ee6e4db..bac0fb7 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/TitleBar.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/TitleBar.as
@@ -32,6 +32,7 @@ package org.apache.flex.html.staticControls
 		{
 			super();
 			
+			className = "TitleBar";
 		}
 		
 		public function get title():String
@@ -91,6 +92,9 @@ package org.apache.flex.html.staticControls
 			closeButton.addToParent(this);
 			
 			childrenAdded();
+			
+			// dispatch this event to force any beads to update
+			dispatchEvent(new Event("widthChanged"));
 		}
 		
 		private function handlePropertyChange(event:Event):void

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b1ece45d/frameworks/as/src/org/apache/flex/html/staticControls/beads/SolidBackgroundBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/beads/SolidBackgroundBead.as b/frameworks/as/src/org/apache/flex/html/staticControls/beads/SolidBackgroundBead.as
index f588990..76133b6 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/beads/SolidBackgroundBead.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/beads/SolidBackgroundBead.as
@@ -23,6 +23,7 @@ package org.apache.flex.html.staticControls.beads
 	import org.apache.flex.core.IBead;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.UIBase;
+	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
 
@@ -43,6 +44,11 @@ package org.apache.flex.html.staticControls.beads
 			_strand = value;
             IEventDispatcher(value).addEventListener("heightChanged", changeHandler);
             IEventDispatcher(value).addEventListener("widthChanged", changeHandler);
+			
+			var bgColor:Object = ValuesManager.valuesImpl.getValue(value, "background-color");
+			if( bgColor != null ) {
+				backgroundColor = uint(bgColor);
+			}
 		}
 		
 		private var _backgroundColor:uint;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b1ece45d/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Panel.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Panel.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Panel.js
new file mode 100644
index 0000000..f67108a
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Panel.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.
+ */
+
+goog.provide('org.apache.flex.html.staticControls.Panel');
+
+goog.require('org.apache.flex.html.staticControls.Container');
+goog.require('org.apache.flex.html.staticControls.TitleBar');
+
+
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.html.staticControls.Container}
+ */
+org.apache.flex.html.staticControls.Panel = function() {
+  goog.base(this);
+};
+goog.inherits(org.apache.flex.html.staticControls.Panel,
+    org.apache.flex.html.staticControls.Container);
+
+
+/**
+ * @override
+ * @this {org.apache.flex.html.staticControls.Panel}
+ * @param {Object} p The parent element.
+ */
+org.apache.flex.html.staticControls.Panel.prototype.addToParent =
+    function(p) {
+  var cb;
+
+  this.element = document.createElement('div');
+  
+  this.titleBar = new org.apache.flex.html.staticControls.TitleBar();
+  this.titleBar.addToParent(this);
+  this.titleBar.title = "Sample Panel";
+
+  p.internalAddChild(this.element);
+
+  this.positioner = this.element;
+  this.element.flexjs_wrapper = this;
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.Panel}
+ * @return {string} The title getter.
+ */
+org.apache.flex.html.staticControls.Panel.prototype.get_title = function() {
+  return this.titleBar.get_title();
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.Panel}
+ * @param {string} value The title setter.
+ */
+org.apache.flex.html.staticControls.Panel.prototype.set_title =
+    function(value) {
+  this.titleBar.set_title(value);
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b1ece45d/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TitleBar.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TitleBar.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TitleBar.js
new file mode 100644
index 0000000..39f1949
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TitleBar.js
@@ -0,0 +1,107 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the 'License');
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an 'AS IS' BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('org.apache.flex.html.staticControls.TitleBar');
+
+goog.require('org.apache.flex.html.staticControls.Container');
+goog.require('org.apache.flex.html.staticControls.Label');
+goog.require('org.apache.flex.html.staticControls.TextButton');
+
+
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.html.staticControls.Container}
+ */
+org.apache.flex.html.staticControls.TitleBar = function() {
+  goog.base(this);
+  
+  this._showCloseButton = false;
+  
+};
+goog.inherits(org.apache.flex.html.staticControls.TitleBar,
+    org.apache.flex.html.staticControls.Container);
+
+
+/**
+ * @override
+ * @this {org.apache.flex.html.staticControls.TitleBar}
+ * @param {Object} p The parent element.
+ */
+org.apache.flex.html.staticControls.TitleBar.prototype.addToParent =
+    function(p) {
+
+  this.element = document.createElement('div');
+  
+  this.titleLabel = new org.apache.flex.html.staticControls.Label();
+  this.titleLabel.addToParent(this);
+  this.titleLabel.positioner.style.display = "inline-block";
+  this.titleLabel.set_className("TitleBarLabel");
+  
+  this.titleButton = new org.apache.flex.html.staticControls.TextButton();
+  this.titleButton.addToParent(this);
+  this.titleButton.text = 'Close';
+  this.titleButton.positioner.style.display = this._showCloseButton ? "inline-block" : "none";
+  
+  //this.element.appendChild(this.titleLabel);
+  //this.element.appendChild(this.titleButton);
+
+  p.internalAddChild(this.element);
+
+  this.positioner = this.element;
+  this.element.flexjs_wrapper = this;
+  
+  this.set_className("TitleBar");
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.TitleBar}
+ * @return {string} The title getter.
+ */
+org.apache.flex.html.staticControls.TitleBar.prototype.get_title = function() {
+  return this.titleLabel.get_text();
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.TitleBar}
+ * @param {string} value The title setter.
+ */
+org.apache.flex.html.staticControls.TitleBar.prototype.set_title = function(value) {
+  this.titleLabel.set_text(value);
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.TitleBar}
+ * @return {string} The showCloseButton getter.
+ */
+org.apache.flex.html.staticControls.TitleBar.prototype.get_showCloseButton = function() {
+  return this._showCloseButton;
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.TitleBar}
+ * @param {string} value The title setter.
+ */
+org.apache.flex.html.staticControls.TitleBar.prototype.set_showCloseButton = function(value) {
+  this._showCloseButton = value;
+  this.titleButton.positioner.style.display = value ? "inline-block" : "none";
+};
\ No newline at end of file