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 Details

    • GRAY

      public static final DateChooserTheme GRAY
      GRAY theme. Default
    • BLUE

      public static final DateChooserTheme BLUE
      BLUE theme
    • YELLOW

      public static final DateChooserTheme YELLOW
      YELLOW theme
    • CLASSIC

      public static final DateChooserTheme CLASSIC
      CLASSIC theme
    • SYSTEM

      public static final DateChooserTheme SYSTEM
      SYSTEM theme
    • defaultTheme

      protected static DateChooserTheme defaultTheme
      Default theme
    • borderBackground

      org.eclipse.swt.graphics.Color borderBackground
      Color for the border
    • headerBackground

      org.eclipse.swt.graphics.Color headerBackground
      Color for month header background
    • headerForeground

      org.eclipse.swt.graphics.Color headerForeground
      Color for month header foreground
    • gridHeaderBackground

      org.eclipse.swt.graphics.Color gridHeaderBackground
      Color for grid days headers background
    • gridHeaderForeground

      org.eclipse.swt.graphics.Color gridHeaderForeground
      Color for grid days headers foreground
    • gridLinesColor

      org.eclipse.swt.graphics.Color gridLinesColor
      Color for grid lines
    • dayCellBackground

      org.eclipse.swt.graphics.Color dayCellBackground
      Color for day cells background
    • dayCellForeground

      org.eclipse.swt.graphics.Color dayCellForeground
      Color for worked days cells foreground
    • selectedBackground

      org.eclipse.swt.graphics.Color selectedBackground
      Color for selected cell background
    • selectedForeground

      org.eclipse.swt.graphics.Color selectedForeground
      Color for selected cell foreground
    • todayBackground

      org.eclipse.swt.graphics.Color todayBackground
      Color for today cell background
    • todayForeground

      org.eclipse.swt.graphics.Color todayForeground
      Color for today cell foreground
    • extraMonthForeground

      org.eclipse.swt.graphics.Color extraMonthForeground
      Color for adjacent days foreground
    • weekendForeground

      org.eclipse.swt.graphics.Color weekendForeground
      Color for week end foreground
    • focusColor

      org.eclipse.swt.graphics.Color focusColor
      Color for focus box
    • borderSize

      int borderSize
      Border size in pixels (default 0)
    • gridVisible

      int gridVisible
      Flag to set grid visible or not
    • cellPadding

      int cellPadding
      Horizontal cell padding
    • font

      org.eclipse.swt.graphics.Font font
      Font
  • 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

      public static DateChooserTheme getDefaultTheme()
      Returns the default theme.
      Returns:
      default theme
    • setDefaultTheme

      public static void setDefaultTheme​(DateChooserTheme defaultTheme)
      Sets a new default theme for all new DateChooser 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, else false
    • 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 color
      enabled - 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 dates
      color - 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 dates
      tootlip - 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 class java.lang.Object