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;
024import com.google.gwt.core.client.JsDate;
025
026/**
027 * @author Jeff
028 * @see http://arshaw.com/fullcalendar/docs/views/View_Object/
029 */
030public class View {
031
032    private final JavaScriptObject view;
033
034    /**
035     * @param jso
036     */
037    public View(final JavaScriptObject jso) {
038        view = jso;
039    }
040
041    public native String getName() /*-{
042        var theInstance = this;
043        return theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.View::view.name;
044    }-*/;
045
046    public native String getTitle() /*-{
047        var theInstance = this;
048        return theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.View::view.title;
049    }-*/;
050
051    public native JsDate getStart() /*-{
052        var theInstance = this;
053        var returnVal = theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.View::view.start;
054        if (returnVal) {
055            return returnVal.toDate();
056        }
057        return null;
058    }-*/;
059
060    public native JsDate getEnd() /*-{
061        var theInstance = this;
062        var returnVal = theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.View::view.end;
063        if (returnVal) {
064            return returnVal.toDate();
065        }
066        return null;
067    }-*/;
068
069    public native JsDate getIntervalStart() /*-{
070        var theInstance = this;
071        var returnVal = theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.View::view.intervalStart;
072        if (returnVal) {
073            return returnVal.toDate();
074        }
075        return null;
076    }-*/;
077
078    public native JsDate getIntervalEnd() /*-{
079        var theInstance = this;
080        var returnVal = theInstance.@org.gwtbootstrap3.extras.fullcalendar.client.ui.View::view.intervalEnd;
081        if (returnVal) {
082            return returnVal.toDate();
083        }
084        return null;
085    }-*/;
086
087    public JavaScriptObject toJavaScript() {
088        return this.view;
089    }
090}