Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[nebula-dev] MonthCalendarSnippet question CompositeTable / WeekHeader incorrect

Hi Folks,

I just a question about the MonthCalendarSnippet for CompositeTable... it seems that the week header is inconsistent with the day of the week? For example it shows today (Friday) as a Thursday. Its just one day out.

For example, if you add a mouse listener to the snippet with something like this, is shows the day so you can compare.

            public void mouseDown(MouseEvent e) {
                Date date = getDay(e).getDate();
                System.out.println(DateFormat.getDateInstance(DateFormat.FULL).format(date));
            }

I'm not sure if there is any programatic way to change this, but I did a quick patch to just change the labels of the WeekHeader class (see attached), is that all there is to it or is there more subtly lurking in the code?

Whilst I'm here, does anyone know how to set the selected day in the calendar, that is to update the widgit to visually show todays date for example as a different colour?

Thanks in advance
--
Toby
### Eclipse Workspace Patch 1.0
#P org.eclipse.swt.nebula.widgets
Index: src/org/eclipse/swt/nebula/widgets/compositetable/month/internal/WeekHeader.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.swt.nebula/org.eclipse.swt.nebula.widgets/src/org/eclipse/swt/nebula/widgets/compositetable/month/internal/WeekHeader.java,v
retrieving revision 1.1
diff -u -r1.1 WeekHeader.java
--- src/org/eclipse/swt/nebula/widgets/compositetable/month/internal/WeekHeader.java	21 Oct 2006 05:55:38 -0000	1.1
+++ src/org/eclipse/swt/nebula/widgets/compositetable/month/internal/WeekHeader.java	25 Jan 2008 20:59:31 -0000
@@ -70,43 +70,31 @@
 		label = new Label(this, SWT.CENTER);
 		label.setBounds(new org.eclipse.swt.graphics.Rectangle(23, 18, 53, 18));
 		label.setLayoutData(gridData6);
-		label.setText("Sunday");
+		label.setText("Monday");
 		label1 = new Label(this, SWT.CENTER);
-		label1
-				.setBounds(new org.eclipse.swt.graphics.Rectangle(98, 18, 79,
-						17));
+		label1.setBounds(new org.eclipse.swt.graphics.Rectangle(98, 18, 79, 17));
 		label1.setLayoutData(gridData5);
-		label1.setText("Monday");
+		label1.setText("Tuesday");
 		label2 = new Label(this, SWT.CENTER);
-		label2
-				.setBounds(new org.eclipse.swt.graphics.Rectangle(187, 18, 47,
-						17));
+		label2.setBounds(new org.eclipse.swt.graphics.Rectangle(187, 18, 47, 17));
 		label2.setLayoutData(gridData4);
-		label2.setText("Tuesday");
+		label2.setText("Wednesday");
 		label3 = new Label(this, SWT.CENTER);
-		label3
-				.setBounds(new org.eclipse.swt.graphics.Rectangle(256, 17, 67,
-						17));
+		label3.setBounds(new org.eclipse.swt.graphics.Rectangle(256, 17, 67, 17));
 		label3.setLayoutData(gridData3);
-		label3.setText("Wednesday");
+		label3.setText("Thursday");
 		label4 = new Label(this, SWT.CENTER);
-		label4
-				.setBounds(new org.eclipse.swt.graphics.Rectangle(338, 17, 62,
-						20));
+		label4.setBounds(new org.eclipse.swt.graphics.Rectangle(338, 17, 62, 20));
 		label4.setLayoutData(gridData2);
-		label4.setText("Thursday");
+		label4.setText("Friday");
 		label5 = new Label(this, SWT.CENTER);
-		label5
-				.setBounds(new org.eclipse.swt.graphics.Rectangle(415, 16, 43,
-						21));
+		label5.setBounds(new org.eclipse.swt.graphics.Rectangle(415, 16, 43, 21));
 		label5.setLayoutData(gridData1);
-		label5.setText("Friday");
+		label5.setText("Saturday");
 		label6 = new Label(this, SWT.CENTER);
-		label6
-				.setBounds(new org.eclipse.swt.graphics.Rectangle(469, 16, 61,
-						23));
+		label6.setBounds(new org.eclipse.swt.graphics.Rectangle(469, 16, 61, 23));
 		label6.setLayoutData(gridData);
-		label6.setText("Saturday");
+		label6.setText("Sunday");
 
 	}
 

Back to the top