01: //WebOnSwing - Web Application Framework
02: //Copyright (C) 2004 Fernando Damian Petrola
03: //
04: //This library is free software; you can redistribute it and/or
05: //modify it under the terms of the GNU Lesser General Public
06: //License as published by the Free Software Foundation; either
07: //version 2.1 of the License, or (at your option) any later version.
08: //
09: //This library is distributed in the hope that it will be useful,
10: //but WITHOUT ANY WARRANTY; without even the implied warranty of
11: //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: //Lesser General Public License for more details.
13: //
14: //You should have received a copy of the GNU Lesser General Public
15: //License along with this library; if not, write to the Free Software
16: //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17:
18: package weblog;
19:
20: import java.awt.*;
21: import java.awt.event.*;
22:
23: import javax.swing.*;
24:
25: import net.ar.webonswing.*;
26: import net.ar.webonswing.swing.layouts.*;
27:
28: public abstract class AddView extends ApplicationFrame implements
29: ActionListener {
30: protected String bodyName;
31: protected String title;
32: protected JTextField subjectField;
33: protected JTextArea storyArea;
34:
35: protected MultipleFieldsPanel addPanel;
36:
37: public AddView(String aBodyName, String aTitle) {
38: loginRequired = true;
39: bodyName = aBodyName;
40: title = aTitle;
41: }
42:
43: protected JComponent createBody() {
44: if (body == null) {
45: addPanel = new MultipleFieldsPanel(new JLabel(title));
46: addPanel.addFieldPanel("Subject",
47: subjectField = new JTextField());
48: addPanel.addFieldPanel(bodyName,
49: storyArea = new JTextArea());
50:
51: addPanel.getSubmitButton().setText("Add");
52: addPanel.getSubmitButton().addActionListener(this );
53:
54: body = new JPanel(new BorderLayout());
55: body.add(addPanel, BorderLayout.NORTH);
56: body.setName("body");
57:
58: if (WosFramework.isActive())
59: body.setLayout(new PropagateTemplateLayoutByName(
60: WosFramework
61: .getKeyPositionTemplateForName("Add")));
62: }
63:
64: body.setBackground(new Color(0xFF, 0xF9, 0xEE));
65:
66: return body;
67: }
68:
69: public JTextArea getStoryArea() {
70: return storyArea;
71: }
72:
73: public JTextField getSubjectField() {
74: return subjectField;
75: }
76:
77: public void setStoryArea(JTextArea aArea) {
78: storyArea = aArea;
79: }
80:
81: public void setSubjectField(JTextField aField) {
82: subjectField = aField;
83: }
84: }
|