Java tutorial
/* * Copyright 2012 oli. * * Licensed 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 com.mycompany; import org.apache.wicket.ajax.AbstractAjaxTimerBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.util.time.Duration; /** * * @author oli */ public class PanelOne extends AbstractPanel { private WebMarkupContainer wmc; public PanelOne(String id) { super(id); } PanelOne(String panel, WebMarkupContainer wmc) { super(panel); this.wmc = wmc; } @Override void initForm() { form.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) { @Override protected void onTimer(AjaxRequestTarget target) { PanelTwo two = new PanelTwo("panel"); //wmc.addOrReplace(two); //PanelOne.this.replaceWith(two); target.add(two); } }); } }