View Javadoc
1 /* 2 * Scope: a generic MVC framework. 3 * Copyright (c) 2000-2002, Steve Meyfroidt 4 * All rights reserved. 5 * Email: smeyfroi@users.sourceforge.net 6 * 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 12 * Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 15 * Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * Neither the name "Scope" nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 28 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 30 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 31 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 * 36 * 37 * $Id: AppController.java,v 1.4 2002/06/17 09:56:00 ludovicc Exp $ 38 */ 39 40 41 package test.controller.servlet; 42 43 44 import org.apache.commons.logging.LogFactory;import org.apache.commons.logging.Log; 45 import org.scopemvc.controller.basic.BasicController; 46 import org.scopemvc.core.Control; 47 import org.scopemvc.core.ControlException; 48 import org.scopemvc.view.servlet.ServletView; 49 import test.model.basic.BasicTestModel; 50 51 52 /*** 53 * <P> 54 * Recognises Control("Test1Control"). Initialises 55 * itself with a ServletViewTest("1") and a 56 * BasicTestModel("TestModel"). View is bound 57 * to the NAME Selector. 58 * 59 * Adds a child SubController(). 60 * </P> 61 * 62 * @author <A HREF="mailto:smeyfroi@users.sourceforge.net">Steve Meyfroidt</A> 63 * @version $Revision: 1.4 $ $Date: 2002/06/17 09:56:00 $ 64 */ 65 class AppController extends BasicController { 66 private static final Log LOG = LogFactory.getLog(AppController.class); 67 static boolean doneTest1Control = false; 68 static boolean doneTest1aControl = false; 69 public AppController() { 70 if (LOG.isDebugEnabled()) LOG.debug("AppController.<init>"); 71 72 ServletView sv = new ServletView(); 73 setView(sv); 74 75 DummyPage v = new DummyPage("1"); 76 v.setSelector(BasicTestModel.NAME); 77 sv.addPage(v); 78 79 v = new DummyPage("1a"); 80 v.setSelector(BasicTestModel.LONG_PROPERTY); 81 sv.addPage(v); 82 83 BasicTestModel m = new BasicTestModel("TestModel"); 84 setModel(m); 85 86 SubController child = new SubController(); 87 addChild(child); 88 } 89 protected void doHandleControl(Control inControl) throws ControlException { 90 if (LOG.isDebugEnabled()) LOG.debug("doHandleControl: " + inControl); 91 if (inControl.matchesID("Test1Control")) { 92 doneTest1Control = true; 93 showView(); 94 } else if (inControl.matchesID("Test1aControl")) { 95 doneTest1aControl = true; 96 ((ServletView)getView()).setVisible("1a"); // no showView 97 } 98 } 99 public void startup() { 100 ((ServletView)getView()).setVisible("1a"); 101 showView(); 102 } 103 public String toString() { 104 return "AppController"; 105 } 106 } 107

This page was automatically generated by Maven