You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2018/10/26 18:06:15 UTC
[royale-asjs] branch develop updated: upper and lower case beads
for Jewel TextInputBase
This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new ad8cdbf upper and lower case beads for Jewel TextInputBase
ad8cdbf is described below
commit ad8cdbfecbac1d63e8f3ce728a99d0839379b73f
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Fri Oct 26 20:06:08 2018 +0200
upper and lower case beads for Jewel TextInputBase
---
.../src/main/royale/TextInputPlayGround.mxml | 13 ++++
.../Jewel/src/main/resources/jewel-manifest.xml | 2 +
.../jewel/beads/controls/textinput/LowerCase.as | 77 ++++++++++++++++++++++
.../jewel/beads/controls/textinput/UpperCase.as | 77 ++++++++++++++++++++++
4 files changed, 169 insertions(+)
diff --git a/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml b/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml
index 5c16b91..2038f24 100644
--- a/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml
+++ b/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml
@@ -95,6 +95,19 @@ limitations under the License.
<j:Slider id="slider_w" width="350" value="211" minimum="10" maximum="350" valueChange="onValueChange(event)"/>
<j:Label text="textinput.width='{textinput.width}'"/>
+
+ <j:VGroup gap="3">
+ <j:TextInput text="Bead for text UPPER case">
+ <js:beads>
+ <j:UpperCase/>
+ </js:beads>
+ </j:TextInput>
+ <j:TextInput text="Bead for text LOWER case">
+ <js:beads>
+ <j:LowerCase/>
+ </js:beads>
+ </j:TextInput>
+ </j:VGroup>
</j:Card>
</j:GridCell>
diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
index 2cbb903..f1d0530 100644
--- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
+++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
@@ -121,6 +121,8 @@
<component id="TextPrompt" class="org.apache.royale.jewel.beads.controls.textinput.TextPrompt"/>
<component id="PasswordInput" class="org.apache.royale.jewel.beads.controls.textinput.PasswordInput"/>
<component id="MaxNumberCharacters" class="org.apache.royale.jewel.beads.controls.textinput.MaxNumberCharacters"/>
+ <component id="UpperCase" class="org.apache.royale.jewel.beads.controls.textinput.UpperCase"/>
+ <component id="LowerCase" class="org.apache.royale.jewel.beads.controls.textinput.LowerCase"/>
<component id="BasicLayout" class="org.apache.royale.jewel.beads.layouts.BasicLayout"/>
<component id="NullLayout" class="org.apache.royale.jewel.beads.layouts.NullLayout"/>
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/LowerCase.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/LowerCase.as
new file mode 100644
index 0000000..48c66eb
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/LowerCase.as
@@ -0,0 +1,77 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.royale.jewel.beads.controls.textinput
+{
+ import org.apache.royale.core.IBead;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.events.IEventDispatcher;
+ import org.apache.royale.jewel.supportClasses.textinput.TextInputBase;
+
+ /**
+ * The LowerCase class is a specialty bead that can be used with
+ * any Jewel TextInputBase control. The bead makes all text change to lower case
+ * Note: if you only need text to look lower case but wants the text remain unchanged
+ * you can use CSS text-transform: lowercase
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public class LowerCase implements IBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function LowerCase()
+ {
+ }
+
+ protected var t:TextInputBase;
+
+ /**
+ * @copy org.apache.royale.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function set strand(value:IStrand):void
+ {
+ t = value as TextInputBase;
+ IEventDispatcher(t).addEventListener(Event.CHANGE, changeToLowerCase);
+ t.text = t.text.toLowerCase();
+ }
+
+ /**
+ * @private
+ */
+ private function changeToLowerCase(event:Event):void
+ {
+ t.text = t.text.toLowerCase();
+ }
+ }
+}
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/UpperCase.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/UpperCase.as
new file mode 100644
index 0000000..d89a1d8
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/UpperCase.as
@@ -0,0 +1,77 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.royale.jewel.beads.controls.textinput
+{
+ import org.apache.royale.core.IBead;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.events.IEventDispatcher;
+ import org.apache.royale.jewel.supportClasses.textinput.TextInputBase;
+
+ /**
+ * The UpperCase class is a specialty bead that can be used with
+ * any Jewel TextInputBase control. The bead makes all text change to upper case
+ * Note: if you only need text to look upper case but wants the text remain unchanged
+ * you can use CSS text-transform: uppercase
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public class UpperCase implements IBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function UpperCase()
+ {
+ }
+
+ protected var t:TextInputBase;
+
+ /**
+ * @copy org.apache.royale.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.4
+ */
+ public function set strand(value:IStrand):void
+ {
+ t = value as TextInputBase;
+ IEventDispatcher(t).addEventListener(Event.CHANGE, changeToUpperCase);
+ t.text = t.text.toUpperCase();
+ }
+
+ /**
+ * @private
+ */
+ private function changeToUpperCase(event:Event):void
+ {
+ t.text = t.text.toUpperCase();
+ }
+ }
+}