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

ItemRenderer.getCurrentRendererState should return currentState instead of null

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Adobe Flex SDK Previous
    • None
    • Spark: DataGroup
    • None
    • Language Found: English

    Description

      The View component treats states slightly differently than ItemRenderer. In View.getCurrentViewState() the code returns currentState if no other state is found:

      View.getCurrentViewState():String
      {
      ...
      // If the appropriate state for the orientation of the device
      // isn't defined, return the current state
      return currentState;
      }

      This code was added to View to fix SDK-27115.

      But in ItemRenderer the code returns null if no other state is found:

      ItemRenderer.getCurrentRendererState():String
      {
      ...
      // If none of the above states are defined in the item renderer,
      // we return null. This means the user-defined renderer
      // will display but essentially be non-interactive visually.
      return null;
      }

      The View approach of returning currentState should also be used in ItemRenderer. This would mean that people writing custom ItemRenderers could choose to support the default set of states in their MXML, or use a completely different set of their own states without needing to override getCurrentRendererState(). That would mean they only have to override getCurrentRendererState() when doing fancier combinations of states instead of something simple.

      I currently point people to use DataRenderer instead of ItemRenderer when they want to define their own set of states without needing to override getCurrentRendererState(), but it would be nice if that wasn't necessary:
      http://flexponential.com/2010/02/07/using-datarenderer-to-add-custom-states-to-a-spark-list-renderer/

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: