Class DateChooserTheme
java.lang.Object
org.eclipse.nebula.widgets.datechooser.DateChooserTheme
public class DateChooserTheme
extends java.lang.Object
Theme for
DateChooser widgets. Defines the GUI settings
(colors, font...) applied to the different elements of the calendar.
Some default themes are provided as constants of this class. The GRAY theme
is defined as the default for all new calendars. This can be changed with
the setDefaultTheme() method.
To define a new theme, instantiate a new DateChooserTheme. It
takes by default the same settings as the GRAY theme. Each setting can then
be changed by the corresponding setter. For colors, setters exist under 2
forms:
- A setter taking a
Colorparameter - A setter taking an
intparameter, corresponding to the SWT colors code
-
Field Summary
Fields Modifier and Type Field Description static DateChooserThemeBLUEBLUE theme(package private) org.eclipse.swt.graphics.ColorborderBackgroundColor for the border(package private) intborderSizeBorder size in pixels (default 0)(package private) intcellPaddingHorizontal cell paddingstatic DateChooserThemeCLASSICCLASSIC theme(package private) org.eclipse.swt.graphics.ColordayCellBackgroundColor for day cells background(package private) org.eclipse.swt.graphics.ColordayCellForegroundColor for worked days cells foregroundprotected static DateChooserThemedefaultThemeDefault theme(package private) org.eclipse.swt.graphics.ColorextraMonthForegroundColor for adjacent days foreground(package private) org.eclipse.swt.graphics.ColorfocusColorColor for focus box(package private) org.eclipse.swt.graphics.FontfontFontstatic DateChooserThemeGRAYGRAY theme.(package private) org.eclipse.swt.graphics.ColorgridHeaderBackgroundColor for grid days headers background(package private) org.eclipse.swt.graphics.ColorgridHeaderForegroundColor for grid days headers foreground(package private) org.eclipse.swt.graphics.ColorgridLinesColorColor for grid lines(package private) intgridVisibleFlag to set grid visible or not(package private) org.eclipse.swt.graphics.ColorheaderBackgroundColor for month header background(package private) org.eclipse.swt.graphics.ColorheaderForegroundColor for month header foreground(package private) org.eclipse.swt.graphics.ColorselectedBackgroundColor for selected cell background(package private) org.eclipse.swt.graphics.ColorselectedForegroundColor for selected cell foregroundstatic DateChooserThemeSYSTEMSYSTEM theme(package private) org.eclipse.swt.graphics.ColortodayBackgroundColor for today cell background(package private) org.eclipse.swt.graphics.ColortodayForegroundColor for today cell foreground(package private) org.eclipse.swt.graphics.ColorweekendForegroundColor for week end foregroundstatic DateChooserThemeYELLOWYELLOW theme -
Constructor Summary
Constructors Constructor Description DateChooserTheme()Constructs a new instance of this class. -
Method Summary
Modifier and Type Method Description voidclearAllCustom()Clear all custom colors/tooltips/state for all daysvoidclearCustomColors()Clear all custom color for all daysvoidclearCustomStates()Clear all custom enabled state for all daysvoidclearCustomTooltips()Clear all custom tootlips for all daysjava.lang.Objectclone()org.eclipse.swt.graphics.ColorgetCustomColor(java.util.Date date)Change the background color of a day
Use null to change the color of all daysbooleangetCustomState(java.util.Date date)java.lang.StringgetCustomTootlip(java.util.Date date)Change the background color of a day
Use null to change the color of all daysstatic DateChooserThemegetDefaultTheme()Returns the default theme.voidsetAdjascentForeground(int extraMonthForeground)voidsetBorderBackground(org.eclipse.swt.graphics.Color borderBackground)voidsetBorderSize(int borderSize)voidsetCellPadding(int cellPadding)voidsetCustom(java.util.Date date, java.lang.String tootlip, org.eclipse.swt.graphics.Color color, boolean enabled)voidsetCustomColor(java.util.Date date, org.eclipse.swt.graphics.Color color)Change the background color of a day.voidsetCustomState(java.util.Date date, boolean enabled)Change the enabled state of a day
A disabled day can not be selected
Use null to change the enabled state of all days
Warning this method will not redraw the control each time it is called, call it manually aftervoidsetCustomTooltip(java.util.Date date, java.lang.String tootlip)Change the background color of a day.voidsetDayCellBackground(int dayCellBackground)voidsetDayCellBackground(org.eclipse.swt.graphics.Color dayCellBackground)voidsetDayCellForeground(int dayCellForeground)voidsetDayCellForeground(org.eclipse.swt.graphics.Color dayCellForeground)static voidsetDefaultTheme(DateChooserTheme defaultTheme)Sets a new default theme for all newDateChooserwidgets.voidsetExtraMonthForeground(org.eclipse.swt.graphics.Color extraMonthForeground)voidsetFocusColor(int focusColor)voidsetFocusColor(org.eclipse.swt.graphics.Color focusColor)voidsetFont(org.eclipse.swt.graphics.Font font)voidsetGridHeaderBackground(int gridHeaderBackground)voidsetGridHeaderBackground(org.eclipse.swt.graphics.Color gridHeaderBackground)voidsetGridHeaderForeground(int gridHeaderForeground)voidsetGridHeaderForeground(org.eclipse.swt.graphics.Color gridHeaderForeground)voidsetGridLinesColor(int gridLinesColor)voidsetGridLinesColor(org.eclipse.swt.graphics.Color gridLinesColor)voidsetGridVisible(boolean gridVisible)Deprecated.voidsetGridVisible(int gridVisible)voidsetHeaderBack(int headerBackground)voidsetHeaderBack(org.eclipse.swt.graphics.Color headerBackground)voidsetHeaderForg(int headerForeground)voidsetHeaderForg(org.eclipse.swt.graphics.Color headerForeground)voidsetSelectedBackground(int selectedBackground)voidsetSelectedBackground(org.eclipse.swt.graphics.Color selectedBackground)voidsetSelectedForeground(int selectedForeground)voidsetSelectedForeground(org.eclipse.swt.graphics.Color selectedForeground)voidsetTodayBackground(int todayBackground)voidsetTodayBackground(org.eclipse.swt.graphics.Color todayBackground)voidsetTodayForeground(int todayForeground)voidsetTodayForeground(org.eclipse.swt.graphics.Color todayForeground)voidsetWeekendForeground(int weekendForeground)voidsetWeekendForeground(org.eclipse.swt.graphics.Color weekendForeground)
-
Field Details
-
GRAY
GRAY theme. Default -
BLUE
BLUE theme -
YELLOW
YELLOW theme -
CLASSIC
CLASSIC theme -
SYSTEM
SYSTEM theme -
defaultTheme
Default theme -
borderBackground
org.eclipse.swt.graphics.Color borderBackgroundColor for the border -
headerBackground
org.eclipse.swt.graphics.Color headerBackgroundColor for month header background -
headerForeground
org.eclipse.swt.graphics.Color headerForegroundColor for month header foreground -
gridHeaderBackground
org.eclipse.swt.graphics.Color gridHeaderBackgroundColor for grid days headers background -
gridHeaderForeground
org.eclipse.swt.graphics.Color gridHeaderForegroundColor for grid days headers foreground -
gridLinesColor
org.eclipse.swt.graphics.Color gridLinesColorColor for grid lines -
dayCellBackground
org.eclipse.swt.graphics.Color dayCellBackgroundColor for day cells background -
dayCellForeground
org.eclipse.swt.graphics.Color dayCellForegroundColor for worked days cells foreground -
selectedBackground
org.eclipse.swt.graphics.Color selectedBackgroundColor for selected cell background -
selectedForeground
org.eclipse.swt.graphics.Color selectedForegroundColor for selected cell foreground -
todayBackground
org.eclipse.swt.graphics.Color todayBackgroundColor for today cell background -
todayForeground
org.eclipse.swt.graphics.Color todayForegroundColor for today cell foreground -
extraMonthForeground
org.eclipse.swt.graphics.Color extraMonthForegroundColor for adjacent days foreground -
weekendForeground
org.eclipse.swt.graphics.Color weekendForegroundColor for week end foreground -
focusColor
org.eclipse.swt.graphics.Color focusColorColor for focus box -
borderSize
int borderSizeBorder size in pixels (default 0) -
gridVisible
int gridVisibleFlag to set grid visible or not -
cellPadding
int cellPaddingHorizontal cell padding -
font
org.eclipse.swt.graphics.Font fontFont
-
-
Constructor Details
-
DateChooserTheme
public DateChooserTheme()Constructs a new instance of this class. All colors elements are initialized with the default GRAY theme.
-
-
Method Details
-
getDefaultTheme
Returns the default theme.- Returns:
- default theme
-
setDefaultTheme
Sets a new default theme for all newDateChooserwidgets.- Parameters:
defaultTheme- new default theme
-
setBorderBackground
public void setBorderBackground(org.eclipse.swt.graphics.Color borderBackground) -
setBorderSize
public void setBorderSize(int borderSize) -
setDayCellBackground
public void setDayCellBackground(org.eclipse.swt.graphics.Color dayCellBackground) -
setDayCellBackground
public void setDayCellBackground(int dayCellBackground) -
setDayCellForeground
public void setDayCellForeground(org.eclipse.swt.graphics.Color dayCellForeground) -
setDayCellForeground
public void setDayCellForeground(int dayCellForeground) -
setGridHeaderBackground
public void setGridHeaderBackground(org.eclipse.swt.graphics.Color gridHeaderBackground) -
setGridHeaderBackground
public void setGridHeaderBackground(int gridHeaderBackground) -
setGridHeaderForeground
public void setGridHeaderForeground(org.eclipse.swt.graphics.Color gridHeaderForeground) -
setGridHeaderForeground
public void setGridHeaderForeground(int gridHeaderForeground) -
setGridLinesColor
public void setGridLinesColor(org.eclipse.swt.graphics.Color gridLinesColor) -
setGridLinesColor
public void setGridLinesColor(int gridLinesColor) -
setHeaderBack
public void setHeaderBack(org.eclipse.swt.graphics.Color headerBackground) -
setHeaderBack
public void setHeaderBack(int headerBackground) -
setHeaderForg
public void setHeaderForg(org.eclipse.swt.graphics.Color headerForeground) -
setHeaderForg
public void setHeaderForg(int headerForeground) -
setSelectedBackground
public void setSelectedBackground(org.eclipse.swt.graphics.Color selectedBackground) -
setSelectedBackground
public void setSelectedBackground(int selectedBackground) -
setSelectedForeground
public void setSelectedForeground(org.eclipse.swt.graphics.Color selectedForeground) -
setSelectedForeground
public void setSelectedForeground(int selectedForeground) -
setTodayBackground
public void setTodayBackground(org.eclipse.swt.graphics.Color todayBackground) -
setTodayBackground
public void setTodayBackground(int todayBackground) -
setTodayForeground
public void setTodayForeground(org.eclipse.swt.graphics.Color todayForeground) -
setTodayForeground
public void setTodayForeground(int todayForeground) -
setExtraMonthForeground
public void setExtraMonthForeground(org.eclipse.swt.graphics.Color extraMonthForeground) -
setAdjascentForeground
public void setAdjascentForeground(int extraMonthForeground) -
setWeekendForeground
public void setWeekendForeground(org.eclipse.swt.graphics.Color weekendForeground) -
setWeekendForeground
public void setWeekendForeground(int weekendForeground) -
setFocusColor
public void setFocusColor(org.eclipse.swt.graphics.Color focusColor) -
setFocusColor
public void setFocusColor(int focusColor) -
setGridVisible
@Deprecated public void setGridVisible(boolean gridVisible)Deprecated.Sets the grid visible or not in the calendar popup. By default, the grid is visible.- Parameters:
gridVisible-trueto set grid visible, elsefalse
-
setGridVisible
public void setGridVisible(int gridVisible) -
setCellPadding
public void setCellPadding(int cellPadding) -
setFont
public void setFont(org.eclipse.swt.graphics.Font font) -
clearCustomColors
public void clearCustomColors()Clear all custom color for all days -
clearCustomTooltips
public void clearCustomTooltips()Clear all custom tootlips for all days -
clearCustomStates
public void clearCustomStates()Clear all custom enabled state for all days -
clearAllCustom
public void clearAllCustom()Clear all custom colors/tooltips/state for all days -
getCustomState
public boolean getCustomState(java.util.Date date)- Parameters:
date- the date to ask the enabled state- Returns:
- true if the selection is possible on this date
-
setCustomState
public void setCustomState(java.util.Date date, boolean enabled)Change the enabled state of a day
A disabled day can not be selected
Use null to change the enabled state of all days
Warning this method will not redraw the control each time it is called, call it manually after- Parameters:
date- the date to change the colorenabled- the state to set on this date
-
getCustomColor
public org.eclipse.swt.graphics.Color getCustomColor(java.util.Date date)Change the background color of a day
Use null to change the color of all days- Parameters:
date-- Returns:
- a color or null if no color was found for this date
-
setCustomColor
public void setCustomColor(java.util.Date date, org.eclipse.swt.graphics.Color color)Change the background color of a day.
Use null background to change the color of all days
this method will not redraw the control each time it is called, you have to redraw the control manually after setting colors.- Parameters:
date- the date to change the color, or null for all datescolor- the color to set on this date
-
getCustomTootlip
public java.lang.String getCustomTootlip(java.util.Date date)Change the background color of a day
Use null to change the color of all days- Parameters:
date-- Returns:
- a color or null if no color was found for this date
-
setCustomTooltip
public void setCustomTooltip(java.util.Date date, java.lang.String tootlip)Change the background color of a day.
Use null background to change the color of all days
this method will not redraw the control each time it is called, you have to redraw the control manually after setting colors.- Parameters:
date- the date to change the color, or null for all datestootlip- the tooltip to set on this date
-
setCustom
public void setCustom(java.util.Date date, java.lang.String tootlip, org.eclipse.swt.graphics.Color color, boolean enabled) -
clone
public java.lang.Object clone()- Overrides:
clonein classjava.lang.Object
-