1 | /*
|
---|
2 | * 01/11/2011
|
---|
3 | *
|
---|
4 | * PopupWindowDecorator.java - Hook allowing hosting applications to decorate
|
---|
5 | * JWindows created by the AutoComplete library.
|
---|
6 | *
|
---|
7 | * This library is distributed under a modified BSD license. See the included
|
---|
8 | * RSyntaxTextArea.License.txt file for details.
|
---|
9 | */
|
---|
10 | package org.fife.ui.rsyntaxtextarea;
|
---|
11 |
|
---|
12 | import javax.swing.JWindow;
|
---|
13 |
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * A hook allowing hosting applications to decorate JWindows created by the
|
---|
17 | * AutoComplete library. For example, you could use the
|
---|
18 | * <a href="http://jgoodies.com/">JGoodies</a> library to add drop shadows
|
---|
19 | * to the windows.
|
---|
20 | *
|
---|
21 | * @author Robert Futrell
|
---|
22 | * @version 1.0
|
---|
23 | */
|
---|
24 | public abstract class PopupWindowDecorator {
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * The singleton instance of this class.
|
---|
28 | */
|
---|
29 | private static PopupWindowDecorator decorator;
|
---|
30 |
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Callback called whenever an appropriate JWindow is created by the
|
---|
34 | * AutoComplete library. Implementations can decorate the window however
|
---|
35 | * they see fit.
|
---|
36 | *
|
---|
37 | * @param window The newly-created window.
|
---|
38 | */
|
---|
39 | public abstract void decorate(JWindow window);
|
---|
40 |
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Returns the singleton instance of this class. This should only be
|
---|
44 | * called on the EDT.
|
---|
45 | *
|
---|
46 | * @return The singleton instance of this class, or <code>null</code>
|
---|
47 | * for none.
|
---|
48 | * @see #set(PopupWindowDecorator)
|
---|
49 | */
|
---|
50 | public static PopupWindowDecorator get() {
|
---|
51 | return decorator;
|
---|
52 | }
|
---|
53 |
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * Sets the singleton instance of this class. This should only be called
|
---|
57 | * on the EDT.
|
---|
58 | *
|
---|
59 | * @param decorator The new instance of this class. This may be
|
---|
60 | * <code>null</code>.
|
---|
61 | * @see #get()
|
---|
62 | */
|
---|
63 | public static void set(PopupWindowDecorator decorator) {
|
---|
64 | PopupWindowDecorator.decorator = decorator;
|
---|
65 | }
|
---|
66 |
|
---|
67 |
|
---|
68 | } |
---|