org.devgateway.eudevfin.ui.common.JQueryUICoreJavaScriptReference.java Source code

Java tutorial

Introduction

Here is the source code for org.devgateway.eudevfin.ui.common.JQueryUICoreJavaScriptReference.java

Source

/*******************************************************************************
 * Copyright (c) 2014 Development Gateway.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 *******************************************************************************/

package org.devgateway.eudevfin.ui.common;

import java.util.List;

import org.apache.wicket.Application;
import org.apache.wicket.markup.head.HeaderItem;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;

import com.google.common.collect.Lists;

import de.agilecoders.wicket.webjars.request.resource.WebjarsJavaScriptResourceReference;

/**
 * core jquery ui package (core, widget, mouse, position, draggable, resizeable)
 *
 * @author miha
 */
public class JQueryUICoreJavaScriptReference extends WebjarsJavaScriptResourceReference {
    private static final long serialVersionUID = 1L;

    /**
     * Singleton instance of this reference
     */
    private static final JQueryUICoreJavaScriptReference INSTANCE = new JQueryUICoreJavaScriptReference();

    /**
     * @return the single instance of the resource reference
     */
    public static JQueryUICoreJavaScriptReference instance() {
        return INSTANCE;
    }

    /**
     * Private constructor.
     */
    private JQueryUICoreJavaScriptReference() {
        super("jquery-ui/current/ui/minified/jquery.ui.core.min.js");
    }

    @Override
    public Iterable<? extends HeaderItem> getDependencies() {
        final List<HeaderItem> dependencies = Lists.newArrayList(super.getDependencies());
        dependencies.add(JavaScriptHeaderItem
                .forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference()));

        return dependencies;
    }

    /**
     * @return this resource reference singleton instance as header item
     */
    public static HeaderItem asHeaderItem() {
        return JavaScriptHeaderItem.forReference(instance());
    }
}