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/09/01 11:30:42 UTC

[royale-asjs] branch develop updated: Move form example to its own section

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 efd1aaf  Move form example to its own section
efd1aaf is described below

commit efd1aaf3a1405cb6d4ca782a11d0567a03797d91
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sat Sep 1 13:30:37 2018 +0200

    Move form example to its own section
---
 .../src/main/royale/FormsValidationPlayGround.mxml | 88 ++++++++++++++++++++++
 .../JewelExample/src/main/royale/MainContent.mxml  |  1 +
 .../src/main/royale/TextInputPlayGround.mxml       | 62 +--------------
 .../src/main/royale/models/MainNavigationModel.as  |  3 +-
 4 files changed, 93 insertions(+), 61 deletions(-)

diff --git a/examples/royale/JewelExample/src/main/royale/FormsValidationPlayGround.mxml b/examples/royale/JewelExample/src/main/royale/FormsValidationPlayGround.mxml
new file mode 100644
index 0000000..1220490
--- /dev/null
+++ b/examples/royale/JewelExample/src/main/royale/FormsValidationPlayGround.mxml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+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.
+
+-->
+<j:SectionContent xmlns:fx="http://ns.adobe.com/mxml/2009"
+				  xmlns:j="library://ns.apache.org/royale/jewel"
+				  xmlns:js="library://ns.apache.org/royale/basic"
+				  xmlns:html="library://ns.apache.org/royale/html">
+
+	<j:beads>
+        <js:ContainerDataBinding/>
+    </j:beads>
+
+	<fx:Script>
+		<![CDATA[
+			import org.apache.royale.utils.StringPadder;
+			import org.apache.royale.jewel.Alert;
+
+			[Bindable]
+			public var randomCode:String = StringPadder.pad(String(Math.round(Math.random() * 10000)), "0", 5);
+
+            public function customValidate(host:TextInput):String {
+				return (host.text == randomCode) ? "" : "The entered code doesn't match " + randomCode;
+            }
+
+            public function doSummit(event:Event):void {
+				Alert.show("Data is valid submitted");
+            }
+		]]>
+	</fx:Script>
+
+	<j:Card width="600">
+		<html:H3 text="Jewel Form And Validators"/>
+
+		<j:Form>
+			<j:beads>
+				<j:FormValidator trigger="{btn}" triggerEvent="click"/>
+			</j:beads>
+			
+			<html:H4 text="Your name"/>
+			<j:TextInput>
+				<j:beads>
+					<j:TextPrompt prompt="Name"/>
+					<j:StringValidator required="3" autoTrim="true" requiredFieldError="Need more than 3 characters"/>
+				</j:beads>
+			</j:TextInput>
+
+			<html:H4 text="Favorite movies (at least 2)"/>
+			<j:VGroup gap="3">
+				<j:beads>
+					<j:CheckBoxValidator required="2" requiredFieldError="Please choose at least 2 movies"/>
+				</j:beads>
+
+				<j:CheckBox text="The Godfather"/>
+				<j:CheckBox text="Scent of a woman"/>
+				<j:CheckBox text="Star Wars"/>
+				<j:CheckBox text="The Shawshank Redemption"/>
+			</j:VGroup>
+
+			<html:H4 text="Verification code: {randomCode}"/>
+			<j:HGroup gap="3">
+				<j:TextInput>
+					<j:beads>
+						<j:TextPrompt prompt="Enter Verification Code"/>
+						<j:StringValidator validateFunction="{customValidate}"/>
+					</j:beads>
+				</j:TextInput>
+
+				<j:Button id="btn" text="send" emphasis="primary"/>
+			</j:HGroup>
+		</j:Form>
+	</j:Card>
+</j:SectionContent>
diff --git a/examples/royale/JewelExample/src/main/royale/MainContent.mxml b/examples/royale/JewelExample/src/main/royale/MainContent.mxml
index 985719a..06547b8 100644
--- a/examples/royale/JewelExample/src/main/royale/MainContent.mxml
+++ b/examples/royale/JewelExample/src/main/royale/MainContent.mxml
@@ -131,6 +131,7 @@ limitations under the License.
         <local:GridPlayGround id="grid_panel"/>
         <local:CardPlayGround id="card_panel"/>
         <local:TablePlayGround id="tables_panel"/>
