1 /* 2 * Copyright 2010 James Pether Sörling 3 * 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 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 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. 15 * 16 * $Id: CIAWebApplication.java 5436 2011-04-26 18:25:22Z pether $ 17 * $HeadURL: https://cia.svn.sourceforge.net/svnroot/cia/trunk/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/CIAWebApplication.java $ 18 */ 19 package com.hack23.cia.web.impl.ui.application; 20 21 import org.vaadin.navigator7.WebApplication; 22 import org.vaadin.navigator7.interceptor.NavigationWarningInterceptor; 23 import org.vaadin.navigator7.interceptor.PageChangeListenersInterceptor; 24 25 /** 26 * The Class CIAWebApplication. 27 */ 28 public final class CIAWebApplication extends WebApplication { 29 30 /** The page change listener interceptor. */ 31 private PageChangeListenersInterceptor pageChangeListenerInterceptor; 32 33 /** 34 * Instantiates a new cIA web application. 35 */ 36 public CIAWebApplication() { 37 super(); 38 this.registerPages(Pages.getUserPages()); 39 this.registerPages(Pages.getAdminPages()); 40 this.registerPages(Pages.getDevPages()); 41 this.getNavigatorConfig().setHomePageClass(Pages.getHomePage()); 42 } 43 44 /** 45 * Gets the page change listener interceptor. 46 * 47 * @return the page change listener interceptor 48 */ 49 public PageChangeListenersInterceptor getPageChangeListenerInterceptor() { 50 return pageChangeListenerInterceptor; 51 } 52 53 /* (non-Javadoc) 54 * @see org.vaadin.navigator7.WebApplication#registerInterceptors() 55 */ 56 @Override 57 protected void registerInterceptors() { 58 // 1st interceptor to call: check if user really wanna quit. 59 registerInterceptor( new NavigationWarningInterceptor() ); 60 registerInterceptor( pageChangeListenerInterceptor = new PageChangeListenersInterceptor() ); 61 super.registerInterceptors(); // Default interceptors. 62 } 63 }