Calendar Component v5.1
www.calendarcomponent.com

com.imagine.component.calendar.skins.wrapper
Class CalendarSkinStyleAdapter

java.lang.Object
  extended bycom.imagine.component.calendar.skins.wrapper.CalendarSkinStyleAdapter

public class CalendarSkinStyleAdapter
extends java.lang.Object

Defines a calendar skin style adapter class used to help implementing a skin style which gets dynamical skin property information.
In this way one can specify something like: I want the cell font to be the default font but to have ITALIC style.
This class defines wrappers only for font properties because a font has 3 parts: family, style and size and maybe some of them it is wanted to be customized. For colors and images there is no need of defining wrappers because they may be directly obtained in the function getDynamicalCalendarSkinProperty(calendarSkin, calendarProperty) based on the calendarComponent or Look and Feel colors.
If it is wanted to be dynamically obtained only the fonts then it should be used directly this class. If it is wanted to be dynamically obtained also the colors and/or the background image it should be created a class which extends the CalendarSkinStyleAdapter class and reimplement the getDynamicalCalendarSkinProperty(calendarSkin, calendarProperty). The reimplementation of this function should start with calling super.getDynamicalCalendarSkinProperty(calendarSkin, calendarProperty).


Field Summary
static CalendarProperty CELL_FONT_WRAPPER
           
static CalendarProperty EXTRA_MONTH_CELL_FONT_WRAPPER
           
static CalendarProperty HEADER_FONT_WRAPPER
           
static CalendarProperty STATUS_PANEL_FONT_WRAPPER
           
static CalendarProperty WEEK_FONT_WRAPPER
           
static CalendarProperty WEEKEND_CELL_FONT_WRAPPER
           
 
Constructor Summary
CalendarSkinStyleAdapter()
          Constructor for the CalendarSkinStyleAdapter object.
 
Method Summary
 void applyStyle(CalendarSkin calendarSkin)
          Applies this style on the specified skin.
 java.lang.Object getDynamicalCalendarSkinProperty(CalendarSkin calendarSkin, CalendarProperty calendarProperty)
          This function will be called from CalendarSkin class every time when a value for a CalendarSkin property is not found in the CalendarSkin.
 FontWrapper getFontWrapperForSkinFontProperty(CalendarProperty calendarSkinFontProperty)
          Get the FontWrapper object associated with the specified calendar skin font property.
 FontWrapper getFontWrapperProperty(CalendarProperty calendarProperty)
          Get the value of the specified property as a FontWrapper object.
 CalendarProperty getFontWrapperPropertyForSkinFontProperty(CalendarProperty calendarSkinFontProperty)
          Get the font wrapper property which have associated the specified calendar skin font property.
 java.lang.String getName()
          Get the name of the style.
 java.lang.Object getProperty(CalendarProperty calendarProperty)
          Get the value for the specified property.
 void setName(java.lang.String name)
          Set the name of the style.
 void setProperty(CalendarProperty calendarProperty, java.lang.Object value)
          Set the value for the specified property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CELL_FONT_WRAPPER

public static final CalendarProperty CELL_FONT_WRAPPER

WEEKEND_CELL_FONT_WRAPPER

public static final CalendarProperty WEEKEND_CELL_FONT_WRAPPER

EXTRA_MONTH_CELL_FONT_WRAPPER

public static final CalendarProperty EXTRA_MONTH_CELL_FONT_WRAPPER

HEADER_FONT_WRAPPER

public static final CalendarProperty HEADER_FONT_WRAPPER

WEEK_FONT_WRAPPER

public static final CalendarProperty WEEK_FONT_WRAPPER

STATUS_PANEL_FONT_WRAPPER

public static final CalendarProperty STATUS_PANEL_FONT_WRAPPER
Constructor Detail

CalendarSkinStyleAdapter

public CalendarSkinStyleAdapter()
Constructor for the CalendarSkinStyleAdapter object.

Method Detail

getProperty

public java.lang.Object getProperty(CalendarProperty calendarProperty)
Get the value for the specified property. The property may be one of the properties defined in CalendarSkin class and also one of the propertiues defined in CalendarSkinStyleAdapter class.

Parameters:
calendarProperty - The property for which it is wanted to be obtained the value.
Returns:
the value for the specified property.

getFontWrapperProperty

public FontWrapper getFontWrapperProperty(CalendarProperty calendarProperty)
Get the value of the specified property as a FontWrapper object. This is an alias of the getProperty function and returns directly the type of this property without forcing the user to cast the return type to the proper type.

Parameters:
calendarProperty - The property for which the value must be returned.
Returns:
The value for the specified property.

getFontWrapperForSkinFontProperty

public FontWrapper getFontWrapperForSkinFontProperty(CalendarProperty calendarSkinFontProperty)
Get the FontWrapper object associated with the specified calendar skin font property.

Parameters:
calendarSkinFontProperty - The property for which must be returned the FontWrapper associated.
Returns:
The FontWrapper object associated with the specified calendar skin font property.

getFontWrapperPropertyForSkinFontProperty

public CalendarProperty getFontWrapperPropertyForSkinFontProperty(CalendarProperty calendarSkinFontProperty)
Get the font wrapper property which have associated the specified calendar skin font property.

Parameters:
calendarSkinFontProperty - The calendar skin font property for which it must be returned the font wrapper property associated.
Returns:
the font wrapper property which have associated the specified calendar skin font property.

setProperty

public void setProperty(CalendarProperty calendarProperty,
                        java.lang.Object value)
Set the value for the specified property. The property may be one of the properties defined in CalendarSkin class and also one of the propertiues defined in CalendarSkinStyleAdapter class.

Parameters:
calendarProperty - The property for which it is wanted to be set the value.
value - The new value for property.

applyStyle

public void applyStyle(CalendarSkin calendarSkin)
                throws CalendarPropertyException
Applies this style on the specified skin.

Parameters:
calendarSkin - The calendarSkin on which the style is applied.
Throws:
CalendarPropertyException

getDynamicalCalendarSkinProperty

public java.lang.Object getDynamicalCalendarSkinProperty(CalendarSkin calendarSkin,
                                                         CalendarProperty calendarProperty)
This function will be called from CalendarSkin class every time when a value for a CalendarSkin property is not found in the CalendarSkin. The CalendarSkinStyle may return through this function dynamic values for some skin properties. For example if it is wanted for the cell font to always be synchronized with the font of the application then the cell font may be obtained dynamically through this function and the value ca be based on the CalendarComponent font.
Also using this function the colors of the skin may be based on the color of the component or on the colors of the current Look and Feel.

Parameters:
calendarSkin - The calendarSkin object associated
calendarProperty - The CalendarProperty for which it is wanted to be obtained the value.
Returns:
The value for the specified calendarProperty.

getName

public java.lang.String getName()
Get the name of the style.

Returns:
The name of the style.

setName

public void setName(java.lang.String name)
Set the name of the style.

Parameters:
name - The name of the style.

Calendar Component v5.1
www.calendarcomponent.com