You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by mk...@apache.org on 2013/05/03 01:48:32 UTC

git commit: [flex-sdk] [refs/heads/develop] - FLEX-33524: Added convenience feature to enable/disable buttons in a ButtonBar/TabBar.

Updated Branches:
  refs/heads/develop 7d20cec89 -> 3053c3295


FLEX-33524: Added convenience feature to enable/disable buttons in a ButtonBar/TabBar.


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

Branch: refs/heads/develop
Commit: 3053c3295e6c14b291e2aa5a947b1d88e9650a6f
Parents: 7d20cec
Author: Mark Kessler <Ke...@gmail.com>
Authored: Thu May 2 19:41:46 2013 -0400
Committer: Mark Kessler <Ke...@gmail.com>
Committed: Thu May 2 19:44:51 2013 -0400

----------------------------------------------------------------------
 .../components/supportClasses/ButtonBarBase.as     |  198 ++++++++++++++-
 1 files changed, 197 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/3053c329/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.as b/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.as
index 233a210..b41504e 100644
--- a/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.as
+++ b/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.as
@@ -513,7 +513,203 @@ public class ButtonBarBase extends ListBase
     //  Methods
     //
     //--------------------------------------------------------------------------
-    
+
+    /**
+    *  Disable a ButtonBar's Button referencing it by the ButtonBarbutton's <code>label</code>. 
+    *
+    *  <p>The function takes a single argument which is the ButtonBarButtons label.</p>
+    *  <pre>myButtonBar.disableButton("My Button Label")</pre>
+    *
+    *  @param labelValue Is the ButtonBarButton label
+    *  @param fieldName Field used for comparing the label
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function disableButton(labelValue:String, fieldName:String = ""):void
+    {
+        var btnCurrent:ButtonBarButton = null;
+        var buttonIndex:int = -1;
+
+
+        if (!dataGroup || labelValue == "" || labelValue == null)
+        {
+            return;
+        }
+
+        if (fieldName == "" || fieldName == null)
+        {
+            buttonIndex = findRowIndex(labelField, labelValue);
+        }
+        else
+        {
+            buttonIndex = findRowIndex(fieldName, labelValue);
+        }
+
+        if (buttonIndex == -1)
+        {
+            return;
+        }
+
+
+        btnCurrent = dataGroup.getElementAt(buttonIndex) as ButtonBarButton;
+        btnCurrent.enabled = false;
+    }
+
+
+    /**
+    *  Disables several of a ButtonBar's Buttons, referencing them by the ButtonBarbutton's <code>label</code>. 
+    *
+    *  <p>The function takes a single argument which is the ButtonBarButtons label.</p>
+    *  <pre>myButtonBar.disableButtons(["My Button Label1", "My Label2"])</pre>
+    *
+    *  @param labelValues Is an array of ButtonBarButton labels.
+    *  @param fieldName Field used for comparing the label
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function disableButtons(labelValues:Array, fieldName:String = ""):void
+    {
+        var btnCurrent:ButtonBarButton = null;
+        var buttonIndices:Array;
+        var indicesTotal:uint = 0;
+        var loopingIndex:uint = 0;
+
+
+        if (!dataGroup || labelValues.length < 1 || labelValues == null)
+        {
+            return;
+        }
+
+        if (fieldName == "" || fieldName == null)
+        {
+            buttonIndices = findRowIndices(labelField, labelValues);
+        }
+        else
+        {
+            buttonIndices = findRowIndices(fieldName, labelValues);
+        }
+
+
+        indicesTotal = buttonIndices.length
+
+        if (indicesTotal == 0)
+        {
+            return;
+        }
+
+        
+        for (loopingIndex; loopingIndex < indicesTotal; loopingIndex++)
+        {
+            btnCurrent = dataGroup.getElementAt(buttonIndices[loopingIndex]) as ButtonBarButton;
+            btnCurrent.enabled = false;
+        }
+    }
+
+
+    /**
+    *  Enable a ButtonBar's Button referencing it by the ButtonBarbutton's <code>label</code>. 
+    *
+    *  <p>The function takes a single argument which is the ButtonBarButtons label.</p>
+    *  <pre>myButtonBar.enableButton("My Button Label")</pre>
+    *
+    *  @param labelValue Is the ButtonBarButton label
+    *  @param fieldName Field used for comparing the label
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function enableButton(labelValue:String, fieldName:String = ""):void
+    {
+        var btnCurrent:ButtonBarButton = null;
+        var buttonIndex:int = -1;
+
+
+        if (!dataGroup || labelValue == "" || labelValue == null)
+        {
+            return;
+        }
+
+        if (fieldName == "" || fieldName == null)
+        {
+            buttonIndex = findRowIndex(labelField, labelValue);
+        }
+        else
+        {
+            buttonIndex = findRowIndex(fieldName, labelValue);
+        }
+
+        if (buttonIndex == -1)
+        {
+            return;
+        }
+
+
+        btnCurrent = dataGroup.getElementAt(buttonIndex) as ButtonBarButton;
+        btnCurrent.enabled = true;
+    }
+
+
+    /**
+    *  Disables several of a ButtonBar's Buttons, referencing them by the ButtonBarbutton's <code>label</code>. 
+    *
+    *  <p>The function takes a single argument which is the ButtonBarButtons label.</p>
+    *  <pre>myButtonBar.enableButtons(["My Button Label1", "My Label2"])</pre>
+    *
+    *  @param labelValues Is an array of ButtonBarButton labels.
+    *  @param fieldName Field used for comparing the label
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 11.1
+    *  @playerversion AIR 3.4
+    *  @productversion Flex 4.10
+    */
+    public function enableButtons(labelValues:Array, fieldName:String = ""):void
+    {
+        var btnCurrent:ButtonBarButton = null;
+        var buttonIndices:Array;
+        var indicesTotal:uint = 0;
+        var loopingIndex:uint = 0;
+
+
+        if (!dataGroup || labelValues.length < 1 || labelValues == null)
+        {
+            return;
+        }
+
+        if (fieldName == "" || fieldName == null)
+        {
+            buttonIndices = findRowIndices(labelField, labelValues);
+        }
+        else
+        {
+            buttonIndices = findRowIndices(fieldName, labelValues);
+        }
+
+
+        indicesTotal = buttonIndices.length
+
+        if (indicesTotal == 0)
+        {
+            return;
+        }
+
+        
+        for (loopingIndex; loopingIndex < indicesTotal; loopingIndex++)
+        {
+            btnCurrent = dataGroup.getElementAt(buttonIndices[loopingIndex]) as ButtonBarButton;
+            btnCurrent.enabled = true;
+        }
+    }
+
+
     /**
      *  @private
      */


Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33524: Added convenience feature to enable/disable buttons in a ButtonBar/TabBar.

