Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7475F200BCC for ; Tue, 29 Nov 2016 23:05:33 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 73553160B15; Tue, 29 Nov 2016 22:05:33 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 95C33160AFC for ; Tue, 29 Nov 2016 23:05:32 +0100 (CET) Received: (qmail 29773 invoked by uid 500); 29 Nov 2016 22:05:31 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 29765 invoked by uid 99); 29 Nov 2016 22:05:31 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Nov 2016 22:05:31 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A1BEEE02AB; Tue, 29 Nov 2016 22:05:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: carlosrovira@apache.org To: commits@flex.apache.org Message-Id: <49bba1de4c1341dcbc2f3ef7d1849bd0@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [flex-asjs] [refs/heads/develop] - Numeric TextField bead Date: Tue, 29 Nov 2016 22:05:31 +0000 (UTC) archived-at: Tue, 29 Nov 2016 22:05:33 -0000 Repository: flex-asjs Updated Branches: refs/heads/develop 059b1f5a1 -> 9f867260d Numeric TextField bead Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/9f867260 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/9f867260 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/9f867260 Branch: refs/heads/develop Commit: 9f867260d238c0251607db061712f3362a431276 Parents: 059b1f5 Author: Carlos Rovira Authored: Tue Nov 29 23:05:24 2016 +0100 Committer: Carlos Rovira Committed: Tue Nov 29 23:05:24 2016 +0100 ---------------------------------------------------------------------- .../MDLExample/src/main/flex/TextFields.mxml | 16 ++- .../flex/org/apache/flex/mdl/beads/Numeric.as | 129 +++++++++++++++++++ .../src/main/resources/mdl-manifest.xml | 1 + 3 files changed, 145 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9f867260/examples/flexjs/MDLExample/src/main/flex/TextFields.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MDLExample/src/main/flex/TextFields.mxml b/examples/flexjs/MDLExample/src/main/flex/TextFields.mxml index 6ddceed..e5fadf6 100644 --- a/examples/flexjs/MDLExample/src/main/flex/TextFields.mxml +++ b/examples/flexjs/MDLExample/src/main/flex/TextFields.mxml @@ -26,7 +26,7 @@ limitations under the License. - + @@ -38,6 +38,20 @@ limitations under the License. + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9f867260/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Numeric.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Numeric.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Numeric.as new file mode 100644 index 0000000..6f28433 --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Numeric.as @@ -0,0 +1,129 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.mdl.beads +{ + COMPILE::SWF + { + import flash.text.TextFieldType; + + import org.apache.flex.core.CSSTextField; + } + + import org.apache.flex.core.IBead; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.UIBase; + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + + import org.apache.flex.mdl.TextField; + + /** + * The TextPrompt class is a specialty bead that can be used with + * any TextField control. The bead places a string into the input field + * when there is no value associated with the text property. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class Numeric implements IBead + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function Numeric() + { + } + + private var _pattern:String = "-?[0-9]*(\.[0-9]+)?"; + + /** + * The string to use as numeric pattern. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get pattern():String + { + return _pattern; + } + public function set pattern(value:String):void + { + _pattern = value; + } + + private var _text:String = "Input is not a number!"; + + /** + * The string to use as error text in the associated span. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get text():String + { + return _text; + } + public function set text(value:String):void + { + _text = value; + } + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + * @flexjsignorecoercion HTMLInputElement + * @flexjsignorecoercion org.apache.flex.core.UIBase; + */ + public function set strand(value:IStrand):void + { + _strand = value; + + COMPILE::JS + { + var mdlTi:TextField = value as TextField; + mdlTi.input.setAttribute('pattern', pattern); + + var span:HTMLSpanElement = document.createElement('span') as HTMLSpanElement; + span.className = "mdl-textfield__error"; + + var spanTextNode:Text = document.createTextNode(text) as Text; + span.appendChild(spanTextNode); + + mdlTi.positioner.appendChild(span); + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9f867260/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml index de38b0d..f552067 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml +++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml @@ -27,6 +27,7 @@ +