001 package org.gwtbootstrap3.extras.fullcalendar.client.ui;
002
003 /*
004 * #%L
005 * GwtBootstrap3
006 * %%
007 * Copyright (C) 2013 - 2014 GwtBootstrap3
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 *
013 * http://www.apache.org/licenses/LICENSE-2.0
014 *
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023 import com.google.gwt.core.client.JavaScriptObject;
024
025 /**
026 * @author Jeff Isenhart
027 * @see http://arshaw.com/fullcalendar/docs/agenda/
028 */
029 public class AgendaOptions implements IsJavaScriptObject {
030 private JavaScriptObject options;
031
032 public AgendaOptions() {
033 newInstance();
034 }
035
036 /**
037 * Sets defaults
038 *
039 * @see http://arshaw.com/fullcalendar/docs/agenda/
040 */
041 public native void newInstance() /*-{
042 var theInstance = this;
043 theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.AgendaOptions::options = {
044 allDaySlot: true,
045 allDayText: "all-day",
046 axisFormat: "h(:mm)a",
047 slotDuration: '00:30.00',
048 scrollTime: '06:00:00',
049 minTime: '00:00:00',
050 maxTime: '24:00:00',
051 slotEventOverlap: true
052
053 };
054 }-*/;
055
056 /**
057 * @see http://arshaw.com/fullcalendar/docs/agenda/allDaySlot/
058 */
059 public native void setAllDaySlot(boolean allDay) /*-{
060 var theInstance = this;
061 theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.AgendaOptions::options.allDaySlot = allDay;
062 }-*/;
063
064 /**
065 * @see http://arshaw.com/fullcalendar/docs/agenda/allDayText/
066 */
067 public native void setAllDayText(String text) /*-{
068 var theInstance = this;
069 theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.AgendaOptions::options.allDayText = text;
070 }-*/;
071
072 /**
073 * @see http://arshaw.com/fullcalendar/docs/agenda/axisFormat/
074 */
075 public native void setAxisFormat(String format) /*-{
076 var theInstance = this;
077 theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.AgendaOptions::options.axisFormat = format;
078 }-*/;
079
080 public void setSlotDuration(final int minutes) {
081 assert minutes >= 0 && minutes <= 60;
082 if (minutes < 10) {
083 setSlotDuration("00:0" + minutes + ":00");
084 } else {
085 setSlotDuration("00:" + minutes + ":00");
086 }
087 }
088
089 /**
090 * @see http://arshaw.com/fullcalendar/docs/agenda/slotDuration/
091 */
092 public native void setSlotDuration(String timeString) /*-{
093 var theInstance = this;
094 theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.AgendaOptions::options.slotDuration = timeString;
095 }-*/;
096
097 public void setSnapDuration(final int minutes) {
098 assert minutes >= 0 && minutes <= 60;
099 if (minutes < 10) {
100 setSnapDuration("00:0" + minutes + ":00");
101 } else {
102 setSnapDuration("00:" + minutes + ":00");
103 }
104 }
105
106 /**
107 * @see http://arshaw.com/fullcalendar/docs/agenda/snapDuration/
108 */
109 public native void setSnapDuration(String timeString) /*-{
110 var theInstance = this;
111 theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.AgendaOptions::options.snapDuration = timeString;
112 }-*/;
113
114 /**
115 * @see http://arshaw.com/fullcalendar/docs/agenda/scrollTime/
116 */
117 public native void setScrollTime(String timeString) /*-{
118 var theInstance = this;
119 theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.AgendaOptions::options.scrollTime = timeString;
120 }-*/;
121
122 /**
123 * @see http://arshaw.com/fullcalendar/docs/agenda/minTime/
124 */
125 public native void setMinTime(String timeString) /*-{
126 var theInstance = this;
127 theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.AgendaOptions::options.minTime = timeString;
128 }-*/;
129
130 /**
131 * @see http://arshaw.com/fullcalendar/docs/agenda/maxTime/
132 */
133 public native void setMaxTime(String timeString) /*-{
134 var theInstance = this;
135 theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.AgendaOptions::options.maxTime = timeString;
136 }-*/;
137
138 /**
139 * @see http://arshaw.com/fullcalendar/docs/agenda/slotEventOverlap/
140 */
141 public native void setSlotEventOverlap(boolean overlap) /*-{
142 var theInstance = this;
143 theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.AgendaOptions::options.slotEventOverlap = overlap;
144 }-*/;
145
146 @Override
147 public JavaScriptObject toJavaScript() {
148 return options;
149 }
150 }