BrightSide Workbench Full Report + Source Code
CalendarMode.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2012 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.calendar;
20 
25 public enum CalendarMode {
26 
27  DAY_MODE("day", 1, "default"),
28  WEEK_MODE("week", 7, "default"),
29  WORKDAYS_MODE("workday", 5, "default"),
30  MONTH_MODE("month", 0, "month");
31 
32  private int days;
33  private String key, mold;
34 
35  private CalendarMode(String key, int days, String mold) {
36  this.key = key;
37  this.days = days;
38  this.mold = mold;
39  }
40 
41  public String getKey() {
42  return key;
43  }
44 
45  public int getDays() {
46  return days;
47  }
48 
49  public String getMold() {
50  return mold;
51  }
52 
53  public static CalendarMode getByKey(String key) {
54  for(CalendarMode cm : CalendarMode.values()) {
55  if(key.equals(cm.getKey())) return cm;
56  }
57  return null;
58  }
59 }
static CalendarMode getByKey(String key)