flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject [1/2] git commit: [flex-asjs] - checkbox control for creates. selected property works but clicking on it does not update visual state
Date Mon, 29 Apr 2013 22:55:15 GMT
Updated Branches:
  refs/heads/feature/createjs-checkbox [created] a898de058


checkbox control for creates. selected property works but clicking on it does not update visual
state


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

Branch: refs/heads/feature/createjs-checkbox
Commit: 11360ac0c28c2d5f762d40bf6e0f0a51eaabad44
Parents: 128e84c
Author: Carlos Rovira <carlos.rovira@gmail.com>
Authored: Tue Apr 30 00:53:19 2013 +0200
Committer: Carlos Rovira <carlos.rovira@gmail.com>
Committed: Tue Apr 30 00:53:19 2013 +0200

----------------------------------------------------------------------
 frameworks/as/createjs-manifest.xml                |    1 +
 frameworks/as/defaults.css                         |    4 +
 .../flex/createjs/staticControls/CheckBox.as       |   26 ++++
 .../flex/createjs/staticControls/CheckBox.js       |  103 +++++++++++++++
 4 files changed, 134 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/11360ac0/frameworks/as/createjs-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/as/createjs-manifest.xml b/frameworks/as/createjs-manifest.xml
index f856cdf..c72090c 100644
--- a/frameworks/as/createjs-manifest.xml
+++ b/frameworks/as/createjs-manifest.xml
@@ -26,5 +26,6 @@
     <component id="ViewBase" class="org.apache.flex.createjs.core.ViewBase"/>
     <component id="Label" class="org.apache.flex.createjs.staticControls.Label"/>
     <component id="TextButton" class="org.apache.flex.createjs.staticControls.TextButton"/>
+    <component id="CheckBox" class="org.apache.flex.createjs.staticControls.CheckBox"/>
 
 </componentPackage>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/11360ac0/frameworks/as/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/as/defaults.css b/frameworks/as/defaults.css
index 64caf16..426cb47 100644
--- a/frameworks/as/defaults.css
+++ b/frameworks/as/defaults.css
@@ -175,5 +175,9 @@ createjs|TextButton
         ITextButtonBead: ClassReference("org.apache.flex.html.staticControls.beads.TextButtonBead");
 }
 
+createjs|CheckBox
+{
+        ICheckBoxBead: ClassReference("org.apache.flex.html.staticControls.beads.CheckBoxBead");
+}
 
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/11360ac0/frameworks/as/src/org/apache/flex/createjs/staticControls/CheckBox.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/createjs/staticControls/CheckBox.as b/frameworks/as/src/org/apache/flex/createjs/staticControls/CheckBox.as
new file mode 100644
index 0000000..b4dc469
--- /dev/null
+++ b/frameworks/as/src/org/apache/flex/createjs/staticControls/CheckBox.as
@@ -0,0 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.createjs.staticControls
+{
+	import org.apache.flex.html.staticControls.CheckBox;
+	
+	public class CheckBox extends org.apache.flex.html.staticControls.CheckBox
+	{	
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/11360ac0/frameworks/js/FlexJS/src/org/apache/flex/createjs/staticControls/CheckBox.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/createjs/staticControls/CheckBox.js
b/frameworks/js/FlexJS/src/org/apache/flex/createjs/staticControls/CheckBox.js
new file mode 100644
index 0000000..65c3c19
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/createjs/staticControls/CheckBox.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.createjs.staticControls.CheckBox');
+
+goog.require('org.apache.flex.createjs.core.UIBase');
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.createjs.core.UIBase}
+ */
+org.apache.flex.createjs.staticControls.CheckBox = function() {
+    org.apache.flex.createjs.core.UIBase.call(this);
+};
+goog.inherits(
+    org.apache.flex.createjs.staticControls.CheckBox, org.apache.flex.createjs.core.UIBase
+);
+
+org.apache.flex.createjs.staticControls.TextButton.prototype.checkMark = null;
+org.apache.flex.createjs.staticControls.TextButton.prototype.checkMarkBackground = null;
+org.apache.flex.createjs.staticControls.TextButton.prototype.checkBoxLabel = null;
+org.apache.flex.createjs.staticControls.TextButton.prototype.selected = false;
+
+/**
+ * @override
+ * @this {org.apache.flex.createjs.staticControls.CheckBox}
+ * @param {Object} p The parent element.
+ */
+org.apache.flex.createjs.staticControls.CheckBox.prototype.addToParent = function(p)
+{	
+	this.checkMarkBackground = new createjs.Shape();
+	this.checkMarkBackground.name = "checkmarkbackground";
+	this.checkMarkBackground.graphics.beginFill("red").drawRoundRect(0, 0, 40, 40, 8);
+	
+	this.checkMark = new createjs.Shape();
+	this.checkMark.name = "checkmark";
+	this.checkMark.graphics.beginFill("white").drawRoundRect(0, 0, 32, 32, 6);
+	this.checkMark.x = 4;
+	this.checkMark.y = 4;
+	this.checkMark.visible = this.selected;
+		
+	this.checkBoxLabel = new createjs.Text("checkbox", "20px Arial", "#ff7700");
+	this.checkBoxLabel.name = "label";
+	this.checkBoxLabel.textAlign = "left";
+	this.checkBoxLabel.textBaseline = "middle";
+	this.checkBoxLabel.x = 45;
+	this.checkBoxLabel.y = 40/2;
+	
+	this.element = new createjs.Container();
+	this.element.name = "checkbox";
+	this.element.addChild(this.checkMarkBackground, this.checkBoxLabel, this.checkMark);
+	p.addChild(this.element);
+
+    this.positioner = this.element;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.createjs.staticControls.CheckBox}
+ * @return {string} The text getter.
+ */
+org.apache.flex.createjs.staticControls.CheckBox.prototype.get_text = function() {
+    return this.checkBoxLabel.text;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.createjs.staticControls.CheckBox}
+ * @param {string} value The text setter.
+ */
+org.apache.flex.createjs.staticControls.CheckBox.prototype.set_text = function(value) {
+    this.checkBoxLabel.text = value;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.createjs.staticControls.CheckBox}
+ * @return {bool} The selected getter.
+ */
+org.apache.flex.createjs.staticControls.CheckBox.prototype.get_selected = function() {
+    return this.selected;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.createjs.staticControls.CheckBox}
+ * @param {bool} value The selected setter.
+ */
+org.apache.flex.createjs.staticControls.CheckBox.prototype.set_selected = function(value)
{
+	this.checkMark.visible = this.selected = value;
+	this.element.getStage().update();
+};


Mime
View raw message