net.rim.device.api.lbs.maps.view
Class StyleSet

java.lang.Object
  extended by net.rim.device.api.lbs.maps.view.StyleSet
All Implemented Interfaces:
Persistable

public class StyleSet
extends Object
implements Persistable

Represents a set of styles.

This class contains three levels of styles:

There are also default values for class-specific styles and a system-wide default style.

Class-specific styles can be hierarchical. In certain situations, the style for class X can be applied when generating a style for a Mappable object that is a subclass of X. See individual methods to determine where this is applicable.

Since:
BlackBerry API 7.0.0

Constructor Summary
StyleSet()
          Constructs a new StyleSet instance.
 
Method Summary
 void addClassBasedStyle(Class clazz, Style style)
          Adds a class-based style to this style set.
 void addIdBasedStyle(Object id, Style style)
          Adds an ID-based style to this style set.
 Style generateStyle(Mappable data)
          Generates a style for the specified Mappable object.
 Style getBaseStyle()
          Retrieves the base style for this style set.
 Style getClassBasedStyle(Class clazz)
          Retrieves the style that is associated with the specified class.
 Style getIdBasedStyle(Object id)
          Retrieves the style that is associated with the specified ID.
 void removeAllClassBasedStyles()
          Removes all class-based styles from this style set.
 void removeAllIdBasedStyles()
          Removes all ID-based styles from this style set.
 void removeClassBasedStyle(Class clazz)
          Removes a class-based style from this style set.
 void removeIdBasedStyle(Object id)
          Removes an ID-based style from this style set.
 void setBaseStyle(Style newBaseStyle)
          Sets the base style for this style set.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

StyleSet

public StyleSet()
Constructs a new StyleSet instance.

Since:
BlackBerry API 7.0.0


Method Detail

getBaseStyle

public Style getBaseStyle()
Retrieves the base style for this style set.

Returns:
The base style.
Since:
BlackBerry API 7.0.0

setBaseStyle

public void setBaseStyle(Style newBaseStyle)
Sets the base style for this style set.

Parameters:
newBaseStyle - The base style to set.
Since:
BlackBerry API 7.0.0

addIdBasedStyle

public void addIdBasedStyle(Object id,
                            Style style)
Adds an ID-based style to this style set.

Parameters:
id - The ID of the data to use the style with.
style - The style to store.
Since:
BlackBerry API 7.0.0

removeIdBasedStyle

public void removeIdBasedStyle(Object id)
Removes an ID-based style from this style set.

Parameters:
id - The ID that is associated with the style to remove.
Since:
BlackBerry API 7.0.0

removeAllIdBasedStyles

public void removeAllIdBasedStyles()
Removes all ID-based styles from this style set.

Since:
BlackBerry API 7.0.0

getIdBasedStyle

public Style getIdBasedStyle(Object id)
Retrieves the style that is associated with the specified ID.

Parameters:
id - The ID that is associated with the desired style.
Returns:
The desired style, or null if it doesn't exist.
See Also:
StyleSet.generateStyle(Mappable)
Since:
BlackBerry API 7.0.0

addClassBasedStyle

public void addClassBasedStyle(Class clazz,
                               Style style)
Adds a class-based style to this style set.

Parameters:
clazz - The class to store the style against.
style - The style to store.
Since:
BlackBerry API 7.0.0

removeClassBasedStyle

public void removeClassBasedStyle(Class clazz)
Removes a class-based style from this style set.

Parameters:
clazz - The class that is associated with the style to remove.
Since:
BlackBerry API 7.0.0

removeAllClassBasedStyles

public void removeAllClassBasedStyles()
Removes all class-based styles from this style set.

Since:
BlackBerry API 7.0.0

getClassBasedStyle

public Style getClassBasedStyle(Class clazz)
Retrieves the style that is associated with the specified class.

Parameters:
clazz - The class that is associated with the desired style.
Returns:
The desired style, or null if it doesn't exist. This method returns style information only for a specific class, and ignores the class's hierarchy. Thus, if a superclass of the desired class has been defined, the information of the superclass is not returned.
See Also:
StyleSet.generateStyle(Mappable)
Since:
BlackBerry API 7.0.0

generateStyle

public Style generateStyle(Mappable data)
Generates a style for the specified Mappable object.

The Style object that this method returns is complete, which means that none of the style properties are defined as inherited.

The Style object is based on an overlay pattern:

  1. the base style.
  2. the style for the class of data provided, including any superclass style definitions.
  3. the style for the ID of the Mappable object.

If there are still any incomplete properties, then system default values are used to populate those properties, starting with class-based styles and then using the system default style.

Parameters:
data - The mappable entity that contains the ID and class to base the style on.
Returns:
A generated, complete style. This method never returns null.
Since:
BlackBerry API 7.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal