01: //The Salmon Open Framework for Internet Applications (SOFIA)
02: //Copyright (C) 1999 - 2002, Salmon LLC
03: //
04: //This program is free software; you can redistribute it and/or
05: //modify it under the terms of the GNU General Public License version 2
06: //as published by the Free Software Foundation;
07: //
08: //This program is distributed in the hope that it will be useful,
09: //but WITHOUT ANY WARRANTY; without even the implied warranty of
10: //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11: //GNU General Public License for more details.
12: //
13: //You should have received a copy of the GNU General Public License
14: //along with this program; if not, write to the Free Software
15: //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16: //
17: //For more information please visit http://www.salmonllc.com
18:
19: package com.salmonllc.examples.example11;
20:
21: import com.salmonllc.jsp.*;
22: import com.salmonllc.html.*;
23: import com.salmonllc.html.events.*;
24:
25: public class GUIController extends JspController implements
26: SubmitListener, PageListener {
27: public com.salmonllc.html.HtmlSubmitButton _submit1;
28: public com.salmonllc.html.HtmlText _replaceMe;
29:
30: private int _count = 0;
31: private HtmlTable _tab;
32:
33: public void initialize() {
34: addPageListener(this );
35: _submit1.addSubmitListener(this );
36: //create an HtmlTable component and replace the replaceMe place holder with it.
37: //This HtmlTable container will be used to lay out dynamically created components in submit performed
38: _tab = new HtmlTable("Table", this );
39: replaceComponent(_replaceMe.getName(), _tab);
40: }
41:
42: public boolean submitPerformed(SubmitEvent e) throws Exception {
43: //Create a new caption and Text Edit and add them to the correct position on the table
44: HtmlText t = new HtmlText("Field " + _count, this );
45: HtmlTextEdit ed = new HtmlTextEdit("Edit" + _count, this );
46: _tab.setComponentAt(_count, 0, t);
47: _tab.setComponentAt(_count, 1, ed);
48: _count++;
49: return true;
50: }
51:
52: public void pageRequested(PageEvent p) {
53: }
54:
55: public void pageRequestEnd(PageEvent p) {
56: }
57:
58: public void pageSubmitEnd(PageEvent p) {
59: }
60:
61: public void pageSubmitted(PageEvent p) {
62: }
63:
64: }
|