1 /*
2 * Dictionary port to Java
3 * Copyright (C) 2000 Kaloian Doganov
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program 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
13 * GNU General Public License for more details.
14
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 package net.sourceforge.dictport.plugin;
20
21 import org.gjt.sp.jedit;
22 import org.gjt.sp.jedit.gui;
23 import javax.swing;
24 import java.awt;
25 import java.awt.event.ActionEvent;
26 import java.awt.event.ActionListener;
27 import net.sourceforge.dictport;
28 import net.sourceforge.dictport.ui;
29
30 /**
31 * Dockable dictionary panel.
32 *
33 * @author Kaloian Doganov <kaloian@europe.com>
34 */
35 public final class DictDockable extends JPanel implements DockableWindow {
36
37 private Dict fDict;
38
39 public DictDockable(DatabaseRegistry aRegistry) {
40 super(new BorderLayout());
41 fDict = new Dict(aRegistry, new UserPrefsModel(new jEditProperties()),
42 true/*plugin mode*/);
43 fDict.setPrefsActionListener(new PreferencesModifiedHandler());
44 add(fDict, "Center");
45 }
46
47 public Dict getDict() {
48 return fDict;
49 }
50
51 // begin DockableWindow implementation
52 public String getName() {
53 return DictportPlugin.NAME;
54 }
55
56 public Component getComponent() {
57 return this;
58 }
59
60 /**
61 * Handle modified preferences from Dict's OptionsDialog (but not modified
62 * from jEdit's Global Options Dialog).
63 */
64 private class PreferencesModifiedHandler implements ActionListener {
65
66 public void actionPerformed(ActionEvent aEvent) {
67 DictportPlugin.propagatePreferences(fDict.getPreferences());
68 }
69 }
70 // end DockableWindow implementation
71 }