1 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 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 [] data) 55 { 56 lists.setAuthors(data); 57 } 58 59 public void setNotes(Object [] data) 60 { 61 lists.setNotes(data); 62 } 63 64 public String getAuthor() 65 { 66 return lists.getAuthor(); 67 } 68 69 public Note getNote() 70 { 71 return lists.getNote(); 72 } 73 74 public void setNoteContent(String 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 [] data) 92 { 93 content.setComments(data); 94 } 95 96 public Comment getComment() 97 { 98 return content.getComment(); 99 } 100 } 101 | Popular Tags |