001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.wicket.resource;
018
019import org.apache.wicket.request.resource.JavaScriptResourceReference;
020
021
022/**
023 * The resource reference for the jquery javascript library as released with Wicket. To add a JQuery
024 * resource reference to a component, do not use this reference, but use
025 * {@link org.apache.wicket.settings.JavaScriptLibrarySettings#getJQueryReference()}
026 * to prevent version conflicts.
027 *
028 * @author papegaaij
029 */
030public class JQueryResourceReference extends JavaScriptResourceReference
031{
032        private static final long serialVersionUID = 1L;
033
034        /**
035         * jQuery ver. 1.x - works on modern browsers and IE 6/7/8
036         */
037        public static final String VERSION_1 = "jquery/jquery-1.12.4.js";
038
039        /**
040         * jQuery ver. 2.x - works only on modern browsers
041         */
042        public static final String VERSION_2 = "jquery/jquery-2.2.4.js";
043
044        /**
045         * JQuery ver. 3.x - improves on ver. 2
046         * <strong>Note</strong>: Might not work with old jQuery plugins!
047         */
048        public static final String VERSION_3 = "jquery/jquery-3.7.1.js";
049
050        public static final JQueryResourceReference INSTANCE_1 = new JQueryResourceReference(VERSION_1);
051        public static final JQueryResourceReference INSTANCE_2 = new JQueryResourceReference(VERSION_2);
052        public static final JQueryResourceReference INSTANCE_3 = new JQueryResourceReference(VERSION_3);
053
054        public static JQueryResourceReference getV1()
055        {
056                return INSTANCE_1;
057        }
058
059        public static JQueryResourceReference getV2()
060        {
061                return INSTANCE_2;
062        }
063
064        public static JQueryResourceReference getV3()
065        {
066                return INSTANCE_3;
067        }
068
069        protected JQueryResourceReference(final String version)
070        {
071                super(JQueryResourceReference.class, version);
072        }
073}