You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Maria Jose Esteve <mj...@iest.com> on 2021/02/01 19:31:33 UTC

Extends Jewel Badge

Hi, I have extended the bead Badge by adding the click () [1] event to it. I have override the "createBadge" function because the "private" variable badge cannot be referenced directly.

I wanted to propose a change in the Jewel Badge component, change the badge variable to "proptected", which is currently "private". Do you see it as possible / convenient?

[1]
    import org.apache.royale.core.IStrand;
    import org.apache.royale.jewel.Label;
    import org.apache.royale.events.MouseEvent;
    import org.apache.royale.jewel.beads.controls.Badge;

    [Event(name="click", type="org.apache.royale.events.MouseEvent")]

    public class BadgeJwExt extends Badge
    {
        public function BadgeJwExt()
        {
            super();
        }
        private var badge2:Label;
        /**
         * used to create the badge ui element
         * that will be a Label
         */
        override protected function createBadge():Label
        {
            badge2 = new Label();
            badge2.typeNames = "jewel badge";
            return badge2;
        }
        public override function set strand(value:IStrand):void
        {
            super.strand = value;
            badge2.addEventListener("click", function():void{
                dispatchEvent(new MouseEvent("click"));
            });
        }
    }


Thx.
Hiedra.


Re: Extends Jewel Badge

Posted by Carlos Rovira <ca...@apache.org>.
Hi Maria Jose,
all seems right to me
If you want to add it to Royale feel free to create a PR :)
thanks

El mié, 3 feb 2021 a las 19:19, Maria Jose Esteve (<mj...@iest.com>)
escribió:

> Hi,
> Well, that's how I left it:
>
> package com.mjesteve.jewel.beads.controls
> {
>         import org.apache.royale.jewel.Label;
>         import org.apache.royale.events.MouseEvent;
>         import org.apache.royale.jewel.beads.controls.Badge;
>
>         [Event(name="click", type="org.apache.royale.events.MouseEvent")]
>
>         /**
>          *  The Badge class provides a small status descriptors for UI
> elements.
>          *
>          *  A Badge is an onscreen notification element consists of a
> small circle,
>      *  typically containing a number or other characters, that appears in
>      *  proximity to another object
>          *
>          *  The BadgeOnClick class is a Badge extension that dispatches
> the MouseClick Event.
>          *
>          *  @langversion 3.0
>          *  @playerversion Flash 10.2
>          *  @playerversion AIR 2.6
>          *  @productversion Royale 0.9.6
>          */
>         public class BadgeOnClick extends
> org.apache.royale.jewel.beads.controls.Badge
>         {
>                 /**
>                  *  constructor.
>                  *
>                  *  @langversion 3.0
>                  *  @playerversion Flash 10.2
>                  *  @playerversion AIR 2.6
>                  *  @productversion Royale 0.9.6
>                  */
>                 public function BadgeOnClick()
>                 {
>                         super();
>                 }
>                 /**
>                  * used to create the badge ui element
>                  * that will be a Label
>                  */
>                 override protected function createBadge():Label
>                 {
>                         var tmpbadge:Label = super.createBadge();
>
>                         tmpbadge.addEventListener("click", function():void{
>                                 dispatchEvent(new MouseEvent("click"));
>                         });
>                         return tmpbadge;
>                 }
>         }
> }
>
> @Carlos, I haven't been able to get it to work by changing this:
>
>         > you can change:
>         >
>         > var badge:Label = new Label();
>         > badge.typeNames = "jewel badge";
>
>         > with just:
>         > super.createdBadge();
>
> If my modification is not correct, please tell me.
> Thx.
> Hiedra.
>
> -----Mensaje original-----
> De: Maria Jose Esteve <mj...@iest.com>
> Enviado el: miércoles, 3 de febrero de 2021 3:06
> Para: dev@royale.apache.org
> Asunto: RE: Extends Jewel Badge
>
> Thanks Carlos, I just saw your commit, I'll review it tomorrow.
>
> Hiedra.
>
> -----Mensaje original-----
> De: Carlos Rovira <ca...@apache.org> Enviado el: martes, 2 de
> febrero de 2021 18:30
> Para: Apache Royale Development <de...@royale.apache.org>
> Asunto: Re: Extends Jewel Badge
>
> Hi Maria Jose,
>
> yes a bead could be convenient for some uses.
>
> you can change:
>
> var badge:Label = new Label();
> badge.typeNames = "jewel badge";
>
> with just:
>
> super.createdBadge();
>
> also this will not be needed:
>
> public override function set strand(value:IStrand):void
>                 {
>                         super.strand = value;
>                 }
>
> thanks
>
> El lun, 1 feb 2021 a las 22:18, Maria Jose Esteve (<mj...@iest.com>)
> escribió:
>
> > Hello again, I have rectified the bead, maybe now it is more correct?
> > (I share it in case someone is interested.)
> >
> >         import org.apache.royale.core.IStrand;
> >         import org.apache.royale.jewel.Label;
> >         import org.apache.royale.events.MouseEvent;
> >         import org.apache.royale.jewel.beads.controls.Badge;
> >
> >         [Event(name="click",
> > type="org.apache.royale.events.MouseEvent")]
> >
> >         /**
> >          *  The Badge class provides a small status descriptors for UI
> > elements.
> >          *
> >          *  A Badge is an onscreen notification element consists of a
> > small circle,
> >      *  typically containing a number or other characters, that appears
> in
> >      *  proximity to another object
> >          *
> >          *  The BadgeOnClick class is a Badge extension that
> > dispatches the MouseClick Event.
> >          */
> >         public class BadgeOnClick extends Badge
> >         {
> >                 public function BadgeOnClick()
> >                 {
> >                         super();
> >                 }
> >                 /**
> >                  * used to create the badge ui element
> >                  * that will be a Label
> >                  */
> >                 override protected function createBadge():Label
> >                 {
> >                         var badge:Label = new Label();
> >                         badge.typeNames = "jewel badge";
> >
> >                         badge.addEventListener("click", function():void{
> >                                 dispatchEvent(new MouseEvent("click"));
> >                         });
> >                         return badge;
> >                 }
> >                 public override function set strand(value:IStrand):void
> >                 {
> >                         super.strand = value;
> >                 }
> >         }
> >
> > Thx.
> > Hiedra.
> >
> >
>
> --
> Carlos Rovira
> Apache Member & Apache Royale PMC
> *Apache Software Foundation*
> http://about.me/carlosrovira
>


