Class DatePicker


  • class DatePicker
    extends VPanel
    • Field Detail

      • dayListener

        private org.eclipse.swt.widgets.Listener dayListener
      • header

        private VPanel header
      • bodyPanels

        private VPanel[] bodyPanels
      • footer

        private VPanel footer
      • dayPanel

        private VPanel dayPanel
      • dayLabels

        VLabel[] dayLabels
      • todayMenuItem

        org.eclipse.swt.widgets.MenuItem todayMenuItem
      • showSelMenuItem

        org.eclipse.swt.widgets.MenuItem showSelMenuItem
      • monthItems

        org.eclipse.swt.widgets.MenuItem[] monthItems
      • yearItems

        org.eclipse.swt.widgets.MenuItem[] yearItems
      • editYear

        boolean editYear
      • scrollable

        private boolean scrollable
      • monthPanel

        VPanel monthPanel
      • monthButtons

        VButton[] monthButtons
      • yearButtons

        VButton[] yearButtons
      • sdf

        private java.text.SimpleDateFormat sdf
      • lastPattern

        private java.lang.String lastPattern
      • picker

        private VPanel picker
    • Constructor Detail

      • DatePicker

        public DatePicker​(CDateTime parent)
        Constructs a new instance of this class given its parent, a style value describing its behavior and appearance, a date to which the initial selection will be set, and the locale to use.
        Parameters:
        parent - a widget which will be the parent of the new instance (cannot be null)
    • Method Detail

      • addBodyPanel

        private void addBodyPanel()
      • adjustDays

        private void adjustDays​(int field,
                                int amount)
        Modifies the given Calendar field by the given amount for every dayButton.
        calendar.add(CalendarField, amount)
        Parameters:
        field - Calendar Field
        amount - adjustment to be added
      • createBody

        private void createBody()
        create the Calendar's body, which contains the dayLabels and dayButtons
      • createContents

        protected void createContents()
      • createDays

        private void createDays​(Body b)
      • colorButtons

        private void colorButtons​(VButton button)
      • createFooter

        private void createFooter()
        create the footer (footerButton) for the Calendar part of this CDateTime
        there is currently no footer for the Clock part - should there be? or should this footer span both parts?
      • createHeader

        private void createHeader()
        create the header for the Calendar part of this CDateTime
        there is no equivalent for the Clock part
      • createMonths

        private void createMonths​(Body b)
      • createTime

        private void createTime​(Body b)
      • createYears

        private void createYears​(Body b)
      • getFields

        public int[] getFields()
      • getFocusDayButton

        private int getFocusDayButton()
      • getFormattedDate

        private java.lang.String getFormattedDate​(java.lang.String pattern,
                                                  java.util.Date date)
      • handleHeaderSelection

        private void handleHeaderSelection​(VButton button)
      • init

        private void init​(int style)
      • scrollCalendar

        private void scrollCalendar​(int keycode)
        perform the scroll by making a call to adjustDays(int, int) with the field set to Calendar.DATE and the amount corresponding to the keycode.
      • setButtonFocus

        private void setButtonFocus​(int index)
      • setDays

        private void setDays​(java.util.Date firstDate,
                             boolean alignMonth)
        Set the date for each dayButton by starting with the given firstDate and iterating over all the dayButtons, adding 1 day to the date with each iteration.
        The date is stored in the dayButton with: setData(CDT.Key.Date, date).
        If alignMonth is true, then the actual first date used will be modified to be the first date of the visible calendar which includes the given firstDate
        Parameters:
        firstDate - the first date of the dayButtons
        alignMonth - whether or not to align the month
      • setEditable

        public void setEditable​(boolean editable)
      • setFields

        public void setFields​(int[] calendarFields)
      • setFocus

        protected boolean setFocus​(boolean focus)
        Overrides:
        setFocus in class VPanel
      • setFocusToSelection

        private boolean setFocusToSelection()
      • setMonthLabelText

        void setMonthLabelText()
      • setScrollable

        public void setScrollable​(boolean scrollable)
      • setSelectionFromButton

        private void setSelectionFromButton​(VButton button,
                                            int stateMask)
      • setSelectionFromFocusButton

        private void setSelectionFromFocusButton​(org.eclipse.swt.widgets.Event event)
      • traverseSelection

        void traverseSelection​(int keyCode)
        Traverse the selection programmatically just as a user would with the keyboard.
        Valid Keys:
        SWT.ARROW_UP, SWT.ARROW_DOWN, SWT.ARROW_LEFT, SWT.ARROW_RIGHT
        Parameters:
        keyCode - a SWT traversal keycode
        See Also:
        scrollCalendar(int)
      • updateDays

        private void updateDays()
        set / update the text and font color of the dayButtons.
      • updateDaysOfWeek

        private void updateDaysOfWeek()
        set / update the text of the displayLabels. these are the Week column headers above the days on the Calendar part of the CDateTime .
      • updateFooter

        private void updateFooter()
        set / update the text of the footerButton.
      • updateHeader

        private void updateHeader()
        set / update the text of the header - monthLabel, yearLabel, and the monthLabel context menu.
      • updateLabels

        protected void updateLabels()
      • updateLocale

        private void updateLocale()
        set / update, or calls methods to set / update, all components affected by the locale
        See Also:
        updateHeader(), #updateDayLabels, updateDays(), updateFooter()
      • updateMonths

        private void updateMonths()
      • updateView

        void updateView()
      • updateYears

        private void updateYears()
      • setCDTSelection

        private void setCDTSelection​(java.util.Date selection)
      • isValidDate

        private boolean isValidDate​(java.util.Calendar selectedDay)
      • isValidDate

        static boolean isValidDate​(java.util.Calendar selectedDay,
                                   java.util.Calendar min,
                                   java.util.Calendar max)