/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.wicket.extensions.yui;

import org.apache.wicket.Application;
import org.apache.wicket.IClusterable;
import org.apache.wicket.ResourceReference;
import org.apache.wicket.markup.html.IHeaderResponse;
import org.apache.wicket.markup.html.resources.JavascriptResourceReference;

/**
 * Use the {@link #load(IHeaderResponse, boolean)} method to initialize the YUI library using the
 * YUI loader. It is OK to call this multiple times.
 * 
 * @author eelcohillenius
 */
public final class YuiLib implements IClusterable
{
	private static final long serialVersionUID = 1L;

	private static final ResourceReference YUILOADER;

	static
	{
		StringBuffer sb = new StringBuffer();
		sb.append("yuiloader-beta");
		if (Application.DEPLOYMENT.equals(Application.get().getConfigurationType()))
		{
			sb.append("-min");
		}
		sb.append(".js");
		YUILOADER = new JavascriptResourceReference(YuiLib.class, sb.toString());
	}

	/**
	 * Load the YUI loader script. After that, you can declare YUI dependencies using
	 * YAHOO.util.YUILoader.
	 * 
	 * @param response
	 *            header response
	 */
	public static void load(IHeaderResponse response)
	{
		response.renderJavascriptReference(YUILOADER);
	}

	/**
	 * Prevent construction.
	 */
	private YuiLib()
	{
	}
}

@@ -1248,18 +1248,17 @@
 imes.%0A *
- 
 %0A
+
  * @auth
@@ -1398,22 +1398,16 @@
  static 
-final 
 Resource
@@ -1432,299 +1432,8 @@
 R;%0A%0A
-%09static%0A%09%7B%0A%09%09StringBuffer sb = new StringBuffer();%0A%09%09sb.append(%22yuiloader-beta%22);%0A%09%09if (Application.DEPLOYMENT.equals(Application.get().getConfigurationType()))%0A%09%09%7B%0A%09%09%09sb.append(%22-min%22);%0A%09%09%7D%0A%09%09sb.append(%22.js%22);%0A%09%09YUILOADER = new JavascriptResourceReference(YuiLib.class, sb.toString());%0A%09%7D%0A%0A
 %09/**
@@ -1545,17 +1545,16 @@
 der.%0A%09 *
- 
 %0A%09 * @pa
@@ -1693,16 +1693,415 @@
 ference(
+getYuiLoader());%0A%09%7D%0A%0A%09private static ResourceReference getYuiLoader()%0A%09%7B%0A%09%09if (YUILOADER == null)%0A%09%09%7B%0A%09%09%09StringBuffer sb = new StringBuffer();%0A%09%09%09sb.append(%22yuiloader-beta%22);%0A%09%09%09if (Application.DEPLOYMENT.equals(Application.get().getConfigurationType()))%0A%09%09%09%7B%0A%09%09%09%09sb.append(%22-min%22);%0A%09%09%09%7D%0A%09%09%09sb.append(%22.js%22);%0A%09%09%09YUILOADER = new JavascriptResourceReference(YuiLib.class, sb.toString());%0A%09%09%7D%0A%09%09return 
 YUILOADE
@@ -2101,17 +2101,16 @@
 UILOADER
-)
 ;%0A%09%7D%0A%0A%09/

fix for "java.lang.NoClassDefFoundError: org.apache.wicket.extensions.yui.calendar.DatePicker" after reloading a webapp in tomcat