BrightSide Workbench Full Report + Source Code
WeekDayListbox.java
Go to the documentation of this file.
1
/*
2
* TurrĂ³ i Cutiller Foundation. License notice.
3
* Copyright (C) 2013 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.scheduler.zul.constraints;
20
21
import
java.text.DateFormatSymbols;
22
import
org.turro.string.Strings;
23
import
org.turro.elephant.context.Application;
24
import
org.turro.scheduler.constraints.WeekDay;
25
import
org.turro.zkoss.input.EnumListbox;
26
31
public
class
WeekDayListbox
extends
EnumListbox<WeekDay> {
32
33
private
DateFormatSymbols dfs;
34
35
public
WeekDayListbox
() {
36
super(
WeekDay
.values());
37
dfs =
new
DateFormatSymbols(
Application
.
getUsedLocale
());
38
}
39
40
public
int
getDayIndex
() {
41
WeekDay
wd = getObjectValue();
42
return
wd ==
null
? -1 : wd.ordinal();
43
}
44
45
public
void
setDayIndex
(
int
index) {
46
if
(index > -1 && index < 7) {
47
setObjectValue(
WeekDay
.values()[index]);
48
}
else
{
49
setObjectValue(
null
);
50
}
51
}
52
53
@Override
54
protected
String
getString
(
WeekDay
v) {
55
return
Strings.capitalize(dfs.getWeekdays()[
WeekDay
.
map
(v.ordinal())]);
56
}
57
58
}
org.turro.elephant.context.Application
Definition:
Application.java:49
org.turro.elephant.context.Application.getUsedLocale
static Locale getUsedLocale()
Definition:
Application.java:290
org.turro.scheduler.zul.constraints.WeekDayListbox
Definition:
WeekDayListbox.java:31
org.turro.scheduler.zul.constraints.WeekDayListbox.WeekDayListbox
WeekDayListbox()
Definition:
WeekDayListbox.java:35
org.turro.scheduler.zul.constraints.WeekDayListbox.setDayIndex
void setDayIndex(int index)
Definition:
WeekDayListbox.java:45
org.turro.scheduler.zul.constraints.WeekDayListbox.getString
String getString(WeekDay v)
Definition:
WeekDayListbox.java:54
org.turro.scheduler.zul.constraints.WeekDayListbox.getDayIndex
int getDayIndex()
Definition:
WeekDayListbox.java:40
org.turro.scheduler.constraints.WeekDay
Definition:
constraints/WeekDay.java:26
org.turro.scheduler.constraints.WeekDay.map
static int map(int i)
Definition:
constraints/WeekDay.java:36
TurroProjects
Public
BrightSide
elephant-scheduler-www
src
main
java
org
turro
scheduler
zul
constraints
WeekDayListbox.java
Generated on Tue Mar 12 2024 07:01:21 for BrightSide by
1.9.1