Posted by Alex Harui <ah...@adobe.com>.


On 5/4/13 11:25 AM, "Mark Kessler" <ke...@gmail.com> wrote:

> Alex,
>    I think your missing the real loop here... the method findRowIndices
> loops through all the buttons every call.  Where as the buttonIndices only
> contains button indices that were found during the findRowIndices method.
> Having the array one call the single method would run the findRowIndices
> for every button label which to me seems very redundant.  Where as it is
> right now, it only runs findRowIndices once, and then only runs 1 count
> through the loop of the buttonIndices.  Although if someone had duplicate
> button labels, all matches would get picked up during this method.
> 
> I understand your idea of it now.  But since I'm not able to directly
> address a specific button without finding it first, makes it hard to have
> the array call the single method.  I think we both look at this problem
> from different sides... When I get back later on I'll see if I can find an
> efficient way to test your idea so everything gets a fair try.
> 
Ah, I didn't realize what was going on in findRowIndices.  You're fine as it
is.  I don't expect a lot of need for this to be totally optimized so it
probably isn't worth any more time.

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui


Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33524: Added convenience feature to enable/disable buttons in a ButtonBar/TabBar.

Posted by Mark Kessler <ke...@gmail.com>.
Alex,
   I think your missing the real loop here... the method findRowIndices
loops through all the buttons every call.  Where as the buttonIndices only
contains button indices that were found during the findRowIndices method.
Having the array one call the single method would run the findRowIndices
for every button label which to me seems very redundant.  Where as it is
right now, it only runs findRowIndices once, and then only runs 1 count
through the loop of the buttonIndices.  Although if someone had duplicate
button labels, all matches would get picked up during this method.

I understand your idea of it now.  But since I'm not able to directly
address a specific button without finding it first, makes it hard to have
the array call the single method.  I think we both look at this problem
from different sides... When I get back later on I'll see if I can find an
efficient way to test your idea so everything gets a fair try.


-Mark





-Mark
On Sat, May 4, 2013 at 11:27 AM, Alex Harui <ah...@adobe.com> wrote:

> Hi Mark,
>
> Look ok.  Is there a reason you chose to have setButtonEnabled call
> setButtonsEnabled instead of having setButtonsEnabled call setButtonEnabled
> in its loop?  That way folks using setButtonEnabled don't pay the price of
> the loop setup and wrapping the single label in an array.
>
> You don't have to change the way you have it since it would be rare for
> this
> API to actually be used so much it would be a performance issue.  I'm just
> pointing out things I think about when I see code.  In the SDK, I think we
> use both patterns.  The commitSelectedItem calls commitSelectedItems
> because
> there is supposed to be a single valueCommit event at then end of a set of
> selection changes and there is no way for commitSelectedItem to know if it
> should dispatch valueCommit or not, but if there is no aggregate event I
> think having the single do the work is slightly more efficient.
>
> Anyway, thanks for doing this work.
>
> -Alex
>
> On 5/4/13 7:02 AM, "Mark Kessler" <ke...@gmail.com> wrote:
>
> > Ok I put it together this morning.  Can see the modified example on my
> site
> > [1] with view source enabled.  The git history at [2]. and So you don't
> > actually have to goto either, I will paste the current methods below.  4
> > Methods brought down to two methods.  The new common method I will end up
> > using later.  Yes I wish to keep the string based method... this would
> be a
> > perfect case for method overloading if it were supported in AS.
> >
> > [1] http://people.apache.org/~mkessler/examples/FLEX-33524/app.swf
> > [2]
> >
> https://github.com/KesslerConsulting/example/commits/master/frameworks/project
> > s/spark/src/spark/components/supportClasses/ButtonBarBase.as
> >
> >
> >     /**
> >     */
> >     public function getButtonIndices(labelValues:Array, fieldName:String
> =
> > ""):Array
> >     {
> >         var buttonIndices:Array;
> >
> >
> >         if (!dataGroup || labelValues.length < 1 || labelValues == null)
> >         {
> >             return [];
> >         }
> >
> >         if (fieldName == "" || fieldName == null)
> >         {
> >             return findRowIndices(labelField, labelValues);
> >         }
> >         else
> >         {
> >             return findRowIndices(fieldName, labelValues);
> >         }
> >     }
> >
> >
> >     /**
> >     */
> >     public function setButtonEnabled(labelValue:String,
> > enabledValue:Boolean, fieldName:String = ""):void
> >     {
> >         setButtonsEnabled([labelValue], enabledValue, fieldName);
> >     }
> >
> >
> >     /**
> >     */
> >     public function setButtonsEnabled(labelValues:Array,
> > enabledValue:Boolean, fieldName:String = ""):void
> >     {
> >         var btnCurrent:ButtonBarButton = null;
> >         var buttonIndices:Array;
> >         var indicesTotal:uint = 0;
> >         var loopingIndex:uint = 0;
> >
> >
> >         buttonIndices = getButtonIndices(labelValues, fieldName);
> >         indicesTotal = buttonIndices.length;
> >
> >         if (indicesTotal == 0)
> >         {
> >             return;
> >         }
> >
> >
> >         for (loopingIndex; loopingIndex < indicesTotal; loopingIndex++)
> >         {
> >             btnCurrent =
> > dataGroup.getElementAt(buttonIndices[loopingIndex]) as ButtonBarButton;
> >             btnCurrent.enabled = enabledValue;
> >         }
> >     }
> >
> >
> > -Mark
> >
> >
> > On Sat, May 4, 2013 at 12:41 AM, Alex Harui <ah...@adobe.com> wrote:
> >
> >> Hi Mark,
> >>
> >> My personal preference is for #2, but only slightly.  IMO, fewer APIs
> are
> >> better as long as they are discoverable, but you can go with #1 if you
> >> want.
> >> My only thought was that it appears that at least internally most of the
> >> code could be in a setButtonEnabled() method and even the array version
> >> would just call that method.
> >>
> >> -Alex
> >>
> >>
>
> --
> Alex Harui
> Flex SDK Team
> Adobe Systems, Inc.
> http://blogs.adobe.com/aharui
>
>

Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33524: Added convenience feature to enable/disable buttons in a ButtonBar/TabBar.

