All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.ftlines.wicket.fullcalendar.AbstractFullCalendar Maven / Gradle / Ivy

There is a newer version: 4.2
Show newest version
/**
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

package net.ftlines.wicket.fullcalendar;

import org.apache.wicket.Application;
import org.apache.wicket.ResourceReference;
import org.apache.wicket.markup.html.IHeaderContributor;
import org.apache.wicket.markup.html.IHeaderResponse;
import org.apache.wicket.markup.html.WebComponent;

abstract class AbstractFullCalendar extends WebComponent implements IHeaderContributor
{
	public AbstractFullCalendar(String id)
	{
		super(id);
	}

	private static final ResourceReference CSS = new ResourceReference(AbstractFullCalendar.class,
		"res/fullcalendar.css");
	private static final ResourceReference JS = new ResourceReference(AbstractFullCalendar.class, "res/fullcalendar.js");
	private static final ResourceReference JS_EXT = new ResourceReference(AbstractFullCalendar.class,
		"res/fullcalendar.ext.js");
	private static final ResourceReference JS_MIN = new ResourceReference(AbstractFullCalendar.class,
		"res/fullcalendar.min.js");

	@Override
	public void renderHead(IHeaderResponse response)
	{

		response.renderCSSReference(CSS);
		if (Application.DEPLOYMENT.equals(Application.get().getConfigurationType()))
		{
			response.renderJavascriptReference(JS_MIN);
		}
		else
		{
			response.renderJavascriptReference(JS);
		}
		response.renderJavascriptReference(JS_EXT);
	}


	public final String toJson(Object value)
	{
		return Json.toJson(value);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy