com.alee.managers.style.data
Class ComponentStyleConverter

java.lang.Object
  extended by com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
      extended by com.thoughtworks.xstream.converters.reflection.ReflectionConverter
          extended by com.alee.managers.style.data.ComponentStyleConverter
All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter, com.thoughtworks.xstream.converters.ConverterMatcher, com.thoughtworks.xstream.core.Caching

public class ComponentStyleConverter
extends com.thoughtworks.xstream.converters.reflection.ReflectionConverter

Custom XStream converter for ComponentStyle class.

Author:
Mikle Garin
See Also:
How to use StyleManager, StyleManager, ComponentStyle

Nested Class Summary
 
Nested classes/interfaces inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.DuplicateFieldException, com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.UnknownFieldException
 
Field Summary
static java.lang.String COMPONENT_NODE
           
static java.lang.String COMPONENT_TYPE_ATTRIBUTE
           
static java.lang.String DEFAULT_STYLE_ID
          Default component style ID.
static java.lang.String EXTENDS_ID_ATTRIBUTE
           
static java.lang.String IGNORED_ATTRIBUTE
           
static java.lang.String PAINTER_CLASS_ATTRIBUTE
           
static java.lang.String PAINTER_ID_ATTRIBUTE
           
static java.lang.String PAINTER_NODE
           
static java.lang.String STYLE_ID_ATTRIBUTE
           
static java.lang.String STYLE_NODE
          Converter constants.
static java.lang.String UI_NODE
           
 
Fields inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
mapper, reflectionProvider, serializationMethodInvoker
 
Constructor Summary
ComponentStyleConverter(com.thoughtworks.xstream.mapper.Mapper mapper, com.thoughtworks.xstream.converters.reflection.ReflectionProvider reflectionProvider)
          Constructs ComponentStyleConverter with the specified mapper and reflection provider.
 
Method Summary
 boolean canConvert(java.lang.Class type)
          
 void marshal(java.lang.Object source, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context)
          
protected  void readProperty(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context, java.lang.String componentStyleId, java.util.Map<java.lang.String,java.lang.Object> properties, java.lang.Class propertyClass, java.lang.String propertyName)
          Parses single style property into properties map.
 java.lang.Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
          
 
Methods inherited from class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
canAccess, doMarshal, doUnmarshal, flushCache, instantiateNewInstance, marshallField, shouldUnmarshalField, shouldUnmarshalTransientFields, unmarshallField
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STYLE_NODE

public static final java.lang.String STYLE_NODE
Converter constants.

See Also:
Constant Field Values

STYLE_ID_ATTRIBUTE

public static final java.lang.String STYLE_ID_ATTRIBUTE
See Also:
Constant Field Values

COMPONENT_TYPE_ATTRIBUTE

public static final java.lang.String COMPONENT_TYPE_ATTRIBUTE
See Also:
Constant Field Values

EXTENDS_ID_ATTRIBUTE

public static final java.lang.String EXTENDS_ID_ATTRIBUTE
See Also:
Constant Field Values

COMPONENT_NODE

public static final java.lang.String COMPONENT_NODE
See Also:
Constant Field Values

UI_NODE

public static final java.lang.String UI_NODE
See Also:
Constant Field Values

PAINTER_NODE

public static final java.lang.String PAINTER_NODE
See Also:
Constant Field Values

PAINTER_ID_ATTRIBUTE

public static final java.lang.String PAINTER_ID_ATTRIBUTE
See Also:
Constant Field Values

PAINTER_CLASS_ATTRIBUTE

public static final java.lang.String PAINTER_CLASS_ATTRIBUTE
See Also:
Constant Field Values

IGNORED_ATTRIBUTE

public static final java.lang.String IGNORED_ATTRIBUTE
See Also:
Constant Field Values

DEFAULT_STYLE_ID

public static final java.lang.String DEFAULT_STYLE_ID
Default component style ID.

See Also:
Constant Field Values
Constructor Detail

ComponentStyleConverter

public ComponentStyleConverter(com.thoughtworks.xstream.mapper.Mapper mapper,
                               com.thoughtworks.xstream.converters.reflection.ReflectionProvider reflectionProvider)
Constructs ComponentStyleConverter with the specified mapper and reflection provider.

Parameters:
mapper - mapper
reflectionProvider - reflection provider
Method Detail

canConvert

public boolean canConvert(java.lang.Class type)

Specified by:
canConvert in interface com.thoughtworks.xstream.converters.ConverterMatcher
Overrides:
canConvert in class com.thoughtworks.xstream.converters.reflection.ReflectionConverter

marshal

public void marshal(java.lang.Object source,
                    com.thoughtworks.xstream.io.HierarchicalStreamWriter writer,
                    com.thoughtworks.xstream.converters.MarshallingContext context)

Specified by:
marshal in interface com.thoughtworks.xstream.converters.Converter
Overrides:
marshal in class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter

unmarshal

public java.lang.Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader,
                                  com.thoughtworks.xstream.converters.UnmarshallingContext context)

Specified by:
unmarshal in interface com.thoughtworks.xstream.converters.Converter
Overrides:
unmarshal in class com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter

readProperty

protected void readProperty(com.thoughtworks.xstream.io.HierarchicalStreamReader reader,
                            com.thoughtworks.xstream.converters.UnmarshallingContext context,
                            java.lang.String componentStyleId,
                            java.util.Map<java.lang.String,java.lang.Object> properties,
                            java.lang.Class propertyClass,
                            java.lang.String propertyName)
Parses single style property into properties map.

Parameters:
reader - hierarchical stream reader
context - unmarshalling context
componentStyleId - component style ID
properties - properties
propertyClass - property class
propertyName - property name