001package 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 023import com.google.gwt.core.client.JavaScriptObject; 024 025/** 026 * Models the configuration of an <code>Event</code> object 027 * 028 * @author Jeff Isenhart 029 * @see http://arshaw.com/fullcalendar/docs/event_data/ 030 */ 031public class EventDataConfig implements IsJavaScriptObject { 032 private JavaScriptObject config; 033 034 public EventDataConfig() { 035 newInstance(); 036 } 037 038 private native void newInstance() /*-{ 039 var theInstance = this; 040 theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.EventDataConfig::config = { 041 allDayDefault: null, 042 startParam: 'start', 043 endParam: 'end', 044 timezoneParam: 'timezone', 045 lazyFetching: true, 046 defaultTimedEventDuration: '02:00:00', 047 defaultAllDayEventDuration: {days: 1}, 048 forceEventDuration: false 049 }; 050 }-*/; 051 052 public void addEventDataTransformCallback(final EventDataTransformCallback callback) { 053 if (callback != null) { 054 addTransformCallback(callback); 055 } 056 } 057 058 private native void addTransformCallback(EventDataTransformCallback callback) /*-{ 059 var theInstance = this; 060 theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.EventDataConfig::config.eventDataTransform = function (eventData) { 061 callback.@org.gwtbootstrap3.extras.fullcalendar.client.ui.EventDataTransformCallback::eventData(Lcom/google/gwt/core/client/JavaScriptObject;)(eventData); 062 } 063 }-*/; 064 065 public void addEventLoadingCallback(final EventLoadingCallback callback) { 066 if (callback != null) { 067 addLoadingCallback(callback); 068 } 069 } 070 071 private native void addLoadingCallback(EventLoadingCallback callback) /*-{ 072 var theInstance = this; 073 theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.EventDataConfig::config.loading = function (loading, view) { 074 callback.@org.gwtbootstrap3.extras.fullcalendar.client.ui.EventLoadingCallback::isLoading(ZLcom/google/gwt/core/client/JavaScriptObject;)(loading, view); 075 } 076 }-*/; 077 078 @Override 079 public JavaScriptObject toJavaScript() { 080 return config; 081 } 082}