3 Replies Latest reply on Jan 11, 2011 10:01 PM by Flex harUI

    Spark ItemRenderer vs Spark Skinning

    Gregory Lafrance Level 6

      I'm trying to work out what you do in a Spark custom item renderer vs what you do in a Spark custom skin, because a Spark container/component could have both.

       

      If I describe this situation as below, is this accurrate?

       

      "In some cases you define a custom item renderer and also a custom skin and the lines are blurred a bit on what you do in each. In general, you can think of the item renderer as defining the physical appearance of the data item, whereas the skin defines the more complete visual appearance of the component. The skin may include borders, scroll bars, and any other aspects of the appearance of the component."

       

      So here I consider an item renderer as defining more of the physical appearance of the component, such as does it have three labels, or two labels and one text control, etc. whereas a skin defines more visual aspects of the component, such as colors, scroll bars, etc.

       

      I understand that in some cases you might not define a skin, so you have the more visual aspects that WOULD go in a skin in an item renderer.

        • 1. Re: Spark ItemRenderer vs Spark Skinning
          Flex harUI Adobe Employee

          I didn't think our default item renderers had skins.

          • 2. Re: Spark ItemRenderer vs Spark Skinning
            Gregory Lafrance Level 6

            I don't know if they do. I'm not referring to that. I'm referring to defining a custom itemrenderer class and a custom skin class (2 classes).

             

            Are there ever cases where you might apply both a custom item renderer class and a custom skin class to a component, or is it one or the other?

             

            If so, then I guess you could say that when you use a custom item renderer, it acts as a skin class and thus should do all that a skin class normally would do.

             

            Hope this clears up the question.

            • 3. Re: Spark ItemRenderer vs Spark Skinning
              Flex harUI Adobe Employee

              IIRC, our default renderers are not skinnable.  A skin and a renderer are

              both views in the MVC model, and some folks have tried to create a skinnable

              renderer (which is possible, but in my mind, redundant).

               

              I'm not sure we have an official statement, but here's how I think of it.

               

              A component is a unit of functionality.  A skinnable component supports a

              skin that changes the visual aspects (the view) of that unit.

               

              A renderer is really just a view, which is why it doesn't need a skin as

              well. A custom renderer defines all of the visual aspects.  Renderers don't

              have to have functionality.

               

              Yes, non-interactive components are essentially renderers, but the renderer

              contract is much simpler and view-like (as in: here is your model/data, now

              go display it).  There is no notion of exposing properties that get tweaked

              on a per-instance basis.   Everything is data-driven.  Renderers are only

              used when merging a collection of data with views for that data.  Components

              and skins are declared, not generated from data.

               

              That's my 2 cents.

              1 person found this helpful