You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ca...@apache.org on 2013/04/30 00:55:15 UTC
[1/2] git commit: [flex-asjs] - checkbox control for creates.
selected property works but clicking on it does not update visual state
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 <ca...@gmail.com>
Authored: Tue Apr 30 00:53:19 2013 +0200
Committer: Carlos Rovira <ca...@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();
+};
[2/2] git commit: [flex-asjs] - update createjs sample with checkbox
control. button event updates selected property to see control change
externaly.
Posted by ca...@apache.org.
update createjs sample with checkbox control. button event updates selected property to see control change externaly.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a898de05
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a898de05
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a898de05
Branch: refs/heads/feature/createjs-checkbox
Commit: a898de058820754aabdcdcd49b23a888551d2331
Parents: 11360ac
Author: Carlos Rovira <ca...@gmail.com>
Authored: Tue Apr 30 00:54:43 2013 +0200
Committer: Carlos Rovira <ca...@gmail.com>
Committed: Tue Apr 30 00:54:43 2013 +0200
----------------------------------------------------------------------
.../FlexJSTest_createjs/src/MyInitialView.mxml | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a898de05/examples/FlexJSTest_createjs/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_createjs/src/MyInitialView.mxml b/examples/FlexJSTest_createjs/src/MyInitialView.mxml
index 2e7a9b2..d972b99 100644
--- a/examples/FlexJSTest_createjs/src/MyInitialView.mxml
+++ b/examples/FlexJSTest_createjs/src/MyInitialView.mxml
@@ -35,6 +35,7 @@ limitations under the License.
{
dispatchEvent( new org.apache.flex.events.Event("pushme2Clicked") );
+ check1.selected = !check1.selected;
}
]]>
</fx:Script>
@@ -50,6 +51,8 @@ limitations under the License.
destinationPropertyName="text" />
</createjs:beads>
</createjs:Label>
- <createjs:TextButton x="350" y="225" text="Change Label" click="changeLabel()" />
-
+ <createjs:TextButton x="350" y="225" text="Change Label" click="changeLabel()"/>
+
+ <createjs:CheckBox id="check1" x="10" y="10" text="Check Me" selected="true"/>
+
</createjs:ViewBase>
\ No newline at end of file