-- 
Carlos Rovira
Apache Member & Apache Royale PMC
*Apache Software Foundation*
http://about.me/carlosrovira

RE: Extends Jewel Badge

Posted by Maria Jose Esteve <mj...@iest.com>.
Hi,
Well, that's how I left it:

package com.mjesteve.jewel.beads.controls
{
	import org.apache.royale.jewel.Label;
	import org.apache.royale.events.MouseEvent;
	import org.apache.royale.jewel.beads.controls.Badge;

	[Event(name="click", type="org.apache.royale.events.MouseEvent")]

	/**
	 *  The Badge class provides a small status descriptors for UI elements.
	 *
	 *  A Badge is an onscreen notification element consists of a small circle,
     *  typically containing a number or other characters, that appears in
     *  proximity to another object
	 *
	 *  The BadgeOnClick class is a Badge extension that dispatches the MouseClick Event.
	 *
	 *  @langversion 3.0
	 *  @playerversion Flash 10.2
	 *  @playerversion AIR 2.6
	 *  @productversion Royale 0.9.6
	 */
	public class BadgeOnClick extends org.apache.royale.jewel.beads.controls.Badge
	{
		/**
		 *  constructor.
		 *
		 *  @langversion 3.0
		 *  @playerversion Flash 10.2
		 *  @playerversion AIR 2.6
		 *  @productversion Royale 0.9.6
		 */
		public function BadgeOnClick()
		{
			super();
		}
		/**
		 * used to create the badge ui element
		 * that will be a Label
		 */
		override protected function createBadge():Label
		{
			var tmpbadge:Label = super.createBadge();

			tmpbadge.addEventListener("click", function():void{
				dispatchEvent(new MouseEvent("click"));
			});
			return tmpbadge;
		}
	}
}

@Carlos, I haven't been able to get it to work by changing this:

	> you can change:
	>
	> var badge:Label = new Label();
	> badge.typeNames = "jewel badge";

	> with just:
	> super.createdBadge();

If my modification is not correct, please tell me.
Thx.
Hiedra.

-----Mensaje original-----
De: Maria Jose Esteve <mj...@iest.com> 
Enviado el: miércoles, 3 de febrero de 2021 3:06
Para: dev@royale.apache.org
Asunto: RE: Extends Jewel Badge

Thanks Carlos, I just saw your commit, I'll review it tomorrow.

Hiedra.

-----Mensaje original-----
De: Carlos Rovira <ca...@apache.org> Enviado el: martes, 2 de febrero de 2021 18:30
Para: Apache Royale Development <de...@royale.apache.org>
Asunto: Re: Extends Jewel Badge

Hi Maria Jose,

yes a bead could be convenient for some uses.

you can change:

var badge:Label = new Label();
badge.typeNames = "jewel badge";

with just:

super.createdBadge();

also this will not be needed:

public override function set strand(value:IStrand):void
                {
                        super.strand = value;
                }

