Class Day
- java.lang.Object
-
- org.eclipse.swt.widgets.Widget
-
- org.eclipse.swt.widgets.Control
-
- org.eclipse.swt.widgets.Scrollable
-
- org.eclipse.swt.widgets.Composite
-
- org.eclipse.swt.widgets.Canvas
-
- org.eclipse.nebula.widgets.compositetable.month.internal.Day
-
- All Implemented Interfaces:
java.util.EventListener
,org.eclipse.swt.events.DisposeListener
,org.eclipse.swt.events.PaintListener
,org.eclipse.swt.graphics.Drawable
,org.eclipse.swt.internal.SWTEventListener
public class Day extends org.eclipse.swt.widgets.Canvas implements org.eclipse.swt.events.PaintListener, org.eclipse.swt.events.DisposeListener
An SWT custom control representing a single day in a month-mode calendar.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
_SIZE_MULTIPLIER
private org.eclipse.swt.graphics.Color
CELL_BACKGROUND_LIGHT
private CalendarableItem[]
controls
private org.eclipse.swt.graphics.Color
CURRENT_MONTH
private java.util.Date
date
private org.eclipse.swt.widgets.Label
dayNumber
static int
FOCUS
private static int
FOCUS_LINE_WIDTH
private org.eclipse.swt.graphics.Color
FOCUS_RUBBERBAND
private org.eclipse.swt.events.FocusListener
focusListener
When we gain/lose focus, redraw ourselves appropriatelyprivate int
focusState
private boolean
inCurrentMonth
private org.eclipse.swt.events.KeyListener
keyListener
private org.eclipse.swt.graphics.Point
monthPosition
private org.eclipse.swt.events.MouseListener
mouseListener
private java.util.LinkedList<org.eclipse.swt.events.MouseListener>
mouseListeners
static int
NO_FOCUS
static int
NONACTIVE_FOCUS
private org.eclipse.swt.graphics.Color
NONACTIVE_FOCUS_RUBBERBAND
private org.eclipse.swt.graphics.Color
OTHER_MONTH
private org.eclipse.swt.widgets.Label
spacer
private org.eclipse.swt.graphics.Point
textBounds
private org.eclipse.swt.events.TraverseListener
traverseListener
Permit focus events via keyboard.
-
Constructor Summary
Constructors Constructor Description Day(org.eclipse.swt.widgets.Composite parent, int style)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMouseListener(org.eclipse.swt.events.MouseListener listener)
org.eclipse.swt.graphics.Point
computeSize(int wHint, int hHint, boolean changed)
private org.eclipse.swt.graphics.Color
getBackgroundTakingIntoAccountIfWeAreInTheCurrentMonth(boolean focused)
java.util.Date
getDate()
Returns the Date represented by this Day.int
getDayNumber()
int
getFocusState()
org.eclipse.swt.graphics.Point
getMonthPosition()
private void
initialize()
private org.eclipse.swt.graphics.RGB
lighten(org.eclipse.swt.graphics.RGB color, float amount)
void
paintControl(org.eclipse.swt.events.PaintEvent e)
void
removeMouseListener(org.eclipse.swt.events.MouseListener listener)
private void
resetAllBackgrounds(org.eclipse.swt.widgets.Composite composite, org.eclipse.swt.graphics.Color color)
private org.eclipse.swt.graphics.RGB
saturate(org.eclipse.swt.graphics.RGB color, float saturation)
Sets the color's saturation to the specified value.void
setDate(java.util.Date date)
Sets the Date represented by this Day.void
setDayNumber(int dayNum)
void
setFocusState(int focusState)
void
setInCurrentMonth(boolean inCurrentMonth)
void
setItems(CalendarableItem[] controls)
void
setMonthPosition(org.eclipse.swt.graphics.Point monthPosition)
void
widgetDisposed(org.eclipse.swt.events.DisposeEvent e)
-
Methods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
-
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
-
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
-
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isAutoScalable, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
-
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
-
-
-
-
Field Detail
-
FOCUS_RUBBERBAND
private final org.eclipse.swt.graphics.Color FOCUS_RUBBERBAND
-
NONACTIVE_FOCUS_RUBBERBAND
private final org.eclipse.swt.graphics.Color NONACTIVE_FOCUS_RUBBERBAND
-
CURRENT_MONTH
private org.eclipse.swt.graphics.Color CURRENT_MONTH
-
OTHER_MONTH
private org.eclipse.swt.graphics.Color OTHER_MONTH
-
CELL_BACKGROUND_LIGHT
private org.eclipse.swt.graphics.Color CELL_BACKGROUND_LIGHT
-
FOCUS_LINE_WIDTH
private static final int FOCUS_LINE_WIDTH
- See Also:
- Constant Field Values
-
NONACTIVE_FOCUS
public static final int NONACTIVE_FOCUS
- See Also:
- Constant Field Values
-
FOCUS
public static final int FOCUS
- See Also:
- Constant Field Values
-
NO_FOCUS
public static final int NO_FOCUS
- See Also:
- Constant Field Values
-
focusState
private int focusState
-
_SIZE_MULTIPLIER
private static final int _SIZE_MULTIPLIER
- See Also:
- Constant Field Values
-
dayNumber
private org.eclipse.swt.widgets.Label dayNumber
-
spacer
private org.eclipse.swt.widgets.Label spacer
-
textBounds
private org.eclipse.swt.graphics.Point textBounds
-
monthPosition
private org.eclipse.swt.graphics.Point monthPosition
-
mouseListeners
private java.util.LinkedList<org.eclipse.swt.events.MouseListener> mouseListeners
-
mouseListener
private org.eclipse.swt.events.MouseListener mouseListener
-
keyListener
private org.eclipse.swt.events.KeyListener keyListener
-
traverseListener
private org.eclipse.swt.events.TraverseListener traverseListener
Permit focus events via keyboard.
-
focusListener
private org.eclipse.swt.events.FocusListener focusListener
When we gain/lose focus, redraw ourselves appropriately
-
inCurrentMonth
private boolean inCurrentMonth
-
controls
private CalendarableItem[] controls
-
date
private java.util.Date date
-
-
Method Detail
-
saturate
private org.eclipse.swt.graphics.RGB saturate(org.eclipse.swt.graphics.RGB color, float saturation)
Sets the color's saturation to the specified value.- Parameters:
color
- The RGB of the colorsaturation
- the new saturation (between 0 and 1)- Returns:
- a Color that is saturated by the specified amount
-
lighten
private org.eclipse.swt.graphics.RGB lighten(org.eclipse.swt.graphics.RGB color, float amount)
- Parameters:
color
- The RGB of the coloramount
- The amount to lighten as a percentage expresssed as a float between -1 and 1.- Returns:
- The new RGB that is lightened by the specified amount
-
widgetDisposed
public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e)
- Specified by:
widgetDisposed
in interfaceorg.eclipse.swt.events.DisposeListener
-
initialize
private void initialize()
-
computeSize
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
- Overrides:
computeSize
in classorg.eclipse.swt.widgets.Control
-
getMonthPosition
public org.eclipse.swt.graphics.Point getMonthPosition()
- Returns:
- The (day, week) of this day in the month.
-
setMonthPosition
public void setMonthPosition(org.eclipse.swt.graphics.Point monthPosition)
- Parameters:
monthPosition
- The (day, week) of this day in the month.
-
getDayNumber
public int getDayNumber()
- Returns:
- The day's number
-
setDayNumber
public void setDayNumber(int dayNum)
- Parameters:
dayNum
- the day number to set
-
paintControl
public void paintControl(org.eclipse.swt.events.PaintEvent e)
- Specified by:
paintControl
in interfaceorg.eclipse.swt.events.PaintListener
-
addMouseListener
public void addMouseListener(org.eclipse.swt.events.MouseListener listener)
- Overrides:
addMouseListener
in classorg.eclipse.swt.widgets.Control
-
removeMouseListener
public void removeMouseListener(org.eclipse.swt.events.MouseListener listener)
- Overrides:
removeMouseListener
in classorg.eclipse.swt.widgets.Control
-
resetAllBackgrounds
private void resetAllBackgrounds(org.eclipse.swt.widgets.Composite composite, org.eclipse.swt.graphics.Color color)
-
getBackgroundTakingIntoAccountIfWeAreInTheCurrentMonth
private org.eclipse.swt.graphics.Color getBackgroundTakingIntoAccountIfWeAreInTheCurrentMonth(boolean focused)
-
setInCurrentMonth
public void setInCurrentMonth(boolean inCurrentMonth)
- Parameters:
inCurrentMonth
-
-
setItems
public void setItems(CalendarableItem[] controls)
- Parameters:
controls
-
-
setDate
public void setDate(java.util.Date date)
Sets the Date represented by this Day.- Parameters:
date
- The date to set
-
getDate
public java.util.Date getDate()
Returns the Date represented by this Day.- Returns:
- This Day's date
-
getFocusState
public int getFocusState()
-
setFocusState
public void setFocusState(int focusState)
-
-