+        <local:FormsValidationPlayGround id="form_validation_panel"/>
     </j:ApplicationMainContent>
     
 </j:ApplicationResponsiveView>
diff --git a/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml b/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml
index 0c3b350..53854ad 100644
--- a/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml
+++ b/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml
@@ -190,72 +190,14 @@ limitations under the License.
 			</j:Card>
 		</j:GridCell>
 
-		<j:GridCell wideScreenNumerator="1" wideScreenDenominator="2"
+		<!-- <j:GridCell wideScreenNumerator="1" wideScreenDenominator="2"
 					desktopNumerator="1" desktopDenominator="1"
 					tabletNumerator="1" tabletDenominator="1"
 					phoneNumerator="1" phoneDenominator="1">
 			<j:Card>
-				<html:H3 text="Jewel Form"/>
-
-				<j:Form>
-					<j:beads>
-						<j:FormValidator trigger="{btn}" triggerEvent="click"/>
-					</j:beads>
-					
-					<html:H4 text="Your name"/>
-					<j:TextInput>
-						<j:beads>
-							<j:TextPrompt prompt="Name"/>
-							<j:StringValidator required="3" autoTrim="true" requiredFieldError="Need more than 3 characters"/>
-						</j:beads>
-					</j:TextInput>
-
-					<html:H4 text="Favorite movies (at least 2)"/>
-					<j:VGroup gap="3">
-						<j:beads>
-							<j:CheckBoxValidator required="2" requiredFieldError="Please choose at least 2 movies"/>
-						</j:beads>
-
-						<j:CheckBox text="The Godfather"/>
-						<j:CheckBox text="Scent of a woman"/>
-						<j:CheckBox text="Star Wars"/>
-						<j:CheckBox text="The Shawshank Redemption"/>
-					</j:VGroup>
-
-					<html:H4 text="Verification code: {randomCode}"/>
-					<j:HGroup gap="3">
-						<j:TextInput>
-							<j:beads>
-								<j:TextPrompt prompt="Enter Verification Code"/>
-								<j:StringValidator validateFunction="{customValidate}"/>
-							</j:beads>
-						</j:TextInput>
-
-						<j:Button id="btn" text="send" emphasis="primary"/>
-
-					</j:HGroup>
 
-				</j:Form>
 			</j:Card>
-		</j:GridCell>
+		</j:GridCell> -->
 	</j:Grid>
 
-	<fx:Script>
-		<![CDATA[
-			import org.apache.royale.utils.StringPadder;
-			import org.apache.royale.jewel.Alert;
-
-			[Bindable]
-			public var randomCode:String = StringPadder.pad(String(Math.round(Math.random() * 10000)), "0", 5);
-
-            public function customValidate(host:TextInput):String {
-				return (host.text == randomCode) ? "" : "The entered code doesn't match " + randomCode;
-            }
-
-            public function doSummit(event:Event):void {
-				Alert.show("Data is valid submitted");
-            }
-		]]>
-	</fx:Script>
-
 </j:SectionContent>
diff --git a/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as b/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as
index 6365e15..64d4986 100644
--- a/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as
+++ b/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as
@@ -37,7 +37,8 @@ package models
             new NavigationLinkVO("RadioButton", "radiobutton_panel", MaterialIconType.RADIO_BUTTON_CHECKED),
             new NavigationLinkVO("Slider", "slider_panel", MaterialIconType.STORAGE),
             new NavigationLinkVO("Text", "text_panel", MaterialIconType.SUBJECT),
-            new NavigationLinkVO("TextInput", "textinput_panel", MaterialIconType.TEXT_FIELDS)
+            new NavigationLinkVO("TextInput", "textinput_panel", MaterialIconType.TEXT_FIELDS),
+            new NavigationLinkVO("Forms & Validation", "form_validation_panel", MaterialIconType.ASSIGNMENT_TURNED_IN)
 
             // new NavigationLinkVO("Menu", "menus_panel"),
             // new NavigationLinkVO("Loading", "loading_panel"),