Revision 33398
branches/v2_0_0_prep/libraries/libCorePlugin/src/org/gvsig/coreplugin/NotificationDialog2.jfd | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<java version="1.6.0_03" class="java.beans.XMLDecoder"> |
|
3 |
<object class="com.jformdesigner.model.FormModel"> |
|
4 |
<void property="contentType"> |
|
5 |
<string>form/swing</string> |
|
6 |
</void> |
|
7 |
<void property="root"> |
|
8 |
<object class="com.jformdesigner.model.FormRoot"> |
|
9 |
<void method="add"> |
|
10 |
<object class="com.jformdesigner.model.FormContainer"> |
|
11 |
<string>javax.swing.JPanel</string> |
|
12 |
<object class="com.jformdesigner.model.FormLayoutManager"> |
|
13 |
<class>com.jgoodies.forms.layout.FormLayout</class> |
|
14 |
<void method="setProperty"> |
|
15 |
<string>$columnSpecs</string> |
|
16 |
<string>default, labelcompgap, default</string> |
|
17 |
</void> |
|
18 |
<void method="setProperty"> |
|
19 |
<string>$rowSpecs</string> |
|
20 |
<string>default, linegap, default, linegap, default</string> |
|
21 |
</void> |
|
22 |
</object> |
|
23 |
<void property="name"> |
|
24 |
<string>this</string> |
|
25 |
</void> |
|
26 |
</object> |
|
27 |
<object class="com.jformdesigner.model.FormLayoutConstraints"> |
|
28 |
<null/> |
|
29 |
<void method="setProperty"> |
|
30 |
<string>location</string> |
|
31 |
<object class="java.awt.Point"> |
|
32 |
<int>0</int> |
|
33 |
<int>0</int> |
|
34 |
</object> |
|
35 |
</void> |
|
36 |
<void method="setProperty"> |
|
37 |
<string>size</string> |
|
38 |
<object class="java.awt.Dimension"> |
|
39 |
<int>400</int> |
|
40 |
<int>300</int> |
|
41 |
</object> |
|
42 |
</void> |
|
43 |
</object> |
|
44 |
</void> |
|
45 |
</object> |
|
46 |
</void> |
|
47 |
</object> |
|
48 |
</java> |
branches/v2_0_0_prep/libraries/libCorePlugin/src/org/gvsig/coreplugin/Consola.java | ||
---|---|---|
52 | 52 |
public class Consola extends Extension { |
53 | 53 |
static PluginServices ps; |
54 | 54 |
public static ConsolaFrame consolaFrame; |
55 |
public static NotificationDialogNew notificationDialogNew; |
|
55 | 56 |
public static NotificationDialog notificationDialog; |
56 | 57 |
|
57 | 58 |
/** |
... | ... | |
60 | 61 |
public void initialize() { |
61 | 62 |
ps = PluginServices.getPluginServices(this); |
62 | 63 |
consolaFrame = new ConsolaFrame(); |
63 |
notificationDialog= new NotificationDialog(); |
|
64 | 64 |
NotificationManager.addNotificationListener(consolaFrame); |
65 |
NotificationManager.addNotificationListener(notificationDialog); |
|
66 | 65 |
|
66 |
notificationDialogNew = new NotificationDialogNew(); |
|
67 |
NotificationManager.addNotificationListener(notificationDialogNew ); |
|
68 |
|
|
69 |
// notificationDialog= new NotificationDialog(); |
|
70 |
// NotificationManager.addNotificationListener(notificationDialog); |
|
71 |
|
|
67 | 72 |
PluginServices.getIconTheme().registerDefault( |
68 | 73 |
"application-console", |
69 | 74 |
this.getClass().getClassLoader().getResource("images/console.png") |
branches/v2_0_0_prep/libraries/libCorePlugin/src/org/gvsig/coreplugin/NotificationDialogNew.java | ||
---|---|---|
1 |
package org.gvsig.coreplugin; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.Dimension; |
|
5 |
import java.awt.FlowLayout; |
|
6 |
import java.awt.GridBagConstraints; |
|
7 |
import java.awt.GridBagLayout; |
|
8 |
import java.awt.LayoutManager; |
|
9 |
import java.awt.event.ActionEvent; |
|
10 |
import java.awt.event.ActionListener; |
|
11 |
import java.net.URL; |
|
12 |
|
|
13 |
import javax.swing.BorderFactory; |
|
14 |
import javax.swing.ImageIcon; |
|
15 |
import javax.swing.JButton; |
|
16 |
import javax.swing.JComponent; |
|
17 |
import javax.swing.JLabel; |
|
18 |
import javax.swing.JPanel; |
|
19 |
import javax.swing.JScrollPane; |
|
20 |
import javax.swing.JTextArea; |
|
21 |
import javax.swing.SwingUtilities; |
|
22 |
import javax.swing.border.Border; |
|
23 |
import javax.swing.border.TitledBorder; |
|
24 |
|
|
25 |
import org.gvsig.andami.PluginServices; |
|
26 |
import org.gvsig.andami.messages.MessageEvent; |
|
27 |
import org.gvsig.andami.messages.NotificationListener; |
|
28 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
29 |
import org.gvsig.andami.ui.mdiManager.SingletonWindow; |
|
30 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
31 |
|
|
32 |
public class NotificationDialogNew extends JPanel implements IWindow, |
|
33 |
SingletonWindow, NotificationListener { |
|
34 |
|
|
35 |
/** |
|
36 |
* |
|
37 |
*/ |
|
38 |
private static final long serialVersionUID = 4363640321917006480L; |
|
39 |
|
|
40 |
JPanelConsole console; |
|
41 |
JPanelButtons buttons; |
|
42 |
JPanelDescription description; |
|
43 |
|
|
44 |
public NotificationDialogNew() { |
|
45 |
super(); |
|
46 |
this.setLayout(new GridBagLayout()); |
|
47 |
|
|
48 |
description = new JPanelDescription(); |
|
49 |
console = new JPanelConsole(); |
|
50 |
buttons = new JPanelButtons(console); |
|
51 |
|
|
52 |
addComppnent(this, description, 0, 0, 3, 1, 1.0, 1.0, |
|
53 |
GridBagConstraints.BOTH, GridBagConstraints.CENTER); |
|
54 |
addComppnent(this, buttons, 0, 1, 3, 1, 0, 0, GridBagConstraints.NONE, |
|
55 |
GridBagConstraints.NORTHEAST); |
|
56 |
addComppnent(this, console, 0, 2, 3, 1, 1.0, 2.0, |
|
57 |
GridBagConstraints.BOTH, GridBagConstraints.CENTER); |
|
58 |
this.setVisible(true); |
|
59 |
this.hideConsole(); |
|
60 |
} |
|
61 |
|
|
62 |
void addComppnent(JPanel panel, JComponent component, int gridx, int gridy, |
|
63 |
int width, int height, double weightx, double weighty, int fill, |
|
64 |
int anchor) { |
|
65 |
GridBagConstraints constraints = new GridBagConstraints(); |
|
66 |
constraints.gridx = gridx; |
|
67 |
constraints.gridy = gridy; |
|
68 |
constraints.gridwidth = width; |
|
69 |
constraints.gridheight = height; |
|
70 |
constraints.weightx = weightx; // 1.0 se estira, 0 no. |
|
71 |
constraints.weighty = weighty; // 1.0 se estira, 0 no. |
|
72 |
constraints.fill = fill; |
|
73 |
constraints.anchor = anchor; |
|
74 |
constraints.ipadx = 2; |
|
75 |
constraints.ipady = 2; |
|
76 |
|
|
77 |
panel.add(component, constraints); |
|
78 |
component.setVisible(true); |
|
79 |
} |
|
80 |
|
|
81 |
public void setDescription(String description) { |
|
82 |
this.description.setDescription(description); |
|
83 |
} |
|
84 |
|
|
85 |
public void closeWindow() { |
|
86 |
PluginServices.getMDIManager().closeWindow(this); |
|
87 |
} |
|
88 |
|
|
89 |
public void hideConsole() { |
|
90 |
this.buttons.hideConsole(); |
|
91 |
} |
|
92 |
|
|
93 |
public void showConsole() { |
|
94 |
this.buttons.showConsole(); |
|
95 |
} |
|
96 |
|
|
97 |
class JPanelDescription extends JPanel { |
|
98 |
/** |
|
99 |
* |
|
100 |
*/ |
|
101 |
private static final long serialVersionUID = 1529755877776747074L; |
|
102 |
JTextArea description = null; |
|
103 |
JLabel image; |
|
104 |
|
|
105 |
JPanelDescription() { |
|
106 |
LayoutManager layout; |
|
107 |
Border border; |
|
108 |
|
|
109 |
layout = new GridBagLayout(); |
|
110 |
this.setLayout(layout); |
|
111 |
|
|
112 |
// border = BorderFactory.createTitledBorder("Description"); |
|
113 |
border = BorderFactory.createEmptyBorder(); |
|
114 |
this.setBorder(border); |
|
115 |
|
|
116 |
this.image = new JLabel(); |
|
117 |
URL stopurl = this.getClass().getClassLoader().getResource("images/stop.png"); |
|
118 |
this.image.setIcon(new ImageIcon(stopurl)); |
|
119 |
addComppnent(this, this.image, 0, 0, 1, 1, 0, 0, |
|
120 |
GridBagConstraints.NONE, GridBagConstraints.CENTER); |
|
121 |
|
|
122 |
this.description = new JTextArea(); |
|
123 |
this.description.setEditable(false); |
|
124 |
this.description.setOpaque(false); |
|
125 |
this.description.setText(""); |
|
126 |
JScrollPane scrollPanel = new JScrollPane(this.description); |
|
127 |
scrollPanel.setBorder(BorderFactory.createEmptyBorder()); |
|
128 |
scrollPanel.setPreferredSize(new Dimension(600, 200)); |
|
129 |
addComppnent(this, scrollPanel, 1, 0, 1, 1, 1, 1, |
|
130 |
GridBagConstraints.BOTH, GridBagConstraints.CENTER); |
|
131 |
} |
|
132 |
|
|
133 |
public String getDescription() { |
|
134 |
return this.description.getText(); |
|
135 |
} |
|
136 |
|
|
137 |
public void setDescription(String description) { |
|
138 |
this.description.setText(description); |
|
139 |
} |
|
140 |
} |
|
141 |
|
|
142 |
class JPanelButtons extends JPanel { |
|
143 |
/** |
|
144 |
* |
|
145 |
*/ |
|
146 |
private static final long serialVersionUID = 1529755877776747074L; |
|
147 |
JButton close = null; |
|
148 |
JButton showDetails = null; |
|
149 |
JButton hideDetails = null; |
|
150 |
JPanel console = null; |
|
151 |
|
|
152 |
JPanelButtons(JPanel console) { |
|
153 |
this.console = console; |
|
154 |
this.setLayout(new FlowLayout()); |
|
155 |
this.close = getCloseButton(); |
|
156 |
this.showDetails = getShowDetailsButton(); |
|
157 |
this.hideDetails = getHideDetailsButton(); |
|
158 |
this.add(this.close); |
|
159 |
this.add(this.showDetails); |
|
160 |
this.add(this.hideDetails); |
|
161 |
hideConsole(); |
|
162 |
} |
|
163 |
|
|
164 |
private JButton getCloseButton() { |
|
165 |
JButton button = new JButton( |
|
166 |
PluginServices.getText(this, "aceptar")); |
|
167 |
button.addActionListener(new ActionListener() { |
|
168 |
public void actionPerformed(ActionEvent e) { |
|
169 |
closeWindow(); |
|
170 |
} |
|
171 |
}); |
|
172 |
return button; |
|
173 |
} |
|
174 |
|
|
175 |
private JButton getShowDetailsButton() { |
|
176 |
JButton button = new JButton(PluginServices.getText(this, |
|
177 |
"detalles") + " >>>"); |
|
178 |
button.addActionListener(new ActionListener() { |
|
179 |
public void actionPerformed(ActionEvent e) { |
|
180 |
showConsole(); |
|
181 |
} |
|
182 |
}); |
|
183 |
return button; |
|
184 |
} |
|
185 |
|
|
186 |
private JButton getHideDetailsButton() { |
|
187 |
JButton button = new JButton(PluginServices.getText(this, |
|
188 |
"detalles") + " <<<"); |
|
189 |
button.addActionListener(new ActionListener() { |
|
190 |
public void actionPerformed(ActionEvent e) { |
|
191 |
hideConsole(); |
|
192 |
} |
|
193 |
}); |
|
194 |
return button; |
|
195 |
} |
|
196 |
|
|
197 |
public void hideConsole() { |
|
198 |
this.showDetails.setVisible(true); |
|
199 |
this.hideDetails.setVisible(false); |
|
200 |
this.console.setVisible(false); |
|
201 |
} |
|
202 |
|
|
203 |
public void showConsole() { |
|
204 |
this.showDetails.setVisible(false); |
|
205 |
this.hideDetails.setVisible(true); |
|
206 |
this.console.setVisible(true); |
|
207 |
} |
|
208 |
} |
|
209 |
|
|
210 |
class JPanelConsole extends JPanel { |
|
211 |
|
|
212 |
/** |
|
213 |
* |
|
214 |
*/ |
|
215 |
private static final long serialVersionUID = -6651900105647107644L; |
|
216 |
|
|
217 |
JPanelConsole() { |
|
218 |
BorderLayout layout = new BorderLayout(); |
|
219 |
this.setLayout(new BorderLayout()); |
|
220 |
TitledBorder border = BorderFactory.createTitledBorder("Console"); |
|
221 |
this.setBorder(border); |
|
222 |
this.setLayout(layout); |
|
223 |
this.add(Consola.consolaFrame, BorderLayout.CENTER); |
|
224 |
} |
|
225 |
} |
|
226 |
|
|
227 |
public Object getWindowModel() { |
|
228 |
return "notification-dialog"; |
|
229 |
} |
|
230 |
|
|
231 |
public WindowInfo getWindowInfo() { |
|
232 |
WindowInfo info = new WindowInfo(WindowInfo.MODELESSDIALOG |
|
233 |
| WindowInfo.ICONIFIABLE | WindowInfo.RESIZABLE); |
|
234 |
info.setTitle(PluginServices.getText(this, "Warning")); |
|
235 |
info.setHeight(this.getPreferredSize().height); |
|
236 |
info.setWidth(this.getPreferredSize().width); |
|
237 |
return info; |
|
238 |
} |
|
239 |
|
|
240 |
public Object getWindowProfile() { |
|
241 |
return WindowInfo.PROPERTIES_PROFILE; |
|
242 |
} |
|
243 |
|
|
244 |
public void errorEvent(MessageEvent e) { |
|
245 |
if (e.getMessages() != null) { |
|
246 |
for (int i = 0; i < e.getMessages().length; i++) { |
|
247 |
this.setDescription(e.getMessages()[i]); |
|
248 |
} |
|
249 |
} |
|
250 |
|
|
251 |
PluginServices.getMDIManager().restoreCursor(); |
|
252 |
if (SwingUtilities.isEventDispatchThread()) { |
|
253 |
PluginServices.getMDIManager().addCentredWindow(this); |
|
254 |
} else { |
|
255 |
final IWindow win = this; |
|
256 |
SwingUtilities.invokeLater(new Runnable() { |
|
257 |
public void run() { |
|
258 |
PluginServices.getMDIManager().addCentredWindow(win); |
|
259 |
} |
|
260 |
}); |
|
261 |
} |
|
262 |
} |
|
263 |
|
|
264 |
public void warningEvent(MessageEvent e) { |
|
265 |
if (e.getMessages() != null) { |
|
266 |
for (int i = 0; i < e.getMessages().length; i++) { |
|
267 |
this.setDescription(e.getMessages()[i]); |
|
268 |
} |
|
269 |
} |
|
270 |
|
|
271 |
PluginServices.getMDIManager().restoreCursor(); |
|
272 |
if (SwingUtilities.isEventDispatchThread()) { |
|
273 |
PluginServices.getMDIManager().addCentredWindow(this); |
|
274 |
} else { |
|
275 |
final IWindow win = this; |
|
276 |
SwingUtilities.invokeLater(new Runnable() { |
|
277 |
public void run() { |
|
278 |
PluginServices.getMDIManager().addCentredWindow(win); |
|
279 |
} |
|
280 |
}); |
|
281 |
} |
|
282 |
} |
|
283 |
|
|
284 |
public void infoEvent(MessageEvent e) { |
|
285 |
// Do nothing, ignore info events |
|
286 |
} |
|
287 |
|
|
288 |
} |
|
0 | 289 |
branches/v2_0_0_prep/libraries/libCorePlugin/src/org/gvsig/coreplugin/NotificationDialog.java | ||
---|---|---|
100 | 100 |
*/ |
101 | 101 |
private JButton getBDetails() { |
102 | 102 |
if (bDetails == null) { |
103 |
final IWindow win = this; |
|
103 | 104 |
bDetails = new JButton(); |
104 | 105 |
bDetails.setBounds(new java.awt.Rectangle(315, 110, 129, 24)); |
105 | 106 |
bDetails.setText(PluginServices.getText(this,"detalles") + " >>>"); |
... | ... | |
110 | 111 |
bDetails.setVisible(false); |
111 | 112 |
getDNoDetails().setVisible(true); |
112 | 113 |
PluginServices.getMDIManager() |
113 |
.getWindowInfo(NotificationDialog.this)
|
|
114 |
.getWindowInfo(win)
|
|
114 | 115 |
.setHeight(325); |
115 | 116 |
setSize(460, 325); |
116 | 117 |
} |
... | ... | |
160 | 161 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getModel() |
161 | 162 |
*/ |
162 | 163 |
public Object getWindowModel() { |
163 |
return "consola"; |
|
164 |
return "consolaOld";
|
|
164 | 165 |
} |
165 | 166 |
|
166 | 167 |
/** |
... | ... | |
188 | 189 |
if (SwingUtilities.isEventDispatchThread()) { |
189 | 190 |
PluginServices.getMDIManager().addWindow(this); |
190 | 191 |
} else { |
192 |
final IWindow win = this; |
|
191 | 193 |
SwingUtilities.invokeLater(new Runnable() { |
192 | 194 |
public void run() { |
193 |
PluginServices.getMDIManager().addWindow(NotificationDialog.this);
|
|
195 |
PluginServices.getMDIManager().addWindow(win);
|
|
194 | 196 |
} |
195 | 197 |
}); |
196 | 198 |
} |
... | ... | |
220 | 222 |
bNoDetails.setVisible(false); |
221 | 223 |
bNoDetails.setBounds(new java.awt.Rectangle(315, 110, 128, 24)); |
222 | 224 |
bNoDetails.setText("<<< " + PluginServices.getText(this,"detalles")); |
225 |
final IWindow win = this; |
|
223 | 226 |
bNoDetails.addActionListener(new java.awt.event.ActionListener() { |
224 | 227 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
225 | 228 |
bDetails.setVisible(true); |
226 | 229 |
bNoDetails.setVisible(false); |
227 | 230 |
Consola.consolaFrame.setVisible(false); |
228 | 231 |
PluginServices.getMDIManager() |
229 |
.getWindowInfo(NotificationDialog.this)
|
|
232 |
.getWindowInfo(win)
|
|
230 | 233 |
.setHeight(175); |
231 | 234 |
setSize(460, 175); |
232 | 235 |
} |
... | ... | |
243 | 246 |
*/ |
244 | 247 |
private JButton getBAcept() { |
245 | 248 |
if (bAcept == null) { |
249 |
final IWindow win = this; |
|
246 | 250 |
bAcept = new JButton(); |
247 | 251 |
bAcept.setBounds(new java.awt.Rectangle(10, 110, 296, 24)); |
248 | 252 |
bAcept.setText(PluginServices.getText(this,"aceptar")); |
249 | 253 |
bAcept.addActionListener(new java.awt.event.ActionListener() { |
250 | 254 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
251 |
PluginServices.getMDIManager().closeWindow(NotificationDialog.this);
|
|
255 |
PluginServices.getMDIManager().closeWindow(win);
|
|
252 | 256 |
} |
253 | 257 |
}); |
254 | 258 |
} |
Also available in: Unified diff