aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBertin Kiekebosch2013-06-10 06:08:02 (EDT)
committerJudith Gull2013-06-10 06:12:58 (EDT)
commit8cd75cf5823a44b5aa20a1bac9b2672b8fecd4eb (patch)
tree5f5835b459e8ebd82b2e5b0c641afe26e965d487
parentf8fdf8bd1a3519e92a787d039d7596edadf2e9a2 (diff)
downloadorg.eclipse.scout.rt-8cd75cf5823a44b5aa20a1bac9b2672b8fecd4eb.zip
org.eclipse.scout.rt-8cd75cf5823a44b5aa20a1bac9b2672b8fecd4eb.tar.gz
org.eclipse.scout.rt-8cd75cf5823a44b5aa20a1bac9b2672b8fecd4eb.tar.bz2
Bug 388722 - Calendar field improvementsrefs/changes/87/13687/2
Fixes Swing mark noon hour and useOverflowCells & extract to a new method Fixes Swt CalendarItemContainer Change-Id: I4a9c237ecc4e53c717a1b2627458ad78fea625a3 Reviewed-on: https://git.eclipse.org/r/13687 Reviewed-by: Judith Gull <jgu@bsiag.com> IP-Clean: Judith Gull <jgu@bsiag.com> Tested-by: Judith Gull <jgu@bsiag.com>
-rw-r--r--org.eclipse.scout.rt.ui.swing/src/org/eclipse/scout/rt/ui/swing/ext/calendar/LargeCalendarCell.java43
-rw-r--r--org.eclipse.scout.rt.ui.swt/src/org/eclipse/scout/rt/ui/swt/basic/calendar/CalendarItemContainer.java2
2 files changed, 25 insertions, 20 deletions
diff --git a/org.eclipse.scout.rt.ui.swing/src/org/eclipse/scout/rt/ui/swing/ext/calendar/LargeCalendarCell.java b/org.eclipse.scout.rt.ui.swing/src/org/eclipse/scout/rt/ui/swing/ext/calendar/LargeCalendarCell.java
index 1db3e11..3c631c3 100644
--- a/org.eclipse.scout.rt.ui.swing/src/org/eclipse/scout/rt/ui/swing/ext/calendar/LargeCalendarCell.java
+++ b/org.eclipse.scout.rt.ui.swing/src/org/eclipse/scout/rt/ui/swing/ext/calendar/LargeCalendarCell.java
@@ -410,7 +410,7 @@ public class LargeCalendarCell extends AbstractCalendarCell {
for (int hour = m_startHour; hour <= m_endHour; hour = hour + step) {
int y = timedView.y + (hour - m_startHour) * (timedView.height) / (m_endHour + 1 - m_startHour);
boolean majorHour = (hour == 12 || hour == 13);
- if (majorHour) {
+ if (majorHour && m_dateChooser.getMarkNoonHour()) {
g.setColor(darkLineCol);
}
else {
@@ -418,27 +418,12 @@ public class LargeCalendarCell extends AbstractCalendarCell {
}
g.drawLine(0, y, w, y);
if (drawLabel) {
- String s;
- if (hour == m_startHour && hour != 0) {
- s = SwingUtility.getNlsText("Calendar_earlier");
- }
- else if (hour == m_endHour && hour != 23) {
- s = SwingUtility.getNlsText("Calendar_later");
- }
- else if (hour == 0) {
- s = formatHour(0);
- }
- else if (hour < 10) {
- s = formatHour(hour);
- }
- else {
- s = formatHour(hour);
- }
+ String label = getFormattedLabel(hour);
//
g.setColor(textCol);
- g.drawString(s, 1, y + ascent);
+ g.drawString(label, 1, y + ascent);
//
- maxLabelWidth = Math.max(maxLabelWidth, fm.stringWidth(s) + 4);
+ maxLabelWidth = Math.max(maxLabelWidth, fm.stringWidth(label) + 4);
}
}
if (drawLabel) {
@@ -455,6 +440,26 @@ public class LargeCalendarCell extends AbstractCalendarCell {
return subView;
}
+ private String getFormattedLabel(int hour) {
+ String s;
+ if (hour == m_startHour && hour != 0 && m_useOverflowCells) {
+ s = SwingUtility.getNlsText("Calendar_earlier");
+ }
+ else if (hour == m_endHour && hour != 23 && m_useOverflowCells) {
+ s = SwingUtility.getNlsText("Calendar_later");
+ }
+ else if (hour == 0) {
+ s = formatHour(0);
+ }
+ else if (hour < 10) {
+ s = formatHour(hour);
+ }
+ else {
+ s = formatHour(hour);
+ }
+ return s;
+ }
+
protected void paintAfter(Graphics g) {
if (getWidth() >= SWITCH_ITEM_WIDTH && getHeight() >= SWITCH_ITEM_HEIGHT) {
//see in paintBefore
diff --git a/org.eclipse.scout.rt.ui.swt/src/org/eclipse/scout/rt/ui/swt/basic/calendar/CalendarItemContainer.java b/org.eclipse.scout.rt.ui.swt/src/org/eclipse/scout/rt/ui/swt/basic/calendar/CalendarItemContainer.java
index e2bbd51..50b7142 100644
--- a/org.eclipse.scout.rt.ui.swt/src/org/eclipse/scout/rt/ui/swt/basic/calendar/CalendarItemContainer.java
+++ b/org.eclipse.scout.rt.ui.swt/src/org/eclipse/scout/rt/ui/swt/basic/calendar/CalendarItemContainer.java
@@ -47,7 +47,7 @@ public class CalendarItemContainer implements Comparable {
//
m_fullDay = model.isFullDay(item);
//
- m_fromRelative = AbstractCell.getTimeOfDayMillis(model.getFromDate(item)) - repTimeOfDayStart - CalendarConstants.HOUR_MILLIS * CalendarConstants.DAY_TIMELINE_START_TIME;
+ m_fromRelative = AbstractCell.getTimeOfDayMillis(model.getFromDate(item)) - repTimeOfDayStart - CalendarConstants.HOUR_MILLIS * cell.getCalendar().getStartHour();
if (m_fromRelative < 0) {
m_fromRelative = 0;
}