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.extensions.markup.html.form.palette.theme; 018 019import org.apache.wicket.Component; 020import org.apache.wicket.behavior.Behavior; 021import org.apache.wicket.extensions.markup.html.form.palette.Palette; 022import org.apache.wicket.markup.ComponentTag; 023import org.apache.wicket.markup.head.CssHeaderItem; 024import org.apache.wicket.markup.head.IHeaderResponse; 025import org.apache.wicket.request.resource.CssResourceReference; 026import org.apache.wicket.request.resource.ResourceReference; 027 028 029/** 030 * A default theme for a {@link Palette}. 031 */ 032public class DefaultTheme extends Behavior 033{ 034 035 private static final long serialVersionUID = 1L; 036 037 /** reference to the palette's css resource */ 038 private static final ResourceReference CSS = new CssResourceReference(DefaultTheme.class, 039 "palette.css"); 040 041 @Override 042 public void onComponentTag(Component component, ComponentTag tag) 043 { 044 tag.append("class", "palette-theme-default", " "); 045 } 046 047 /** 048 * Renders header contributions 049 * 050 * @param component 051 * @param response 052 */ 053 @Override 054 public void renderHead(Component component, IHeaderResponse response) 055 { 056 response.render(CssHeaderItem.forReference(CSS)); 057 } 058}