BrightSide Workbench Full Report + Source Code
org.turro.html.calendar.CalendarUtil Class Reference

Static Public Member Functions

static void positionFirstCell (Calendar date)
 
static String[] getDayNames (Locale locale)
 
static String[] getDayNames (Locale locale, boolean small)
 
static String[] getMonthNames (Locale locale)
 
static String[] getMonthNames (Locale locale, boolean small)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 30 of file CalendarUtil.java.

Member Function Documentation

◆ getDayNames() [1/2]

static String [] org.turro.html.calendar.CalendarUtil.getDayNames ( Locale  locale)
static

Definition at line 43 of file CalendarUtil.java.

43  {
44  return getDayNames(locale, false);
45  }
static String[] getDayNames(Locale locale)
Here is the caller graph for this function:

◆ getDayNames() [2/2]

static String [] org.turro.html.calendar.CalendarUtil.getDayNames ( Locale  locale,
boolean  small 
)
static

Definition at line 47 of file CalendarUtil.java.

47  {
48  Calendar date = Calendar.getInstance(locale);
49  SimpleDateFormat fmtDayWeek = new SimpleDateFormat((small ? "EE" : "EEEE"), locale);
50  int curr = date.getFirstDayOfWeek(), idx = 0;
51  date.set(Calendar.DAY_OF_WEEK, curr);
52  List dayNames = new ArrayList();
53  while(true) {
54  dayNames.add(fmtDayWeek.format(date.getTime()));
55  idx++; curr++;
56  if(idx >= 7) break;
57  if(curr > 7) curr = 1;
58  date.set(Calendar.DAY_OF_WEEK, curr);
59  }
60  return (String[])dayNames.toArray(new String[0]);
61  }

◆ getMonthNames() [1/2]

static String [] org.turro.html.calendar.CalendarUtil.getMonthNames ( Locale  locale)
static

Definition at line 63 of file CalendarUtil.java.

63  {
64  return getMonthNames(locale, false);
65  }
static String[] getMonthNames(Locale locale)
Here is the caller graph for this function:

◆ getMonthNames() [2/2]

static String [] org.turro.html.calendar.CalendarUtil.getMonthNames ( Locale  locale,
boolean  small 
)
static

Definition at line 67 of file CalendarUtil.java.

67  {
68  Calendar date = Calendar.getInstance(locale);
69  SimpleDateFormat fmtMonth = new SimpleDateFormat((small ? "MMM" : "MMMM"), locale);
70  List monthNames = new ArrayList();
71  for(int m = 0; m < 12; m++) {
72  date.set(Calendar.MONTH, m);
73  monthNames.add(fmtMonth.format(date.getTime()));
74  }
75  return (String[])monthNames.toArray(new String[0]);
76  }

◆ positionFirstCell()

static void org.turro.html.calendar.CalendarUtil.positionFirstCell ( Calendar  date)
static

Definition at line 36 of file CalendarUtil.java.

36  {
37  date.set(Calendar.DAY_OF_MONTH, 1);
38  int first = date.getFirstDayOfWeek();
39  while(date.get(Calendar.DAY_OF_WEEK) != first)
40  date.add(Calendar.DAY_OF_MONTH, -1);
41  }
Here is the caller graph for this function:

The documentation for this class was generated from the following file: