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.photos.wicket;
18 import org.apache.wicket.markup.html.CSSPackageResource;
19 import org.apache.wicket.markup.html.WebPage;
20 import org.apache.wicket.markup.html.basic.Label;
21 import org.apache.wicket.markup.html.link.Link;
22 import org.apache.wicket.markup.html.panel.FeedbackPanel;
23 import org.apache.wicket.model.IModel;
24 import org.wamblee.wicket.behavior.TitleAttributeTooltipBehavior;
25 import org.wamblee.wicket.css.ResetCssBehavior;
26 import org.wamblee.wicket.page.ExpireBehavior;
27 import org.wamblee.wicket.page.WebApplicationBasePage;
29 public class BasePage extends WebApplicationBasePage {
31 private boolean isExpired = false;
37 public BasePage(IModel aModel) {
39 add(new ResetCssBehavior());
40 add(new TitleAttributeTooltipBehavior());
41 add(CSSPackageResource.getHeaderContribution(BasePage.class,
45 add(new FeedbackPanel("feedback"));
46 add(new Label("title", getTitle()));
48 addBehavior(new ExpireBehavior() {
50 protected boolean isExpired(WebPage aPage) {
55 add(new Link("logout") {
57 public void onClick() {
58 getRequestCycle().getSession().invalidate();
63 public void setExpired(boolean aExpired) {
67 private String getTitle() {
68 String name = getClass().getSimpleName();
69 name = name.replaceAll("([A-Z]+)([A-Z][a-z])", "$1 $2");
70 name = name.replaceAll("[A-Z]+", " $0");
71 name = name.replaceAll("^ ", "");
72 name = name.replaceAll(" ", " ");