Source code: com/RuntimeCollective/webapps/form/BeanForm.java
1 /* $Header: /home/CVS/rjp/src/com/RuntimeCollective/webapps/form/BeanForm.java,v 1.4 2003/09/30 15:13:13 joe Exp $
2 * $Revision: 1.4 $
3 * $Date: 2003/09/30 15:13:13 $
4 *
5 * ====================================================================
6 *
7 * Josephine : http://www.runtime-collective.com/josephine/index.html
8 *
9 * Copyright (C) 2003 Runtime Collective
10 *
11 * This product includes software developed by the
12 * Apache Software Foundation (http://www.apache.org/).
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 */
29
30 package com.RuntimeCollective.webapps.form;
31
32 import com.RuntimeCollective.webapps.bean.EntityBean;
33 import javax.servlet.http.HttpServletRequest;
34 import org.apache.struts.action.ActionMapping;
35 import java.sql.SQLException;
36
37 /** A form that provides a `front end' for editing an <code>EntityBean</code>.
38 *
39 * @version $Id: BeanForm.java,v 1.4 2003/09/30 15:13:13 joe Exp $
40 */
41 public interface BeanForm {
42
43 /** Populate this form from a bean.
44 * @param bean The entity bean to populate the form from
45 */
46 public void populateForm( EntityBean bean );
47
48 /** Populate this bean from an ActionForm.
49 * @param bean The bean to populate.
50 * @return The bean updated with the fields from this form. Note that this does <i>not</i> save the updated bean to the database.
51 */
52 public EntityBean populateBean( EntityBean bean ) throws SQLException ;
53
54 /** Get the action that this form is being used for, such as "register" a new bean, or "delete" or "edit" an existing one. */
55 public String getFormAction();
56
57 /** Set the action that this form is being used for, such as "register" a new bean, or "delete" or "edit" an existing one. */
58 public void setFormAction(String formAction);
59
60 /** Reset all properties to default values.
61 * @param mapping The mapping used to select this instance
62 * @param request The servlet request we are processing
63 */
64 public void reset(ActionMapping mapping, HttpServletRequest request);
65 }