1 Clazz.declarePackage ("javax.swing");
\r
2 Clazz.load (["javax.swing.AbstractSpinnerModel"], "javax.swing.SpinnerDateModel", ["java.lang.IllegalArgumentException", "java.util.Calendar", "$.Date"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
7 this.calendarField = 0;
\r
8 Clazz.instantialize (this, arguments);
\r
9 }, javax.swing, "SpinnerDateModel", javax.swing.AbstractSpinnerModel);
\r
10 Clazz.defineMethod (c$, "calendarFieldOK",
\r
11 function (calendarField) {
\r
12 switch (calendarField) {
\r
33 Clazz.makeConstructor (c$,
\r
34 function (value, start, end, calendarField) {
\r
35 Clazz.superConstructor (this, javax.swing.SpinnerDateModel, []);
\r
36 if (value == null) {
\r
37 throw new IllegalArgumentException ("value is null");
\r
38 }if (!this.calendarFieldOK (calendarField)) {
\r
39 throw new IllegalArgumentException ("invalid calendarField");
\r
40 }if (!(((start == null) || (start.compareTo (value) <= 0)) && ((end == null) || (end.compareTo (value) >= 0)))) {
\r
41 throw new IllegalArgumentException ("(start <= value <= end) is false");
\r
42 }this.value = java.util.Calendar.getInstance ();
\r
45 this.calendarField = calendarField;
\r
46 this.value.setTime (value);
\r
47 }, "java.util.Date,Comparable,Comparable,~N");
\r
48 Clazz.makeConstructor (c$,
\r
50 this.construct ( new java.util.Date (), null, null, 5);
\r
52 Clazz.defineMethod (c$, "setStart",
\r
54 if ((start == null) ? (this.start != null) : !start.equals (this.start)) {
\r
56 this.fireStateChanged ();
\r
58 Clazz.defineMethod (c$, "getStart",
\r
62 Clazz.defineMethod (c$, "setEnd",
\r
64 if ((end == null) ? (this.end != null) : !end.equals (this.end)) {
\r
66 this.fireStateChanged ();
\r
68 Clazz.defineMethod (c$, "getEnd",
\r
72 Clazz.defineMethod (c$, "setCalendarField",
\r
73 function (calendarField) {
\r
74 if (!this.calendarFieldOK (calendarField)) {
\r
75 throw new IllegalArgumentException ("invalid calendarField");
\r
76 }if (calendarField != this.calendarField) {
\r
77 this.calendarField = calendarField;
\r
78 this.fireStateChanged ();
\r
80 Clazz.defineMethod (c$, "getCalendarField",
\r
82 return this.calendarField;
\r
84 Clazz.overrideMethod (c$, "getNextValue",
\r
86 var cal = java.util.Calendar.getInstance ();
\r
87 cal.setTime (this.value.getTime ());
\r
88 cal.add (this.calendarField, 1);
\r
89 var next = cal.getTime ();
\r
90 return ((this.end == null) || (this.end.compareTo (next) >= 0)) ? next : null;
\r
92 Clazz.overrideMethod (c$, "getPreviousValue",
\r
94 var cal = java.util.Calendar.getInstance ();
\r
95 cal.setTime (this.value.getTime ());
\r
96 cal.add (this.calendarField, -1);
\r
97 var prev = cal.getTime ();
\r
98 return ((this.start == null) || (this.start.compareTo (prev) <= 0)) ? prev : null;
\r
100 Clazz.defineMethod (c$, "getDate",
\r
102 return this.value.getTime ();
\r
104 Clazz.overrideMethod (c$, "getValue",
\r
106 return this.value.getTime ();
\r
108 Clazz.overrideMethod (c$, "setValue",
\r
110 if ((value == null) || !(Clazz.instanceOf (value, java.util.Date))) {
\r
111 throw new IllegalArgumentException ("illegal value");
\r
112 }if (!value.equals (this.value.getTime ())) {
\r
113 this.value.setTime (value);
\r
114 this.fireStateChanged ();
\r