2 * Copyright 2005-2010 the original author or authors.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.wamblee.wicket.page;
18 import java.util.logging.Logger;
20 import org.apache.wicket.markup.html.WebPage;
23 * Bahevior that will expire a page when the page is disabled.
24 * Implementations should implemnet
26 * @author Erik Brakkee
29 public abstract class ExpireBehavior extends AbstractPageBehavior {
30 private static final Logger LOGGER = Logger.getLogger(ExpireBehavior.class.getName());
33 * Constructs the behavior.
35 public ExpireBehavior() {
40 public void onDetach(WebPage aPage) {
41 if (isExpired(aPage)) {
42 aPage.getPageMap().remove(aPage);
47 * Must be implemented to determine if a page is expired.
48 * @param aPage Page to check. If a behavior instance is only used on one page then this
49 * argument is always that page so it can bne ignored in that case.
52 protected abstract boolean isExpired(WebPage aPage);