/**
   * Gets a Color stored as a property on the RenderingContext using the specified key. Or if not
   * found on, gets the color from the Ocelot StyleMap using the specified style class name.
   */
  private static Color _getColor(
      UIXRenderingContext context, String styleClass, Object key, Color defaultColor) {
    // First check for the color on the RenderingContext
    Color color = (Color) context.getProperty(UIConstants.MARLIN_NAMESPACE, key);

    if (color != null) return color;

    // If the color hasn't been stored on the RenderingContext, get it
    // from the style map.
    StyleMap map = context.getStyleContext().getStyleMap();

    if (map != null) {
      Style style = map.getStyleByClass(context.getStyleContext(), styleClass);
      if (style != null) {
        try {
          color = (Color) style.getParsedProperty(Style.BACKGROUND_KEY);
        } catch (PropertyParseException e) {
          // This should really be reported at parse time
          _LOG.info(e);
        }
      }
    }

    if (color == null) color = defaultColor;

    // Cache the color on the RenderingContext
    context.setProperty(UIConstants.MARLIN_NAMESPACE, key, color);

    return color;
  }
  // Returns the style for the specified name
  protected static Style getStyle(UIXRenderingContext context, UINode node, String name) {
    if (name == null) return null;

    StyleMap map = context.getStyleContext().getStyleMap();
    if (map == null) return null;

    return map.getStyleByName(context.getStyleContext(), name);
  }