View Javadoc
1 /* 2 * Scope: a generic MVC framework. 3 * Copyright (c) 2000-2002, The Scope team 4 * All rights reserved. 5 * 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 14 * Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * Neither the name "Scope" nor the names of its contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 27 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 * 35 * 36 * $Id: Controller.java,v 1.6 2002/09/06 16:11:45 ludovicc Exp $ 37 */ 38 package org.scopemvc.core; 39 40 41 /*** 42 * <P> 43 * 44 * Controllers arranged in a hierarchy of chains of command provide the 45 * structure of an application's logic, mirroring independent contexts of 46 * discrete {@link View}s and their bound model objects. Each context can be 47 * treated as an independent component. Application logic invoked by sending 48 * {@link Control}s into the chain executes in the context of a Controller that 49 * specifically recognises and responds to the Control by its ID. </P> <P> 50 * 51 * For example, a Controller might manage a search panel (eg CustomerSearchView 52 * and bound CustomerSearchModel) that can be embedded within other arbitrary 53 * views. The search panel context has certain Controls that are recognised by 54 * the Controller which has no knowledge of anything outside the immediate 55 * context. Controls that the Controller doesn't explicitly recognise are simply 56 * passed to the parent Controller. </P> <P> 57 * 58 * A Controller responds to {@link Control}s issued to it via the handleControl 59 * method from one of two places: 60 * <UL> 61 * <LI> {@link View}s issue Controls to indicate that the user has invoked 62 * some application logic by interacting with the user interface, eg by 63 * pressing a Button,</LI> 64 * <LI> Controllers pass Controls to their parent Controller to create a Chain 65 * of Command.</LI> 66 * </UL> 67 * </P> <P> 68 * 69 * To implement a Controller see the basic implementation provided in {@link 70 * org.scopemvc.controller.basic.BasicController BasicController}</P> </P> 71 * 72 * @author <A HREF="mailto:smeyfroi@users.sourceforge.net">Steve Meyfroidt</A> 73 * @created 05 August 2002 74 * @version $Revision: 1.6 $ $Date: 2002/09/06 16:11:45 $ 75 */ 76 public interface Controller { 77 78 /*** 79 * Get the parent of this Controller 80 * 81 * @return the parent Controller of this Controller in the chain of command 82 */ 83 Controller getParent(); 84 85 86 /*** 87 * Bind a new model to this Controller. <br> 88 * The controller will automatically bind the model and the view together. 89 * 90 * @param inModel the model object bound to the View that this Controller 91 * maintains 92 */ 93 void setModel(Object inModel); 94 95 96 /*** 97 * Return the model bound to this Controller 98 * 99 * @return the model object bound to the View that this Controller maintains 100 */ 101 Object getModel(); 102 103 104 /*** 105 * Bind a new view to this Controller. <br> 106 * The controller will automatically bind the model and the view together. 107 * 108 * @param inView set the View that this Controller maintains 109 */ 110 void setView(View inView); 111 112 113 /*** 114 * Return the View bound to this Controller. 115 * 116 * @return the View that this Controller maintains 117 */ 118 View getView(); 119 120 121 /*** 122 * <P> 123 * 124 * Respond to a {@link Control} (from either a {@link View} or a child 125 * Controller) or pass up to the parent Controller in the chain of command 126 * if the Control is not recognised in this context. </P> 127 * 128 * @param inControl the Control to respond to by examination of its ID: see 129 * {@link Control#matchesID} 130 * @see org.scopemvc.controller.basic.BasicController#handleControl 131 */ 132 void handleControl(Control inControl); 133 134 135 /*** 136 * Find the top-most parent Controller at the head of the chain of command. 137 * This is the application Controller that initialises the rest of the 138 * Controllers as children to handle specific areas of functionality. 139 * 140 * @return The topParent value 141 */ 142 Controller getTopParent(); 143 } 144

This page was automatically generated by Maven