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 69445200BDE for ; Fri, 4 Nov 2016 15:42:06 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 68297160AE8; Fri, 4 Nov 2016 14:42:06 +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 41677160B07 for ; Fri, 4 Nov 2016 15:42:05 +0100 (CET) Received: (qmail 63107 invoked by uid 500); 4 Nov 2016 14:42:03 -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 62582 invoked by uid 99); 4 Nov 2016 14:42:03 -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; Fri, 04 Nov 2016 14:42:03 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 286EEF1731; Fri, 4 Nov 2016 14:42:03 +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 Date: Fri, 04 Nov 2016 14:42:16 -0000 Message-Id: <48805fde2f074875b5753b26df4618ad@git.apache.org> In-Reply-To: <77365af14dce4106bd9ae934484c1373@git.apache.org> References: <77365af14dce4106bd9ae934484c1373@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [15/34] git commit: [flex-asjs] [refs/heads/feature/mdl] - MDL CheckBox impl archived-at: Fri, 04 Nov 2016 14:42:06 -0000 MDL CheckBox impl Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/697e3bf7 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/697e3bf7 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/697e3bf7 Branch: refs/heads/feature/mdl Commit: 697e3bf77a96e66ead79187555d1e1adb6ccdd27 Parents: b548665 Author: Carlos Rovira Authored: Mon Oct 17 16:16:22 2016 +0200 Committer: Carlos Rovira Committed: Fri Nov 4 15:41:34 2016 +0100 ---------------------------------------------------------------------- .../main/flex/org/apache/flex/mdl/CheckBox.as | 162 +++++++++++++++++++ .../src/main/resources/mdl-manifest.xml | 1 + 2 files changed, 163 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/697e3bf7/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/CheckBox.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/CheckBox.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/CheckBox.as new file mode 100644 index 0000000..082b99f --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/CheckBox.as @@ -0,0 +1,162 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +{ + COMPILE::SWF + { + import org.apache.flex.html.CheckBox; + } + COMPILE::JS + { + import org.apache.flex.core.UIBase; + import org.apache.flex.core.WrappedHTMLElement; + import org.apache.flex.events.Event; + } + + /** + * The CheckBox class provides a MDL UI-like appearance for + * a CheckBox. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + COMPILE::SWF + public class CheckBox extends org.apache.flex.html.CheckBox + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function CheckBox() + { + super(); + } + } + + COMPILE::JS + public class CheckBox extends UIBase + { + + private var input:HTMLInputElement; + private var checkbox:HTMLSpanElement; + private var label:HTMLLabelElement; + private var textNode:Text; + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + * @flexjsignorecoercion HTMLLabelElement + * @flexjsignorecoercion HTMLInputElement + * @flexjsignorecoercion HTMLSpanElement + * @flexjsignorecoercion Text + */ + override protected function createElement():WrappedHTMLElement + { + label = document.createElement('label') as HTMLLabelElement; + label.className = 'mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect'; + element = label as WrappedHTMLElement; + + input = document.createElement('input') as HTMLInputElement; + input.type = 'checkbox'; + input.className = 'mdl-checkbox__input'; + //input.addEventListener('change', selectionChangeHandler, false); + label.appendChild(input); + + checkbox = document.createElement('span') as HTMLSpanElement; + checkbox.className = 'mdl-checkbox__label'; + //checkbox.addEventListener('mouseover', mouseOverHandler, false); + //checkbox.addEventListener('mouseout', mouseOutHandler, false); + label.appendChild(checkbox); + + textNode = document.createTextNode('') as Text; + checkbox.appendChild(textNode); + //label.className = 'CheckBox'; + typeNames = 'CheckBox'; + + positioner = element; + positioner.style.position = 'relative'; + (input as WrappedHTMLElement).flexjs_wrapper = this; + (checkbox as WrappedHTMLElement).flexjs_wrapper = this; + element.flexjs_wrapper = this; + + return element; + }; + + + /** + */ + private function mouseOverHandler(event:Event):void + { + //checkbox.className = 'checkbox-icon-hover'; + } + + /** + */ + private function mouseOutHandler(event:Event):void + { + /*if (input.checked) + checkbox.className = 'checkbox-icon-checked'; + else + checkbox.className = 'checkbox-icon';*/ + } + + + /** + */ + private function selectionChangeHandler(event:Event):void + { + /*if (input.checked) + checkbox.className = 'checkbox-icon-checked'; + else + checkbox.className = 'checkbox-icon';*/ + } + + + public function get text():String + { + return textNode.nodeValue; + } + + public function set text(value:String):void + { + textNode.nodeValue = value; + } + + public function get selected():Boolean + { + return input.checked; + } + + public function set selected(value:Boolean):void + { + input.checked = value; + /*if (value) + checkbox.className = 'checkbox-icon-checked'; + else + checkbox.className = 'checkbox-icon';*/ + } + + } + +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/697e3bf7/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 eb65435..ffbc9c0 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml +++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml @@ -23,5 +23,6 @@ +