Posted by Alex Harui <ah...@adobe.com>.
Hi Mark,

Look ok.  Is there a reason you chose to have setButtonEnabled call
setButtonsEnabled instead of having setButtonsEnabled call setButtonEnabled
in its loop?  That way folks using setButtonEnabled don't pay the price of
the loop setup and wrapping the single label in an array.

You don't have to change the way you have it since it would be rare for this
API to actually be used so much it would be a performance issue.  I'm just
pointing out things I think about when I see code.  In the SDK, I think we
use both patterns.  The commitSelectedItem calls commitSelectedItems because
there is supposed to be a single valueCommit event at then end of a set of
selection changes and there is no way for commitSelectedItem to know if it
should dispatch valueCommit or not, but if there is no aggregate event I
think having the single do the work is slightly more efficient.

Anyway, thanks for doing this work.

-Alex

On 5/4/13 7:02 AM, "Mark Kessler" <ke...@gmail.com> wrote:

> Ok I put it together this morning.  Can see the modified example on my site
> [1] with view source enabled.  The git history at [2]. and So you don't
> actually have to goto either, I will paste the current methods below.  4
> Methods brought down to two methods.  The new common method I will end up
> using later.  Yes I wish to keep the string based method... this would be a
> perfect case for method overloading if it were supported in AS.
> 
> [1] http://people.apache.org/~mkessler/examples/FLEX-33524/app.swf
> [2]
> https://github.com/KesslerConsulting/example/commits/master/frameworks/project
> s/spark/src/spark/components/supportClasses/ButtonBarBase.as
> 
> 
>     /**
>     */
>     public function getButtonIndices(labelValues:Array, fieldName:String =
> ""):Array
>     {
>         var buttonIndices:Array;
> 
> 
>         if (!dataGroup || labelValues.length < 1 || labelValues == null)
>         {
>             return [];
>         }
> 
>         if (fieldName == "" || fieldName == null)
>         {
>             return findRowIndices(labelField, labelValues);
>         }
>         else
>         {
>             return findRowIndices(fieldName, labelValues);
>         }
>     }
> 
> 
>     /**
>     */
>     public function setButtonEnabled(labelValue:String,
> enabledValue:Boolean, fieldName:String = ""):void
>     {
>         setButtonsEnabled([labelValue], enabledValue, fieldName);
>     }
> 
> 
>     /**
>     */
>     public function setButtonsEnabled(labelValues:Array,
> enabledValue:Boolean, fieldName:String = ""):void
>     {
>         var btnCurrent:ButtonBarButton = null;
>         var buttonIndices:Array;
>         var indicesTotal:uint = 0;
>         var loopingIndex:uint = 0;
> 
> 
>         buttonIndices = getButtonIndices(labelValues, fieldName);
>         indicesTotal = buttonIndices.length;
> 
>         if (indicesTotal == 0)
>         {
>             return;
>         }
> 
> 
>         for (loopingIndex; loopingIndex < indicesTotal; loopingIndex++)
>         {
>             btnCurrent =
> dataGroup.getElementAt(buttonIndices[loopingIndex]) as ButtonBarButton;
>             btnCurrent.enabled = enabledValue;
>         }
>     }
> 
> 
> -Mark
> 
> 
> On Sat, May 4, 2013 at 12:41 AM, Alex Harui <ah...@adobe.com> wrote:
> 
>> Hi Mark,
>> 
>> My personal preference is for #2, but only slightly.  IMO, fewer APIs are
>> better as long as they are discoverable, but you can go with #1 if you
>> want.
>> My only thought was that it appears that at least internally most of the
>> code could be in a setButtonEnabled() method and even the array version
>> would just call that method.
>> 
>> -Alex
>> 
>> 

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui


Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33524: Added convenience feature to enable/disable buttons in a ButtonBar/TabBar.

Posted by Mark Kessler <ke...@gmail.com>.
Ok I put it together this morning.  Can see the modified example on my site
[1] with view source enabled.  The git history at [2]. and So you don't
actually have to goto either, I will paste the current methods below.  4
Methods brought down to two methods.  The new common method I will end up
using later.  Yes I wish to keep the string based method... this would be a
perfect case for method overloading if it were supported in AS.

[1] http://people.apache.org/~mkessler/examples/FLEX-33524/app.swf
[2]
https://github.com/KesslerConsulting/example/commits/master/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.as


    /**
    */
    public function getButtonIndices(labelValues:Array, fieldName:String =
""):Array
    {
        var buttonIndices:Array;


        if (!dataGroup || labelValues.length < 1 || labelValues == null)
        {
            return [];
        }

        if (fieldName == "" || fieldName == null)
        {
            return findRowIndices(labelField, labelValues);
        }
        else
        {
            return findRowIndices(fieldName, labelValues);
        }
    }


    /**
    */
    public function setButtonEnabled(labelValue:String,
enabledValue:Boolean, fieldName:String = ""):void
    {
        setButtonsEnabled([labelValue], enabledValue, fieldName);
    }


    /**
    */
    public function setButtonsEnabled(labelValues:Array,
enabledValue:Boolean, fieldName:String = ""):void
    {
        var btnCurrent:ButtonBarButton = null;
        var buttonIndices:Array;
        var indicesTotal:uint = 0;
        var loopingIndex:uint = 0;


        buttonIndices = getButtonIndices(labelValues, fieldName);
        indicesTotal = buttonIndices.length;

        if (indicesTotal == 0)
        {
            return;
        }


        for (loopingIndex; loopingIndex < indicesTotal; loopingIndex++)
        {
            btnCurrent =
dataGroup.getElementAt(buttonIndices[loopingIndex]) as ButtonBarButton;
            btnCurrent.enabled = enabledValue;
        }
    }