thanks

El lun, 1 feb 2021 a las 22:18, Maria Jose Esteve (<mj...@iest.com>)
escribió:

> Hello again, I have rectified the bead, maybe now it is more correct?
> (I share it in case someone is interested.)
>
>         import org.apache.royale.core.IStrand;
>         import org.apache.royale.jewel.Label;
>         import org.apache.royale.events.MouseEvent;
>         import org.apache.royale.jewel.beads.controls.Badge;
>
>         [Event(name="click",
> type="org.apache.royale.events.MouseEvent")]
>
>         /**
>          *  The Badge class provides a small status descriptors for UI 
> elements.
>          *
>          *  A Badge is an onscreen notification element consists of a 
> small circle,
>      *  typically containing a number or other characters, that appears in
>      *  proximity to another object
>          *
>          *  The BadgeOnClick class is a Badge extension that 
> dispatches the MouseClick Event.
>          */
>         public class BadgeOnClick extends Badge
>         {
>                 public function BadgeOnClick()
>                 {
>                         super();
>                 }
>                 /**
>                  * used to create the badge ui element
>                  * that will be a Label
>                  */
>                 override protected function createBadge():Label
>                 {
>                         var badge:Label = new Label();
>                         badge.typeNames = "jewel badge";
>
>                         badge.addEventListener("click", function():void{
>                                 dispatchEvent(new MouseEvent("click"));
>                         });
>                         return badge;
>                 }
>                 public override function set strand(value:IStrand):void
>                 {
>                         super.strand = value;
>                 }
>         }
>
> Thx.
> Hiedra.
>
>

--
Carlos Rovira
Apache Member & Apache Royale PMC
*Apache Software Foundation*
http://about.me/carlosrovira

RE: Extends Jewel Badge

Posted by Maria Jose Esteve <mj...@iest.com>.
Thanks Carlos, I just saw your commit, I'll review it tomorrow.

Hiedra.

-----Mensaje original-----
De: Carlos Rovira <ca...@apache.org> 
Enviado el: martes, 2 de febrero de 2021 18:30
Para: Apache Royale Development <de...@royale.apache.org>
Asunto: Re: Extends Jewel Badge

Hi Maria Jose,

yes a bead could be convenient for some uses.

you can change:

var badge:Label = new Label();
badge.typeNames = "jewel badge";

with just:

super.createdBadge();

also this will not be needed:

public override function set strand(value:IStrand):void
                {
                        super.strand = value;
                }

thanks

El lun, 1 feb 2021 a las 22:18, Maria Jose Esteve (<mj...@iest.com>)
escribió:

> Hello again, I have rectified the bead, maybe now it is more correct?
> (I share it in case someone is interested.)
>
>         import org.apache.royale.core.IStrand;
>         import org.apache.royale.jewel.Label;
>         import org.apache.royale.events.MouseEvent;
>         import org.apache.royale.jewel.beads.controls.Badge;
>
>         [Event(name="click", 
> type="org.apache.royale.events.MouseEvent")]
>
>         /**
>          *  The Badge class provides a small status descriptors for UI 
> elements.
>          *
>          *  A Badge is an onscreen notification element consists of a 
> small circle,
>      *  typically containing a number or other characters, that appears in
>      *  proximity to another object
>          *
>          *  The BadgeOnClick class is a Badge extension that 
> dispatches the MouseClick Event.
>          */
>         public class BadgeOnClick extends Badge
>         {
>                 public function BadgeOnClick()
>                 {
>                         super();
>                 }
>                 /**
>                  * used to create the badge ui element
>                  * that will be a Label
>                  */
>                 override protected function createBadge():Label
>                 {
>                         var badge:Label = new Label();
>                         badge.typeNames = "jewel badge";
>
>                         badge.addEventListener("click", function():void{
>                                 dispatchEvent(new MouseEvent("click"));
>                         });
>                         return badge;
>                 }
>                 public override function set strand(value:IStrand):void
>                 {
>                         super.strand = value;
>                 }
>         }
>
> Thx.
> Hiedra.
>
>

--
Carlos Rovira
Apache Member & Apache Royale PMC
*Apache Software Foundation*
http://about.me/carlosrovira

Re: Extends Jewel Badge

Posted by Carlos Rovira <ca...@apache.org>.
Hi Maria Jose,

yes a bead could be convenient for some uses.

you can change:

var badge:Label = new Label();
badge.typeNames = "jewel badge";

with just:

super.createdBadge();

also this will not be needed:

public override function set strand(value:IStrand):void
                {
                        super.strand = value;
                }

thanks

El lun, 1 feb 2021 a las 22:18, Maria Jose Esteve (<mj...@iest.com>)
escribió:

