No, I think all should extend a base type. i.e.:MaterialIconBase, where we could add common properties, like add "md-48" or others, so you can put md48="true" in MXML. What do you think? I subclass I think does not give's nothing since only has text and you have to customize the createElement
2016-12-02 0:31 GMT+01:00 Piotr Zarzycki <piotrzarzyck...@gmail.com>: > Carlos, > > Do you think that "MaterialIcons" class should extends "I" and implements > "IBead". Derived classes like MaterialIconCancel will apply only > MaterialIconsType.Cancel ? > > Piotr > > 2016-12-02 0:26 GMT+01:00 <pio...@apache.org>: > > > Repository: flex-asjs > > Updated Branches: > > refs/heads/develop 7493febe8 -> 0b9753ef5 > > > > > > - Add first Material Icons beads "cancel" and "add" > > - Use "add' material icon bead in Buttons example > > - Add missing classList > > - Throw error DeletableChip strand do not meet requirements > > > > > > Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo > > Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/0b9753ef > > Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/0b9753ef > > Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/0b9753ef > > > > Branch: refs/heads/develop > > Commit: 0b9753ef54928628b84db0466817418efffe5c92 > > Parents: 7493feb > > Author: piotrz <pio...@apache.org> > > Authored: Fri Dec 2 00:26:45 2016 +0100 > > Committer: piotrz <pio...@apache.org> > > Committed: Fri Dec 2 00:26:45 2016 +0100 > > > > ---------------------------------------------------------------------- > > .../MDLExample/src/main/flex/Buttons.mxml | 4 +- > > .../flex/org/apache/flex/mdl/beads/Badge.as | 3 +- > > .../org/apache/flex/mdl/beads/DeletableChip.as | 10 ++- > > .../flex/org/apache/flex/mdl/beads/Restrict.as | 12 +--- > > .../mdl/beads/materialIcons/MaterialIconAdd.as | 74 > ++++++++++++++++++++ > > .../beads/materialIcons/MaterialIconCancel.as | 74 > ++++++++++++++++++++ > > .../beads/materialIcons/MaterialIconsType.as | 26 +++++++ > > .../flex/mdl/supportClasses/MaterialIcons.as | 61 ++++++++++++++++ > > .../src/main/resources/mdl-manifest.xml | 2 + > > 9 files changed, 250 insertions(+), 16 deletions(-) > > ---------------------------------------------------------------------- > > > > > > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ > > 0b9753ef/examples/flexjs/MDLExample/src/main/flex/Buttons.mxml > > ---------------------------------------------------------------------- > > diff --git a/examples/flexjs/MDLExample/src/main/flex/Buttons.mxml > > b/examples/flexjs/MDLExample/src/main/flex/Buttons.mxml > > index d6c3853..7879fad 100644 > > --- a/examples/flexjs/MDLExample/src/main/flex/Buttons.mxml > > +++ b/examples/flexjs/MDLExample/src/main/flex/Buttons.mxml > > @@ -32,7 +32,9 @@ limitations under the License. > > <mdl:GridCell column="1"> > > <!-- Fab button --> > > <mdl:Button fab="true" colored="true"> > > - <i class="material-icons">add</i> > > + <mdl:beads> > > + <mdl:MaterialIconAdd /> > > + </mdl:beads> > > </mdl:Button> > > </mdl:GridCell> > > > > > > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ > > 0b9753ef/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/Badge.as > > ---------------------------------------------------------------------- > > diff --git a/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/Badge.as b/frameworks/projects/ > > MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Badge.as > > index 4abb3ed..49feb2a 100644 > > --- a/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/Badge.as > > +++ b/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/Badge.as > > @@ -147,7 +147,8 @@ package org.apache.flex.mdl.beads > > host.element.classList.toggle( > "mdl-badge--no-background", > > _noBackground); > > host.element.classList.toggle( > "mdl-badge--overlap", > > _overlap); > > host.element.setAttribute(' > data-badge', > > _dataBadge.toString()); > > - } else > > + } > > + else > > { > > throw new Error("Host component > > must be an MDL Host for Badges."); > > } > > > > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ > > 0b9753ef/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/DeletableChip.as > > ---------------------------------------------------------------------- > > diff --git a/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/DeletableChip.as b/frameworks/projects/ > > MaterialDesignLite/src/main/flex/org/apache/flex/mdl/ > > beads/DeletableChip.as > > index f5a5329..bf75144 100644 > > --- a/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/DeletableChip.as > > +++ b/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/DeletableChip.as > > @@ -47,12 +47,12 @@ package org.apache.flex.mdl.beads > > > > } > > > > - private var deleteButton:Button; > > - > > private var _strand:IStrand; > > > > /** > > * @flexjsignorecoercion HTMLElement > > + * @flexjsignorecoercion HTMLSpanElement > > + * @flexjsignorecoercion HTMLButtonElement > > * > > * @param value > > */ > > @@ -70,7 +70,7 @@ package org.apache.flex.mdl.beads > > { > > element.classList.add("mdl-chip--deletable"); > > > > - deleteButton = new Button(); > > + var deleteButton:Button = new Button(); > > deleteButton.icon = true; > > > > var htmlButton:HTMLElement = (deleteButton.element > as > > HTMLElement) > > @@ -78,6 +78,10 @@ package org.apache.flex.mdl.beads > > > > element.appendChild(deleteButton.element as > > HTMLElement); > > } > > + else > > + { > > + throw new Error("Host component must be an MDL Host > > for Chips."); > > + } > > } > > } > > } > > > > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ > > 0b9753ef/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/Restrict.as > > ---------------------------------------------------------------------- > > diff --git a/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/Restrict.as b/frameworks/projects/ > > MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Restrict.as > > index 30accdb..7acbba7 100644 > > --- a/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/Restrict.as > > +++ b/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/Restrict.as > > @@ -18,18 +18,8 @@ > > //////////////////////////////////////////////////////////// > > //////////////////// > > 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; > > > > @@ -127,7 +117,7 @@ package org.apache.flex.mdl.beads > > mdlTi.input.setAttribute('pattern', pattern); > > > > var span:HTMLSpanElement = > document.createElement('span') > > as HTMLSpanElement; > > - span.className = "mdl-textfield__error"; > > + span.classList.add("mdl- > > textfield__error"); > > > > var spanTextNode:Text = document.createTextNode(error) > as > > Text; > > span.appendChild(spanTextNode); > > > > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ > > 0b9753ef/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/materialIcons/MaterialIconAdd.as > > ---------------------------------------------------------------------- > > diff --git a/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/materialIcons/MaterialIconAdd.as > > b/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/materialIcons/MaterialIconAdd.as > > new file mode 100644 > > index 0000000..d05a1f9 > > --- /dev/null > > +++ b/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/materialIcons/MaterialIconAdd.as > > @@ -0,0 +1,74 @@ > > +/////////////////////////////////////////////////////////// > > ///////////////////// > > +// > > +// 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.materialIcons > > +{ > > + import org.apache.flex.core.IBead; > > + import org.apache.flex.core.IStrand; > > + import org.apache.flex.core.UIBase; > > + import org.apache.flex.mdl.supportClasses.MaterialIcons; > > + > > + /** > > + * The MaterialIconCancel bead class is a specialty bead that add > > "add" icon > > + * to component taken from "material-icons" > > + * > > + * @langversion 3.0 > > + * @playerversion Flash 10.2 > > + * @playerversion AIR 2.6 > > + * @productversion FlexJS 0.0 > > + */ > > + public class MaterialIconAdd implements IBead > > + { > > + /** > > + * constructor. > > + * > > + * @langversion 3.0 > > + * @playerversion Flash 10.2 > > + * @playerversion AIR 2.6 > > + * @productversion FlexJS 0.0 > > + */ > > + public function MaterialIconAdd() > > + { > > + } > > + > > + private var add:MaterialIcons; > > + > > + private var _strand:IStrand; > > + > > + /** > > + * @flexjsignorecoercion HTMLElement > > + * > > + * @param value > > + */ > > + public function set strand(value:IStrand):void > > + { > > + _strand = value; > > + > > + COMPILE::JS > > + { > > + var host:UIBase = value as UIBase; > > + var element:HTMLElement = host.element as HTMLElement; > > + > > + add = new MaterialIcons(); > > + add.text = MaterialIconsType.ADD; > > + > > + element.appendChild(add.element as HTMLElement); > > + } > > + } > > + } > > +} > > > > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ > > 0b9753ef/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/materialIcons/MaterialIconCancel.as > > ---------------------------------------------------------------------- > > diff --git a/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/materialIcons/MaterialIconCancel.as > > b/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/materialIcons/MaterialIconCancel.as > > new file mode 100644 > > index 0000000..b179b1d > > --- /dev/null > > +++ b/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/materialIcons/MaterialIconCancel.as > > @@ -0,0 +1,74 @@ > > +/////////////////////////////////////////////////////////// > > ///////////////////// > > +// > > +// 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.materialIcons > > +{ > > + import org.apache.flex.core.IBead; > > + import org.apache.flex.core.IStrand; > > + import org.apache.flex.core.UIBase; > > + import org.apache.flex.mdl.supportClasses.MaterialIcons; > > + > > + /** > > + * The MaterialIconCancel bead class is a specialty bead that add > > "cancel" icon > > + * to component taken from "material-icons" > > + * > > + * @langversion 3.0 > > + * @playerversion Flash 10.2 > > + * @playerversion AIR 2.6 > > + * @productversion FlexJS 0.0 > > + */ > > + public class MaterialIconCancel implements IBead > > + { > > + /** > > + * constructor. > > + * > > + * @langversion 3.0 > > + * @playerversion Flash 10.2 > > + * @playerversion AIR 2.6 > > + * @productversion FlexJS 0.0 > > + */ > > + public function MaterialIconCancel() > > + { > > + } > > + > > + private var cancel:MaterialIcons; > > + > > + private var _strand:IStrand; > > + > > + /** > > + * @flexjsignorecoercion HTMLElement > > + * > > + * @param value > > + */ > > + public function set strand(value:IStrand):void > > + { > > + _strand = value; > > + > > + COMPILE::JS > > + { > > + var host:UIBase = value as UIBase; > > + var element:HTMLElement = host.element as HTMLElement; > > + > > + cancel = new MaterialIcons(); > > + cancel.text = MaterialIconsType.CANCEL; > > + > > + element.appendChild(cancel.element as HTMLElement); > > + } > > + } > > + } > > +} > > > > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ > > 0b9753ef/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/materialIcons/MaterialIconsType.as > > ---------------------------------------------------------------------- > > diff --git a/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/materialIcons/MaterialIconsType.as > > b/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/materialIcons/MaterialIconsType.as > > new file mode 100644 > > index 0000000..6759926 > > --- /dev/null > > +++ b/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/beads/materialIcons/MaterialIconsType.as > > @@ -0,0 +1,26 @@ > > +/////////////////////////////////////////////////////////// > > ///////////////////// > > +// > > +// 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.materialIcons > > +{ > > + public class MaterialIconsType > > + { > > + public static const CANCEL:String = "cancel"; > > + public static const ADD:String = "add"; > > + } > > +} > > > > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ > > 0b9753ef/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/supportClasses/MaterialIcons.as > > ---------------------------------------------------------------------- > > diff --git a/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/supportClasses/MaterialIcons.as > > b/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/supportClasses/MaterialIcons.as > > new file mode 100644 > > index 0000000..64b5295 > > --- /dev/null > > +++ b/frameworks/projects/MaterialDesignLite/src/main/ > > flex/org/apache/flex/mdl/supportClasses/MaterialIcons.as > > @@ -0,0 +1,61 @@ > > +/////////////////////////////////////////////////////////// > > ///////////////////// > > +// > > +// 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.supportClasses > > +{ > > + import org.apache.flex.html.I; > > + COMPILE::JS > > + { > > + import org.apache.flex.core.WrappedHTMLElement; > > + } > > + > > + /** > > + * Provide HTML element for material icons derived class > > + * > > + * @langversion 3.0 > > + * @playerversion Flash 10.2 > > + * @playerversion AIR 2.6 > > + * @productversion FlexJS 0.0 > > + */ > > + public class MaterialIcons extends I > > + { > > + public function MaterialIcons() > > + { > > + super(); > > + } > > + > > + /** > > + * @flexjsignorecoercion HTMLElement > > + * > > + * @param value > > + */ > > + COMPILE::JS > > + override protected function createElement():WrappedHTMLElement > > + { > > + super.createElement(); > > + > > + var materialIconElement:HTMLElement = element as > HTMLElement; > > + materialIconElement.classList.add("material-icons"); > > + > > + positioner = element; > > + element.flexjs_wrapper = this; > > + > > + return element; > > + } > > + } > > +} > > > > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ > > 0b9753ef/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 375a723..66a739b 100644 > > --- a/frameworks/projects/MaterialDesignLite/src/main/ > > resources/mdl-manifest.xml > > +++ b/frameworks/projects/MaterialDesignLite/src/main/ > > resources/mdl-manifest.xml > > @@ -62,4 +62,6 @@ > > <component id="Chip" class="org.apache.flex.mdl.Chip"/> > > <component id="ButtonChip" class="org.apache.flex.mdl.ButtonChip"/> > > <component id="DeletableChip" class="org.apache.flex.mdl. > > beads.DeletableChip"/> > > + <component id="MaterialIconCancel" class="org.apache.flex.mdl. > > beads.materialIcons.MaterialIconCancel"/> > > + <component id="MaterialIconAdd" class="org.apache.flex.mdl. > > beads.materialIcons.MaterialIconAdd"/> > > </componentPackage> > > > > > > > -- > > Greetings > Piotr Zarzycki > > Flex/AIR/.NET Developer > > mobile: +48 880 859 557 > e-mail: piotrzarzyck...@gmail.com > skype: zarzycki10 > > LinkedIn: http://www.linkedin.com/piotrzarzycki > <https://pl.linkedin.com/in/piotr-zarzycki-92a53552> > -- Carlos Rovira Director General M: +34 607 22 60 05 http://www.codeoscopic.com http://www.avant2.es Este mensaje se dirige exclusivamente a su destinatario y puede contener información privilegiada o confidencial. Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma vía y proceda a su destrucción. De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC S.A. La finalidad de dicho tratamiento es facilitar la prestación del servicio o información solicitados, teniendo usted derecho de acceso, rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación necesaria.