-Mark


On Sat, May 4, 2013 at 12:41 AM, Alex Harui <ah...@adobe.com> wrote:

> Hi Mark,
>
> My personal preference is for #2, but only slightly.  IMO, fewer APIs are
> better as long as they are discoverable, but you can go with #1 if you
> want.
> My only thought was that it appears that at least internally most of the
> code could be in a setButtonEnabled() method and even the array version
> would just call that method.
>
> -Alex
>
>

Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33524: Added convenience feature to enable/disable buttons in a ButtonBar/TabBar.

Posted by Alex Harui <ah...@adobe.com>.
Hi Mark,

My personal preference is for #2, but only slightly.  IMO, fewer APIs are
better as long as they are discoverable, but you can go with #1 if you want.
My only thought was that it appears that at least internally most of the
code could be in a setButtonEnabled() method and even the array version
would just call that method.

-Alex


On 5/3/13 5:01 PM, "Mark Kessler" <ke...@gmail.com> wrote:

> Alex,
>    Give me an opinion which of these you prefer.  I have a few sets of
> changes I could use.  I will apply the same logic for the array based ones
> too.
> 
> 1.  Keep the existing named methods (disableButton/enabledButton) and move
> 70% of code to a button index lookup method which they both call.
> 
> 2.  Combine the 2 methods (disableButton/enabledButton) into one method
> with an extra property requirement "setButtonEnabled(buttonLabel,
> enabledValue, optionalFieldName)".
> 
> 3.  Both options
> 
> 
> -Mark
> 
> On Thu, May 2, 2013 at 11:44 PM, Alex Harui <ah...@adobe.com> wrote:
> 
>> Hey Mark,
>> 
>> Do you think it is worth trying to have all of these APIs call a common
>> function?  I think I'm seeing the same code more than once.
>> 
>> 

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui


Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33524: Added convenience feature to enable/disable buttons in a ButtonBar/TabBar.

Posted by Mark Kessler <ke...@gmail.com>.
Alex,
   Give me an opinion which of these you prefer.  I have a few sets of
changes I could use.  I will apply the same logic for the array based ones
too.

1.  Keep the existing named methods (disableButton/enabledButton) and move
70% of code to a button index lookup method which they both call.

2.  Combine the 2 methods (disableButton/enabledButton) into one method
with an extra property requirement "setButtonEnabled(buttonLabel,
enabledValue, optionalFieldName)".

3.  Both options


-Mark

On Thu, May 2, 2013 at 11:44 PM, Alex Harui <ah...@adobe.com> wrote:

> Hey Mark,
>
> Do you think it is worth trying to have all of these APIs call a common
> function?  I think I'm seeing the same code more than once.
>
>

Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33524: Added convenience feature to enable/disable buttons in a ButtonBar/TabBar.

Posted by Mark Kessler <ke...@gmail.com>.
I'll fiddle around with it and remove some of the redundancy.

Methods, like I use more centrally and have been working well.

findRowIndex(labelField, labelValue);
findRowIndices(fieldName, labelValues);


-Mark


On Thu, May 2, 2013 at 11:44 PM, Alex Harui <ah...@adobe.com> wrote:

