Hi,

I'm preparing a new example about basic view states, and I find a bug.

The view loose the layout bead when switch 2 times if I remove the first
one (that is not needed).

<j:beads>
<j:VerticalLayout/>
</j:beads>

If you can check this project, you'll see the effect if comment lines 40 to
42 (the verticallayout)
I think this happens with Jewel since it uses css class selectors instead
of hardcoded values. But is a bug.

If someone can point me where to look this problem, I'll look tomorrow.
This bug of loosing bead layout generate different strange behaviors
depending on the code, this one only shows this particular one.

Thanks.



2018-06-01 21:04 GMT+02:00 <carlosrov...@apache.org>:

> 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 3f4dde9  new blog example for using view states
> 3f4dde9 is described below
>
> commit 3f4dde9b46278977fc8a71952b29d8da00f24fa8
> Author: Carlos Rovira <carlosrov...@apache.org>
> AuthorDate: Fri Jun 1 21:04:32 2018 +0200
>
>     new blog example for using view states
> ---
>  .../resources/META-INF/flex/services-config.xml    |   2 +-
>  ...ing_View_States_in_a_Royale_Application.as3proj |  95
> +++++++++++++++++
>  .../README.txt                                     |  30 ++++++
>  .../asconfig.json                                  |  31 ++++++
>  .../build.xml                                      |  63 ++++++++++++
>  .../pom.xml                                        | 112
> +++++++++++++++++++++
>  .../resources/jewel-example-index-template.html    |  31 ++++++
>  .../src/main/resources/styles.css                  |  28 ++++++
>  ..._Using_View_States_in_a_Royale_Application.mxml |  68 +++++++++++++
>  .../Jewel/src/main/resources/jewel-manifest.xml    |   2 +
>  .../beads/controls/textinput/PasswordInput.as      | 101
> +++++++++++++++++++
>  11 files changed, 562 insertions(+), 1 deletion(-)
>
> diff --git a/examples/amf/SampleAmfWebApp/src/main/
> resources/META-INF/flex/services-config.xml b/examples/amf/
> SampleAmfWebApp/src/main/resources/META-INF/flex/services-config.xml
> index a168757..59ab362 100644
> --- a/examples/amf/SampleAmfWebApp/src/main/resources/META-INF/flex/
> services-config.xml
> +++ b/examples/amf/SampleAmfWebApp/src/main/resources/META-INF/flex/
> services-config.xml
> @@ -45,7 +45,7 @@
>          <server-to-client-heartbeat-millis>5000</server-to-client-
> heartbeat-millis>
>          <add-no-cache-headers>true</add-no-cache-headers>
>          <serialization>
> -            <enable-small-messages>false</enable-small-messages>
> +            <enable-small-messages>true</enable-small-messages>
>          </serialization>
>        </properties>
>      </channel-definition>
> diff --git a/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/BE0008_Using_View_States_in_a_Royale_Application.as3proj
> b/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/BE0008_Using_View_States_in_a_Royale_Application.as3proj
> new file mode 100644
> index 0000000..dc44dcd
> --- /dev/null
> +++ b/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/BE0008_Using_View_States_in_a_Royale_Application.as3proj
> @@ -0,0 +1,95 @@
> +<?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.
> +
> +-->
> +<project>
> +  <output>
> +    <movie disabled="False"/>
> +    <movie path="bin-debug/BE0008_Using_View_States_in_a_Royale_
> Application.swf"/>
> +    <movie version="11"/>
> +    <movie input=""/>
> +    <movie width="800"/>
> +    <movie height="600"/>
> +    <movie fps="60"/>
> +    <movie background="#FFFFFF"/>
> +    <movie platform="Flash Player"/>
> +  </output>
> +  &lt;!-- Other classes to be compiled into your SWF --&gt;
> +  <classpaths>
> +    <class path="src/main/royale"/>
> +  </classpaths>
> +  <moonshineResourcePaths></moonshineResourcePaths>
> +  <moonshineNativeExtensionPaths></moonshineNativeExtensionPaths>
> +  <build>
> +    <option useResourceBundleMetadata="True"/>
> +    <option showBindingWarnings="True"/>
> +    <option warnings="True"/>
> +    <option es="False"/>
> +    <option verboseStackTraces="False"/>
> +    <option additional="-theme=${royalelib}/themes/Jewel-Light-
> NoFlat-Primary-Blue-Theme/src/main/resources/defaults.css
> -html-template=src/main/resources/jewel-example-index-template.html"/>
> +    <option loadConfig=""/>
> +    <option linkReport=""/>
> +    <option benchmark="False"/>
> +    <option optimize="False"/>
> +    <option showActionScriptWarnings="True"/>
> +    <option staticLinkRSL="False"/>
> +    <option locale=""/>
> +    <option compilerConstants=""/>
> +    <option showDeprecationWarnings="True"/>
> +    <option antBuildPath="build/build.xml"/>
> +    <option showUnusedTypeSelectorWarnings="True"/>
> +    <option customSDK=""/>
> +    <option strict="True"/>
> +    <option accessible="False"/>
> +    <option useNetwork="True"/>
> +    <option allowSourcePathOverlap="False"/>
> +  </build>
> +  <includeLibraries></includeLibraries>
> +  <libraryPaths></libraryPaths>
> +  <externalLibraryPaths></externalLibraryPaths>
> +  <rslPaths></rslPaths>
> +  <intrinsics>
> +    <element path="Library/AS3/frameworks/Flex4"/>
> +    <element path="Library\AS3\frameworks\Flex4"/>
> +  </intrinsics>
> +  <library></library>
> +  <compileTargets>
> +    <compile path="src/main/royale/BE0008_Using_View_States_in_a_Royale_
> Application.mxml"/>
> +  </compileTargets>
> +  <hiddenPaths></hiddenPaths>
> +  <preBuildCommand>null</preBuildCommand>
> +  <postBuildCommand alwaysRun="False">null</postBuildCommand>
> +  <options>
> +    <option testMovie=""/>
> +    <option showHiddenPaths="False"/>
> +    <option testMovieCommand=""/>
> +    <option defaultBuildTargets=""/>
> +    <option isPrimeFacesVisualEditor="False"/>
> +  </options>
> +  <moonshineRunCustomization>
> +    <option deviceSimulator="null"/>
> +    <option targetPlatform="2"/>
> +    <option launchMethod="Simulator"/>
> +    <option urlToLaunch=""/>
> +    <option projectType="2"/>
> +    <deviceSimulator>null</deviceSimulator>
> +    <certAndroid>null</certAndroid>
> +    <certIos>null</certIos>
> +    <certIosProvisioning>null</certIosProvisioning>
> +  </moonshineRunCustomization>
> +</project>
> \ No newline at end of file
> diff --git 
> a/examples/blog/BE0008_Using_View_States_in_a_Royale_Application/README.txt
> b/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/README.txt
> new file mode 100644
> index 0000000..9b9cff2
> --- /dev/null
> +++ b/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/README.txt
> @@ -0,0 +1,30 @@
> +///////////////////////////////////////////////////////////
> /////////////////////
> +//
> +//  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.
> +//
> +///////////////////////////////////////////////////////////
> /////////////////////
> +
> +DESCRIPTION
> +
> +Using View States in a Royale Application
> +
> +
> +---
> +
> +
> +http://royale.apache.org/using-view-states-in-a-royale-application/
> +
> +Learn how to use view states in a royale application to show or hide
> content
> \ No newline at end of file
> diff --git 
> a/examples/blog/BE0008_Using_View_States_in_a_Royale_Application/asconfig.json
> b/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/asconfig.json
> new file mode 100644
> index 0000000..4b6259e
> --- /dev/null
> +++ b/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/asconfig.json
> @@ -0,0 +1,31 @@
> +///////////////////////////////////////////////////////////
> /////////////////////
> +//
> +//  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.
> +//
> +///////////////////////////////////////////////////////////
> /////////////////////
> +{
> +    "config": "royale",
> +    "compilerOptions": {
> +        "debug": false,
> +        "targets": ["JSRoyale","SWF"],
> +        "source-map": true
> +    },
> +    "additionalOptions": "-remove-circulars -js-output-optimization=
> skipAsCoercions",
> +    "files":
> +    [
> +        "src/main/royale/App.mxml"
> +    ]
> +}
> diff --git 
> a/examples/blog/BE0008_Using_View_States_in_a_Royale_Application/build.xml
> b/examples/blog/BE0008_Using_View_States_in_a_Royale_Application/build.xml
> new file mode 100644
> index 0000000..70e55f5
> --- /dev/null
> +++ b/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/build.xml
> @@ -0,0 +1,63 @@
> +<?xml version="1.0"?>
> +<!--
> +
> +  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.
> +
> +-->
> +
> +
> +<project 
> name="BE0007_Selecting_options_from_a_group_of_jewel_checkbox_controls"
> default="main" basedir=".">
> +    <property name="ROYALE_HOME" location="../../.."/>
> +    <property name="example" value="App" />
> +
> +    <property file="${ROYALE_HOME}/env.properties"/>
> +    <property environment="env"/>
> +    <property file="${ROYALE_HOME}/build.properties"/>
> +    <property name="ROYALE_HOME" value="${ROYALE_HOME}"/>
> +
> +    <include file="${basedir}/../../build_example.xml" />
> +
> +    <target name="main" depends="clean,build_example.compile"
> description="Clean build of ${example}">
> +        <mkdir dir="${basedir}/bin/js-debug/assets" />
> +        <copy todir="${basedir}/bin/js-debug/assets" failonerror="false">
> +            <fileset dir="${basedir}/src/main/resources/assets">
> +                <include name="**" />
> +            </fileset>
> +        </copy>
> +        <mkdir dir="${basedir}/bin/js-release/assets" />
> +        <copy todir="${basedir}/bin/js-release/assets"
> failonerror="false">
> +            <fileset dir="${basedir}/src/main/resources/assets">
> +                <include name="**" />
> +            </fileset>
> +        </copy>
> +    </target>
> +
> +    <target name="clean">
> +        <delete dir="${basedir}/bin" failonerror="false" />
> +        <delete dir="${basedir}/bin-debug" failonerror="false" />
> +        <delete dir="${basedir}/bin-release" failonerror="false" />
> +        <delete dir="${basedir}/target" failonerror="false" />
> +    </target>
> +
> +    <target name="examine" depends="build_example.get.browser">
> +        <property name="which" value="debug" />
> +        <echo message="See various team members."/>
> +        <exec executable="${browser}" dir="${basedir}/bin/js-${which}"
> failonerror="true">
> +            <arg value="${basedir}/bin/js-${which}/index.html"/>
> +        </exec>
> +    </target>
> +
> +</project>
> diff --git 
> a/examples/blog/BE0008_Using_View_States_in_a_Royale_Application/pom.xml
> b/examples/blog/BE0008_Using_View_States_in_a_Royale_Application/pom.xml
> new file mode 100644
> index 0000000..26ec97a
> --- /dev/null
> +++ b/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/pom.xml
> @@ -0,0 +1,112 @@
> +<?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.
> +
> +-->
> +<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://
> maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";>
> +  <modelVersion>4.0.0</modelVersion>
> +
> +  <parent>
> +    <groupId>org.apache.royale.examples</groupId>
> +    <artifactId>examples-blog</artifactId>
> +    <version>0.9.3-SNAPSHOT</version>
> +  </parent>
> +
> +  <artifactId>BE0008_Using_View_States_in_a_Royale_
> Application</artifactId>
> +  <version>0.9.3-SNAPSHOT</version>
> +  <packaging>swf</packaging>
> +
> +  <name>Apache Royale: Examples: Blog: 0008: Using View States in a
> Royale Application</name>
> +
> +  <build>
> +    <sourceDirectory>src/main/royale</sourceDirectory>
> +    <plugins>
> +      <plugin>
> +        <groupId>org.apache.royale.compiler</groupId>
> +        <artifactId>royale-maven-plugin</artifactId>
> +        <extensions>true</extensions>
> +        <configuration>
> +          <mainClass>BE0008_Using_View_States_in_a_Royale_
> Application.mxml</mainClass>
> +          <targets>JSRoyale,SWF</targets>
> +          <debug>false</debug>
> +          <htmlTemplate>${basedir}/target/javascript/bin/js-
> debug/jewel-example-index-template.html</htmlTemplate>
> +        </configuration>
> +      </plugin>
> +    </plugins>
> +  </build>
> +
> +  <dependencies>
> +    <dependency>
> +      <groupId>com.adobe.flash.framework</groupId>
> +      <artifactId>playerglobal</artifactId>
> +      <version>${flash.version}</version>
> +      <type>swc</type>
> +      <scope>provided</scope>
> +    </dependency>
> +    <dependency>
> +      <groupId>org.apache.royale.framework</groupId>
> +      <artifactId>Effects</artifactId>
> +      <version>0.9.3-SNAPSHOT</version>
> +      <type>swc</type>
> +      <classifier>swf</classifier>
> +    </dependency>
> +    <dependency>
> +      <groupId>org.apache.royale.framework</groupId>
> +      <artifactId>Effects</artifactId>
> +      <version>0.9.3-SNAPSHOT</version>
> +      <type>swc</type>
> +      <classifier>js</classifier>
> +    </dependency>
> +    <dependency>
> +      <groupId>org.apache.royale.framework</groupId>
> +      <artifactId>Jewel</artifactId>
> +      <version>0.9.3-SNAPSHOT</version>
> +      <type>swc</type>
> +      <classifier>swf</classifier>
> +    </dependency>
> +    <dependency>
> +      <groupId>org.apache.royale.framework</groupId>
> +      <artifactId>Jewel</artifactId>
> +      <version>0.9.3-SNAPSHOT</version>
> +      <type>swc</type>
> +      <classifier>js</classifier>
> +    </dependency>
> +    <dependency>
> +      <groupId>org.apache.royale.framework</groupId>
> +      <artifactId>HTML</artifactId>
> +      <version>0.9.3-SNAPSHOT</version>
> +      <type>swc</type>
> +      <classifier>swf</classifier>
> +    </dependency>
> +    <dependency>
> +      <groupId>org.apache.royale.framework</groupId>
> +      <artifactId>HTML</artifactId>
> +      <version>0.9.3-SNAPSHOT</version>
> +      <type>swc</type>
> +      <classifier>js</classifier>
> +    </dependency>
> +    <dependency>
> +      <groupId>org.apache.royale.framework</groupId>
> +      <artifactId>Jewel-Light-NoFlat-Primary-Blue-Theme</artifactId>
> +      <version>0.9.3-SNAPSHOT</version>
> +      <type>swc</type>
> +      <scope>theme</scope>
> +      <classifier>js</classifier>
> +    </dependency>
> +  </dependencies>
> +
> +</project>
> diff --git a/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/src/main/resources/jewel-example-index-template.html
> b/examples/blog/BE0008_Using_View_States_in_a_Royale_Application/src/main/
> resources/jewel-example-index-template.html
> new file mode 100644
> index 0000000..d98e4cf
> --- /dev/null
> +++ b/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/src/main/resources/jewel-example-index-template.html
> @@ -0,0 +1,31 @@
> +<!--
> +  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.
> +-->
> +<!DOCTYPE html>
> +<html>
> +<head>
> +       <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
> +       <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
> +    <meta name="Custom Template for injecting custom style CSS">
> +    <meta name="viewport" content="width=device-width, initial-scale=1.0,
> minimum-scale=1.0">
> +    <link rel="stylesheet" type="text/css" href="${application}.css">
> +    <link href="https://fonts.googleapis.com/css?family=Lato:400,700";
> rel="stylesheet">
> +${head}
> +</head>
> +<body>
> +${body}
> +</body>
> +</html>
> diff --git a/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/src/main/resources/styles.css b/examples/blog/BE0008_Using_
> View_States_in_a_Royale_Application/src/main/resources/styles.css
> new file mode 100644
> index 0000000..31b7b4f
> --- /dev/null
> +++ b/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/src/main/resources/styles.css
> @@ -0,0 +1,28 @@
> +/*
> +///////////////////////////////////////////////////////////
> /////////////////////
> +//
> +//  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.
> +//
> +///////////////////////////////////////////////////////////
> /////////////////////
> +*/
> +
> +@namespace "http://www.w3.org/1999/xhtml";;
> +
> +.Application
> +{
> +    padding: 10px;
> +       margin: 10px;
> +}
> diff --git a/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/src/main/royale/BE0008_Using_View_States_in_a_Royale_Application.mxml
> b/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/src/main/royale/BE0008_Using_View_States_in_a_
> Royale_Application.mxml
> new file mode 100644
> index 0000000..67015d3
> --- /dev/null
> +++ b/examples/blog/BE0008_Using_View_States_in_a_Royale_
> Application/src/main/royale/BE0008_Using_View_States_in_a_
> Royale_Application.mxml
> @@ -0,0 +1,68 @@
> +<?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:Application 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">
> +
> +    <fx:Style source="../../main/resources/styles.css"/>
> +
> +    <fx:Style>
> +        global {
> +               IStatesImpl: ClassReference("org.apache.
> royale.core.SimpleStatesImpl");
> +               }
> +       </fx:Style>
> +
> +    <j:initialView>
> +        <j:View id="view" >
> +            <j:states>
> +                <js:State name="login" />
> +                <js:State name="loggedIn" />
> +            </j:states>
> +
> +            <j:beads>
> +                <j:VerticalLayout/>
> +            </j:beads>
> +
> +            <j:Group id="loginForm" includeIn="login">
> +                <j:beads>
> +                    <j:VerticalLayoutWithPaddingAndGap gap="10"/>
> +                </j:beads>
> +                <html:H1 text="Royale login"/>
> +                <j:TextInput id="username" text="someuser"/>
> +                <j:TextInput id="password" text="somepass">
> +                    <j:beads>
> +                        <j:PasswordInput/>
> +                    </j:beads>
> +                </j:TextInput>
> +                <j:Button text="Login" primary="true"
> click="view.currentState = 'loggedIn'" />
> +            </j:Group>
> +
> +            <j:Group id="loggedInForm" includeIn="loggedIn">
> +                <j:beads>
> +                    <j:VerticalLayoutWithPaddingAndGap gap="10"/>
> +                </j:beads>
> +                <html:H1 text="You are logged!! :)"/>
> +                <j:Button text="Logout" click="view.currentState =
> 'login'"/>
> +            </j:Group>
> +        </j:View>
> +    </j:initialView>
> +
> +</j:Application>
> \ No newline at end of file
> diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
> b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
> index acfb15b..aa93bec 100644
> --- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
> +++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
> @@ -42,7 +42,9 @@
>      <component id="DropDownListList" class="org.apache.royale.
> jewel.supportClasses.DropDownListList"/>
>
>      <component id="Disabled" class="org.apache.royale.
> jewel.beads.controls.Disabled"/>
> +
>      <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="BasicLayout" class="org.apache.royale.
> jewel.beads.layouts.BasicLayout"/>
>      <component id="TileLayout" class="org.apache.royale.
> jewel.beads.layouts.TileLayout"/>
> diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/
> royale/jewel/beads/controls/textinput/PasswordInput.as
> b/frameworks/projects/Jewel/src/main/royale/org/apache/
> royale/jewel/beads/controls/textinput/PasswordInput.as
> new file mode 100644
> index 0000000..0a6dde5
> --- /dev/null
> +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/
> royale/jewel/beads/controls/textinput/PasswordInput.as
> @@ -0,0 +1,101 @@
> +///////////////////////////////////////////////////////////
> /////////////////////
> +//
> +//  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
> +{
> +       COMPILE::SWF
> +       {
> +               import org.apache.royale.core.CSSTextField;
>
> +               import org.apache.royale.core.beads.ITextFieldView;
> +       }
> +       import org.apache.royale.core.IBead;
> +       import org.apache.royale.core.IStrand;
> +       import org.apache.royale.core.UIBase;
> +       import org.apache.royale.events.Event;
> +       import org.apache.royale.events.IEventDispatcher;
> +
> +       /**
> +        *  The PasswordInput class is a specialty bead that can be used
> with
> +        *  any TextInput control. The bead secures the text input area by
> masking
> +        *  the input as it is typed.
> +        *
> +        *  @langversion 3.0
> +        *  @playerversion Flash 10.2
> +        *  @playerversion AIR 2.6
> +        *  @productversion Royale 0.9
> +        */
> +       public class PasswordInput implements IBead
> +       {
> +               /**
> +                *  constructor.
> +                *
> +                *  @langversion 3.0
> +                *  @playerversion Flash 10.2
> +                *  @playerversion AIR 2.6
> +                *  @productversion Royale 0.9
> +                */
> +               public function PasswordInput()
> +               {
> +               }
> +
> +               protected var _strand:IStrand;
> +
> +               /**
> +                *  @copy org.apache.royale.core.IBead#strand
> +                *
> +                *  @langversion 3.0
> +                *  @playerversion Flash 10.2
> +                *  @playerversion AIR 2.6
> +                *  @productversion Royale 0.9
> +                *  @royaleignorecoercion org.apache.royale.core.UIBase
> +                *  @royaleignorecoercion HTMLInputElement
> +                */
> +               public function set strand(value:IStrand):void
> +               {
> +                       _strand = value;
> +
> +                       COMPILE::SWF
> +                       {
> +                               IEventDispatcher(value).
> addEventListener("viewChanged",viewChangeHandler);
>
> +                       }
> +                       COMPILE::JS
> +                       {
> +                               var host:UIBase = value as UIBase;
> +                               var e:HTMLInputElement = host.element as
> HTMLInputElement;
> +                               e.type = 'password';
> +                       }
> +               }
> +
> +               /**
> +                * @private
> +                */
> +               COMPILE::SWF
> +               private function viewChangeHandler(event:Event):void
> +               {
> +                       // get the ITextFieldView bead, which is required
> for this bead to work
> +                       var textView:ITextFieldView =
> _strand.getBeadByType(ITextFieldView) as ITextFieldView;
> +                       if (textView) {
> +                               var textField:CSSTextField =
> textView.textField;
> +                               textField.displayAsPassword = true;
> +                       }
> +                       else {
> +                               throw new Error("PasswordInputBead
> requires strand to have a TextInputView bead");
> +                       }
> +               }
> +       }
> +}
>
> --
> To stop receiving notification emails like this one, please contact
> carlosrov...@apache.org.
>



-- 
Carlos Rovira
http://about.me/carlosrovira

Reply via email to