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.DisposeListenerAn SWT custom control representing a single day in a month-mode calendar.
-
-
Field Summary
Fields Modifier and Type Field Description private static int_SIZE_MULTIPLIERprivate org.eclipse.swt.graphics.ColorCELL_BACKGROUND_LIGHTprivate CalendarableItem[]controlsprivate org.eclipse.swt.graphics.ColorCURRENT_MONTHprivate java.util.Datedateprivate org.eclipse.swt.widgets.LabeldayNumberstatic intFOCUSprivate static intFOCUS_LINE_WIDTHprivate org.eclipse.swt.graphics.ColorFOCUS_RUBBERBANDprivate org.eclipse.swt.events.FocusListenerfocusListenerWhen we gain/lose focus, redraw ourselves appropriatelyprivate intfocusStateprivate booleaninCurrentMonthprivate org.eclipse.swt.events.KeyListenerkeyListenerprivate org.eclipse.swt.graphics.PointmonthPositionprivate org.eclipse.swt.events.MouseListenermouseListenerprivate java.util.LinkedList<org.eclipse.swt.events.MouseListener>mouseListenersstatic intNO_FOCUSstatic intNONACTIVE_FOCUSprivate org.eclipse.swt.graphics.ColorNONACTIVE_FOCUS_RUBBERBANDprivate org.eclipse.swt.graphics.ColorOTHER_MONTHprivate org.eclipse.swt.widgets.Labelspacerprivate org.eclipse.swt.graphics.PointtextBoundsprivate org.eclipse.swt.events.TraverseListenertraverseListenerPermit 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 voidaddMouseListener(org.eclipse.swt.events.MouseListener listener)org.eclipse.swt.graphics.PointcomputeSize(int wHint, int hHint, boolean changed)private org.eclipse.swt.graphics.ColorgetBackgroundTakingIntoAccountIfWeAreInTheCurrentMonth(boolean focused)java.util.DategetDate()Returns the Date represented by this Day.intgetDayNumber()intgetFocusState()org.eclipse.swt.graphics.PointgetMonthPosition()private voidinitialize()private org.eclipse.swt.graphics.RGBlighten(org.eclipse.swt.graphics.RGB color, float amount)voidpaintControl(org.eclipse.swt.events.PaintEvent e)voidremoveMouseListener(org.eclipse.swt.events.MouseListener listener)private voidresetAllBackgrounds(org.eclipse.swt.widgets.Composite composite, org.eclipse.swt.graphics.Color color)private org.eclipse.swt.graphics.RGBsaturate(org.eclipse.swt.graphics.RGB color, float saturation)Sets the color's saturation to the specified value.voidsetDate(java.util.Date date)Sets the Date represented by this Day.voidsetDayNumber(int dayNum)voidsetFocusState(int focusState)voidsetInCurrentMonth(boolean inCurrentMonth)voidsetItems(CalendarableItem[] controls)voidsetMonthPosition(org.eclipse.swt.graphics.Point monthPosition)voidwidgetDisposed(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:
widgetDisposedin interfaceorg.eclipse.swt.events.DisposeListener
-
initialize
private void initialize()
-
computeSize
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)- Overrides:
computeSizein 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:
paintControlin interfaceorg.eclipse.swt.events.PaintListener
-
addMouseListener
public void addMouseListener(org.eclipse.swt.events.MouseListener listener)
- Overrides:
addMouseListenerin classorg.eclipse.swt.widgets.Control
-
removeMouseListener
public void removeMouseListener(org.eclipse.swt.events.MouseListener listener)
- Overrides:
removeMouseListenerin 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)
-
-