svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / test / java / org / gvsig / app / panelGroup / Test2TreePanel.java @ 40558
History | View | Annotate | Download (2.79 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.app.panelGroup; |
25 |
|
26 |
import javax.swing.JFrame; |
27 |
|
28 |
import org.gvsig.gui.beans.panelGroup.PanelGroupManager; |
29 |
import org.gvsig.gui.beans.panelGroup.treePanel.TreePanel; |
30 |
import org.gvsig.tools.exception.BaseException; |
31 |
|
32 |
import org.gvsig.app.panelGroup.loaders.PanelGroupLoaderFromExtensionPoint; |
33 |
import org.gvsig.app.panelGroup.samples.Samples_ExtensionPointsOfIPanels; |
34 |
|
35 |
/**
|
36 |
* <p>Tests the creation of a {@link TreePanel TreePanel} object using {@link PanelGroupLoaderFromExtensionPoint PanelGroupLoaderFromExtensionPoint} .</p>
|
37 |
*
|
38 |
* @version 17/10/2007
|
39 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
|
40 |
*/
|
41 |
public class Test2TreePanel { |
42 |
private static JFrame jFrame; |
43 |
private static TreePanel panelGroup; |
44 |
|
45 |
/**
|
46 |
* <p>Test method for the Test2TreePanel.</p>
|
47 |
*
|
48 |
* @param args optional arguments
|
49 |
*/
|
50 |
public static void main(String[] args) { |
51 |
try {
|
52 |
Samples_ExtensionPointsOfIPanels.loadSample(); |
53 |
|
54 |
PanelGroupManager manager = PanelGroupManager.getManager(); |
55 |
manager.registerPanelGroup(TreePanel.class); |
56 |
manager.setDefaultType(TreePanel.class); |
57 |
|
58 |
panelGroup = (TreePanel) manager.getPanelGroup(Samples_ExtensionPointsOfIPanels.REFERENCE2); |
59 |
PanelGroupLoaderFromExtensionPoint loader = new PanelGroupLoaderFromExtensionPoint(Samples_ExtensionPointsOfIPanels.EXTENSIONPOINT2_NAME);
|
60 |
|
61 |
// Begin: Test the normal load
|
62 |
panelGroup.loadPanels(loader); |
63 |
// End: Test the normal load
|
64 |
|
65 |
// Objects creation
|
66 |
jFrame = new JFrame(); |
67 |
jFrame.setTitle("Test TreePanel using PanelGroupLoaderFromExtensionPoint");
|
68 |
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
69 |
jFrame.setSize(panelGroup.getPreferredSize()); |
70 |
jFrame.getContentPane().add(panelGroup); |
71 |
|
72 |
jFrame.setVisible(true);
|
73 |
|
74 |
} catch (BaseException e) {
|
75 |
System.out.println(e.getLocalizedMessageStack());
|
76 |
} catch (Exception e) { |
77 |
e.printStackTrace(); |
78 |
} |
79 |
} |
80 |
} |