|
@@ -25,7 +25,6 @@ package com.dmdirc;
|
25
|
25
|
import com.dmdirc.identities.ConfigManager;
|
26
|
26
|
import com.dmdirc.logger.ErrorLevel;
|
27
|
27
|
import com.dmdirc.logger.Logger;
|
28
|
|
-import com.dmdirc.ui.interfaces.InputWindow;
|
29
|
28
|
import com.dmdirc.ui.MainFrame;
|
30
|
29
|
import com.dmdirc.ui.interfaces.Window;
|
31
|
30
|
|
|
@@ -33,16 +32,14 @@ import java.awt.Color;
|
33
|
32
|
import java.beans.PropertyVetoException;
|
34
|
33
|
|
35
|
34
|
import javax.swing.ImageIcon;
|
36
|
|
-import javax.swing.event.InternalFrameEvent;
|
37
|
|
-import javax.swing.event.InternalFrameListener;
|
38
|
35
|
|
39
|
36
|
/**
|
40
|
37
|
* The frame container implements basic methods that should be present in
|
41
|
38
|
* all objects that handle a frame.
|
42
|
|
- *
|
|
39
|
+ *
|
43
|
40
|
* @author chris
|
44
|
41
|
*/
|
45
|
|
-public abstract class FrameContainer implements InternalFrameListener {
|
|
42
|
+public abstract class FrameContainer {
|
46
|
43
|
|
47
|
44
|
/** The colour of our frame's notifications. */
|
48
|
45
|
protected Color notification = Color.BLACK;
|
|
@@ -52,13 +49,14 @@ public abstract class FrameContainer implements InternalFrameListener {
|
52
|
49
|
|
53
|
50
|
/**
|
54
|
51
|
* Returns the internal frame associated with this object.
|
55
|
|
- *
|
|
52
|
+ *
|
56
|
53
|
* @return The internal frame associated with this object
|
57
|
54
|
*/
|
58
|
55
|
public abstract Window getFrame();
|
59
|
56
|
|
60
|
57
|
/**
|
61
|
58
|
* Returns a string identifier for this object/its frame.
|
|
59
|
+ *
|
62
|
60
|
* @return String identifier
|
63
|
61
|
*/
|
64
|
62
|
public abstract String toString();
|
|
@@ -70,12 +68,14 @@ public abstract class FrameContainer implements InternalFrameListener {
|
70
|
68
|
|
71
|
69
|
/**
|
72
|
70
|
* Returns the server instance associated with this container.
|
|
71
|
+ *
|
73
|
72
|
* @return the associated server connection
|
74
|
73
|
*/
|
75
|
74
|
public abstract Server getServer();
|
76
|
75
|
|
77
|
76
|
/**
|
78
|
77
|
* Retrieves the icon used by the query frame.
|
|
78
|
+ *
|
79
|
79
|
* @return The query frame's icon
|
80
|
80
|
*/
|
81
|
81
|
public ImageIcon getIcon() {
|
|
@@ -84,6 +84,7 @@ public abstract class FrameContainer implements InternalFrameListener {
|
84
|
84
|
|
85
|
85
|
/**
|
86
|
86
|
* Returns the config manager for this container.
|
|
87
|
+ *
|
87
|
88
|
* @return the associated config manager
|
88
|
89
|
*/
|
89
|
90
|
public ConfigManager getConfigManager() {
|
|
@@ -107,6 +108,7 @@ public abstract class FrameContainer implements InternalFrameListener {
|
107
|
108
|
|
108
|
109
|
/**
|
109
|
110
|
* Sends a notification to the frame manager if this fame isn't active.
|
|
111
|
+ *
|
110
|
112
|
* @param colour The colour to use for the notification
|
111
|
113
|
*/
|
112
|
114
|
public void sendNotification(final Color colour) {
|
|
@@ -119,6 +121,7 @@ public abstract class FrameContainer implements InternalFrameListener {
|
119
|
121
|
|
120
|
122
|
/**
|
121
|
123
|
* Retrieves the current notification colour of this channel.
|
|
124
|
+ *
|
122
|
125
|
* @return This channel's notification colour
|
123
|
126
|
*/
|
124
|
127
|
public Color getNotification() {
|
|
@@ -127,6 +130,7 @@ public abstract class FrameContainer implements InternalFrameListener {
|
127
|
130
|
|
128
|
131
|
/**
|
129
|
132
|
* Determines if the specified frame is owned by this object.
|
|
133
|
+ *
|
130
|
134
|
* @param target Window to check ownership of
|
131
|
135
|
* @return True iff frame is owned by this container, false otherwise
|
132
|
136
|
*/
|
|
@@ -135,10 +139,9 @@ public abstract class FrameContainer implements InternalFrameListener {
|
135
|
139
|
}
|
136
|
140
|
|
137
|
141
|
/**
|
138
|
|
- * Invoked when a internal frame has been opened.
|
139
|
|
- * @param internalFrameEvent frame opened event
|
|
142
|
+ * Invoked when our window has been opened.
|
140
|
143
|
*/
|
141
|
|
- public void internalFrameOpened(final InternalFrameEvent internalFrameEvent) {
|
|
144
|
+ public void windowOpened() {
|
142
|
145
|
final boolean pref = getServer().getConfigManager().getOptionBool("ui", "maximisewindows");
|
143
|
146
|
if (pref || MainFrame.getMainFrame().getMaximised()) {
|
144
|
147
|
try {
|
|
@@ -150,42 +153,23 @@ public abstract class FrameContainer implements InternalFrameListener {
|
150
|
153
|
}
|
151
|
154
|
|
152
|
155
|
/**
|
153
|
|
- * Invoked when an internal frame is in the process of being closed.
|
154
|
|
- * @param internalFrameEvent frame closing event
|
|
156
|
+ * Invoked when our window is closing.
|
155
|
157
|
*/
|
156
|
|
- public void internalFrameClosing(final InternalFrameEvent internalFrameEvent) {
|
|
158
|
+ public void windowClosing() {
|
157
|
159
|
close();
|
158
|
160
|
}
|
159
|
161
|
|
160
|
162
|
/**
|
161
|
|
- * Invoked when an internal frame has been closed.
|
162
|
|
- * @param internalFrameEvent frame closed event
|
163
|
|
- */
|
164
|
|
- public void internalFrameClosed(final InternalFrameEvent internalFrameEvent) {
|
165
|
|
- //Ignore.
|
166
|
|
- }
|
167
|
|
-
|
168
|
|
- /**
|
169
|
|
- * Invoked when an internal frame is iconified.
|
170
|
|
- * @param internalFrameEvent frame iconified event
|
171
|
|
- */
|
172
|
|
- public void internalFrameIconified(final InternalFrameEvent internalFrameEvent) {
|
173
|
|
- //Ignore.
|
174
|
|
- }
|
175
|
|
-
|
176
|
|
- /**
|
177
|
|
- * Invoked when an internal frame is de-iconified.
|
178
|
|
- * @param internalFrameEvent frame deiconified event
|
|
163
|
+ * Invoked when our window has been closed.
|
179
|
164
|
*/
|
180
|
|
- public void internalFrameDeiconified(final InternalFrameEvent internalFrameEvent) {
|
181
|
|
- //Ignore.
|
|
165
|
+ public void windowClosed() {
|
|
166
|
+ // Ignore.
|
182
|
167
|
}
|
183
|
168
|
|
184
|
169
|
/**
|
185
|
|
- * Invoked when an internal frame is activated.
|
186
|
|
- * @param internalFrameEvent frame activation event
|
|
170
|
+ * Invoked when our window is activated.
|
187
|
171
|
*/
|
188
|
|
- public void internalFrameActivated(final InternalFrameEvent internalFrameEvent) {
|
|
172
|
+ public void windowActivated() {
|
189
|
173
|
if (MainFrame.getMainFrame().getMaximised()) {
|
190
|
174
|
try {
|
191
|
175
|
getFrame().setMaximum(true);
|
|
@@ -199,11 +183,10 @@ public abstract class FrameContainer implements InternalFrameListener {
|
199
|
183
|
}
|
200
|
184
|
|
201
|
185
|
/**
|
202
|
|
- * Invoked when an internal frame is de-activated.
|
203
|
|
- * @param internalFrameEvent frame deactivation event
|
|
186
|
+ * Invoked when our window is deactivated.
|
204
|
187
|
*/
|
205
|
|
- public void internalFrameDeactivated(final InternalFrameEvent internalFrameEvent) {
|
206
|
|
- //Ignore.
|
|
188
|
+ public void windowDeactivated() {
|
|
189
|
+ // Do nothing.
|
207
|
190
|
}
|
208
|
191
|
|
209
|
192
|
}
|