> Hey Mark,
>
> Do you think it is worth trying to have all of these APIs call a common
> function?  I think I'm seeing the same code more than once.
>
>
> On 5/2/13 4:48 PM, "mkessler@apache.org" <mk...@apache.org> wrote:
>
> > Updated Branches:
> >   refs/heads/develop 7d20cec89 -> 3053c3295
> >
> >
> > FLEX-33524: Added convenience feature to enable/disable buttons in a
> > ButtonBar/TabBar.
> >
> >
> > Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
> > Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/3053c329
> > Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/3053c329
> > Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/3053c329
> >
> > Branch: refs/heads/develop
> > Commit: 3053c3295e6c14b291e2aa5a947b1d88e9650a6f
> > Parents: 7d20cec
> > Author: Mark Kessler <Ke...@gmail.com>
> > Authored: Thu May 2 19:41:46 2013 -0400
> > Committer: Mark Kessler <Ke...@gmail.com>
> > Committed: Thu May 2 19:44:51 2013 -0400
> >
> > ----------------------------------------------------------------------
> >  .../components/supportClasses/ButtonBarBase.as     |  198
> ++++++++++++++-
> >  1 files changed, 197 insertions(+), 1 deletions(-)
> > ----------------------------------------------------------------------
> >
> >
> >
> http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/3053c329/frameworks/proje
> > cts/spark/src/spark/components/supportClasses/ButtonBarBase.as
> > ----------------------------------------------------------------------
> > diff --git
> >
> a/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.
> > as
> >
> b/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.
> > as
> > index 233a210..b41504e 100644
> > ---
> >
> a/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.
> > as
> > +++
> >
> b/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.
> > as
> > @@ -513,7 +513,203 @@ public class ButtonBarBase extends ListBase
> >      //  Methods
> >      //
> >
> >
> //--------------------------------------------------------------------------
> > -
> > +
> > +    /**
> > +    *  Disable a ButtonBar's Button referencing it by the
> ButtonBarbutton's
> > <code>label</code>.
> > +    *
> > +    *  <p>The function takes a single argument which is the
> ButtonBarButtons
> > label.</p>
> > +    *  <pre>myButtonBar.disableButton("My Button Label")</pre>
> > +    *
> > +    *  @param labelValue Is the ButtonBarButton label
> > +    *  @param fieldName Field used for comparing the label
> > +    *
> > +    *  @langversion 3.0
> > +    *  @playerversion Flash 11.1
> > +    *  @playerversion AIR 3.4
> > +    *  @productversion Flex 4.10
> > +    */
> > +    public function disableButton(labelValue:String, fieldName:String =
> > ""):void
> > +    {
> > +        var btnCurrent:ButtonBarButton = null;
> > +        var buttonIndex:int = -1;
> > +
> > +
> > +        if (!dataGroup || labelValue == "" || labelValue == null)
> > +        {
> > +            return;
> > +        }
> > +
> > +        if (fieldName == "" || fieldName == null)
> > +        {
> > +            buttonIndex = findRowIndex(labelField, labelValue);
> > +        }
> > +        else
> > +        {
> > +            buttonIndex = findRowIndex(fieldName, labelValue);
> > +        }
> > +
> > +        if (buttonIndex == -1)
> > +        {
> > +            return;
> > +        }
> > +
> > +
> > +        btnCurrent = dataGroup.getElementAt(buttonIndex) as
> ButtonBarButton;
> > +        btnCurrent.enabled = false;
> > +    }
> > +
> > +
> > +    /**
> > +    *  Disables several of a ButtonBar's Buttons, referencing them by
> the
> > ButtonBarbutton's <code>label</code>.
> > +    *
> > +    *  <p>The function takes a single argument which is the
> ButtonBarButtons
> > label.</p>
> > +    *  <pre>myButtonBar.disableButtons(["My Button Label1", "My
> > Label2"])</pre>
> > +    *
> > +    *  @param labelValues Is an array of ButtonBarButton labels.
> > +    *  @param fieldName Field used for comparing the label
> > +    *
> > +    *  @langversion 3.0
> > +    *  @playerversion Flash 11.1
> > +    *  @playerversion AIR 3.4
> > +    *  @productversion Flex 4.10
> > +    */
> > +    public function disableButtons(labelValues:Array, fieldName:String =
> > ""):void
> > +    {
> > +        var btnCurrent:ButtonBarButton = null;
> > +        var buttonIndices:Array;
> > +        var indicesTotal:uint = 0;
> > +        var loopingIndex:uint = 0;
> > +
> > +
> > +        if (!dataGroup || labelValues.length < 1 || labelValues == null)
> > +        {
> > +            return;
> > +        }
> > +
> > +        if (fieldName == "" || fieldName == null)
> > +        {
> > +            buttonIndices = findRowIndices(labelField, labelValues);
> > +        }
> > +        else
> > +        {
> > +            buttonIndices = findRowIndices(fieldName, labelValues);
> > +        }
> > +
> > +
> > +        indicesTotal = buttonIndices.length
> > +
> > +        if (indicesTotal == 0)
> > +        {
> > +            return;
> > +        }
> > +
> > +
> > +        for (loopingIndex; loopingIndex < indicesTotal; loopingIndex++)
> > +        {
> > +            btnCurrent =
> dataGroup.getElementAt(buttonIndices[loopingIndex])
> > as ButtonBarButton;
> > +            btnCurrent.enabled = false;
> > +        }
> > +    }
> > +
> > +
> > +    /**
> > +    *  Enable a ButtonBar's Button referencing it by the
> ButtonBarbutton's
> > <code>label</code>.
> > +    *
> > +    *  <p>The function takes a single argument which is the
> ButtonBarButtons
> > label.</p>
> > +    *  <pre>myButtonBar.enableButton("My Button Label")</pre>
> > +    *
> > +    *  @param labelValue Is the ButtonBarButton label
> > +    *  @param fieldName Field used for comparing the label
> > +    *
> > +    *  @langversion 3.0
> > +    *  @playerversion Flash 11.1
> > +    *  @playerversion AIR 3.4
> > +    *  @productversion Flex 4.10
> > +    */
> > +    public function enableButton(labelValue:String, fieldName:String =
> > ""):void
> > +    {
> > +        var btnCurrent:ButtonBarButton = null;
> > +        var buttonIndex:int = -1;
> > +
> > +
> > +        if (!dataGroup || labelValue == "" || labelValue == null)
> > +        {
> > +            return;
> > +        }
> > +
> > +        if (fieldName == "" || fieldName == null)
> > +        {
> > +            buttonIndex = findRowIndex(labelField, labelValue);
> > +        }
> > +        else
> > +        {
> > +            buttonIndex = findRowIndex(fieldName, labelValue);
> > +        }
> > +
> > +        if (buttonIndex == -1)
> > +        {
> > +            return;
> > +        }
> > +
> > +
> > +        btnCurrent = dataGroup.getElementAt(buttonIndex) as
> ButtonBarButton;
> > +        btnCurrent.enabled = true;
> > +    }
> > +
> > +
> > +    /**
> > +    *  Disables several of a ButtonBar's Buttons, referencing them by
> the
> > ButtonBarbutton's <code>label</code>.
> > +    *
> > +    *  <p>The function takes a single argument which is the
> ButtonBarButtons
> > label.</p>
> > +    *  <pre>myButtonBar.enableButtons(["My Button Label1", "My
> > Label2"])</pre>
> > +    *
> > +    *  @param labelValues Is an array of ButtonBarButton labels.
> > +    *  @param fieldName Field used for comparing the label
> > +    *
> > +    *  @langversion 3.0
> > +    *  @playerversion Flash 11.1
> > +    *  @playerversion AIR 3.4
> > +    *  @productversion Flex 4.10
> > +    */
> > +    public function enableButtons(labelValues:Array, fieldName:String =
> > ""):void
> > +    {
> > +        var btnCurrent:ButtonBarButton = null;
> > +        var buttonIndices:Array;
> > +        var indicesTotal:uint = 0;
> > +        var loopingIndex:uint = 0;
> > +
> > +
> > +        if (!dataGroup || labelValues.length < 1 || labelValues == null)
> > +        {
> > +            return;
> > +        }
> > +
> > +        if (fieldName == "" || fieldName == null)
> > +        {
> > +            buttonIndices = findRowIndices(labelField, labelValues);
> > +        }
> > +        else
> > +        {
> > +            buttonIndices = findRowIndices(fieldName, labelValues);
> > +        }
> > +
> > +
> > +        indicesTotal = buttonIndices.length
> > +
> > +        if (indicesTotal == 0)
> > +        {
> > +            return;
> > +        }
> > +
> > +
> > +        for (loopingIndex; loopingIndex < indicesTotal; loopingIndex++)
> > +        {
> > +            btnCurrent =
> dataGroup.getElementAt(buttonIndices[loopingIndex])
> > as ButtonBarButton;
> > +            btnCurrent.enabled = true;
> > +        }
> > +    }
> > +
> > +
> >      /**
> >       *  @private
> >       */
> >
>
> --
> Alex Harui
> Flex SDK Team
> Adobe Systems, Inc.
> http://blogs.adobe.com/aharui
>
>

Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33524: Added convenience feature to enable/disable buttons in a ButtonBar/TabBar.

