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
Color
parameter - A setter taking an
int
parameter, corresponding to the SWT colors code
-
Field Summary
Fields Modifier and Type Field Description static DateChooserTheme
BLUE
BLUE theme(package private) org.eclipse.swt.graphics.Color
borderBackground
Color for the border(package private) int
borderSize
Border size in pixels (default 0)(package private) int
cellPadding
Horizontal cell paddingstatic DateChooserTheme
CLASSIC
CLASSIC theme(package private) org.eclipse.swt.graphics.Color
dayCellBackground
Color for day cells background(package private) org.eclipse.swt.graphics.Color
dayCellForeground
Color for worked days cells foregroundprotected static DateChooserTheme
defaultTheme
Default theme(package private) org.eclipse.swt.graphics.Color
extraMonthForeground
Color for adjacent days foreground(package private) org.eclipse.swt.graphics.Color
focusColor
Color for focus box(package private) org.eclipse.swt.graphics.Font
font
Fontstatic DateChooserTheme
GRAY
GRAY theme.(package private) org.eclipse.swt.graphics.Color
gridHeaderBackground
Color for grid days headers background(package private) org.eclipse.swt.graphics.Color
gridHeaderForeground
Color for grid days headers foreground(package private) org.eclipse.swt.graphics.Color
gridLinesColor
Color for grid lines(package private) int
gridVisible
Flag to set grid visible or not(package private) org.eclipse.swt.graphics.Color
headerBackground
Color for month header background(package private) org.eclipse.swt.graphics.Color
headerForeground
Color for month header foreground(package private) org.eclipse.swt.graphics.Color
selectedBackground
Color for selected cell background(package private) org.eclipse.swt.graphics.Color
selectedForeground
Color for selected cell foregroundstatic DateChooserTheme
SYSTEM
SYSTEM theme(package private) org.eclipse.swt.graphics.Color
todayBackground
Color for today cell background(package private) org.eclipse.swt.graphics.Color
todayForeground
Color for today cell foreground(package private) org.eclipse.swt.graphics.Color
weekendForeground
Color for week end foregroundstatic DateChooserTheme
YELLOW
YELLOW theme -
Constructor Summary
Constructors Constructor Description DateChooserTheme()
Constructs a new instance of this class. -
Method Summary
Modifier and Type Method Description void
clearAllCustom()
Clear all custom colors/tooltips/state for all daysvoid
clearCustomColors()
Clear all custom color for all daysvoid
clearCustomStates()
Clear all custom enabled state for all daysvoid
clearCustomTooltips()
Clear all custom tootlips for all daysjava.lang.Object
clone()
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 daysboolean
getCustomState(java.util.Date date)
java.lang.String
getCustomTootlip(java.util.Date date)
Change the background color of a day
Use null to change the color of all daysstatic DateChooserTheme
getDefaultTheme()
Returns the default theme.void
setAdjascentForeground(int extraMonthForeground)
void
setBorderBackground(org.eclipse.swt.graphics.Color borderBackground)
void
setBorderSize(int borderSize)
void
setCellPadding(int cellPadding)
void
setCustom(java.util.Date date, java.lang.String tootlip, org.eclipse.swt.graphics.Color color, boolean enabled)
void
setCustomColor(java.util.Date date, org.eclipse.swt.graphics.Color color)
Change the background color of a day.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 aftervoid
setCustomTooltip(java.util.Date date, java.lang.String tootlip)
Change the background color of a day.void
setDayCellBackground(int dayCellBackground)
void
setDayCellBackground(org.eclipse.swt.graphics.Color dayCellBackground)
void
setDayCellForeground(int dayCellForeground)
void
setDayCellForeground(org.eclipse.swt.graphics.Color dayCellForeground)
static void
setDefaultTheme(DateChooserTheme defaultTheme)
Sets a new default theme for all newDateChooser
widgets.void
setExtraMonthForeground(org.eclipse.swt.graphics.Color extraMonthForeground)
void
setFocusColor(int focusColor)
void
setFocusColor(org.eclipse.swt.graphics.Color focusColor)
void
setFont(org.eclipse.swt.graphics.Font font)
void
setGridHeaderBackground(int gridHeaderBackground)
void
setGridHeaderBackground(org.eclipse.swt.graphics.Color gridHeaderBackground)
void
setGridHeaderForeground(int gridHeaderForeground)
void
setGridHeaderForeground(org.eclipse.swt.graphics.Color gridHeaderForeground)
void
setGridLinesColor(int gridLinesColor)
void
setGridLinesColor(org.eclipse.swt.graphics.Color gridLinesColor)
void
setGridVisible(boolean gridVisible)
Deprecated.void
setGridVisible(int gridVisible)
void
setHeaderBack(int headerBackground)
void
setHeaderBack(org.eclipse.swt.graphics.Color headerBackground)
void
setHeaderForg(int headerForeground)
void
setHeaderForg(org.eclipse.swt.graphics.Color headerForeground)
void
setSelectedBackground(int selectedBackground)
void
setSelectedBackground(org.eclipse.swt.graphics.Color selectedBackground)
void
setSelectedForeground(int selectedForeground)
void
setSelectedForeground(org.eclipse.swt.graphics.Color selectedForeground)
void
setTodayBackground(int todayBackground)
void
setTodayBackground(org.eclipse.swt.graphics.Color todayBackground)
void
setTodayForeground(int todayForeground)
void
setTodayForeground(org.eclipse.swt.graphics.Color todayForeground)
void
setWeekendForeground(int weekendForeground)
void
setWeekendForeground(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 newDateChooser
widgets.- 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
-true
to 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:
clone
in classjava.lang.Object
-