⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testdetachpage.java

📁 Wicket一个开发Java Web应用程序框架。它使得开发web应用程序变得容易而轻松。 Wicket利用一个POJO data beans组件使得它可以与任何持久层技术相结合。
💻 JAVA
字号:
/* * 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;import org.apache.wicket.ajax.AjaxEventBehavior;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.markup.html.WebPage;import org.apache.wicket.markup.html.basic.Label;import org.apache.wicket.model.IModel;/** * Test page for detach logic. *  * @author dashorst */public class TestDetachPage extends WebPage{	/** For serialization. */	private static final long serialVersionUID = 1L;	private int nrPageOnDetachCalls = 0;	private int nrPageDetachModelCalls = 0;	private int nrPageDetachModelsCalls = 0;	private int nrComponentOnDetachCalls = 0;	private int nrComponentDetachModelCalls = 0;	private int nrComponentDetachModelsCalls = 0;	private int nrAjaxBehaviorDetachModelCalls = 0;	private int nrModelDetachCalls = 0;	private final AjaxEventBehavior ajaxEventBehavior;	/**	 * Model for testing detach logic.	 * 	 * @author dashorst	 */	private class DetachModel implements IModel	{		/** for serialization. */		private static final long serialVersionUID = 1L;		public Object getObject()		{			return "body";		}		public void setObject(Object object)		{		}		public void detach()		{			nrModelDetachCalls++;		}	}	/**	 * Construct.	 */	public TestDetachPage()	{		final Label label = new Label("comp", new DetachModel())		{			/** For serialization */			private static final long serialVersionUID = 1L;			protected void onDetach()			{				nrComponentOnDetachCalls++;				super.onDetach();			}			protected void detachModel()			{				nrComponentDetachModelCalls++;				super.detachModel();			}			public void detachModels()			{				nrComponentDetachModelsCalls++;				super.detachModels();			}		};		label.setOutputMarkupId(true);		ajaxEventBehavior = new AjaxEventBehavior("onclick")		{			/** for serialization. */			private static final long serialVersionUID = 1L;			public void detach(Component component)			{				nrAjaxBehaviorDetachModelCalls++;				super.detach(component);			}			protected void onEvent(AjaxRequestTarget target)			{				target.addComponent(label);			}		};		label.add(ajaxEventBehavior);		add(label);	}	protected void onDetach()	{		nrPageOnDetachCalls++;		super.onDetach();	}	protected void detachModel()	{		nrPageDetachModelCalls++;		super.detachModel();	}	public void detachModels()	{		nrPageDetachModelsCalls++;		super.detachModels();	}	/**	 * @return nrComponentDetachModelCalls	 */	public int getNrComponentDetachModelCalls()	{		return nrComponentDetachModelCalls;	}	/**	 * @return nrComponentDetachModelsCalls	 */	public int getNrComponentDetachModelsCalls()	{		return nrComponentDetachModelsCalls;	}	/**	 * @return nrComponentOnDetachCalls	 */	public int getNrComponentOnDetachCalls()	{		return nrComponentOnDetachCalls;	}	/**	 * @return nrPageDetachModelCalls	 */	public int getNrPageDetachModelCalls()	{		return nrPageDetachModelCalls;	}	/**	 * @return nrPageDetachModelsCalls	 */	public int getNrPageDetachModelsCalls()	{		return nrPageDetachModelsCalls;	}	/**	 * @return nrPageOnDetachCalls	 */	public int getNrPageOnDetachCalls()	{		return nrPageOnDetachCalls;	}	/**	 * @return nrModelDetachCalls	 */	public int getNrModelDetachCalls()	{		return nrModelDetachCalls;	}	/**	 * @return nrAjaxBehaviorDetachModelCalls	 */	public int getNrAjaxBehaviorDetachModelCalls()	{		return nrAjaxBehaviorDetachModelCalls;	}	/**	 * @return ajaxEventBehavior	 */	public AjaxEventBehavior getAjaxBehavior()	{		return ajaxEventBehavior;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -