Hi,
I am using DatePickerCombo. I needed some
changes/enhancements. There are also some bug fixes.
You can find the result of my work in this request.
In the attachement you can find the changed source files.
Summary of the changes (marked with ++pr):
DatePicker.java:
----------------
++pr 1
The colors of the todayLabel are not optimal. In my
configuration the foreground color is black and the
background color ist dark-blue. It is hard to read the
text. I introduced a new color variable:
todayLabelForegroundColor
++pr 2
When DatePickerStyle SINGLE_CLICK_SELECTION ist set
and the today-button is selected, my expectation is
that the today date should be accepted and transferred
into the text field. I made a change in the selection
listener of the today-button for this new behaviour.
++pr 5
When the month-button is pressed forward an backward,
then the focusedLabel is no longer highlighted. I
extracted the code for un-highlighting and highliting
of the focusedLabel into separate methods
(unHighliteFocusedLabel and highliteFocusedLabel) and
I inserted a call of highliteFocusedLabel into method
updateCalendar.
++pr 6
It is possible that the focusedLabel or selectedLabel
is placed on a day that remains from last month when
next-month button is pressed (or on a day from next
month, when prev-month is pressed). e.g. set focus to
1.Aug.2006, then press next-month -> 29.Aug.2006 is
focused (should be 1.Sept.2006), then press CR ->
1.Aug.2006 is selected into the text field.
++pr 7
I found that some comparisons were made against the
data field of a GLabels object that was in the last or
in the next month. I added setData calls into the loops
for the last and the next month in the updateCalendar
method.
++pr 8
I find it a little bit confusing that there a 3 days
that can be in a selected state: focusLabel, todayLabel
and selectedLabel. There can be a situation where all
these three days are in one month. How does the user
know which date will be transferred into the text field
? He has to know that the gray label ist the
focusLabel. I think that as long as the assignment
between the color and the meaning of a highlighted
label is not clear, then it is better to highlight not
all special days, only the focusLabel. Another argument
for not showing the selectedLabel is that the selected
date is visible in the text field. I added 2
DatePickerStyle Parameters:
DO_NOT_HIGHLITE_TODAY
DO_NOT_HIGHLITE_SELECTED
DatePickerCombo.java:
---------------------
++pr 3
The preferred size of the DatePickerCombo is too
small. e.g. When you place the DatePickerCombo into a
Composite with a GridLayout, the text field has space
for only 1 character. I changed the computeSize method
of the DatePickerCombo. Here I calculate the size of a
dummy date, formatted with the current date-format. The
textWidth variable is then set to this size.
++pr 4
It is not possible to create a DatePickerCombo with
month-buttons, when no other dpStyle parameter is
spezified. When the DatePickerCombo is constructed
without a dpStyle parameter, then dpStyle defaults to
0. This leads to a call of
createPopup(DatePickerStyle.DISABLE_MONTH_BUTTONS). I
have not found a style ENABLE_MONTH_BUTTONS to explicit
enable month-buttons. I changed the call
createPopup(DatePickerStyle.DISABLE_MONTH_BUTTONS) to
createPopup(0). The default style of the combo is now
with month-buttons.
DatePicker source files