Posted by Alex Harui <ah...@adobe.com>.
Hey Mark,

Do you think it is worth trying to have all of these APIs call a common
function?  I think I'm seeing the same code more than once.


On 5/2/13 4:48 PM, "mkessler@apache.org" <mk...@apache.org> wrote:

> Updated Branches:
>   refs/heads/develop 7d20cec89 -> 3053c3295
> 
> 
> FLEX-33524: Added convenience feature to enable/disable buttons in a
> ButtonBar/TabBar.
> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
> Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/3053c329
> Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/3053c329
> Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/3053c329
> 
> Branch: refs/heads/develop
> Commit: 3053c3295e6c14b291e2aa5a947b1d88e9650a6f
> Parents: 7d20cec
> Author: Mark Kessler <Ke...@gmail.com>
> Authored: Thu May 2 19:41:46 2013 -0400
> Committer: Mark Kessler <Ke...@gmail.com>
> Committed: Thu May 2 19:44:51 2013 -0400
> 
> ----------------------------------------------------------------------
>  .../components/supportClasses/ButtonBarBase.as     |  198 ++++++++++++++-
>  1 files changed, 197 insertions(+), 1 deletions(-)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/3053c329/frameworks/proje
> cts/spark/src/spark/components/supportClasses/ButtonBarBase.as
> ----------------------------------------------------------------------
> diff --git 
> a/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.
> as 
> b/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.
> as
> index 233a210..b41504e 100644
> --- 
> a/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.
> as
> +++ 
> b/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.
> as
> @@ -513,7 +513,203 @@ public class ButtonBarBase extends ListBase
>      //  Methods
>      //
>      
> //--------------------------------------------------------------------------
> -    
> +
> +    /**
> +    *  Disable a ButtonBar's Button referencing it by the ButtonBarbutton's
> <code>label</code>.
> +    *
> +    *  <p>The function takes a single argument which is the ButtonBarButtons
> label.</p>
> +    *  <pre>myButtonBar.disableButton("My Button Label")</pre>
> +    *
> +    *  @param labelValue Is the ButtonBarButton label
> +    *  @param fieldName Field used for comparing the label
> +    *
> +    *  @langversion 3.0
> +    *  @playerversion Flash 11.1
> +    *  @playerversion AIR 3.4
> +    *  @productversion Flex 4.10
> +    */
> +    public function disableButton(labelValue:String, fieldName:String =
> ""):void
> +    {
> +        var btnCurrent:ButtonBarButton = null;
> +        var buttonIndex:int = -1;
> +
> +
> +        if (!dataGroup || labelValue == "" || labelValue == null)
> +        {
> +            return;
> +        }
> +
> +        if (fieldName == "" || fieldName == null)
> +        {
> +            buttonIndex = findRowIndex(labelField, labelValue);
> +        }
> +        else
> +        {
> +            buttonIndex = findRowIndex(fieldName, labelValue);
> +        }
> +
> +        if (buttonIndex == -1)
> +        {
> +            return;
> +        }
> +
> +
> +        btnCurrent = dataGroup.getElementAt(buttonIndex) as ButtonBarButton;
> +        btnCurrent.enabled = false;
> +    }
> +
> +
> +    /**
> +    *  Disables several of a ButtonBar's Buttons, referencing them by the
> ButtonBarbutton's <code>label</code>.
> +    *
> +    *  <p>The function takes a single argument which is the ButtonBarButtons
> label.</p>
> +    *  <pre>myButtonBar.disableButtons(["My Button Label1", "My
> Label2"])</pre>
> +    *
> +    *  @param labelValues Is an array of ButtonBarButton labels.
> +    *  @param fieldName Field used for comparing the label
> +    *
> +    *  @langversion 3.0
> +    *  @playerversion Flash 11.1
> +    *  @playerversion AIR 3.4
> +    *  @productversion Flex 4.10
> +    */
> +    public function disableButtons(labelValues:Array, fieldName:String =
> ""):void
> +    {
> +        var btnCurrent:ButtonBarButton = null;
> +        var buttonIndices:Array;
> +        var indicesTotal:uint = 0;
> +        var loopingIndex:uint = 0;
> +
> +
> +        if (!dataGroup || labelValues.length < 1 || labelValues == null)
> +        {
> +            return;
> +        }
> +
> +        if (fieldName == "" || fieldName == null)
> +        {
> +            buttonIndices = findRowIndices(labelField, labelValues);
> +        }
> +        else
> +        {
> +            buttonIndices = findRowIndices(fieldName, labelValues);
> +        }
> +
> +
> +        indicesTotal = buttonIndices.length
> +
> +        if (indicesTotal == 0)
> +        {
> +            return;
> +        }
> +
> +        
> +        for (loopingIndex; loopingIndex < indicesTotal; loopingIndex++)
> +        {
> +            btnCurrent = dataGroup.getElementAt(buttonIndices[loopingIndex])
> as ButtonBarButton;
> +            btnCurrent.enabled = false;
> +        }
> +    }
> +
> +
> +    /**
> +    *  Enable a ButtonBar's Button referencing it by the ButtonBarbutton's
> <code>label</code>.
> +    *
> +    *  <p>The function takes a single argument which is the ButtonBarButtons
> label.</p>
> +    *  <pre>myButtonBar.enableButton("My Button Label")</pre>
> +    *
> +    *  @param labelValue Is the ButtonBarButton label
> +    *  @param fieldName Field used for comparing the label
> +    *
> +    *  @langversion 3.0
> +    *  @playerversion Flash 11.1
> +    *  @playerversion AIR 3.4
> +    *  @productversion Flex 4.10
> +    */
> +    public function enableButton(labelValue:String, fieldName:String =
> ""):void
> +    {
> +        var btnCurrent:ButtonBarButton = null;
> +        var buttonIndex:int = -1;
> +
> +
> +        if (!dataGroup || labelValue == "" || labelValue == null)
> +        {
> +            return;
> +        }
> +
> +        if (fieldName == "" || fieldName == null)
> +        {
> +            buttonIndex = findRowIndex(labelField, labelValue);
> +        }
> +        else
> +        {
> +            buttonIndex = findRowIndex(fieldName, labelValue);
> +        }
> +
> +        if (buttonIndex == -1)
> +        {
> +            return;
> +        }
> +
> +
> +        btnCurrent = dataGroup.getElementAt(buttonIndex) as ButtonBarButton;
> +        btnCurrent.enabled = true;
> +    }
> +
> +
> +    /**
> +    *  Disables several of a ButtonBar's Buttons, referencing them by the
> ButtonBarbutton's <code>label</code>.
> +    *
> +    *  <p>The function takes a single argument which is the ButtonBarButtons
> label.</p>
> +    *  <pre>myButtonBar.enableButtons(["My Button Label1", "My
> Label2"])</pre>
> +    *
> +    *  @param labelValues Is an array of ButtonBarButton labels.
> +    *  @param fieldName Field used for comparing the label
> +    *
> +    *  @langversion 3.0
> +    *  @playerversion Flash 11.1
> +    *  @playerversion AIR 3.4
> +    *  @productversion Flex 4.10
> +    */
> +    public function enableButtons(labelValues:Array, fieldName:String =
> ""):void
> +    {
> +        var btnCurrent:ButtonBarButton = null;
> +        var buttonIndices:Array;
> +        var indicesTotal:uint = 0;
> +        var loopingIndex:uint = 0;
> +
> +
> +        if (!dataGroup || labelValues.length < 1 || labelValues == null)
> +        {
> +            return;
> +        }
> +
> +        if (fieldName == "" || fieldName == null)
> +        {
> +            buttonIndices = findRowIndices(labelField, labelValues);
> +        }
> +        else
> +        {
> +            buttonIndices = findRowIndices(fieldName, labelValues);
> +        }
> +
> +
> +        indicesTotal = buttonIndices.length
> +
> +        if (indicesTotal == 0)
> +        {
> +            return;
> +        }
> +
> +        
> +        for (loopingIndex; loopingIndex < indicesTotal; loopingIndex++)
> +        {
> +            btnCurrent = dataGroup.getElementAt(buttonIndices[loopingIndex])
> as ButtonBarButton;
> +            btnCurrent.enabled = true;
> +        }
> +    }
> +
> +
>      /**
>       *  @private
>       */
> 

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui


Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33524: Added convenience feature to enable/disable buttons in a ButtonBar/TabBar.

