Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-18847

NavBar / LinkBar breaks if the first item in the dataProvider is a DisplayObject

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • Adobe Flex SDK 3.5 (Release)
    • None
    • mx: LinkBar
    • None
    • Affected OS(s): All OS Platforms
      Affected OS(s): All OS Platforms
      Language Found: English

    Description

      Steps to reproduce:
      1. Create a LinkBar
      2. Pass an Array into the dataProvider property of the linkbar where the first item is a DispayObject

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

      <mx:LinkBar>
      <mx:dataProvider>
      <mx:Array>
      <mx:Button label="Foo" />
      <mx:Object label="One" />
      <mx:Object label="Two" />
      <mx:Object label="Three" />
      <mx:Object label="Four" />
      </mx:Array>
      </mx:dataProvider>
      </mx:LinkBar>

      </mx:Application>

      3. An exception is thrown with the message "The dataProvider of 'LinkBar 'myLinkBar'' must be String, ViewStack, Array, or IList"

      The cause of this is code on line 393 of the latest Gumbo nightly that checks the first element of a list or array, and if it is a DisplayObject, incorrectly throws an excsption claiming that the list is not a list:

      else if ((value is IList && IList(value).length > 0 &&
      IList(value).getItemAt(0) is DisplayObject) ||
      (value is Array && (value as Array).length > 0 &&
      value[0] is DisplayObject))

      { ... throw error ... }

      I'm not sure what that code is trying to do, but I'm sure this isn't it :o)

      Actual results:
      Error: ERROR: The dataProvider of 'a LinkBar' must be String, ViewStack, Array, or IList.
      at mx.controls::NavBar/set dataProvider()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\controls\NavBar.as:410]
      at mx.core::Container/createComponentFromDescriptor()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\Container.as:3638]
      at mx.core::Container/createComponentsFromDescriptors()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\Container.as:3536]
      at mx.core::Container/createChildren()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\Container.as:2632]
      at mx.core::UIComponent/initialize()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\UIComponent.as:5381]
      at mx.core::Container/initialize()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\Container.as:2569]
      at mx.core::Application/initialize()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\Application.as:864]
      at Flex35_sdk24191/initialize()[C:\Documents and Settings\pdehaan\Adobe Flash Builder Prerelease\Flex34\src\Flex35_sdk24191.mxml:0]
      at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\SystemManager.as:2131]
      at mx.managers::SystemManager/initializeTopLevelWindow()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\SystemManager.as:3400]
      at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\SystemManager.as:3223]
      at mx.managers::SystemManager/docFrameListener()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\SystemManager.as:3069]

      Expected results:
      No RTE. If i move the display object to the second index, it compiles and runs fine. Seems like an odd limitation that only the FIRST item in the data provider cannot be a display object.

      Workaround (if any):
      One can wrap every object that is supposed to go into the Array in a class that delegates all property accesses to the rapped DisplayObject.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            adobejira Adobe JIRA
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment