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.request.resource;
018
019import java.util.Locale;
020
021/**
022 * Static resource reference for css resources. The resources are filtered (stripped comments and
023 * whitespace) if there is registered compressor.
024 * 
025 * @see org.apache.wicket.settings.ResourceSettings#getCssCompressor()
026 */
027public class CssResourceReference extends PackageResourceReference
028{
029        private static final long serialVersionUID = 1L;
030
031        /**
032         * Construct.
033         * 
034         * @param scope
035         *            mandatory parameter
036         * @param name
037         *            mandatory parameter
038         * @param locale
039         *            resource locale
040         * @param style
041         *            resource style
042         * @param variation
043         *            resource variation
044         */
045        public CssResourceReference(Class<?> scope, String name, Locale locale, String style,
046                String variation)
047        {
048                super(scope, name, locale, style, variation);
049        }
050
051        /**
052         * Construct.
053         * 
054         * @param scope
055         *            mandatory parameter
056         * @param name
057         *            mandatory parameter
058         */
059        public CssResourceReference(Class<?> scope, String name)
060        {
061                super(scope, name);
062        }
063
064        /**
065         * Constructor.
066         *
067         * @param key
068         */
069        public CssResourceReference(Key key)
070        {
071                super(key);
072        }
073
074        @Override
075        public CssPackageResource getResource()
076        {
077                final CssPackageResource resource = new CssPackageResource(getScope(), getName(), getLocale(), getStyle(),
078                                getVariation());
079                removeCompressFlagIfUnnecessary(resource);
080                return resource;
081        }
082
083}