KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lucane > applications > notes > gui > main > MainFrame


1 /*
2  * Lucane - a collaborative platform
3  * Copyright (C) 2003 Vincent Fiack <vfiack@mail15.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
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 {
31     private TopListPanel lists;
32     private MainPanel content;
33     
34     public MainFrame(NotesPlugin parent)
35     {
36         //panel config
37
super(parent, parent.getTitle());
38         this.getContentPane().setLayout(new BorderLayout(0, 5));
39         setPreferredSize(new Dimension(600, 400));
40
41         MyListSelectionListener mlsl = new MyListSelectionListener(parent, this);
42         MyActionListener mal = new MyActionListener(parent, this);
43         MyMouseListener mml = new MyMouseListener(parent, this);
44         
45         this.lists = new TopListPanel(parent, mlsl);
46         this.content = new MainPanel(parent, mal, mml);
47         
48         this.getContentPane().add(lists, BorderLayout.NORTH);
49         this.getContentPane().add(content, BorderLayout.CENTER);
50
51          this.addWindowListener(new PluginExitWindowListener(parent));
52     }
53     
54     public void setAuthors(Object JavaDoc[] data)
55     {
56         lists.setAuthors(data);
57     }
58     
59     public void setNotes(Object JavaDoc[] data)
60     {
61         lists.setNotes(data);
62     }
63     
64     public String JavaDoc getAuthor()
65     {
66         return lists.getAuthor();
67     }
68     
69     public Note getNote()
70     {
71         return lists.getNote();
72     }
73     
74     public void setNoteContent(String JavaDoc txt)
75     {
76         if(txt != null)
77          {
78              Note n = getNote();
79              content.allowComments(n.isCommentable());
80              content.allowEdition(n.getAuthor().equals(Client.getInstance().getMyInfos().getName()));
81              content.setNoteContent(txt);
82          }
83          else
84           {
85               content.allowComments(false);
86               content.allowEdition(false);
87               content.setNoteContent("");
88           }
89     }
90     
91     public void setComments(Object JavaDoc[] data)
92     {
93         content.setComments(data);
94     }
95     
96     public Comment getComment()
97     {
98         return content.getComment();
99     }
100 }
101
Popular Tags