1 19 20 package org.lucane.applications.notes.gui.main; 21 22 import java.awt.*; 23 import java.awt.event.*; 24 25 import org.lucane.client.widgets.*; 26 import org.lucane.applications.notes.*; 27 import org.lucane.applications.notes.gui.comment.CommentFrame; 28 import org.lucane.applications.notes.gui.note.NoteFrame; 29 30 class MyActionListener implements ActionListener 31 { 32 private NotesPlugin plugin; 33 private MainFrame parent; 34 35 public MyActionListener(NotesPlugin plugin, MainFrame parent) 36 { 37 this.plugin = plugin; 38 this.parent = parent; 39 } 40 41 public void actionPerformed(ActionEvent ae) 42 { 43 Component source = (Component)ae.getSource(); 44 String sourceName = source.getName(); 45 46 if (sourceName.equals("newNote")) 47 { 48 new NoteFrame(plugin).show(); 49 } 50 else if (sourceName.equals("editNote")) 51 { 52 Note note = parent.getNote(); 53 new NoteFrame(plugin, note).show(); 54 } 55 else if(sourceName.equals("removeNote")) 56 { 57 boolean remove = DialogBox.question(plugin.tr("main.removeNoteTitle"), plugin.tr("main.removeNoteMessage")); 58 if(remove) 59 { 60 Note note = parent.getNote(); 61 plugin.removeNote(note.getId()); 62 } 63 } 64 else if(sourceName.equals("addComment")) 65 { 66 new CommentFrame(plugin, parent.getNote()).show(); 67 } 68 else if(sourceName.equals("close")) 69 { 70 parent.dispose(); 71 plugin.exit(); 72 } 73 } 74 } | Popular Tags |