/[gzz]/gzz/gzz/vob/CalendarVob.java
ViewVC logotype

Diff of /gzz/gzz/vob/CalendarVob.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by mudyc, Wed Oct 30 15:07:03 2002 UTC revision 1.5 by mudyc, Thu Oct 31 17:34:06 2002 UTC
# Line 22  public static final String rcsid = "$Id$ Line 22  public static final String rcsid = "$Id$
22      static protected TextStyle style_week_numbers;      static protected TextStyle style_week_numbers;
23      static private float linewidth;      static private float linewidth;
24    
25        static private float[] scales = { 1.1f, // date
26                                          0.3f, // weekday
27                                          0.5f, // week number
28                                          1.7f  // month name
29        };
30    
31        static private float[] shifts = { 0.0f, // date
32                                          0.0f, // weekday
33                                          0.0f, // week number
34                                          1.0f  // month name
35        };
36    
37      static private float weeknumber_width;      static private float weeknumber_width;
38      static private float weekday_height;      static private float weekday_height;
39      static private float month_name_height;      static private float month_name_height;
# Line 33  public static final String rcsid = "$Id$ Line 45  public static final String rcsid = "$Id$
45      private int days_in_month;      private int days_in_month;
46      private int first_week_number;      private int first_week_number;
47    
48      private String text[] = {"Ma", "Ti", "Ke", "To",      private String text[] = {"Maanantai", "Tiistai", "Keskiviikko", "Torstai",
49                               "Pe", "La", "Su", "MONTH NAME" };                               "Perjantai", "Lauantai", "Sunnuntai", "MONTH NAME" };
50    
51    
52        
53    
54      public CalendarVob(int year, int month) {      public CalendarVob(int year, int month) {
55          this.year = year;          this.year = year;
# Line 58  public static final String rcsid = "$Id$ Line 72  public static final String rcsid = "$Id$
72          pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);          pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
73          pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);          pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
74          Calendar calendar = new GregorianCalendar(pdt);          Calendar calendar = new GregorianCalendar(pdt);
   
75          calendar.setFirstDayOfWeek(Calendar.MONDAY);          calendar.setFirstDayOfWeek(Calendar.MONDAY);
76    
77          Date date = new Date();          Date date = new Date();
78          date.setYear(year);          
79            // Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.YEAR, year + 1900).
80            date.setYear(year - 1900);
81    
82          // set first day of month          // set first day of month
83          date.setDate(1);          date.setDate(1);
# Line 77  public static final String rcsid = "$Id$ Line 92  public static final String rcsid = "$Id$
92                     "\n   ");                     "\n   ");
93                            
94          // count empty day at the beginning of the month.          // count empty day at the beginning of the month.
95          if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {          switch(calendar.get(Calendar.DAY_OF_WEEK)) {
96              empty_before_first_day = 6;          case Calendar.MONDAY: empty_before_first_day = 0; break;
97          } else {          case Calendar.TUESDAY: empty_before_first_day = 1; break;
98              empty_before_first_day =          case Calendar.WEDNESDAY: empty_before_first_day = 2; break;
99                  calendar.get(Calendar.DAY_OF_WEEK) - 2;          case Calendar.THURSDAY: empty_before_first_day = 3; break;
100            case Calendar.FRIDAY: empty_before_first_day = 4; break;
101            case Calendar.SATURDAY: empty_before_first_day = 5; break;
102            case Calendar.SUNDAY: empty_before_first_day = 6; break;
103          }          }
104                  
105          for (int i=0; i< empty_before_first_day; i++) {          for (int i=0; i< empty_before_first_day; i++) {
106              if (dbg) System.out.print("      ");              if (dbg) System.out.print("      ");
107          }          }
# Line 154  public static final String rcsid = "$Id$ Line 172  public static final String rcsid = "$Id$
172          CalendarVob.linewidth          = linewidth;          CalendarVob.linewidth          = linewidth;
173      }      }
174    
175        static public void setScales(float date, float week_num, float weekday, float month) {
176            CalendarVob.scales[0] = date;
177            CalendarVob.scales[1] = week_num;
178            CalendarVob.scales[2] = weekday;
179            CalendarVob.scales[3] = month;
180        }
181    
182        static public void setShifting(float date, float week_num, float weekday, float month) {
183            CalendarVob.shifts[0] = date;
184            CalendarVob.shifts[1] = week_num;
185            CalendarVob.shifts[2] = weekday;
186            CalendarVob.shifts[3] = month;
187        }
188    
189      static public void setBounds(float weeknumber_width,      static public void setBounds(float weeknumber_width,
190                                   float weekday_height,                                     float weekday_height,  
191                                   float month_name_height)                                   float month_name_height)
# Line 164  public static final String rcsid = "$Id$ Line 196  public static final String rcsid = "$Id$
196      }      }
197    
198    
199    
200      //    public Rectangle clip;      //    public Rectangle clip;
201      Color bgcolor;      Color bgcolor;
202    
# Line 220  public static final String rcsid = "$Id$ Line 253  public static final String rcsid = "$Id$
253                                         text[6],                                         text[6],
254                                         text[7],                                         text[7],
255    
256                                           scales[0],
257                                           scales[1],
258                                           scales[2],
259                                           scales[3],
260    
261                                           shifts[0],
262                                           shifts[1],
263                                           shifts[2],
264                                           shifts[3],
265    
266                                         weeknumber_width,                                         weeknumber_width,
267                                         weekday_height,                                           weekday_height,  
268                                         month_name_height);                                         month_name_height);

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26