Revision 5621 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/preferences/DlgPreferences.java
DlgPreferences.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
import java.awt.BorderLayout; |
44 | 44 |
import java.awt.Component; |
45 |
import java.awt.Dimension; |
|
45 | 46 |
import java.awt.event.ActionListener; |
46 | 47 |
import java.util.Enumeration; |
47 | 48 |
import java.util.Hashtable; |
48 | 49 |
|
49 |
import javax.swing.ImageIcon; |
|
50 | 50 |
import javax.swing.JButton; |
51 | 51 |
import javax.swing.JLabel; |
52 | 52 |
import javax.swing.JPanel; |
... | ... | |
58 | 58 |
import javax.swing.tree.DefaultTreeCellRenderer; |
59 | 59 |
import javax.swing.tree.DefaultTreeModel; |
60 | 60 |
|
61 |
import sun.net.www.content.image.jpeg; |
|
62 |
|
|
63 | 61 |
import com.iver.andami.PluginServices; |
64 | 62 |
import com.iver.andami.ui.mdiManager.SingletonView; |
65 | 63 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
... | ... | |
91 | 89 |
private JSplitPane jSplitPaneCenter = null; |
92 | 90 |
|
93 | 91 |
private JPanel jPanelContainer = null; |
92 |
private JButton jButtonRestore; |
|
94 | 93 |
|
95 | 94 |
private class MyTreeCellRenderer extends DefaultTreeCellRenderer |
96 | 95 |
{ |
... | ... | |
152 | 151 |
/** |
153 | 152 |
* It is very common to be confused with this method. But |
154 | 153 |
* the one you are looking for is addPreferencePage(IPreference) |
155 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
|
156 | 154 |
*/ |
157 | 155 |
public Component add(Component c) { |
158 | 156 |
throw new Error("Do not use com.iver.cit.gvsig.gui.preferences.DlgPreferences.add(Component) use com.iver.cit.gvsig.gui.preferences.DlgPreferences.addPreferencePage(IPreference) instead"); |
... | ... | |
298 | 296 |
if (jPanelButtons == null) { |
299 | 297 |
jPanelButtons = new JPanel(new BorderLayout()); |
300 | 298 |
JPanel jPanelAux = new JPanel(); |
299 |
JLabel l = new JLabel(); |
|
300 |
l.setPreferredSize(new Dimension(40, 20)); |
|
301 | 301 |
jPanelButtons.add(new JSeparator(JSeparator.HORIZONTAL), BorderLayout.NORTH); |
302 |
jPanelAux.add(getJButtonOK(), null); |
|
303 |
jPanelAux.add(getJButtonCancel(), null); |
|
302 |
jPanelAux.add(getJButtonRestore(), BorderLayout.WEST); |
|
303 |
jPanelAux.add(l, BorderLayout.CENTER); |
|
304 |
jPanelAux.add(getJButtonOK(), BorderLayout.EAST); |
|
305 |
jPanelAux.add(getJButtonCancel(), BorderLayout.EAST); |
|
304 | 306 |
|
305 | 307 |
jPanelButtons.add(jPanelAux); |
306 | 308 |
} |
307 | 309 |
return jPanelButtons; |
308 | 310 |
} |
311 |
|
|
312 |
/** |
|
313 |
* This method initializes jPanelButtons |
|
314 |
* |
|
315 |
* @return javax.swing.JPanel |
|
316 |
*/ |
|
317 |
|
|
309 | 318 |
|
310 | 319 |
/** |
311 | 320 |
* This method initializes jButtonOK |
... | ... | |
319 | 328 |
jButtonOK.addActionListener(new ActionListener() |
320 | 329 |
{ |
321 | 330 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
322 |
activePreference.storeValues(); |
|
331 |
if (activePreference!=null) |
|
332 |
activePreference.storeValues(); |
|
323 | 333 |
closeView(); |
324 | 334 |
}; |
325 | 335 |
}); |
326 | 336 |
} |
327 | 337 |
return jButtonOK; |
328 | 338 |
} |
339 |
|
|
340 |
/** |
|
341 |
* This method initializes jButtonOK |
|
342 |
* |
|
343 |
* @return javax.swing.JButton |
|
344 |
*/ |
|
329 | 345 |
|
346 |
/** |
|
347 |
* This method initializes jButtonOK |
|
348 |
* |
|
349 |
* @return javax.swing.JButton |
|
350 |
*/ |
|
351 |
private JButton getJButtonRestore() { |
|
352 |
if (jButtonRestore == null) { |
|
353 |
jButtonRestore = new JButton(); |
|
354 |
jButtonRestore.setText(PluginServices.getText(this, "restore_defaults")); |
|
355 |
jButtonRestore.addActionListener(new ActionListener() |
|
356 |
{ |
|
357 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
358 |
if (activePreference!=null) |
|
359 |
activePreference.initializeDefaults(); |
|
360 |
}; |
|
361 |
}); |
|
362 |
} |
|
363 |
return jButtonRestore; |
|
364 |
} |
|
365 |
|
|
330 | 366 |
private void closeView() { |
331 | 367 |
PluginServices.getMDIManager().closeView(this); |
332 | 368 |
} |
... | ... | |
370 | 406 |
jPanelCenter.setLayout(new BorderLayout()); |
371 | 407 |
jPanelCenter.add(jPanelPageTitle, BorderLayout.NORTH); |
372 | 408 |
jPanelCenter.add(getJPanelContainer(), java.awt.BorderLayout.CENTER); |
409 |
|
|
373 | 410 |
} |
374 | 411 |
return jPanelCenter; |
375 | 412 |
} |
... | ... | |
416 | 453 |
return this.getClass(); |
417 | 454 |
} |
418 | 455 |
|
419 |
} // @jve:decl-index=0:visual-constraint="10,10"
|
|
456 |
} |
Also available in: Unified diff