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.markup.html;
018
019import org.apache.wicket.Component;
020import org.apache.wicket.markup.head.IHeaderResponse;
021import org.apache.wicket.util.io.IClusterable;
022
023/**
024 * An interface to be implemented by {@link org.apache.wicket.behavior.Behavior}s,
025 * {@link org.apache.wicket.ajax.attributes.IAjaxCallListener}s.
026 * 
027 * Example:
028 * 
029 * <pre>
030 * class MyAjaxCallDecorator implements IAjaxCallListener, IComponentAwareHeaderContributor
031 * {
032 *
033 *  // IAjaxCallListener methods omitted for brevity
034 *
035 *      public void renderHead(Component component, IHeaderResponse response)
036 *      {
037 *              response.render(new OnLoadJavaScriptHeaderItem(&quot;alert('page loaded!');&quot;));
038 *      }
039 * }
040 * </pre>
041 */
042public interface IComponentAwareHeaderContributor extends IClusterable
043{
044        /**
045         * Render to the web response whatever the component-aware wants to contribute to the head
046         * section.
047         * 
048         * @param component
049         *            component which is contributing to the response. This parameter is here to give
050         *            the component as the context for component-awares implementing this interface
051         * 
052         * @param response
053         *            Response object
054         */
055        void renderHead(Component component, IHeaderResponse response);
056}