01: /*
02: * Lucane - a collaborative platform
03: * Copyright (C) 2003 Vincent Fiack <vfiack@mail15.com>
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: */
19:
20: package org.lucane.applications.notes.gui.main;
21:
22: import java.awt.*;
23:
24: import org.lucane.applications.notes.*;
25: import org.lucane.client.*;
26: import org.lucane.client.util.PluginExitWindowListener;
27: import org.lucane.client.widgets.ManagedWindow;
28:
29: public class MainFrame extends ManagedWindow {
30: private TopListPanel lists;
31: private MainPanel content;
32:
33: public MainFrame(NotesPlugin parent) {
34: //panel config
35: super (parent, parent.getTitle());
36: this .getContentPane().setLayout(new BorderLayout(0, 5));
37: setPreferredSize(new Dimension(600, 400));
38:
39: MyListSelectionListener mlsl = new MyListSelectionListener(
40: parent, this );
41: MyActionListener mal = new MyActionListener(parent, this );
42: MyMouseListener mml = new MyMouseListener(parent, this );
43:
44: this .lists = new TopListPanel(parent, mlsl);
45: this .content = new MainPanel(parent, mal, mml);
46:
47: this .getContentPane().add(lists, BorderLayout.NORTH);
48: this .getContentPane().add(content, BorderLayout.CENTER);
49:
50: this .addWindowListener(new PluginExitWindowListener(parent));
51: }
52:
53: public void setAuthors(Object[] data) {
54: lists.setAuthors(data);
55: }
56:
57: public void setNotes(Object[] data) {
58: lists.setNotes(data);
59: }
60:
61: public String getAuthor() {
62: return lists.getAuthor();
63: }
64:
65: public Note getNote() {
66: return lists.getNote();
67: }
68:
69: public void setNoteContent(String txt) {
70: if (txt != null) {
71: Note n = getNote();
72: content.allowComments(n.isCommentable());
73: content.allowEdition(n.getAuthor().equals(
74: Client.getInstance().getMyInfos().getName()));
75: content.setNoteContent(txt);
76: } else {
77: content.allowComments(false);
78: content.allowEdition(false);
79: content.setNoteContent("");
80: }
81: }
82:
83: public void setComments(Object[] data) {
84: content.setComments(data);
85: }
86:
87: public Comment getComment() {
88: return content.getComment();
89: }
90: }
|