001 // This file is part of the Attempto Java Packages. 002 // Copyright 2008, Attempto Group, University of Zurich (see http://attempto.ifi.uzh.ch). 003 // 004 // The Attempto Java Packages is free software: you can redistribute it and/or modify it under the 005 // terms of the GNU Lesser General Public License as published by the Free Software Foundation, 006 // either version 3 of the License, or (at your option) any later version. 007 // 008 // The Attempto Java Packages is distributed in the hope that it will be useful, but WITHOUT ANY 009 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 010 // PURPOSE. See the GNU Lesser General Public License for more details. 011 // 012 // You should have received a copy of the GNU Lesser General Public License along with the Attempto 013 // Java Packages. If not, see http://www.gnu.org/licenses/. 014 015 package ch.uzh.ifi.attempto.preditor.example; 016 017 import nextapp.echo2.app.ApplicationInstance; 018 import nextapp.echo2.app.Window; 019 import nextapp.echo2.webcontainer.WebContainerServlet; 020 import ch.uzh.ifi.attempto.echocomp.Style; 021 import ch.uzh.ifi.attempto.preditor.PreditorWindow; 022 023 /** 024 * This class is an examplary implementation of a servlet that starts a predictive editor. See the 025 * <a href="{@docRoot}/src-html/ch/uzh/ifi/attempto/preditor/example/ExampleServlet.html#line.1">source code</a>. 026 * 027 * @author Tobias Kuhn 028 */ 029 public class ExampleServlet extends WebContainerServlet { 030 031 /** 032 * Creates a new servlet instance. 033 */ 034 public ExampleServlet() { 035 } 036 037 public ApplicationInstance newApplicationInstance() { 038 039 return new ApplicationInstance() { 040 041 public Window init() { 042 setStyleSheet(Style.styleSheet); 043 Window window = new Window(); 044 window.setTitle("Preditor Example Application"); 045 046 PreditorWindow preditor = new PreditorWindow("My Predictive Editor", new ExampleGrammar(), new ExampleMenuCreator()); 047 preditor.setClosable(false); 048 window.getContent().add(preditor); 049 050 return window; 051 } 052 053 }; 054 055 } 056 057 }