Revision 34482
branches/v2_0_0_prep/frameworks/_fwAndami/src/org/gvsig/andami/ui/mdiFrame/MDIFrame.java | ||
---|---|---|
78 | 78 |
import javax.swing.MenuElement; |
79 | 79 |
import javax.swing.SwingUtilities; |
80 | 80 |
import javax.swing.Timer; |
81 |
import javax.swing.WindowConstants; |
|
81 | 82 |
|
82 | 83 |
import org.apache.log4j.Logger; |
84 |
|
|
83 | 85 |
import org.gvsig.andami.Launcher; |
84 | 86 |
import org.gvsig.andami.PluginServices; |
85 | 87 |
import org.gvsig.andami.messages.Messages; |
... | ... | |
97 | 99 |
import org.gvsig.andami.ui.mdiManager.MDIManagerFactory; |
98 | 100 |
import org.gvsig.gui.beans.controls.IControl; |
99 | 101 |
|
100 |
|
|
101 |
|
|
102 | 102 |
/** |
103 | 103 |
* Main application window. |
104 |
* |
|
104 |
*
|
|
105 | 105 |
* @version $Revision$ |
106 | 106 |
*/ |
107 | 107 |
public class MDIFrame extends JFrame implements ComponentListener, |
108 |
ContainerListener, ActionListener, MainFrame { |
|
109 |
/** DOCUMENT ME! */ |
|
110 |
private static Logger logger = Logger.getLogger(MDIFrame.class.getName()); |
|
111 |
private MDIManager mdiManager = MDIManagerFactory.createManager(); |
|
108 |
ContainerListener, ActionListener, MainFrame { |
|
112 | 109 |
|
113 |
/** Elementos de la aplicaci�n */ |
|
114 |
private JMenuBar menuBar = new JMenuBar(); |
|
110 |
private static final long serialVersionUID = -2472484309160847654L; |
|
115 | 111 |
|
116 |
/** Panel which contains the toolbars */ |
|
117 |
private JPanel toolBars = new JPanel(); |
|
112 |
/** DOCUMENT ME! */ |
|
113 |
private static Logger logger = Logger.getLogger(MDIFrame.class.getName()); |
|
114 |
private MDIManager mdiManager = MDIManagerFactory.createManager(); |
|
118 | 115 |
|
119 |
/** Status bar */
|
|
120 |
private NewStatusBar bEstado = null;
|
|
116 |
/** Elementos de la aplicaci�n */
|
|
117 |
private JMenuBar menuBar = new JMenuBar();
|
|
121 | 118 |
|
122 |
/** Asocia los nombres con las barras de herramientas */
|
|
123 |
private HashMap toolBarMap = new HashMap();
|
|
119 |
/** Panel which contains the toolbars */
|
|
120 |
private JPanel toolBars = new JPanel();
|
|
124 | 121 |
|
125 |
/** Almacena los grupos de selectableTools */ |
|
126 |
private HashMap buttonGroupMap = new HashMap(); |
|
127 |
/** |
|
128 |
* Stores the initially selected tools. |
|
122 |
/** Status bar */ |
|
123 |
private NewStatusBar bEstado = null; |
|
124 |
|
|
125 |
/** Asocia los nombres con las barras de herramientas */ |
|
126 |
private HashMap toolBarMap = new HashMap(); |
|
127 |
|
|
128 |
/** Almacena los grupos de selectableTools */ |
|
129 |
private HashMap buttonGroupMap = new HashMap(); |
|
130 |
/** |
|
131 |
* Stores the initially selected tools. |
|
129 | 132 |
* It contains pairs (String groupName, JToolBarToggleButton button) |
130 |
*/
|
|
131 |
private HashMap initialSelectedTools = new HashMap();
|
|
133 |
*/
|
|
134 |
private HashMap initialSelectedTools = new HashMap();
|
|
132 | 135 |
|
133 | 136 |
/** |
134 | 137 |
* Stores the actionCommand of the selected tool, for each group. |
... | ... | |
138 | 141 |
// this should be the same value defined at plugin-config.xsd |
139 | 142 |
private String defaultGroup = "unico"; |
140 | 143 |
|
141 |
/** Asocia los nombres con los popupMenus */
|
|
142 |
private HashMap popupMap = new HashMap();
|
|
144 |
/** Asocia los nombres con los popupMenus */
|
|
145 |
private HashMap popupMap = new HashMap();
|
|
143 | 146 |
|
144 |
/** Asocia controles con la clase de la extension asociada */
|
|
145 |
private HashMap controlClass = new HashMap();
|
|
147 |
/** Asocia controles con la clase de la extension asociada */
|
|
148 |
private HashMap controlClass = new HashMap();
|
|
146 | 149 |
|
147 |
/**
|
|
148 |
* Asocia la informaci�n sobre las etiquetas que van en la status bar con
|
|
149 |
* cada extension
|
|
150 |
*/
|
|
151 |
private HashMap classLabels = new HashMap();
|
|
150 |
/**
|
|
151 |
* Asocia la informaci�n sobre las etiquetas que van en la status bar con
|
|
152 |
* cada extension
|
|
153 |
*/
|
|
154 |
private HashMap classLabels = new HashMap();
|
|
152 | 155 |
|
153 |
//private HashMap classControls = new HashMap();
|
|
156 |
// private HashMap classControls = new HashMap();
|
|
154 | 157 |
|
155 |
/** ProgressListeners (ver interfaz com.iver.mdiApp.ui.ProgressListener) */
|
|
156 |
private ArrayList progressListeners = new ArrayList();
|
|
158 |
/** ProgressListeners (ver interfaz com.iver.mdiApp.ui.ProgressListener) */
|
|
159 |
private ArrayList progressListeners = new ArrayList();
|
|
157 | 160 |
|
158 |
/** Timer para invocar los enventos de la interfaz anterior */
|
|
159 |
private Timer progressTimer = null;
|
|
161 |
/** Timer para invocar los enventos de la interfaz anterior */
|
|
162 |
private Timer progressTimer = null;
|
|
160 | 163 |
|
161 |
/** Tabla hash que asocia las clases con las extensiones */
|
|
162 |
private HashMap classesExtensions = new HashMap();
|
|
164 |
/** Tabla hash que asocia las clases con las extensiones */
|
|
165 |
private HashMap classesExtensions = new HashMap();
|
|
163 | 166 |
|
164 |
/** �ltima clase que activ� etiquetas */
|
|
165 |
private Class lastLabelClass;
|
|
167 |
/** �ltima clase que activ� etiquetas */
|
|
168 |
private Class lastLabelClass;
|
|
166 | 169 |
|
167 |
/** Instancia que pone los tooltip en la barra de estado */
|
|
168 |
private TooltipListener tooltipListener = new TooltipListener();
|
|
169 |
private HashMap infoCodedMenus = new HashMap();
|
|
170 |
/** Instancia que pone los tooltip en la barra de estado */
|
|
171 |
private TooltipListener tooltipListener = new TooltipListener();
|
|
172 |
private HashMap infoCodedMenus = new HashMap();
|
|
170 | 173 |
|
171 |
private String titlePrefix;
|
|
174 |
private String titlePrefix;
|
|
172 | 175 |
|
173 |
private static final String noIcon = "no-icon";
|
|
176 |
private static final String noIcon = "no-icon";
|
|
174 | 177 |
|
175 |
/** |
|
176 |
* Makes some initialization tasks. |
|
177 |
* |
|
178 |
* @throws RuntimeException DOCUMENT ME! |
|
179 |
*/ |
|
180 |
public void init() { |
|
181 |
JPopupMenu.setDefaultLightWeightPopupEnabled(false); |
|
182 |
if (!SwingUtilities.isEventDispatchThread()) { |
|
183 |
throw new RuntimeException("Not Event Dispatch Thread"); |
|
184 |
} |
|
178 |
/** |
|
179 |
* Makes some initialization tasks. |
|
180 |
* |
|
181 |
* @throws RuntimeException |
|
182 |
* DOCUMENT ME! |
|
183 |
*/ |
|
184 |
public void init() { |
|
185 |
JPopupMenu.setDefaultLightWeightPopupEnabled(false); |
|
186 |
if (!SwingUtilities.isEventDispatchThread()) { |
|
187 |
throw new RuntimeException("Not Event Dispatch Thread"); |
|
188 |
} |
|
185 | 189 |
|
186 |
//Se a�aden los listeners del JFrame |
|
187 |
this.addWindowListener(new WindowAdapter() { |
|
188 |
public void windowClosing(WindowEvent e) { |
|
189 |
Launcher.closeApplication(); |
|
190 |
} |
|
191 |
}); |
|
192 |
this.addComponentListener(this); |
|
193 |
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); |
|
190 |
// Se a�aden los listeners del JFrame |
|
191 |
this.addWindowListener(new WindowAdapter() { |
|
194 | 192 |
|
195 |
//Se configura la barra de menu |
|
196 |
setJMenuBar(menuBar); |
|
193 |
@Override |
|
194 |
public void windowClosing(WindowEvent e) { |
|
195 |
Launcher.closeApplication(); |
|
196 |
} |
|
197 |
}); |
|
198 |
this.addComponentListener(this); |
|
199 |
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
|
197 | 200 |
|
198 |
//Se configura el layout del JFrame principal
|
|
199 |
this.getContentPane().setLayout(new BorderLayout());
|
|
201 |
// Se configura la barra de menu
|
|
202 |
setJMenuBar(menuBar);
|
|
200 | 203 |
|
201 |
/* |
|
202 |
* Se configura y se a�ade el JPanel de las barras de |
|
203 |
* herramientas |
|
204 |
*/ |
|
205 |
FlowLayout layout = new FlowLayout(FlowLayout.LEFT); |
|
206 |
layout.setHgap(0); |
|
207 |
layout.setVgap(0); |
|
208 |
toolBars.setLayout(layout); |
|
209 |
getContentPane().add(toolBars, BorderLayout.PAGE_START); |
|
204 |
// Se configura el layout del JFrame principal |
|
205 |
this.getContentPane().setLayout(new BorderLayout()); |
|
210 | 206 |
|
211 |
// Se a�ade la barra de estado a la aplicaci�n |
|
212 |
bEstado = new NewStatusBar(); |
|
213 |
bEstado.setInfoText(Messages.getString("StatusBar.Aplicacion_iniciada")); |
|
214 |
getContentPane().add(bEstado, BorderLayout.SOUTH); |
|
207 |
/* |
|
208 |
* Se configura y se a�ade el JPanel de las barras de |
|
209 |
* herramientas |
|
210 |
*/ |
|
211 |
FlowLayout layout = new FlowLayout(FlowLayout.LEFT); |
|
212 |
layout.setHgap(0); |
|
213 |
layout.setVgap(0); |
|
214 |
toolBars.setLayout(layout); |
|
215 |
getContentPane().add(toolBars, BorderLayout.PAGE_START); |
|
215 | 216 |
|
216 |
this.toolBars.addContainerListener(this); |
|
217 |
// Se a�ade la barra de estado a la aplicaci�n |
|
218 |
bEstado = new NewStatusBar(); |
|
219 |
bEstado |
|
220 |
.setInfoText(Messages.getString("StatusBar.Aplicacion_iniciada")); |
|
221 |
getContentPane().add(bEstado, BorderLayout.SOUTH); |
|
217 | 222 |
|
218 |
pack();
|
|
223 |
this.toolBars.addContainerListener(this);
|
|
219 | 224 |
|
220 |
// TODO LWS Aqui deber�a cargar los valores salvados de la �ltima ejecuci�n. |
|
221 |
setSize(700, 580); |
|
222 |
setLocation(10,10); |
|
223 |
setExtendedState(MAXIMIZED_BOTH); |
|
225 |
pack(); |
|
224 | 226 |
|
225 |
mdiManager.init(this); |
|
226 |
} |
|
227 |
// TODO LWS Aqui deber�a cargar los valores salvados de la �ltima |
|
228 |
// ejecuci�n. |
|
229 |
setSize(700, 580); |
|
230 |
setLocation(10, 10); |
|
231 |
setExtendedState(MAXIMIZED_BOTH); |
|
227 | 232 |
|
228 |
/* |
|
229 |
* (non-javadoc) |
|
230 |
* @see java.awt.Frame.setTitle(String title) |
|
231 |
*/ |
|
232 |
public void setTitle(String title) { |
|
233 |
super.setTitle(titlePrefix + ":" + title); |
|
234 |
} |
|
233 |
mdiManager.init(this); |
|
234 |
} |
|
235 | 235 |
|
236 |
/** |
|
237 |
* A�ade un modo de operaci�n a la caja de herramientas |
|
238 |
* |
|
239 |
* @param ext Texto del boton, si es null no aparece texto |
|
240 |
* @param ext Icono del boton, si es null no aparece icono |
|
241 |
* @param ext Extensi�n asociada al control |
|
242 |
* @param selectableTool Enable text del control |
|
243 |
* |
|
244 |
* @throws ClassNotFoundException |
|
245 |
* @throws RuntimeException DOCUMENT ME! |
|
246 |
*/ |
|
247 |
public void addTool(PluginClassLoader loader, SkinExtensionType ext, |
|
248 |
ToolBar toolBar, SelectableTool selectableTool) |
|
249 |
throws ClassNotFoundException { |
|
250 |
if (!SwingUtilities.isEventDispatchThread()) { |
|
251 |
throw new RuntimeException("No Event Dispatch Thread"); |
|
252 |
} |
|
236 |
/* |
|
237 |
* (non-javadoc) |
|
238 |
* |
|
239 |
* @see java.awt.Frame.setTitle(String title) |
|
240 |
*/ |
|
241 |
@Override |
|
242 |
public void setTitle(String title) { |
|
243 |
super.setTitle(titlePrefix + ":" + title); |
|
244 |
} |
|
253 | 245 |
|
254 |
// Para traducir |
|
255 |
PluginServices ps = PluginServices.getPluginServices(loader.getPluginName()); |
|
246 |
/** |
|
247 |
* A�ade un modo de operaci�n a la caja de herramientas |
|
248 |
* |
|
249 |
* @param ext |
|
250 |
* Texto del boton, si es null no aparece texto |
|
251 |
* @param ext |
|
252 |
* Icono del boton, si es null no aparece icono |
|
253 |
* @param ext |
|
254 |
* Extensi�n asociada al control |
|
255 |
* @param selectableTool |
|
256 |
* Enable text del control |
|
257 |
* |
|
258 |
* @throws ClassNotFoundException |
|
259 |
* @throws RuntimeException |
|
260 |
* DOCUMENT ME! |
|
261 |
*/ |
|
262 |
public void addTool(PluginClassLoader loader, SkinExtensionType ext, |
|
263 |
ToolBar toolBar, SelectableTool selectableTool) |
|
264 |
throws ClassNotFoundException { |
|
265 |
if (!SwingUtilities.isEventDispatchThread()) { |
|
266 |
throw new RuntimeException("No Event Dispatch Thread"); |
|
267 |
} |
|
256 | 268 |
|
257 |
JToolBarToggleButton btn; |
|
258 |
ImageIcon image = PluginServices.getIconTheme().get(selectableTool.getIcon()); |
|
269 |
// Para traducir |
|
270 |
PluginServices ps = |
|
271 |
PluginServices.getPluginServices(loader.getPluginName()); |
|
259 | 272 |
|
260 |
if (image != null) { |
|
261 |
btn = new JToolBarToggleButton(selectableTool.getText(), image); |
|
262 |
} else { |
|
263 |
logger.error(PluginServices.getText(this, "Unable_to_find_icon") +": "+selectableTool.getIcon()); |
|
264 |
btn = new JToolBarToggleButton(selectableTool.getText(), |
|
265 |
PluginServices.getIconTheme().get(noIcon)); |
|
266 |
} |
|
273 |
JToolBarToggleButton btn; |
|
274 |
ImageIcon image = |
|
275 |
PluginServices.getIconTheme().get(selectableTool.getIcon()); |
|
267 | 276 |
|
268 |
org.gvsig.andami.ui.mdiFrame.ToggleButtonModel buttonModel = new org.gvsig.andami.ui.mdiFrame.ToggleButtonModel(); |
|
269 |
btn.setModel(buttonModel); |
|
270 |
btn.setMargin(new Insets(0, 0, 0, 0)); |
|
271 |
btn.addMouseListener(tooltipListener); |
|
272 |
btn.addActionListener(this); |
|
273 |
btn.setFocusable(false); |
|
274 |
btn.setActionCommand(selectableTool.getActionCommand()); |
|
275 |
btn.setToolTipText(selectableTool.getTooltip()); |
|
276 |
btn.setEnabled(false); |
|
277 |
btn.setVisible(false); |
|
278 |
String name = toolBar.getName(); |
|
277 |
if (image != null) { |
|
278 |
btn = new JToolBarToggleButton(selectableTool.getText(), image); |
|
279 |
} else { |
|
280 |
logger.error(PluginServices.getText(this, "Unable_to_find_icon") |
|
281 |
+ ": " + selectableTool.getIcon()); |
|
282 |
btn = |
|
283 |
new JToolBarToggleButton(selectableTool.getText(), |
|
284 |
PluginServices.getIconTheme().get(noIcon)); |
|
285 |
} |
|
279 | 286 |
|
280 |
SelectableToolBar jtb = (SelectableToolBar) toolBarMap.get(name); |
|
287 |
org.gvsig.andami.ui.mdiFrame.ToggleButtonModel buttonModel = |
|
288 |
new org.gvsig.andami.ui.mdiFrame.ToggleButtonModel(); |
|
289 |
btn.setModel(buttonModel); |
|
290 |
btn.setMargin(new Insets(0, 0, 0, 0)); |
|
291 |
btn.addMouseListener(tooltipListener); |
|
292 |
btn.addActionListener(this); |
|
293 |
btn.setFocusable(false); |
|
294 |
btn.setActionCommand(selectableTool.getActionCommand()); |
|
295 |
btn.setToolTipText(selectableTool.getTooltip()); |
|
296 |
btn.setEnabled(false); |
|
297 |
btn.setVisible(false); |
|
298 |
String name = toolBar.getName(); |
|
281 | 299 |
|
282 |
if (jtb == null) { |
|
283 |
jtb = new SelectableToolBar(name); |
|
284 |
jtb.setRollover(true); |
|
285 |
jtb.setAndamiVisibility(toolBar.getIsVisible()); |
|
286 |
toolBarMap.put(name, jtb); |
|
287 |
toolBars.add(jtb); |
|
288 |
} |
|
300 |
SelectableToolBar jtb = (SelectableToolBar) toolBarMap.get(name); |
|
289 | 301 |
|
290 |
ButtonGroup group;
|
|
291 |
if (buttonGroupMap.containsKey(selectableTool.getGroup())) {
|
|
292 |
group = (ButtonGroup) buttonGroupMap.get(selectableTool.getGroup());
|
|
293 |
}
|
|
294 |
else {
|
|
295 |
group = new ButtonGroup();
|
|
296 |
buttonGroupMap.put(selectableTool.getGroup(), group);
|
|
302 |
if (jtb == null) {
|
|
303 |
jtb = new SelectableToolBar(name);
|
|
304 |
jtb.setRollover(true);
|
|
305 |
jtb.setAndamiVisibility(toolBar.getIsVisible());
|
|
306 |
toolBarMap.put(name, jtb);
|
|
307 |
toolBars.add(jtb);
|
|
308 |
}
|
|
297 | 309 |
|
298 |
} |
|
299 |
jtb.addButton(group, btn); |
|
300 |
buttonModel.setGroupName(selectableTool.getGroup()); |
|
310 |
ButtonGroup group; |
|
311 |
if (buttonGroupMap.containsKey(selectableTool.getGroup())) { |
|
312 |
group = (ButtonGroup) buttonGroupMap.get(selectableTool.getGroup()); |
|
313 |
} else { |
|
314 |
group = new ButtonGroup(); |
|
315 |
buttonGroupMap.put(selectableTool.getGroup(), group); |
|
301 | 316 |
|
302 |
if (selectableTool.getIsDefault()) { |
|
303 |
btn.setSelected(true); |
|
304 |
initialSelectedTools.put(selectableTool.getGroup(), btn.getActionCommand()); |
|
305 |
} |
|
317 |
} |
|
318 |
jtb.addButton(group, btn); |
|
319 |
buttonModel.setGroupName(selectableTool.getGroup()); |
|
306 | 320 |
|
307 |
controlClass.put(btn, loader.loadClass(ext.getClassName())); |
|
321 |
if (selectableTool.getIsDefault()) { |
|
322 |
btn.setSelected(true); |
|
323 |
initialSelectedTools.put(selectableTool.getGroup(), |
|
324 |
btn.getActionCommand()); |
|
325 |
} |
|
308 | 326 |
|
309 |
if (selectableTool.getName() != null) { |
|
310 |
btn.setName(selectableTool.getName()); |
|
311 |
} |
|
327 |
controlClass.put(btn, loader.loadClass(ext.getClassName())); |
|
312 | 328 |
|
313 |
if (selectableTool.getTooltip() != null) {
|
|
314 |
btn.setToolTip(ps.getText(selectableTool.getTooltip()));
|
|
315 |
}
|
|
329 |
if (selectableTool.getName() != null) {
|
|
330 |
btn.setName(selectableTool.getName());
|
|
331 |
}
|
|
316 | 332 |
|
317 |
if (selectableTool.getEnableText() != null) {
|
|
318 |
btn.setEnableText(ps.getText(selectableTool.getEnableText()));
|
|
319 |
}
|
|
333 |
if (selectableTool.getTooltip() != null) {
|
|
334 |
btn.setToolTip(ps.getText(selectableTool.getTooltip()));
|
|
335 |
}
|
|
320 | 336 |
|
321 |
if (selectableTool.getLast() == true) { |
|
322 |
jtb.addSeparator(); |
|
323 |
} |
|
324 |
} |
|
337 |
if (selectableTool.getEnableText() != null) { |
|
338 |
btn.setEnableText(ps.getText(selectableTool.getEnableText())); |
|
339 |
} |
|
325 | 340 |
|
326 |
/** |
|
327 |
* A�ade un bot�n a la barra de herramientas |
|
328 |
* |
|
329 |
* @param ext Texto del boton, si es null no aparece texto |
|
330 |
* @param ext Extensi�n asociada al control |
|
331 |
* @param toolBar Icono del boton, si es null no aparece texto |
|
332 |
* @param actionTool Tooltip de la barra de herramientas |
|
333 |
* |
|
334 |
* @throws ClassNotFoundException |
|
335 |
* @throws RuntimeException DOCUMENT ME! |
|
336 |
*/ |
|
337 |
public void addTool(PluginClassLoader loader, SkinExtensionType ext, |
|
338 |
ToolBar toolBar, ActionTool actionTool) throws ClassNotFoundException { |
|
339 |
if (!SwingUtilities.isEventDispatchThread()) { |
|
340 |
throw new RuntimeException("No Event Dispatch Thread"); |
|
341 |
} |
|
341 |
if (selectableTool.getLast() == true) { |
|
342 |
jtb.addSeparator(); |
|
343 |
} |
|
344 |
} |
|
342 | 345 |
|
343 |
// Para traducir los textos que vengan |
|
344 |
PluginServices ps = PluginServices.getPluginServices(loader.getPluginName()); |
|
346 |
/** |
|
347 |
* A�ade un bot�n a la barra de herramientas |
|
348 |
* |
|
349 |
* @param ext |
|
350 |
* Texto del boton, si es null no aparece texto |
|
351 |
* @param ext |
|
352 |
* Extensi�n asociada al control |
|
353 |
* @param toolBar |
|
354 |
* Icono del boton, si es null no aparece texto |
|
355 |
* @param actionTool |
|
356 |
* Tooltip de la barra de herramientas |
|
357 |
* |
|
358 |
* @throws ClassNotFoundException |
|
359 |
* @throws RuntimeException |
|
360 |
* DOCUMENT ME! |
|
361 |
*/ |
|
362 |
public void addTool(PluginClassLoader loader, SkinExtensionType ext, |
|
363 |
ToolBar toolBar, ActionTool actionTool) throws ClassNotFoundException { |
|
364 |
if (!SwingUtilities.isEventDispatchThread()) { |
|
365 |
throw new RuntimeException("No Event Dispatch Thread"); |
|
366 |
} |
|
345 | 367 |
|
346 |
JToolBarButton btn; |
|
347 |
ImageIcon image = PluginServices.getIconTheme().get(actionTool.getIcon(),ps.getClassLoader()); |
|
368 |
// Para traducir los textos que vengan |
|
369 |
PluginServices ps = |
|
370 |
PluginServices.getPluginServices(loader.getPluginName()); |
|
348 | 371 |
|
349 |
if (image != null) { |
|
350 |
btn = new JToolBarButton(actionTool.getText(), image); |
|
351 |
} else { |
|
352 |
logger.error(PluginServices.getText(this, "Unable_to_find_icon") +": "+actionTool.getIcon()); |
|
353 |
btn = new JToolBarButton(actionTool.getText(), |
|
354 |
PluginServices.getIconTheme().get(noIcon)); |
|
355 |
} |
|
372 |
JToolBarButton btn; |
|
373 |
ImageIcon image = |
|
374 |
PluginServices.getIconTheme().get(actionTool.getIcon(), |
|
375 |
ps.getClassLoader()); |
|
356 | 376 |
|
357 |
btn.setMargin(new Insets(0, 0, 0, 0)); |
|
358 |
btn.addMouseListener(tooltipListener); |
|
359 |
btn.addActionListener(this); |
|
360 |
btn.setFocusable(false); |
|
361 |
btn.setActionCommand(actionTool.getActionCommand()); |
|
362 |
btn.setEnabled(false); |
|
363 |
btn.setVisible(false); |
|
377 |
if (image != null) { |
|
378 |
btn = new JToolBarButton(actionTool.getText(), image); |
|
379 |
} else { |
|
380 |
logger.error(PluginServices.getText(this, "Unable_to_find_icon") |
|
381 |
+ ": " + actionTool.getIcon()); |
|
382 |
btn = |
|
383 |
new JToolBarButton(actionTool.getText(), PluginServices |
|
384 |
.getIconTheme().get(noIcon)); |
|
385 |
} |
|
364 | 386 |
|
365 |
String name = toolBar.getName(); |
|
387 |
btn.setMargin(new Insets(0, 0, 0, 0)); |
|
388 |
btn.addMouseListener(tooltipListener); |
|
389 |
btn.addActionListener(this); |
|
390 |
btn.setFocusable(false); |
|
391 |
btn.setActionCommand(actionTool.getActionCommand()); |
|
392 |
btn.setEnabled(false); |
|
393 |
btn.setVisible(false); |
|
366 | 394 |
|
367 |
SelectableToolBar jtb = (SelectableToolBar) toolBarMap.get(name);
|
|
395 |
String name = toolBar.getName();
|
|
368 | 396 |
|
369 |
if (jtb == null) { |
|
370 |
jtb = new SelectableToolBar(name); |
|
371 |
jtb.setRollover(true); |
|
372 |
jtb.setAndamiVisibility(toolBar.getIsVisible()); |
|
373 |
toolBarMap.put(name, jtb); |
|
374 |
toolBars.add(jtb); |
|
375 |
} |
|
397 |
SelectableToolBar jtb = (SelectableToolBar) toolBarMap.get(name); |
|
376 | 398 |
|
377 |
jtb.add(btn); |
|
399 |
if (jtb == null) { |
|
400 |
jtb = new SelectableToolBar(name); |
|
401 |
jtb.setRollover(true); |
|
402 |
jtb.setAndamiVisibility(toolBar.getIsVisible()); |
|
403 |
toolBarMap.put(name, jtb); |
|
404 |
toolBars.add(jtb); |
|
405 |
} |
|
378 | 406 |
|
379 |
controlClass.put(btn, loader.loadClass(ext.getClassName()));
|
|
407 |
jtb.add(btn);
|
|
380 | 408 |
|
381 |
if (actionTool.getName() != null) { |
|
382 |
btn.setName(actionTool.getName()); |
|
383 |
} |
|
409 |
controlClass.put(btn, loader.loadClass(ext.getClassName())); |
|
384 | 410 |
|
385 |
if (actionTool.getTooltip() != null) {
|
|
386 |
btn.setToolTip(ps.getText(actionTool.getTooltip()));
|
|
387 |
}
|
|
411 |
if (actionTool.getName() != null) {
|
|
412 |
btn.setName(actionTool.getName());
|
|
413 |
}
|
|
388 | 414 |
|
389 |
if (actionTool.getEnableText() != null) {
|
|
390 |
btn.setEnableText(ps.getText(actionTool.getEnableText()));
|
|
391 |
}
|
|
415 |
if (actionTool.getTooltip() != null) {
|
|
416 |
btn.setToolTip(ps.getText(actionTool.getTooltip()));
|
|
417 |
}
|
|
392 | 418 |
|
393 |
if (actionTool.getLast() == true) { |
|
394 |
jtb.addSeparator(); |
|
395 |
} |
|
396 |
} |
|
419 |
if (actionTool.getEnableText() != null) { |
|
420 |
btn.setEnableText(ps.getText(actionTool.getEnableText())); |
|
421 |
} |
|
397 | 422 |
|
398 |
/** |
|
399 |
* Creates the needed menu structure to add the menu to the bar. |
|
400 |
* Returns the father which must hold the menu which was |
|
401 |
* provided as parameter. |
|
402 |
* |
|
403 |
* Crea la estructura de men�s necesaria para a�adir el menu a la barra. |
|
404 |
* Devuelve el padre del cual debe colgar el menu que se pasa como |
|
405 |
* par�metro. |
|
406 |
* |
|
407 |
* @param menu The Menu whose support is going to be added |
|
408 |
* @param loader The plugin's class loader |
|
409 |
* |
|
410 |
* @return The proper father for the menu which was provided as parameter |
|
411 |
*/ |
|
412 |
private JMenu createMenuAncestors(Menu menu, PluginClassLoader loader) { |
|
413 |
MenuElement menuPadre = null; |
|
423 |
if (actionTool.getLast() == true) { |
|
424 |
jtb.addSeparator(); |
|
425 |
} |
|
426 |
} |
|
414 | 427 |
|
415 |
PluginServices ps = PluginServices.getPluginServices(loader.getPluginName()); |
|
428 |
/** |
|
429 |
* Creates the needed menu structure to add the menu to the bar. |
|
430 |
* Returns the father which must hold the menu which was |
|
431 |
* provided as parameter. |
|
432 |
* |
|
433 |
* Crea la estructura de men�s necesaria para a�adir el menu a la barra. |
|
434 |
* Devuelve el padre del cual debe colgar el menu que se pasa como |
|
435 |
* par�metro. |
|
436 |
* |
|
437 |
* @param menu |
|
438 |
* The Menu whose support is going to be added |
|
439 |
* @param loader |
|
440 |
* The plugin's class loader |
|
441 |
* |
|
442 |
* @return The proper father for the menu which was provided as parameter |
|
443 |
*/ |
|
444 |
private JMenu createMenuAncestors(Menu menu, PluginClassLoader loader) { |
|
445 |
MenuElement menuPadre = null; |
|
416 | 446 |
|
417 |
String[] menues = menu.getText().split("/"); |
|
418 |
ArrayList menuList = new ArrayList(); |
|
419 |
menuList.add(menues[0]); |
|
420 |
menuPadre = getMenu(menuList, menuBar); |
|
447 |
PluginServices ps = |
|
448 |
PluginServices.getPluginServices(loader.getPluginName()); |
|
421 | 449 |
|
422 |
JMenu padre = null; |
|
450 |
String[] menues = menu.getText().split("/"); |
|
451 |
ArrayList menuList = new ArrayList(); |
|
452 |
menuList.add(menues[0]); |
|
453 |
menuPadre = getMenu(menuList, menuBar); |
|
423 | 454 |
|
424 |
if (menuPadre==null) { |
|
425 |
padre = new JMenu(ps.getText(menues[0])); |
|
426 |
padre.setName(menues[0]); |
|
427 |
menuBar.add(padre); |
|
428 |
} |
|
429 |
else if (menuPadre instanceof JMenu) { |
|
430 |
padre = (JMenu) menuPadre; |
|
431 |
} |
|
432 |
else { |
|
433 |
logger.error(ps.getText("error_creating_menu_Ancestor_does_not_exist")); |
|
434 |
return null; |
|
435 |
} |
|
455 |
JMenu padre = null; |
|
436 | 456 |
|
437 |
//Se crea el resto de menus |
|
438 |
ArrayList temp = new ArrayList(); |
|
457 |
if (menuPadre == null) { |
|
458 |
padre = new JMenu(ps.getText(menues[0])); |
|
459 |
padre.setName(menues[0]); |
|
460 |
menuBar.add(padre); |
|
461 |
} else |
|
462 |
if (menuPadre instanceof JMenu) { |
|
463 |
padre = (JMenu) menuPadre; |
|
464 |
} else { |
|
465 |
logger.error(ps |
|
466 |
.getText("error_creating_menu_Ancestor_does_not_exist")); |
|
467 |
return null; |
|
468 |
} |
|
439 | 469 |
|
440 |
for (int i = 1; i < (menues.length - 1); i++) { |
|
441 |
temp.add(menues[i]); |
|
442 |
} |
|
470 |
// Se crea el resto de menus |
|
471 |
ArrayList temp = new ArrayList(); |
|
443 | 472 |
|
444 |
menuPadre = createMenus(temp, padre); |
|
473 |
for (int i = 1; i < (menues.length - 1); i++) { |
|
474 |
temp.add(menues[i]); |
|
475 |
} |
|
445 | 476 |
|
446 |
return (JMenu) menuPadre; |
|
447 |
} |
|
477 |
menuPadre = createMenus(temp, padre); |
|
448 | 478 |
|
449 |
/** |
|
450 |
* A�ade la informaci�n del menu al framework. Debido a que los men�es se |
|
451 |
* pueden introducir en un orden determinado por el usuario, pero los |
|
452 |
* plugins se instalan en un orden arbitrario, primero se almacena la |
|
453 |
* informaci�n de todos los menus para luego ordenarlos y posteriormente |
|
454 |
* a�adirlos al interfaz |
|
455 |
* |
|
456 |
* @param loader Posicion del menu. Se ordena por este campo |
|
457 |
* @param ext Array con los nombres de los padres del menu |
|
458 |
* @param menu Texto del menu |
|
459 |
* |
|
460 |
* @throws ClassNotFoundException |
|
461 |
* @throws RuntimeException DOCUMENT ME! |
|
462 |
*/ |
|
463 |
public void addMenu(PluginClassLoader loader, SkinExtensionType ext, |
|
464 |
Menu menu) throws ClassNotFoundException { |
|
465 |
if (!SwingUtilities.isEventDispatchThread()) { |
|
466 |
throw new RuntimeException("No Event Dispatch Thread"); |
|
467 |
} |
|
479 |
return (JMenu) menuPadre; |
|
480 |
} |
|
468 | 481 |
|
469 |
JMenu menuPadre = createMenuAncestors(menu, loader); |
|
482 |
/** |
|
483 |
* A�ade la informaci�n del menu al framework. Debido a que los men�es |
|
484 |
* se |
|
485 |
* pueden introducir en un orden determinado por el usuario, pero los |
|
486 |
* plugins se instalan en un orden arbitrario, primero se almacena la |
|
487 |
* informaci�n de todos los menus para luego ordenarlos y posteriormente |
|
488 |
* a�adirlos al interfaz |
|
489 |
* |
|
490 |
* @param loader |
|
491 |
* Posicion del menu. Se ordena por este campo |
|
492 |
* @param ext |
|
493 |
* Array con los nombres de los padres del menu |
|
494 |
* @param menu |
|
495 |
* Texto del menu |
|
496 |
* |
|
497 |
* @throws ClassNotFoundException |
|
498 |
* @throws RuntimeException |
|
499 |
* DOCUMENT ME! |
|
500 |
*/ |
|
501 |
public void addMenu(PluginClassLoader loader, SkinExtensionType ext, |
|
502 |
Menu menu) throws ClassNotFoundException { |
|
503 |
if (!SwingUtilities.isEventDispatchThread()) { |
|
504 |
throw new RuntimeException("No Event Dispatch Thread"); |
|
505 |
} |
|
470 | 506 |
|
471 |
//Se registra y a�ade el menu |
|
472 |
/* String[] aux = menu.getText().split("/"); |
|
507 |
JMenu menuPadre = createMenuAncestors(menu, loader); |
|
473 | 508 |
|
474 |
if (aux.length == 2) |
|
475 |
if (aux[1].equals("----")) |
|
476 |
{ |
|
477 |
menuPadre.addSeparator(); |
|
478 |
return; |
|
479 |
} */ |
|
480 |
if (menu.getIs_separator()) |
|
481 |
{ |
|
509 |
// Se registra y a�ade el menu |
|
510 |
/* |
|
511 |
* String[] aux = menu.getText().split("/"); |
|
512 |
* |
|
513 |
* if (aux.length == 2) |
|
514 |
* if (aux[1].equals("----")) |
|
515 |
* { |
|
516 |
* menuPadre.addSeparator(); |
|
517 |
* return; |
|
518 |
* } |
|
519 |
*/ |
|
520 |
if (menu.getIs_separator()) { |
|
482 | 521 |
menuPadre.addSeparator(); |
483 | 522 |
return; |
484 | 523 |
} |
485 | 524 |
|
486 |
JMenuItem nuevoMenu = createJMenuItem(loader, menu);
|
|
487 |
nuevoMenu.addMouseListener(tooltipListener);
|
|
488 |
nuevoMenu.addActionListener(this);
|
|
489 |
menuPadre.add(nuevoMenu);
|
|
525 |
JMenuItem nuevoMenu = createJMenuItem(loader, menu);
|
|
526 |
nuevoMenu.addMouseListener(tooltipListener);
|
|
527 |
nuevoMenu.addActionListener(this);
|
|
528 |
menuPadre.add(nuevoMenu);
|
|
490 | 529 |
controlClass.put(nuevoMenu, loader.loadClass(ext.getClassName())); |
491 |
}
|
|
530 |
}
|
|
492 | 531 |
|
532 |
/** |
|
533 |
* Dado un array de nombres de menu, encuentra el men� |
|
534 |
* |
|
535 |
* @param nombres |
|
536 |
* DOCUMENT ME! |
|
537 |
* @param padre |
|
538 |
* DOCUMENT ME! |
|
539 |
* |
|
540 |
* @return DOCUMENT ME! |
|
541 |
*/ |
|
542 |
private javax.swing.JMenuItem getMenu(ArrayList nombres, MenuElement parent) { |
|
543 |
if (parent instanceof javax.swing.JMenu) { |
|
544 |
javax.swing.JMenu parentItem = (javax.swing.JMenu) parent; |
|
493 | 545 |
|
494 |
/** |
|
495 |
* Dado un array de nombres de menu, encuentra el men� |
|
496 |
* |
|
497 |
* @param nombres DOCUMENT ME! |
|
498 |
* @param padre DOCUMENT ME! |
|
499 |
* |
|
500 |
* @return DOCUMENT ME! |
|
501 |
*/ |
|
502 |
private javax.swing.JMenuItem getMenu(ArrayList nombres, MenuElement parent) { |
|
503 |
if (parent instanceof javax.swing.JMenu) { |
|
504 |
javax.swing.JMenu parentItem = (javax.swing.JMenu) parent; |
|
546 |
for (int i = 0; i < parentItem.getMenuComponentCount(); i++) { |
|
547 |
if ((parentItem.getMenuComponent(i).getName() != null // not a |
|
548 |
// JToolBar.Separator |
|
549 |
) |
|
550 |
&& (parentItem.getMenuComponent(i).getName() |
|
551 |
.compareTo((String) nombres.get(0)) == 0)) { |
|
552 |
nombres.remove(0); |
|
553 |
if (nombres.isEmpty()) { |
|
554 |
if (parentItem.getMenuComponent(i) instanceof javax.swing.JMenuItem) { |
|
555 |
return (javax.swing.JMenuItem) parentItem |
|
556 |
.getMenuComponent(i); |
|
557 |
} else { |
|
558 |
logger.error(PluginServices.getText(this, |
|
559 |
"Menu_type_not_supported_") |
|
560 |
+ " " |
|
561 |
+ parentItem.getMenuComponent(i).getClass() |
|
562 |
.getName()); |
|
563 |
return null; |
|
564 |
} |
|
565 |
} else { |
|
566 |
return getMenu(nombres, |
|
567 |
(MenuElement) parentItem.getMenuComponent(i)); |
|
568 |
} |
|
569 |
} |
|
570 |
} |
|
571 |
} else |
|
572 |
if (parent instanceof JMenuBar) { |
|
573 |
javax.swing.JMenuBar parentItem = (javax.swing.JMenuBar) parent; |
|
505 | 574 |
|
506 |
for (int i=0; i<parentItem.getMenuComponentCount(); i++) { |
|
507 |
if (parentItem.getMenuComponent(i).getName()!=null // not a JToolBar.Separator |
|
508 |
&& parentItem.getMenuComponent(i).getName().compareTo((String)nombres.get(0)) == 0) { |
|
509 |
nombres.remove(0); |
|
510 |
if (nombres.isEmpty()) { |
|
511 |
if (parentItem.getMenuComponent(i) instanceof javax.swing.JMenuItem) { |
|
512 |
return (javax.swing.JMenuItem) parentItem.getMenuComponent(i); |
|
513 |
} |
|
514 |
else { |
|
515 |
logger.error(PluginServices.getText(this, "Menu_type_not_supported_")+" "+parentItem.getMenuComponent(i).getClass().getName()); |
|
516 |
return null; |
|
517 |
} |
|
518 |
} |
|
519 |
else { |
|
520 |
return getMenu(nombres, (MenuElement) parentItem.getMenuComponent(i)); |
|
521 |
} |
|
522 |
} |
|
523 |
} |
|
524 |
} |
|
525 |
else if (parent instanceof JMenuBar) { |
|
526 |
javax.swing.JMenuBar parentItem = (javax.swing.JMenuBar) parent; |
|
575 |
for (int i = 0; i < parentItem.getMenuCount(); i++) { |
|
576 |
if ((parentItem.getMenu(i).getName() != null // not a |
|
577 |
// JToolBar.Separator |
|
578 |
) |
|
579 |
&& (parentItem.getMenu(i).getName() |
|
580 |
.compareTo((String) nombres.get(0)) == 0)) { |
|
581 |
nombres.remove(0); |
|
582 |
if (nombres.isEmpty()) { |
|
583 |
if (parentItem.getMenu(i) instanceof javax.swing.JMenuItem) { |
|
584 |
return parentItem.getMenu(i); |
|
585 |
} else { |
|
586 |
logger.error(PluginServices.getText(this, |
|
587 |
"Menu_type_not_supported_") |
|
588 |
+ " " |
|
589 |
+ parentItem.getMenu(i).getClass() |
|
590 |
.getName()); |
|
591 |
return null; |
|
592 |
} |
|
593 |
} else { |
|
594 |
return getMenu(nombres, parentItem.getMenu(i)); |
|
595 |
} |
|
596 |
} |
|
597 |
} |
|
598 |
} else { |
|
599 |
logger.error(PluginServices.getText(this, |
|
600 |
"Menu_type_not_supported_") |
|
601 |
+ " " |
|
602 |
+ parent.getClass().getName() + " " + parent.toString()); |
|
603 |
} |
|
604 |
return null; |
|
605 |
} |
|
527 | 606 |
|
528 |
for (int i=0; i<parentItem.getMenuCount(); i++) { |
|
529 |
if (parentItem.getMenu(i).getName()!=null // not a JToolBar.Separator |
|
530 |
&& parentItem.getMenu(i).getName().compareTo((String)nombres.get(0)) == 0) { |
|
531 |
nombres.remove(0); |
|
532 |
if (nombres.isEmpty()) { |
|
533 |
if (parentItem.getMenu(i) instanceof javax.swing.JMenuItem) { |
|
534 |
return (javax.swing.JMenuItem) parentItem.getMenu(i); |
|
535 |
} |
|
536 |
else { |
|
537 |
logger.error(PluginServices.getText(this, "Menu_type_not_supported_")+" "+parentItem.getMenu(i).getClass().getName()); |
|
538 |
return null; |
|
539 |
} |
|
540 |
} |
|
541 |
else { |
|
542 |
return getMenu(nombres, (MenuElement) parentItem.getMenu(i)); |
|
543 |
} |
|
544 |
} |
|
545 |
} |
|
546 |
} |
|
547 |
else { |
|
548 |
logger.error(PluginServices.getText(this, "Menu_type_not_supported_")+" "+parent.getClass().getName()+" "+parent.toString()); |
|
549 |
} |
|
550 |
return null; |
|
551 |
} |
|
607 |
/** |
|
608 |
* Crea la estructura de menus recursivamente. Por ejemplo, si se le pasa |
|
609 |
* en el par�metro nombres el array {"Search", "References", "Workspace"} |
|
610 |
* crear� un men� Search, un submen� del anterior que se llamar� |
|
611 |
* References y debajo de �ste �ltimo otro menu llamado Workspace |
|
612 |
* |
|
613 |
* @param nombres |
|
614 |
* Array con los nombres de los men�s que se quieren crear |
|
615 |
* @param padre |
|
616 |
* Menu padre de los men�s creados. Es �til porque es un |
|
617 |
* algoritmo recursivo |
|
618 |
* |
|
619 |
* @return Devuelve el men� creado. Al final de toda la recursividad, |
|
620 |
* devolver� el men� de m�s abajo en la jerarqu�a |
|
621 |
* |
|
622 |
* @throws RuntimeException |
|
623 |
* DOCUMENT ME! |
|
624 |
*/ |
|
625 |
private JMenu createMenus(ArrayList nombres, JMenu padre) { |
|
626 |
if (!SwingUtilities.isEventDispatchThread()) { |
|
627 |
throw new RuntimeException("No Event Dispatch Thread"); |
|
628 |
} |
|
552 | 629 |
|
553 |
/** |
|
554 |
* Crea la estructura de menus recursivamente. Por ejemplo, si se le pasa |
|
555 |
* en el par�metro nombres el array {"Search", "References", "Workspace"} |
|
556 |
* crear� un men� Search, un submen� del anterior que se llamar� |
|
557 |
* References y debajo de �ste �ltimo otro menu llamado Workspace |
|
558 |
* |
|
559 |
* @param nombres Array con los nombres de los men�s que se quieren crear |
|
560 |
* @param padre Menu padre de los men�s creados. Es �til porque es un |
|
561 |
* algoritmo recursivo |
|
562 |
* |
|
563 |
* @return Devuelve el men� creado. Al final de toda la recursividad, |
|
564 |
* devolver� el men� de m�s abajo en la jerarqu�a |
|
565 |
* |
|
566 |
* @throws RuntimeException DOCUMENT ME! |
|
567 |
*/ |
|
568 |
private JMenu createMenus(ArrayList nombres, JMenu padre) { |
|
569 |
if (!SwingUtilities.isEventDispatchThread()) { |
|
570 |
throw new RuntimeException("No Event Dispatch Thread"); |
|
571 |
} |
|
630 |
// si no quedan nombres de menu por crear se vuelve: caso base |
|
631 |
if (nombres.size() == 0) { |
|
632 |
return padre; |
|
633 |
} |
|
572 | 634 |
|
573 |
//si no quedan nombres de menu por crear se vuelve: caso base |
|
574 |
if (nombres.size() == 0) { |
|
575 |
return padre; |
|
576 |
} |
|
635 |
// Se busca el menu por si ya existiera para no crearlo otra vez |
|
636 |
JMenu buscado = null; |
|
577 | 637 |
|
578 |
//Se busca el menu por si ya existiera para no crearlo otra vez |
|
579 |
JMenu buscado = null; |
|
638 |
for (int i = 0; i < padre.getMenuComponentCount(); i++) { |
|
639 |
try { |
|
640 |
JMenu hijo = (JMenu) padre.getMenuComponent(i); |
|
580 | 641 |
|
581 |
for (int i = 0; i < padre.getMenuComponentCount(); i++) { |
|
582 |
try { |
|
583 |
JMenu hijo = (JMenu) padre.getMenuComponent(i); |
|
642 |
if (hijo.getName().compareTo((String) nombres.get(0)) == 0) { |
|
643 |
buscado = hijo; |
|
644 |
} |
|
645 |
} catch (ClassCastException e) { |
|
646 |
/* |
|
647 |
* Se ha encontrado un elemento hoja del arbol de men�es |
|
648 |
*/ |
|
649 |
} |
|
650 |
} |
|
584 | 651 |
|
585 |
if (hijo.getName().compareTo((String) nombres.get(0)) == 0) { |
|
586 |
buscado = hijo; |
|
587 |
} |
|
588 |
} catch (ClassCastException e) { |
|
589 |
/* |
|
590 |
* Se ha encontrado un elemento hoja del arbol de men�es |
|
591 |
*/ |
|
592 |
} |
|
593 |
} |
|
652 |
if (buscado != null) { |
|
653 |
// Si lo hemos encontrado creamos el resto |
|
654 |
nombres.remove(0); |
|
594 | 655 |
|
595 |
if (buscado != null) { |
|
596 |
//Si lo hemos encontrado creamos el resto |
|
597 |
nombres.remove(0); |
|
656 |
return createMenus(nombres, buscado); |
|
657 |
} else { |
|
658 |
// Si no lo hemos encontrado se crea el menu, se a�ade al padre |
|
659 |
// y se crea el resto |
|
660 |
String nombre = (String) nombres.get(0); |
|
661 |
JMenu menuPadre = new JMenu(PluginServices.getText(this, nombre)); |
|
662 |
menuPadre.setName(nombre); |
|
663 |
padre.add(menuPadre); |
|
598 | 664 |
|
599 |
return createMenus(nombres, buscado); |
|
600 |
} else { |
|
601 |
//Si no lo hemos encontrado se crea el menu, se a�ade al padre |
|
602 |
//y se crea el resto |
|
603 |
String nombre = (String) nombres.get(0); |
|
604 |
JMenu menuPadre = new JMenu((String) PluginServices.getText(this, nombre)); |
|
605 |
menuPadre.setName(nombre); |
|
606 |
padre.add(menuPadre); |
|
665 |
nombres.remove(0); |
|
607 | 666 |
|
608 |
nombres.remove(0); |
|
667 |
return createMenus(nombres, menuPadre); |
|
668 |
} |
|
669 |
} |
|
609 | 670 |
|
610 |
return createMenus(nombres, menuPadre); |
|
611 |
} |
|
612 |
} |
|
671 |
/** |
|
672 |
* M�todo invocado en respuesta a ciertos eventos de la interfaz que |
|
673 |
* pueden |
|
674 |
* ocultar botones de las barras de herramientas y que redimensiona �sta |
|
675 |
* de manera conveniente para que no se oculte ninguno |
|
676 |
*/ |
|
677 |
private void ajustarToolBar() { |
|
678 |
int margen = 8; |
|
679 |
int numFilas = 1; |
|
680 |
double acum = margen; |
|
613 | 681 |
|
614 |
/** |
|
615 |
* M�todo invocado en respuesta a ciertos eventos de la interfaz que pueden |
|
616 |
* ocultar botones de las barras de herramientas y que redimensiona �sta |
|
617 |
* de manera conveniente para que no se oculte ninguno |
|
618 |
*/ |
|
619 |
private void ajustarToolBar() { |
|
620 |
int margen = 8; |
|
621 |
int numFilas = 1; |
|
622 |
double acum = margen; |
|
682 |
int toolHeight = 0; |
|
623 | 683 |
|
624 |
int toolHeight = 0; |
|
684 |
for (int i = 0; i < toolBars.getComponentCount(); i++) { |
|
685 |
Component c = toolBars.getComponent(i); |
|
625 | 686 |
|
626 |
for (int i = 0; i < toolBars.getComponentCount(); i++) { |
|
627 |
Component c = toolBars.getComponent(i); |
|
687 |
if (!c.isVisible()) { |
|
688 |
continue; |
|
689 |
} |
|
628 | 690 |
|
629 |
if (!c.isVisible()) { |
|
630 |
continue; |
|
631 |
} |
|
691 |
double width = c.getPreferredSize().getWidth(); |
|
692 |
acum = acum + width; |
|
632 | 693 |
|
633 |
double width = c.getPreferredSize().getWidth(); |
|
634 |
acum = acum + width; |
|
694 |
if (acum > this.getWidth()) { |
|
695 |
numFilas++; |
|
696 |
acum = width + margen; |
|
697 |
} |
|
635 | 698 |
|
636 |
if (acum > this.getWidth()) {
|
|
637 |
numFilas++;
|
|
638 |
acum = width + margen;
|
|
639 |
}
|
|
699 |
if (c.getPreferredSize().getHeight() > toolHeight) {
|
|
700 |
toolHeight = c.getPreferredSize().height;
|
|
701 |
}
|
|
702 |
}
|
|
640 | 703 |
|
641 |
if (c.getPreferredSize().getHeight() > toolHeight) { |
|
642 |
toolHeight = c.getPreferredSize().height; |
|
643 |
} |
|
644 |
} |
|
704 |
toolBars.setPreferredSize(new Dimension(this.getWidth(), |
|
705 |
(numFilas * toolHeight))); |
|
645 | 706 |
|
646 |
toolBars.setPreferredSize(new Dimension(this.getWidth(),
|
|
647 |
(int) (numFilas * toolHeight)));
|
|
707 |
toolBars.updateUI();
|
|
708 |
}
|
|
648 | 709 |
|
649 |
toolBars.updateUI(); |
|
650 |
} |
|
710 |
/** |
|
711 |
* DOCUMENT ME! |
|
712 |
* |
|
713 |
* @param classesExtensions |
|
714 |
*/ |
|
715 |
public void setClassesExtensions(HashMap classesExtensions) { |
|
716 |
this.classesExtensions = classesExtensions; |
|
717 |
} |
|
651 | 718 |
|
652 |
/** |
|
653 |
* DOCUMENT ME! |
|
654 |
* |
|
655 |
* @param classesExtensions |
|
656 |
*/ |
|
657 |
public void setClassesExtensions(HashMap classesExtensions) { |
|
658 |
this.classesExtensions = classesExtensions; |
|
659 |
} |
|
719 |
/** |
|
720 |
* M�todo de callback invocado cuando se selecciona un men� o un bot�n |
|
721 |
* de |
|
722 |
* la barra de herramientas. Se busca la extensi�n asociada y se ejecuta |
|
723 |
* |
|
724 |
* @param e |
|
725 |
* Evento producido |
|
726 |
*/ |
|
727 |
public void actionPerformed(ActionEvent e) { |
|
728 |
Object control = e.getSource(); |
|
729 |
org.gvsig.andami.plugins.IExtension ext = |
|
730 |
(org.gvsig.andami.plugins.IExtension) classesExtensions |
|
731 |
.get(controlClass.get(control)); |
|
732 |
String actionCommand = e.getActionCommand(); |
|
733 |
try { |
|
734 |
logger.debug(Messages.getString("Ejecutando comando: ") |
|
735 |
+ actionCommand); |
|
736 |
ext.execute(actionCommand); |
|
660 | 737 |
|
661 |
/** |
|
662 |
* M�todo de callback invocado cuando se selecciona un men� o un bot�n de |
|
663 |
* la barra de herramientas. Se busca la extensi�n asociada y se ejecuta |
|
664 |
* |
|
665 |
* @param e Evento producido |
|
666 |
*/ |
|
667 |
public void actionPerformed(ActionEvent e) { |
|
668 |
Object control = e.getSource(); |
|
669 |
org.gvsig.andami.plugins.IExtension ext = (org.gvsig.andami.plugins.IExtension) classesExtensions.get((Class) controlClass.get( |
|
670 |
control)); |
|
671 |
String actionCommand = e.getActionCommand(); |
|
672 |
try { |
|
673 |
logger.debug(Messages.getString("Ejecutando comando: ") + actionCommand); |
|
674 |
ext.execute(actionCommand); |
|
738 |
try { |
|
739 |
JToolBarToggleButton toggle = (JToolBarToggleButton) control; |
|
740 |
ToggleButtonModel model = (ToggleButtonModel) toggle.getModel(); |
|
741 |
selectedTool.put(model.getGroupName(), actionCommand); |
|
742 |
} catch (ClassCastException ex) { |
|
743 |
} catch (NullPointerException ex) { |
|
744 |
} |
|
675 | 745 |
|
676 |
try { |
|
677 |
JToolBarToggleButton toggle = (JToolBarToggleButton) control; |
|
678 |
ToggleButtonModel model = (ToggleButtonModel)toggle.getModel(); |
|
679 |
selectedTool.put(model.getGroupName(), actionCommand); |
|
680 |
} |
|
681 |
catch (ClassCastException ex) {} |
|
682 |
catch (NullPointerException ex) {} |
|
746 |
} catch (RuntimeException t) { |
|
747 |
if (ext == null) { |
|
748 |
logger.error(Messages |
|
749 |
.getString("No_extension_associated_with_this_event_") |
|
750 |
+ e.getActionCommand()); |
|
751 |
} |
|
752 |
NotificationManager.addError(Messages |
|
753 |
.getString("MDIFrame.Error_no_capturado_por_el_usuario"), t); |
|
754 |
} |
|
683 | 755 |
|
684 |
} catch (RuntimeException t) { |
|
685 |
if (ext==null) { |
|
686 |
logger.error(Messages.getString("No_extension_associated_with_this_event_")+ e.getActionCommand()); |
|
687 |
} |
|
688 |
NotificationManager.addError(Messages.getString( |
|
689 |
"MDIFrame.Error_no_capturado_por_el_usuario"), t); |
|
690 |
} |
|
756 |
enableControls(); |
|
757 |
showMemory(); |
|
758 |
} |
|
691 | 759 |
|
692 |
enableControls(); |
|
693 |
showMemory(); |
|
694 |
} |
|
760 |
/** |
|
761 |
* DOCUMENT ME! |
|
762 |
* |
|
763 |
* @param name |
|
764 |
* DOCUMENT ME! |
|
765 |
* @param loader |
|
766 |
* DOCUMENT ME! |
|
767 |
* |
|
768 |
* @return DOCUMENT ME! |
|
769 |
*/ |
|
770 |
private String getName(String name, PluginClassLoader loader) { |
|
771 |
if (name.indexOf('.') == -1) { |
|
772 |
return loader.getPluginName() + "." + name; |
|
773 |
} else { |
|
774 |
return name; |
|
775 |
} |
|
776 |
} |
|
695 | 777 |
|
696 |
/**
|
|
697 |
* DOCUMENT ME!
|
|
698 |
*
|
|
699 |
* @param name DOCUMENT ME!
|
|
700 |
* @param loader DOCUMENT ME!
|
|
701 |
*
|
|
702 |
* @return DOCUMENT ME!
|
|
703 |
*/
|
|
704 |
private String getName(String name, PluginClassLoader loader) {
|
|
705 |
if (name.indexOf('.') == -1) {
|
|
706 |
return loader.getPluginName() + "." + name;
|
|
707 |
} else {
|
|
708 |
return name;
|
|
709 |
}
|
|
710 |
}
|
|
778 |
/**
|
|
779 |
* DOCUMENT ME!
|
|
780 |
*
|
|
781 |
* @param loader
|
|
782 |
* DOCUMENT ME!
|
|
783 |
* @param menu
|
|
784 |
* DOCUMENT ME!
|
|
785 |
*
|
|
786 |
* @throws RuntimeException
|
|
787 |
* DOCUMENT ME!
|
|
788 |
*/
|
|
789 |
public void addPopupMenu(PluginClassLoader loader, PopupMenu menu) {
|
|
790 |
if (!SwingUtilities.isEventDispatchThread()) {
|
|
791 |
throw new RuntimeException("No Event Dispatch Thread");
|
|
792 |
}
|
|
711 | 793 |
|
712 |
/** |
|
713 |
* DOCUMENT ME! |
|
714 |
* |
|
715 |
* @param loader DOCUMENT ME! |
|
716 |
* @param menu DOCUMENT ME! |
|
717 |
* |
|
718 |
* @throws RuntimeException DOCUMENT ME! |
|
719 |
*/ |
|
720 |
public void addPopupMenu(PluginClassLoader loader, PopupMenu menu) { |
|
721 |
if (!SwingUtilities.isEventDispatchThread()) { |
|
722 |
throw new RuntimeException("No Event Dispatch Thread"); |
|
723 |
} |
|
794 |
String name = getName(menu.getName(), loader); |
|
724 | 795 |
|
725 |
String name = getName(menu.getName(), loader); |
|
796 |
// Se crea el control popupmenu |
|
797 |
JPopUpMenu popupMenu = (JPopUpMenu) popupMap.get(name); |
|
726 | 798 |
|
727 |
//Se crea el control popupmenu |
|
728 |
JPopUpMenu popupMenu = (JPopUpMenu) popupMap.get(name); |
|
799 |
if (popupMenu == null) { |
|
800 |
popupMenu = new JPopUpMenu(menu.getName()); |
|
801 |
popupMap.put(name, popupMenu); |
|
802 |
} |
|
729 | 803 |
|
730 |
if (popupMenu == null) { |
|
731 |
popupMenu = new JPopUpMenu(menu.getName()); |
|
732 |
popupMap.put(name, popupMenu); |
|
733 |
} |
|
804 |
// Se a�aden las entradas |
|
805 |
Menu[] menues = menu.getMenu(); |
|
734 | 806 |
|
735 |
// Se a�aden las entradas |
|
736 |
Menu[] menues = menu.getMenu(); |
|
807 |
for (int i = 0; i < menues.length; i++) { |
|
808 |
// Se registra y a�ade el menu |
|
809 |
JMenuItem nuevoMenu = createJMenuItem(loader, menues[i]); |
|
737 | 810 |
|
738 |
for (int i = 0; i < menues.length; i++) {
|
|
739 |
//Se registra y a�ade el menu
|
|
740 |
JMenuItem nuevoMenu = createJMenuItem(loader, menues[i]);
|
|
811 |
popupMenu.add(nuevoMenu);
|
|
812 |
}
|
|
813 |
}
|
|
741 | 814 |
|
742 |
popupMenu.add(nuevoMenu); |
|
743 |
} |
|
744 |
} |
|
815 |
/** |
|
816 |
* DOCUMENT ME! |
|
817 |
* |
|
818 |
* @param loader |
|
819 |
* @param menu |
|
820 |
* |
|
821 |
* @return |
|
822 |
* |
|
823 |
* @throws RuntimeException |
|
824 |
* DOCUMENT ME! |
|
825 |
*/ |
|
826 |
private JMenuItem createJMenuItem(PluginClassLoader loader, Menu menu) { |
|
827 |
JMenuItem nuevoMenu = null; |
|
745 | 828 |
|
746 |
/** |
|
747 |
* DOCUMENT ME! |
|
748 |
* |
|
749 |
* @param loader |
|
750 |
* @param menu |
|
751 |
* |
|
752 |
* @return |
|
753 |
* |
|
754 |
* @throws RuntimeException DOCUMENT ME! |
|
755 |
*/ |
|
756 |
private JMenuItem createJMenuItem(PluginClassLoader loader, Menu menu) { |
|
757 |
JMenuItem nuevoMenu = null; |
|
829 |
PluginServices ps = |
|
830 |
PluginServices.getPluginServices(loader.getPluginName()); |
|
831 |
String text = menu.getText(); |
|
832 |
text = text.substring(text.lastIndexOf('/') + 1); |
|
833 |
String translatedText = ps.getText(text); |
|
758 | 834 |
|
759 |
PluginServices ps = PluginServices.getPluginServices(loader.getPluginName()); |
|
760 |
String text = menu.getText(); |
|
761 |
text = text.substring(text.lastIndexOf('/') + 1); |
|
762 |
String translatedText = ps.getText(text); |
|
835 |
if (menu.getIcon() != null) { |
|
836 |
ImageIcon image = |
|
837 |
PluginServices.getIconTheme().get(menu.getIcon(), |
|
838 |
ps.getClassLoader()); |
|
839 |
if (image != null) { |
|
840 |
nuevoMenu = new JMenuItem(translatedText, image); |
|
841 |
} else { |
|
842 |
nuevoMenu = |
|
843 |
new JMenuItem(translatedText, PluginServices.getIconTheme() |
|
844 |
.get(noIcon)); |
|
845 |
logger.error(PluginServices |
|
846 |
.getText(this, "Unable_to_find_icon") |
|
847 |
+ ": " |
|
848 |
+ menu.getIcon()); |
|
849 |
} |
|
850 |
} else { |
|
851 |
nuevoMenu = new JMenuItem(translatedText); |
|
852 |
} |
|
853 |
nuevoMenu.setName(text); |
|
854 |
if (menu.getMnemonic() != null) { |
|
855 |
if (menu.getMnemonic().length() != 1) { |
|
856 |
throw new RuntimeException( |
|
857 |
"Mnemonic must be 1 character length"); |
|
858 |
} |
|
763 | 859 |
|
764 |
if (menu.getIcon() != null) { |
|
765 |
ImageIcon image = PluginServices.getIconTheme().get(menu.getIcon(),ps.getClassLoader()); |
|
766 |
if (image != null) { |
|
767 |
nuevoMenu = new JMenuItem(translatedText, image); |
|
768 |
} else { |
|
769 |
nuevoMenu = new JMenuItem(translatedText, PluginServices.getIconTheme().get(noIcon)); |
|
770 |
logger.error(PluginServices.getText(this, "Unable_to_find_icon") +": "+menu.getIcon()); |
|
771 |
} |
|
772 |
} else { |
|
773 |
nuevoMenu = new JMenuItem(translatedText); |
|
774 |
} |
|
775 |
nuevoMenu.setName(text); |
|
776 |
if (menu.getMnemonic() != null) { |
|
777 |
if (menu.getMnemonic().length() != 1) { |
|
778 |
throw new RuntimeException( |
|
779 |
"Mnemonic must be 1 character length"); |
|
780 |
} |
|
860 |
nuevoMenu.setMnemonic(KeyMapping.getKey(menu.getMnemonic() |
|
861 |
.charAt(0))); |
|
862 |
} |
|
781 | 863 |
|
782 |
nuevoMenu.setMnemonic(KeyMapping.getKey(menu.getMnemonic().charAt(0))); |
|
783 |
} |
|
864 |
if (menu.getKey() != null) { |
|
865 |
String osName = System.getProperty("os.name"); |
|
866 |
boolean MAC_OS_X = osName.toLowerCase().startsWith("mac os x"); |
|
867 |
if (MAC_OS_X) { |
|
868 |
// en OS X, en vez de hardwiring la ShortcutKey, usamos el |
|
869 |
// default sugerido por el OS |
|
870 |
nuevoMenu.setAccelerator(KeyStroke.getKeyStroke(KeyMapping |
|
871 |
.getKey(menu.getKey().charAt(0)), Toolkit |
|
872 |
.getDefaultToolkit().getMenuShortcutKeyMask())); |
|
873 |
} else { |
|
874 |
nuevoMenu.setAccelerator(KeyStroke.getKeyStroke( |
|
875 |
KeyMapping.getKey(menu.getKey().charAt(0)), |
|
876 |
ActionEvent.ALT_MASK)); |
|
877 |
} |
|
878 |
} |
|
784 | 879 |
|
785 |
if (menu.getKey() != null) { |
|
786 |
String osName = (String) System.getProperty("os.name"); |
|
787 |
boolean MAC_OS_X = osName.toLowerCase().startsWith("mac os x"); |
|
788 |
if (MAC_OS_X) { |
|
789 |
//en OS X, en vez de hardwiring la ShortcutKey, usamos el default sugerido por el OS |
|
790 |
nuevoMenu.setAccelerator(KeyStroke.getKeyStroke(KeyMapping.getKey( |
|
791 |
menu.getKey().charAt(0)), Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); |
|
792 |
} else { |
|
793 |
nuevoMenu.setAccelerator(KeyStroke.getKeyStroke(KeyMapping.getKey( |
|
794 |
menu.getKey().charAt(0)), ActionEvent.ALT_MASK)); |
|
795 |
} |
|
796 |
} |
|
880 |
nuevoMenu.setActionCommand(menu.getActionCommand()); |
|
797 | 881 |
|
798 |
nuevoMenu.setActionCommand(menu.getActionCommand()); |
|
882 |
if (menu.getTooltip() != null) { |
|
883 |
nuevoMenu.setToolTip(ps.getText(menu.getTooltip())); |
|
884 |
} |
|
799 | 885 |
|
800 |
if (menu.getTooltip() != null) {
|
|
801 |
nuevoMenu.setToolTip(ps.getText(menu.getTooltip()));
|
|
802 |
}
|
|
886 |
if (menu.getEnableText() != null) {
|
|
887 |
nuevoMenu.setEnableText(ps.getText(menu.getEnableText()));
|
|
888 |
}
|
|
803 | 889 |
|
804 |
if (menu.getEnableText() != null) { |
|
805 |
nuevoMenu.setEnableText(ps.getText(menu.getEnableText())); |
|
806 |
} |
|
890 |
nuevoMenu.setEnabled(true); |
|
891 |
nuevoMenu.setVisible(true); |
|
807 | 892 |
|
808 |
nuevoMenu.setEnabled(true);
|
|
809 |
nuevoMenu.setVisible(true);
|
|
893 |
return nuevoMenu;
|
|
894 |
}
|
|
810 | 895 |
|
811 |
return nuevoMenu; |
|
812 |
} |
|
896 |
/** |
|
897 |
* Muestra u oculta el menu de nombre 'name' |
|
898 |
* |
|
899 |
* @param name |
|
900 |
* Nombre del menu que se quiere mostrar |
|
901 |
* @param x |
|
902 |
* Evento de raton |
|
903 |
* @param y |
|
904 |
* DOCUMENT ME! |
|
905 |
* @param c |
|
906 |
* DOCUMENT ME! |
|
907 |
*/ |
|
908 |
private void showPopupMenu(String name, int x, int y, Component c) { |
|
909 |
JPopupMenu menu = (JPopupMenu) popupMap.get(name); |
|
813 | 910 |
|
814 |
/** |
|
815 |
* Muestra u oculta el menu de nombre 'name' |
|
816 |
* |
|
817 |
* @param name Nombre del menu que se quiere mostrar |
|
818 |
* @param x Evento de raton |
|
819 |
* @param y DOCUMENT ME! |
|
820 |
* @param c DOCUMENT ME! |
|
821 |
*/ |
|
822 |
private void showPopupMenu(String name, int x, int y, Component c) { |
|
823 |
JPopupMenu menu = (JPopupMenu) popupMap.get(name); |
|
911 |
if (menu != null) { |
|
912 |
menu.show(c, x, y); |
|
913 |
} |
|
914 |
} |
|
824 | 915 |
|
825 |
if (menu != null) { |
|
826 |
menu.show(c, x, y); |
|
827 |
} |
|
828 |
} |
|
916 |
/** |
|
917 |
* DOCUMENT ME! |
|
918 |
* |
|
919 |
* @param name |
|
920 |
* DOCUMENT ME! |
|
921 |
* @param listener |
|
922 |
* DOCUMENT ME! |
|
923 |
*/ |
|
924 |
public void removePopupMenuListener(String name, ActionListener listener) { |
|
925 |
JPopupMenu menu = (JPopupMenu) popupMap.get(name); |
|
829 | 926 |
|
830 |
/** |
|
831 |
* DOCUMENT ME! |
|
832 |
* |
|
833 |
* @param name DOCUMENT ME! |
|
834 |
* @param listener DOCUMENT ME! |
|
835 |
*/ |
|
836 |
public void removePopupMenuListener(String name, ActionListener listener) { |
|
837 |
JPopupMenu menu = (JPopupMenu) popupMap.get(name); |
|
927 |
if (menu != null) { |
|
928 |
Component[] jmenuitems = menu.getComponents(); |
|
838 | 929 |
|
839 |
if (menu != null) { |
|
840 |
Component[] jmenuitems = menu.getComponents(); |
|
930 |
for (int i = 0; i < jmenuitems.length; i++) { |
|
931 |
if (jmenuitems[i] instanceof JMenuItem) { |
|
932 |
((JMenuItem) jmenuitems[i]).removeActionListener(listener); |
|
933 |
} |
|
934 |
} |
|
935 |
} |
|
936 |
} |
|
841 | 937 |
|
842 |
for (int i = 0; i < jmenuitems.length; i++) { |
|
843 |
if (jmenuitems[i] instanceof JMenuItem) { |
|
844 |
((JMenuItem) jmenuitems[i]).removeActionListener(listener); |
|
845 |
} |
|
846 |
} |
|
847 |
} |
|
848 |
} |
|
938 |
/** |
|
939 |
* DOCUMENT ME! |
|
940 |
* |
|
941 |
* @param popupName |
|
942 |
* @param c |
|
943 |
* DOCUMENT ME! |
|
944 |
* @param listener |
|
945 |
* @param loader |
|
946 |
*/ |
|
947 |
public void addPopupMenuListener(String popupName, Component c, |
|
948 |
ActionListener listener, PluginClassLoader loader) { |
|
949 |
final String name = getName(popupName, loader); |
|
849 | 950 |
|
850 |
/** |
|
851 |
* DOCUMENT ME! |
|
852 |
* |
|
853 |
* @param popupName |
|
854 |
* @param c DOCUMENT ME! |
|
855 |
* @param listener |
|
856 |
* @param loader |
|
857 |
*/ |
|
858 |
public void addPopupMenuListener(String popupName, Component c, |
|
859 |
ActionListener listener, PluginClassLoader loader) { |
|
860 |
final String name = getName(popupName, loader); |
|
951 |
JPopupMenu menu = (JPopupMenu) popupMap.get(name); |
|
861 | 952 |
|
862 |
JPopupMenu menu = (JPopupMenu) popupMap.get(name); |
|
953 |
if (menu != null) { |
|
954 |
Component[] jmenuitems = menu.getComponents(); |
|
863 | 955 |
|
864 |
if (menu != null) { |
|
865 |
Component[] jmenuitems = menu.getComponents(); |
|
956 |
for (int i = 0; i < jmenuitems.length; i++) { |
|
957 |
if (jmenuitems[i] instanceof JMenuItem) { |
|
958 |
((JMenuItem) jmenuitems[i]).addActionListener(listener); |
|
959 |
} |
|
960 |
} |
Also available in: Unified diff