Posted by Alex Harui <ah...@adobe.com>.
Hey Mark,

Do you think it is worth trying to have all of these APIs call a common
function?  I think I'm seeing the same code more than once.


On 5/2/13 4:48 PM, "mkessler@apache.org" <mk...@apache.org> wrote:

> Updated Branches:
>   refs/heads/develop 7d20cec89 -> 3053c3295
> 
> 
> FLEX-33524: Added convenience feature to enable/disable buttons in a
> ButtonBar/TabBar.
> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
> Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/3053c329
> Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/3053c329
> Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/3053c329
> 
> Branch: refs/heads/develop
> Commit: 3053c3295e6c14b291e2aa5a947b1d88e9650a6f
> Parents: 7d20cec
> Author: Mark Kessler <Ke...@gmail.com>
> Authored: Thu May 2 19:41:46 2013 -0400
> Committer: Mark Kessler <Ke...@gmail.com>
> Committed: Thu May 2 19:44:51 2013 -0400
> 
> ----------------------------------------------------------------------
>  .../components/supportClasses/ButtonBarBase.as     |  198 ++++++++++++++-
>  1 files changed, 197 insertions(+), 1 deletions(-)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/3053c329/frameworks/proje
> cts/spark/src/spark/components/supportClasses/ButtonBarBase.as
> ----------------------------------------------------------------------
> diff --git 
> a/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.
> as 
> b/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.
> as
> index 233a210..b41504e 100644
> --- 
> a/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.
> as
> +++ 
> b/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.
> as
> @@ -513,7 +513,203 @@ public class ButtonBarBase extends ListBase
>      //  Methods
>      //
>      
> //--------------------------------------------------------------------------
> -    
> +
> +    /**
> +    *  Disable a ButtonBar's Button referencing it by the ButtonBarbutton's
> <code>label</code>.
> +    *
> +    *  <p>The function takes a single argument which is the ButtonBarButtons
> label.</p>
> +    *  <pre>myButtonBar.disableButton("My Button Label")</pre>
> +    *
> +    *  @param labelValue Is the ButtonBarButton label
> +    *  @param fieldName Field used for comparing the label
> +    *
> +    *  @langversion 3.0
> +    *  @playerversion Flash 11.1
> +    *  @playerversion AIR 3.4
> +    *  @productversion Flex 4.10
> +    */
> +    public function disableButton(labelValue:String, fieldName:String =
> ""):void
> +    {
> +        var btnCurrent:ButtonBarButton = null;
> +        var buttonIndex:int = -1;
> +
> +
> +        if (!dataGroup || labelValue == "" || labelValue == null)
> +        {
> +            return;
> +        }
> +
> +        if (fieldName == "" || fieldName == null)
> +        {
> +            buttonIndex = findRowIndex(labelField, labelValue);
> +        }
> +        else
> +        {
> +            buttonIndex = findRowIndex(fieldName, labelValue);
> +        }
> +
> +        if (buttonIndex == -1)
> +        {
> +            return;
> +        }
> +
> +
> +        btnCurrent = dataGroup.getElementAt(buttonIndex) as ButtonBarButton;
> +        btnCurrent.enabled = false;
> +    }
> +
> +
> +    /**
> +    *  Disables several of a ButtonBar's Buttons, referencing them by the
> ButtonBarbutton's <code>label</code>.
> +    *
> +    *  <p>The function takes a single argument which is the ButtonBarButtons
> label.</p>
> +    *  <pre>myButtonBar.disableButtons(["My Button Label1", "My
> Label2"])</pre>
> +    *
> +    *  @param labelValues Is an array of ButtonBarButton labels.
> +    *  @param fieldName Field used for comparing the label
> +    *
> +    *  @langversion 3.0
> +    *  @playerversion Flash 11.1
> +    *  @playerversion AIR 3.4
> +    *  @productversion Flex 4.10
> +    */
> +    public function disableButtons(labelValues:Array, fieldName:String =
> ""):void
> +    {
> +        var btnCurrent:ButtonBarButton = null;
> +        var buttonIndices:Array;
> +        var indicesTotal:uint = 0;
> +        var loopingIndex:uint = 0;
> +
> +
> +        if (!dataGroup || labelValues.length < 1 || labelValues == null)
> +        {
> +            return;
> +        }
> +
> +        if (fieldName == "" || fieldName == null)
> +        {
> +            buttonIndices = findRowIndices(labelField, labelValues);
> +        }
> +        else
> +        {
> +            buttonIndices = findRowIndices(fieldName, labelValues);
> +        }
> +
> +
> +        indicesTotal = buttonIndices.length
> +
> +        if (indicesTotal == 0)
> +        {
> +            return;
> +        }
> +
> +        
> +        for (loopingIndex; loopingIndex < indicesTotal; loopingIndex++)
> +        {
> +            btnCurrent = dataGroup.getElementAt(buttonIndices[loopingIndex])
> as ButtonBarButton;
> +            btnCurrent.enabled = false;
> +        }
> +    }
> +
> +
> +    /**
> +    *  Enable a ButtonBar's Button referencing it by the ButtonBarbutton's
> <code>label</code>.
> +    *
> +    *  <p>The function takes a single argument which is the ButtonBarButtons
> label.</p>
> +    *  <pre>myButtonBar.enableButton("My Button Label")</pre>
> +    *
> +    *  @param labelValue Is the ButtonBarButton label
> +    *  @param fieldName Field used for comparing the label
> +    *
> +    *  @langversion 3.0
> +    *  @playerversion Flash 11.1
> +    *  @playerversion AIR 3.4
> +    *  @productversion Flex 4.10
> +    */
> +    public function enableButton(labelValue:String, fieldName:String =
> ""):void
> +    {
> +        var btnCurrent:ButtonBarButton = null;
> +        var buttonIndex:int = -1;
> +
> +
> +        if (!dataGroup || labelValue == "" || labelValue == null)
> +        {
> +            return;
> +        }
> +
> +        if (fieldName == "" || fieldName == null)
> +        {
> +            buttonIndex = findRowIndex(labelField, labelValue);
> +        }
> +        else
> +        {
> +            buttonIndex = findRowIndex(fieldName, labelValue);
> +        }
> +
> +        if (buttonIndex == -1)
> +        {
> +            return;
> +        }
> +
> +
> +        btnCurrent = dataGroup.getElementAt(buttonIndex) as ButtonBarButton;
> +        btnCurrent.enabled = true;
> +    }
> +
> +
> +    /**
> +    *  Disables several of a ButtonBar's Buttons, referencing them by the
> ButtonBarbutton's <code>label</code>.
> +    *
> +    *  <p>The function takes a single argument which is the ButtonBarButtons
> label.</p>
> +    *  <pre>myButtonBar.enableButtons(["My Button Label1", "My
> Label2"])</pre>
> +    *
> +    *  @param labelValues Is an array of ButtonBarButton labels.
> +    *  @param fieldName Field used for comparing the label
> +    *
> +    *  @langversion 3.0
> +    *  @playerversion Flash 11.1
> +    *  @playerversion AIR 3.4
> +    *  @productversion Flex 4.10
> +    */
> +    public function enableButtons(labelValues:Array, fieldName:String =
> ""):void
> +    {
> +        var btnCurrent:ButtonBarButton = null;
> +        var buttonIndices:Array;
> +        var indicesTotal:uint = 0;
> +        var loopingIndex:uint = 0;
> +
> +
> +        if (!dataGroup || labelValues.length < 1 || labelValues == null)
> +        {
> +            return;
> +        }
> +
> +        if (fieldName == "" || fieldName == null)
> +        {
> +            buttonIndices = findRowIndices(labelField, labelValues);
> +        }
> +        else
> +        {
> +            buttonIndices = findRowIndices(fieldName, labelValues);
> +        }
> +
> +
> +        indicesTotal = buttonIndices.length
> +
> +        if (indicesTotal == 0)
> +        {
> +            return;
> +        }
> +
> +        
> +        for (loopingIndex; loopingIndex < indicesTotal; loopingIndex++)
> +        {
> +            btnCurrent = dataGroup.getElementAt(buttonIndices[loopingIndex])
> as ButtonBarButton;
> +            btnCurrent.enabled = true;
> +        }
> +    }
> +
> +
>      /**
>       *  @private
>       */
> 

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui