KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > methodhead > shim > Module


1 /*
2  * Copyright (C) 2006 Methodhead Software LLC. All rights reserved.
3  *
4  * This file is part of TransferCM.
5  *
6  * TransferCM is free software; you can redistribute it and/or modify it under the
7  * terms of the GNU General Public License as published by the Free Software
8  * Foundation; either version 2 of the License, or (at your option) any later
9  * version.
10  *
11  * TransferCM is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * TransferCM; if not, write to the Free Software Foundation, Inc., 51 Franklin St,
18  * Fifth Floor, Boston, MA 02110-1301 USA
19  */

20
21 package com.methodhead.shim;
22
23 import javax.servlet.http.HttpServletRequest JavaDoc;
24 import javax.servlet.http.HttpServletResponse JavaDoc;
25 import javax.servlet.jsp.JspWriter JavaDoc;
26 import org.apache.struts.action.ActionMapping;
27 import org.apache.struts.action.ActionForward;
28 import org.apache.struts.action.DynaActionForm;
29 import java.io.IOException JavaDoc;
30
31 /**
32  * A module that can be inserted into a panel and managed by shim.
33  */

34 public interface Module {
35
36   // constants ////////////////////////////////////////////////////////////////
37

38   // constructors /////////////////////////////////////////////////////////////
39

40   // methods //////////////////////////////////////////////////////////////////
41

42   /**
43    * Returns a short descriptive name for the module.
44    */

45   public String JavaDoc getName();
46
47   /**
48    * Sets the module's <tt>page</tt> and <tt>panel</tt>. This method is called
49    * before any other operations are performed.
50    */

51   public void init(
52     Page page,
53     String JavaDoc panel );
54
55   /**
56    * Creates the module. This method is called when a module is instantiated
57    * for a page and panel. The module should be initialized such that future
58    * calls to {@link #configure configure()} and {@link #display display()} are
59    * successful. Note that this method is also called when a template is
60    * changed for a page, giving modules an opportunity to reset (or leave
61    * alone) the data associated with the panel.
62    */

63   public void create();
64
65   /**
66    * Returns <tt>true</tt> if the module has a configuration interface; that
67    * is, if {@link #configure configure()} actually does something.
68    */

69   public boolean isConfigurable();
70
71   /**
72    * Manages the configuration interface for the module.
73    */

74   public ActionForward configure(
75     ActionMapping mapping,
76     DynaActionForm form,
77     HttpServletRequest JavaDoc request,
78     HttpServletResponse JavaDoc response );
79
80   /**
81    * Returns <tt>true</tt> if the module can be updated in the rich text
82    * editor; if so, {@link #update update()} must be implemented.
83    */

84   public boolean isEditable();
85
86   /**
87    * Updates the module with <tt>text</tt> submitted from the rich text editor.
88    */

89   public void update( String JavaDoc text );
90
91   /**
92    * Displays the module.
93    */

94   public void display(
95     HttpServletRequest JavaDoc request,
96     HttpServletResponse JavaDoc response,
97     JspWriter JavaDoc out )
98   throws
99     IOException JavaDoc;
100
101   /**
102    * Destroys the module, freeing any resources associated with the module.
103    */

104   public void destroy();
105
106   /**
107    * Copies any resources associated with the module for <tt>page</tt>.
108    */

109   public void copyTo(
110     Page page );
111 }
112
Popular Tags