<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Styling Component Parts</title><link>https://sourceforge.net/adobe/flexsdk/wiki/Styling%2520Component%2520Parts/</link><description>Recent changes to Styling Component Parts</description><atom:link href="https://sourceforge.net/adobe/flexsdk/wiki/Styling%20Component%20Parts/feed" rel="self"/><language>en</language><lastBuildDate>Fri, 07 Dec 2012 18:12:01 -0000</lastBuildDate><atom:link href="https://sourceforge.net/adobe/flexsdk/wiki/Styling%20Component%20Parts/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage Styling Component Parts modified by SourceForge Editorial Staff</title><link>https://sourceforge.net/adobe/flexsdk/wiki/Styling%2520Component%2520Parts/</link><description>&lt;pre&gt;--- v1
+++ v2
@@ -1,12 +1,11 @@
 
-
-&lt;div class="section"&gt;
+&lt;div class="section" markdown&gt;
 
 
 
 
 
-&lt;div class="column" style="display:inline-block; vertical-align:top; width:80%;"&gt;
+&lt;div class="column" style="display:inline-block; vertical-align:top; width:80%;" markdown&gt;
 
 
 
@@ -136,7 +135,7 @@
 
 A 3rd party developer could easily create a theme that uses advanced CSS (ie proposal #2), if desired.
 
-[[ include ref='site:open_commentlogin' ]]
+
 
 
 
@@ -144,7 +143,7 @@
 
 
 
-[[ include ref='flexsdk:flexsdk_rightnav' ]]
+[[ include ref='flexsdk_rightnav' ]]
 
 
 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SourceForge Editorial Staff</dc:creator><pubDate>Fri, 07 Dec 2012 18:12:01 -0000</pubDate><guid>https://sourceforge.netcda9034f798c702d1a725877f220b495922981ae</guid></item><item><title>WikiPage Styling Component Parts modified by SourceForge Editorial Staff</title><link>https://sourceforge.net/adobe/flexsdk/wiki/Styling%2520Component%2520Parts/</link><description>

&lt;div class="section"&gt;





&lt;div class="column" style="display:inline-block; vertical-align:top; width:80%;"&gt;



# Styling Component Parts

## Problem Description

How do you style skin parts independently from styling the overall component? For example, making the Panel title "bold" while the rest of the text in the Panel is "normal". 

See these bugs for more background:  
https://bugs.adobe.com/jira/browse/SDK-19726  
https://bugs.adobe.com/jira/browse/SDK-19447

## Decision

pending…

## Decision Criteria

  * Toolability
  * Performance
  * Usability
  * Implementation concerns

## Proposed Solution(s):

### 1. Hard-coded into skin definitions

This is the current approach used by the Gumbo components. The majority of styles are defined once, on the global selector. If a skin part requires a different style, it is hard-coded into the skin.

Example:  

    global {
        font-weight: normal;   /* global font weight */
    }
    
    FxPanelSkin.mxml
    &lt;Skin&gt;
        ...
        &lt;!-- Panel title is bold. --&gt;
        &lt;TextBox id="titleField" fontWeight="bold" /&gt;
        ....
    &lt;/Skin&gt;
    

Pros: 

  * Simple and lightweight

Cons: 

  * Requires re-skinning to change the style

### 2. Use Advanced CSS

Use the new advanced CSS features added to Flex 4 for specifying styles. For example, the Panel titleField is made bold with the following selector:

Example:  

    Panel #titleField {
        font-weight: bold;
    }
    

Pros: 

  * Uses a new feature of Flex 4
  * Allows changing of styles without reskinning

Cons: 

  * Possible name collisions with child elements. For example, _any_ child with the id "titleField" at _any_ depth below the panel will be bold. The chance of collision could be limited with clever naming, but these names are also the names of the skin parts.
  * Could be confusing when re-skinning. If you create a new panel skin and want non-bold text in the header, you need to either add a CSS selector, or force the text to be non-bold. An issue here is Catalyst does not have any way to explicitly un-bold text that is implicitly bolded.
  * Performance considerations of using advanced CSS.

### 3. Expose selectors for skin parts

This is the solution used for most Halo components. 

Example:  

    FxPanel {
        titleFieldStyleName: panelTitleField;
    }
    
    .titleFieldStyleName {
        font-weight: bold;
    }
    

Pros: 

  * Consistency with Halo (is that a Pro?)
  * Allows changing of styles without reskinning.

Cons: 

  * Complicates component APIs by adding a bunch of style name selectors.
  * Clunky hack now that we have advanced CSS.

### 4. Create new types for specific skin parts

This is the solution used by some Halo components like FormItem/FormItemLabel.

Example:  

    PanelTitleTextBox {
        font-weight: bold;
    }
    

Pros: 

  * Allows changing of styles without reskinning.

Cons: 

  * Class bloat
  * Excessive solution to a simple problem.

## Recommended Solution:

Solution #1, for the following reasons: 

  1. This is the solution that works best for Catalyst
  2. Simple, straightforward, and no side effects

A 3rd party developer could easily create a theme that uses advanced CSS (ie proposal #2), if desired.

[[ include ref='site:open_commentlogin' ]]



&lt;/div&gt;



[[ include ref='flexsdk:flexsdk_rightnav' ]]



&lt;/div&gt;


</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SourceForge Editorial Staff</dc:creator><pubDate>Thu, 15 Mar 2012 18:12:59 -0000</pubDate><guid>https://sourceforge.net6272faaeff8dc6bb26a39460c3db2910ebbef7ce</guid></item></channel></rss>