flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pio...@apache.org
Subject [02/16] git commit: [flex-asjs] [refs/heads/feature/fontawesome] - Adding TextInput to Express project with password, prompt, and numeric options which add beads as necessary.
Date Thu, 05 Jan 2017 10:29:24 GMT
Adding TextInput to Express project with password, prompt, and numeric options which add beads
as necessary.


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

Branch: refs/heads/feature/fontawesome
Commit: c5a3eee9b7761a3e5cc9efe11d300cce6b30d7d3
Parents: c08abd4
Author: Peter Ent <pent@apache.org>
Authored: Wed Jan 4 09:52:25 2017 -0500
Committer: Peter Ent <pent@apache.org>
Committed: Wed Jan 4 09:52:25 2017 -0500

----------------------------------------------------------------------
 .../Express/src/main/flex/ExpressClasses.as     |   1 +
 .../flex/org/apache/flex/express/TextInput.as   | 114 +++++++++++++++++++
 .../Express/src/main/resources/defaults.css     |   8 ++
 .../src/main/resources/express-manifest.xml     |   1 +
 4 files changed, 124 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c5a3eee9/frameworks/projects/Express/src/main/flex/ExpressClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Express/src/main/flex/ExpressClasses.as b/frameworks/projects/Express/src/main/flex/ExpressClasses.as
index b2a813d..7c9da2a 100644
--- a/frameworks/projects/Express/src/main/flex/ExpressClasses.as
+++ b/frameworks/projects/Express/src/main/flex/ExpressClasses.as
@@ -33,6 +33,7 @@ internal class ExpressClasses
     import org.apache.flex.express.HContainer; HContainer;
     import org.apache.flex.express.HView; HView;
     import org.apache.flex.express.MXMLItemRenderer; MXMLItemRenderer;
+	import org.apache.flex.express.TextInput; TextInput;
     import org.apache.flex.express.VContainer; VContainer;
     import org.apache.flex.express.View; View;
     import org.apache.flex.express.VView; VView;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c5a3eee9/frameworks/projects/Express/src/main/flex/org/apache/flex/express/TextInput.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Express/src/main/flex/org/apache/flex/express/TextInput.as
b/frameworks/projects/Express/src/main/flex/org/apache/flex/express/TextInput.as
new file mode 100644
index 0000000..7cb96c8
--- /dev/null
+++ b/frameworks/projects/Express/src/main/flex/org/apache/flex/express/TextInput.as
@@ -0,0 +1,114 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.express
+{
+	import org.apache.flex.events.Event;
+	import org.apache.flex.html.TextInput;
+	import org.apache.flex.html.accessories.NumericOnlyTextInputBead;
+	import org.apache.flex.html.accessories.PasswordInputBead;
+	import org.apache.flex.html.accessories.TextPromptBead;
+	
+	/**
+	 * This class extends the standard TextInput class and adds in
+	 * the prompt, password, and numeric accessories (as needed) for
+	 * convenience.
+	 */
+	public class TextInput extends org.apache.flex.html.TextInput
+	{
+		public function TextInput()
+		{
+			super();
+			
+			_promptBead = new TextPromptBead();
+			_promptBead.prompt = "";
+			addBead(_promptBead);
+		}
+		
+		private var _promptBead:TextPromptBead;
+		
+		[Bindable("promptChanged")]
+		/**
+		 * Displays a message to the user when the field is empty.
+		 */
+		public function get prompt():String
+		{
+			return _promptBead.prompt;
+		}
+		
+		public function set prompt(value:String):void
+		{
+			_promptBead.prompt = value;
+			dispatchEvent(new Event("promptChanged"));
+		}
+		
+		private var _passwordBead:PasswordInputBead;
+		private var _secure:Boolean = false;
+		
+		[Bindable("secureChanged")]
+		/**
+		 * Displays input as * to obsure the content.
+		 */
+		public function get secure():Boolean
+		{
+			return _secure;
+		}
+		public function set secure(value:Boolean):void
+		{
+			_secure = value;
+			
+			if (_secure && _passwordBead == null) {
+				_passwordBead = new PasswordInputBead();
+				addBead(_passwordBead);
+			}
+			else if (!_secure && _passwordBead != null) {
+				removeBead(_passwordBead);
+				_passwordBead = null;
+			}
+			
+			dispatchEvent(new Event("secureChanged"));
+		}
+		
+		private var _numericBead:NumericOnlyTextInputBead;
+		private var _numeric:Boolean = false;
+		
+		[Bindable("numericChanged")]
+		/**
+		 * Allows only numeric values to be entered.
+		 */
+		public function get numeric():Boolean
+		{
+			return _numeric;
+		}
+		public function set numeric(value:Boolean):void
+		{
+			_numeric = value;
+			
+			if (_numeric && _numericBead == null) {
+				_numericBead = new NumericOnlyTextInputBead();
+				addBead(_numericBead);
+			}
+			else if (!_numeric && _numericBead != null) {
+				removeBead(_numericBead);
+				_numericBead = null;
+			}
+			
+			dispatchEvent(new Event("numericChanged"));
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c5a3eee9/frameworks/projects/Express/src/main/resources/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/Express/src/main/resources/defaults.css b/frameworks/projects/Express/src/main/resources/defaults.css
index 7e1f593..7ad5c48 100644
--- a/frameworks/projects/Express/src/main/resources/defaults.css
+++ b/frameworks/projects/Express/src/main/resources/defaults.css
@@ -47,6 +47,14 @@ Container
 	IViewportModel: ClassReference("org.apache.flex.html.beads.models.ViewportModel");
 }
 
+TextInput
+{
+	border: 1px solid #808080;
+	border-radius: 2px;
+	padding: 4px;
+	margin: 0px;
+}
+
 View
 {
 	IBeadView: ClassReference("org.apache.flex.html.beads.ContainerView");

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c5a3eee9/frameworks/projects/Express/src/main/resources/express-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Express/src/main/resources/express-manifest.xml b/frameworks/projects/Express/src/main/resources/express-manifest.xml
index 9559985..c60c55e 100644
--- a/frameworks/projects/Express/src/main/resources/express-manifest.xml
+++ b/frameworks/projects/Express/src/main/resources/express-manifest.xml
@@ -26,6 +26,7 @@
     <component id="HContainer" class="org.apache.flex.express.HContainer"/>
     <component id="HView" class="org.apache.flex.express.HView"/>
     <component id="MXMLItemRenderer" class="org.apache.flex.express.MXMLItemRenderer"/>
+    <component id="TextInput" class="org.apache.flex.express.TextInput"/>
     <component id="VContainer" class="org.apache.flex.express.VContainer"/>
     <component id="View" class="org.apache.flex.express.View"/>
     <component id="VView" class="org.apache.flex.express.VView"/>


Mime
View raw message