root / trunk / libraries / libUIComponent / src-test-ui / org / gvsig / gui / beans / panelGroup / Test1TabbedPanel.java @ 15734
History | View | Annotate | Download (3.29 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*/
|
19 |
|
20 |
package org.gvsig.gui.beans.panelGroup; |
21 |
|
22 |
import java.awt.Dimension; |
23 |
|
24 |
import javax.swing.JFrame; |
25 |
|
26 |
import org.gvsig.gui.beans.panelGroup.loaders.PanelGroupLoaderFromList; |
27 |
import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel; |
28 |
import org.gvsig.gui.beans.panelGroup.samples.SampleInfoPanel; |
29 |
import org.gvsig.gui.beans.panelGroup.samples.Samples_Data; |
30 |
import org.gvsig.gui.beans.panelGroup.tabbedPanel.TabbedPanel; |
31 |
|
32 |
/**
|
33 |
* <p>Tests the creation of a {@link TabbedPanel TabbedPanel} object using {@link PanelGroupLoaderFromList PanelGroupLoaderFromList} .</p>
|
34 |
*
|
35 |
* @version 16/10/2007
|
36 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
|
37 |
*/
|
38 |
public class Test1TabbedPanel { |
39 |
/**
|
40 |
* <p>Test method for the Test1TabbedPanel.</p>
|
41 |
*
|
42 |
* @param args optional arguments
|
43 |
*/
|
44 |
public static void main(String[] args) { |
45 |
try {
|
46 |
PanelGroupManager manager = PanelGroupManager.getManager(); |
47 |
manager.setDefaultType(TabbedPanel.class); |
48 |
|
49 |
TabbedPanel panelGroup = (TabbedPanel) manager.getPanelGroup(Samples_Data.REFERENCE1); |
50 |
PanelGroupLoaderFromList loader = new PanelGroupLoaderFromList(Samples_Data.TEST1_CLASSES);
|
51 |
AbstractPanel[] panels = loader.loadPanels();
|
52 |
|
53 |
// Begin: Initialise sample classes
|
54 |
int i = 0; |
55 |
|
56 |
for (AbstractPanel panel: panels) {
|
57 |
panel.setPreferredSize(new Dimension(Samples_Data.PANELS_DEFAULT_WIDTH, Samples_Data.PANELS_DEFAULT_HEIGHT)); |
58 |
panel.setReference(Samples_Data.REFERENCE1); |
59 |
|
60 |
panel.setID(Samples_Data.PANELS1_IDS[i]); |
61 |
panel.setLabel(Samples_Data.PANELS1_LABELS[i]); |
62 |
panel.setLabelGroup(Samples_Data.PANELS1_LABELGROUPS[i++]); |
63 |
|
64 |
panelGroup.addPanel(panel); |
65 |
} |
66 |
// End: Initialise sample classes
|
67 |
|
68 |
// Begin: Tests adding and removing a panel without "label" -> this shoudn't add that panel
|
69 |
loader = new PanelGroupLoaderFromList(new Class[]{SampleInfoPanel.class}); |
70 |
panels = loader.loadPanels(); |
71 |
panels[0].setID("ID"); |
72 |
panels[0].setLabel(null); |
73 |
panels[0].setLabelGroup("LABEL_GROUP"); |
74 |
panelGroup.addPanel(panels[0]);
|
75 |
//panelGroup.removePanel(panels[0]);
|
76 |
// End: Tests adding and removing a panel without "label" -> this shoudn't add that panel
|
77 |
|
78 |
JFrame jFrame = new JFrame(); |
79 |
jFrame.setTitle("Test TabbedPanel using PanelGroupLoaderFromList");
|
80 |
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
81 |
jFrame.setSize(panelGroup.getPreferredSize()); |
82 |
jFrame.getContentPane().add(panelGroup); |
83 |
jFrame.setVisible(true);
|
84 |
|
85 |
} catch (Exception e) { |
86 |
e.printStackTrace(); |
87 |
} |
88 |
} |
89 |
} |