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.ajax.markup.html.autocomplete; 018 019import org.apache.wicket.markup.head.CssHeaderItem; 020import org.apache.wicket.markup.head.IHeaderResponse; 021import org.apache.wicket.model.IModel; 022import org.apache.wicket.request.resource.CssResourceReference; 023 024/** 025 * An {@link AutoCompleteTextField} which automatically includes the default CSS for the 026 * suggestions. 027 * 028 * @see AutoCompleteTextField 029 * @author Antony Stubbs 030 * @param <T> 031 * The model type 032 */ 033public abstract class DefaultCssAutoCompleteTextField<T> extends AutoCompleteTextField<T> 034{ 035 private static final long serialVersionUID = 1L; 036 037 /** 038 * Constructor. 039 * 040 * @param id 041 * the component id 042 */ 043 public DefaultCssAutoCompleteTextField(final String id) 044 { 045 this(id, null); 046 } 047 048 /** 049 * Construct. 050 * 051 * @param id 052 * the component id 053 * @param model 054 * the component model 055 */ 056 public DefaultCssAutoCompleteTextField(final String id, final IModel<T> model) 057 { 058 super(id, model); 059 } 060 061 @Override 062 public void renderHead(final IHeaderResponse response) 063 { 064 super.renderHead(response); 065 066 response.render(CssHeaderItem.forReference(new CssResourceReference( 067 DefaultCssAutoCompleteTextField.class, "DefaultCssAutoCompleteTextField.css"))); 068 } 069}