> Hello again, I have rectified the bead, maybe now it is more correct?
> (I share it in case someone is interested.)
>
>         import org.apache.royale.core.IStrand;
>         import org.apache.royale.jewel.Label;
>         import org.apache.royale.events.MouseEvent;
>         import org.apache.royale.jewel.beads.controls.Badge;
>
>         [Event(name="click", type="org.apache.royale.events.MouseEvent")]
>
>         /**
>          *  The Badge class provides a small status descriptors for UI
> elements.
>          *
>          *  A Badge is an onscreen notification element consists of a
> small circle,
>      *  typically containing a number or other characters, that appears in
>      *  proximity to another object
>          *
>          *  The BadgeOnClick class is a Badge extension that dispatches
> the MouseClick Event.
>          */
>         public class BadgeOnClick extends Badge
>         {
>                 public function BadgeOnClick()
>                 {
>                         super();
>                 }
>                 /**
>                  * used to create the badge ui element
>                  * that will be a Label
>                  */
>                 override protected function createBadge():Label
>                 {
>                         var badge:Label = new Label();
>                         badge.typeNames = "jewel badge";
>
>                         badge.addEventListener("click", function():void{
>                                 dispatchEvent(new MouseEvent("click"));
>                         });
>                         return badge;
>                 }
>                 public override function set strand(value:IStrand):void
>                 {
>                         super.strand = value;
>                 }
>         }
>
> Thx.
> Hiedra.
>
>

-- 
Carlos Rovira
Apache Member & Apache Royale PMC
*Apache Software Foundation*
http://about.me/carlosrovira

RE: Extends Jewel Badge

Posted by Maria Jose Esteve <mj...@iest.com>.
Hello again, I have rectified the bead, maybe now it is more correct?
(I share it in case someone is interested.)

	import org.apache.royale.core.IStrand;
	import org.apache.royale.jewel.Label;
	import org.apache.royale.events.MouseEvent;
	import org.apache.royale.jewel.beads.controls.Badge;

	[Event(name="click", type="org.apache.royale.events.MouseEvent")]
	
	/**
	 *  The Badge class provides a small status descriptors for UI elements.
	 *
	 *  A Badge is an onscreen notification element consists of a small circle, 
     *  typically containing a number or other characters, that appears in 
     *  proximity to another object
	 * 
	 *  The BadgeOnClick class is a Badge extension that dispatches the MouseClick Event.
	 */
	public class BadgeOnClick extends Badge
	{
		public function BadgeOnClick()
		{
			super();
		}
		/**
		 * used to create the badge ui element
		 * that will be a Label
		 */
		override protected function createBadge():Label
		{			
			var badge:Label = new Label();
			badge.typeNames = "jewel badge";

			badge.addEventListener("click", function():void{
				dispatchEvent(new MouseEvent("click"));
			});
			return badge;
		}
		public override function set strand(value:IStrand):void
		{
			super.strand = value;
		}
	}

Thx.
Hiedra.


Re: Extends Jewel Badge

Posted by Carlos Rovira <ca...@apache.org>.
Hi Maria Jose,

just turned badge to protected in my last commit

El lun, 1 feb 2021 a las 20:31, Maria Jose Esteve (<mj...@iest.com>)
escribió:

> Hi, I have extended the bead Badge by adding the click () [1] event to it.
> I have override the "createBadge" function because the "private" variable
> badge cannot be referenced directly.
>
> I wanted to propose a change in the Jewel Badge component, change the
> badge variable to "proptected", which is currently "private". Do you see it
> as possible / convenient?
>
> [1]
>     import org.apache.royale.core.IStrand;
>     import org.apache.royale.jewel.Label;
>     import org.apache.royale.events.MouseEvent;
>     import org.apache.royale.jewel.beads.controls.Badge;
>
>     [Event(name="click", type="org.apache.royale.events.MouseEvent")]
>
>     public class BadgeJwExt extends Badge
>     {
>         public function BadgeJwExt()
>         {
>             super();
>         }
>         private var badge2:Label;
>         /**
>          * used to create the badge ui element
>          * that will be a Label
>          */
>         override protected function createBadge():Label
>         {
>             badge2 = new Label();
>             badge2.typeNames = "jewel badge";
>             return badge2;
>         }
>         public override function set strand(value:IStrand):void
>         {
>             super.strand = value;
>             badge2.addEventListener("click", function():void{
>                 dispatchEvent(new MouseEvent("click"));
>             });
>         }
>     }
>
>
> Thx.
> Hiedra.
>
>

-- 
Carlos Rovira
Apache Member & Apache Royale PMC
*Apache Software Foundation*
http://about.me/carlosrovira