Statistics
| Revision:

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 / samples / Samples_ExtensionPointsOfIPanels.java @ 40558

History | View | Annotate | Download (11.2 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.samples;
25

    
26
import org.gvsig.gui.beans.panelGroup.PanelGroupManager;
27
import org.gvsig.gui.beans.panelGroup.loaders.PanelGroupLoaderFromList;
28
import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel;
29
import org.gvsig.gui.beans.panelGroup.tabbedPanel.TabbedPanel;
30
import org.gvsig.gui.beans.panelGroup.treePanel.TreePanel;
31
import org.gvsig.tools.ToolsLocator;
32
import org.gvsig.tools.extensionpoint.ExtensionPoint;
33
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
34

    
35
import org.gvsig.app.panelGroup.PanelGroupDialog;
36
import org.gvsig.app.panelGroup.loaders.PanelGroupLoaderFromExtensionPoint;
37

    
38
/**
39
 * <p>
40
 * This class has information to create samples to test
41
 * {@link PanelGroupManager PanelGroupManager}, {@link TabbedPanel TabbedPanel},
42
 * {@link TreePanel TreePanel}, {@link AbstractPanel AbstractPanel},
43
 * {@link PanelGroupLoaderUtilities PanelGroupLoaderUtilities},
44
 * {@link PanelGroupLoaderFromList PanelGroupLoaderFromList},
45
 * {@link PanelGroupLoaderFromExtensionPoint PanelGroupLoaderFromExtensionPoint}
46
 * , and {@link PanelGroupDialog PanelGroupDialog}.
47
 * </p>
48
 * 
49
 * @version 16/10/2007
50
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
51
 */
52
public class Samples_ExtensionPointsOfIPanels {
53
        public final static String EXTENSIONPOINT1_NAME = "RasterLayerProperties";
54
        public final static String EXTENSIONPOINT2_NAME = "ImaginaryLayerProperties";
55
        public final static String EXTENSIONPOINT3_NAME = "Other tests";
56
        public final static String EXTENSIONPOINT4_NAME = "Test 1 exceptions";
57
        public final static String EXTENSIONPOINT5_NAME = "Test 2 exceptions";
58
        public final static String EXTENSIONPOINT6_NAME = "Test 3 exceptions";
59
        public final static String EXTENSIONPOINT7_NAME = "Test 4 exceptions";
60
        public final static String EXTENSIONPOINT8_NAME = "Test 5 exceptions";
61
        public final static String EXTENSIONPOINT9_NAME = "Test 6 exceptions";
62
        public final static String EXTENSIONPOINT10_NAME = "Test 7 exceptions";
63
        public final static String[] EXTENSIONPOINTS1_NAMES = {"Information", "Bands", "Transparency", "Enhanced", "PanSharpening", "Scale"};
64
        public final static String[] EXTENSIONPOINTS2_NAMES = {"Information", "Transparency", "Scale"};
65
        public final static String[] EXTENSIONPOINTS3_OTHER_NAMES = {"SamplePanelWithoutGroupLabel", "SamplePanelGroupLabelRepeated"};
66
        public final static String[] EXTENSIONPOINTS4_NAMES = {
67
                        "SampleInitializingExcetionPanel", "SampleInfoPanel" }; // Test 'ListCouldntLoadPanelFromListException' with any 'Exception'
68
        public final static String[] EXTENSIONPOINTS5_NAMES = {"SampleInfoPanel", "SampleUndefinedPreferredSizeExceptionPanel"}; // Test 'ListCouldntAddPanelException' with a 'PanelWithNoPreferredSizeDefinedException'
69
        public final static String[] EXTENSIONPOINTS6_NAMES = {}; // Test 'ListCouldntAddPanelException' with a 'EmptyPanelGroupException'
70
        public final static String[] EXTENSIONPOINTS7_NAMES = {"SampleInvisiblePanel.class"}; // Test 'ListCouldntAddPanelException' with a 'EmptyPanelGroupGUIException'
71
        public final static String[] EXTENSIONPOINTS8_NAMES = {"SampleInitializingExcetionPanel", "SampleUndefinedPreferredSizeExceptionPanel"}; // Test 'ListCouldntAddPanelException' with a 'PanelWithNoPreferredSizeDefinedException', a 'EmptyPanelGroupException' and a 'ListCouldntLoadPanelFromListException' with any 'Exception'
72
        public final static String[] EXTENSIONPOINTS9_NAMES = {"SampleInvisiblePanel", "SampleInitializingExcetionPanel", "SampleUndefinedPreferredSizeExceptionPanel"}; // Test 'ListCouldntAddPanelException' with a 'PanelWithNoPreferredSizeDefinedException', a 'EmptyPanelGroupGUIException' and a 'ListCouldntLoadPanelFromListException' with any 'Exception'
73
        public final static String[] EXTENSIONPOINTS10_NAMES = {"SampleBandSetupPanel", "SampleInvisiblePanel", "SampleInitializingExcetionPanel", "SampleUndefinedPreferredSizeExceptionPanel"}; // Test 'ListCouldntAddPanelException' with a 'PanelWithNoPreferredSizeDefinedException', a EmptyPanelGroupGUIException and a 'ListCouldntLoadPanelFromListException' with any 'Exception'
74
        public final static Class[] EXTENSIONPOINTS1_CLASSES = {SampleInfoPanel.class, SampleBandSetupPanel.class, SampleTransparencyPanel.class, SampleEnhancedPanel.class, SamplePanSharpeningPanel.class, SampleScalePanel.class};
75
        public final static Class[] EXTENSIONPOINTS2_CLASSES = {SampleInfoPanel.class, SampleTransparencyPanel.class, SampleScalePanel.class};
76
        public final static Class[] OTHER_PANELS_EXTENSIONPOINTS3_CLASSES = {SamplePanelWithoutGroupLabel.class, SamplePanelGroupLabelRepeated.class};
77
        public final static Class[] EXTENSIONPOINTS4_CLASSES = {
78
                        SampleInitializingExcetionPanel.class, SampleInfoPanel.class }; // Test 'ListCouldntLoadPanelFromListException' with any 'Exception'
79
        public final static Class[] EXTENSIONPOINTS5_CLASSES = {SampleInfoPanel.class, SampleUndefinedPreferredSizeExceptionPanel.class}; // Test 'ListCouldntAddPanelException' with a 'PanelWithNoPreferredSizeDefinedException'
80
        public final static Class[] EXTENSIONPOINTS6_CLASSES = {}; // Test 'ListCouldntAddPanelException' with a 'EmptyPanelGroupException'
81
        public final static Class[] EXTENSIONPOINTS7_CLASSES = {SampleInvisiblePanel.class}; // Test 'ListCouldntAddPanelException' with a 'EmptyPanelGroupGUIException'
82
        public final static Class[] EXTENSIONPOINTS8_CLASSES = {SampleInitializingExcetionPanel.class, SampleUndefinedPreferredSizeExceptionPanel.class}; // Test 'ListCouldntAddPanelException' with a 'PanelWithNoPreferredSizeDefinedException', a 'EmptyPanelGroupException' and a 'ListCouldntLoadPanelFromListException' with any 'Exception'
83
        public final static Class[] EXTENSIONPOINTS9_CLASSES = {SampleInvisiblePanel.class, SampleInitializingExcetionPanel.class, SampleUndefinedPreferredSizeExceptionPanel.class}; // Test 'ListCouldntAddPanelException' with a 'PanelWithNoPreferredSizeDefinedException', a 'EmptyPanelGroupGUIException' and a 'ListCouldntLoadPanelFromListException' with any 'Exception'
84
        public final static Class[] EXTENSIONPOINTS10_CLASSES = {SampleBandSetupPanel.class, SampleInvisiblePanel.class, SampleInitializingExcetionPanel.class, SampleUndefinedPreferredSizeExceptionPanel.class}; // Test 'ListCouldntAddPanelException' with a 'PanelWithNoPreferredSizeDefinedException', a EmptyPanelGroupGUIException and a 'ListCouldntLoadPanelFromListException' with any 'Exception'
85
        public final static Object REFERENCE1 = new String("Raster Layer");
86
        public final static Object REFERENCE2 = new String("Imaginary Layer");
87
        public final static Object REFERENCE3 = new String("Other tests");
88
        public final static String REFERENCE1_NAME = "Raster Layer reference";
89
        public final static String REFERENCE2_NAME = "Imaginary Layer reference";
90
        public final static String REFERENCE3_NAME = "Other tests reference";
91
        public final static String[] PANELS1_IDS = {"Information_ID", "Bands_ID", "Transparency_ID", "Enhanced_ID", "PanSharpening_ID", "Scale_ID"};
92
        public final static String[] PANELS2_IDS = {"Information_ID", "Transparency_ID", "Scale_ID"};
93
        public final static String[] PANELS3_IDS = {"WithoutGroup_ID", "GroupLabelRepeated_ID"};
94
        public final static String[] PANELS1_LABELS = {"Information_LABEL", "Bands_LABEL", "Transparency_LABEL", "Enhanced_LABEL", "PanSharpening_LABEL", "Scale_LABEL"};
95
        public final static String[] PANELS2_LABELS = {"Information_LABEL", "Transparency_LABEL", "Scale_LABEL"};
96
        public final static String[] PANELS3_LABELS = {"WithoutGroup_LABEL", "GroupLabelRepeated_LABEL"};
97
        public final static String[] PANELS1_LABELGROUPS = {"Information_LABELGROUP", "Bands_LABELGROUP", "Transparency_LABELGROUP", "Enhanced_LABELGROUP", "PanSharpening_LABELGROUP", "Scale_LABELGROUP"};
98
        public final static String[] PANELS2_LABELGROUPS = {"Information_LABELGROUP", "Transparency_LABELGROUP", "Scale_LABELGROUP"};
99
        public final static String[] PANELS3_LABELGROUPS = {null, "GroupLabelRepeated_LABELGROUP"};
100
        public final static short PANELS_DEFAULT_WIDTH = 500;
101
        public final static short PANELS_DEFAULT_HEIGHT = 400;
102

    
103

    
104
        /**
105
         * <p>Loads the information of the sample.</p>
106
         */
107
        public static void loadSample() {
108
                        ExtensionPointManager epMan = ToolsLocator.getExtensionPointManager();
109

    
110
                ExtensionPoint ep = epMan.add(EXTENSIONPOINT1_NAME, "");
111

    
112
                ep.append(EXTENSIONPOINTS1_NAMES[0], "", EXTENSIONPOINTS1_CLASSES[0]);
113
                ep.append(EXTENSIONPOINTS1_NAMES[1], "", EXTENSIONPOINTS1_CLASSES[1]);
114
                ep.append(EXTENSIONPOINTS1_NAMES[2], "", EXTENSIONPOINTS1_CLASSES[2]);
115
                ep.append(EXTENSIONPOINTS1_NAMES[3], "", EXTENSIONPOINTS1_CLASSES[3]);
116
                ep.append(EXTENSIONPOINTS1_NAMES[4], "", EXTENSIONPOINTS1_CLASSES[4]);
117
                ep.append(EXTENSIONPOINTS1_NAMES[5], "", EXTENSIONPOINTS1_CLASSES[5]);
118

    
119
                ep = epMan.add(EXTENSIONPOINT2_NAME, "");
120
                ep.append(EXTENSIONPOINTS2_NAMES[0], "", EXTENSIONPOINTS2_CLASSES[0]);
121
                ep.append(EXTENSIONPOINTS2_NAMES[1], "", EXTENSIONPOINTS2_CLASSES[1]);
122
                ep.append(EXTENSIONPOINTS2_NAMES[2], "", EXTENSIONPOINTS2_CLASSES[2]);
123

    
124
                ep = epMan.add(EXTENSIONPOINT3_NAME, "");
125
                ep.append(EXTENSIONPOINTS3_OTHER_NAMES[0], "",
126
                                OTHER_PANELS_EXTENSIONPOINTS3_CLASSES[0]);
127
                ep.append(EXTENSIONPOINTS3_OTHER_NAMES[1], "",
128
                                OTHER_PANELS_EXTENSIONPOINTS3_CLASSES[1]);
129

    
130
                ep = epMan.add(EXTENSIONPOINT4_NAME, "");
131
                ep.append(EXTENSIONPOINTS4_NAMES[0], "", EXTENSIONPOINTS4_CLASSES[0]);
132
                ep.append(EXTENSIONPOINTS4_NAMES[1], "", EXTENSIONPOINTS4_CLASSES[1]);
133

    
134
                ep = epMan.add(EXTENSIONPOINT5_NAME, "");
135
                ep.append(EXTENSIONPOINTS5_NAMES[0], "", EXTENSIONPOINTS5_CLASSES[0]);
136
                ep.append(EXTENSIONPOINTS5_NAMES[1], "", EXTENSIONPOINTS5_CLASSES[1]);
137

    
138
                epMan.add(EXTENSIONPOINT6_NAME, "");
139

    
140
                ep = epMan.add(EXTENSIONPOINT7_NAME, "");
141
                ep.append(EXTENSIONPOINTS7_NAMES[0], "", EXTENSIONPOINTS7_CLASSES[0]);
142

    
143
                ep = epMan.add(EXTENSIONPOINT8_NAME, "");
144
                ep.append(EXTENSIONPOINTS8_NAMES[0], "", EXTENSIONPOINTS8_CLASSES[0]);
145
                ep.append(EXTENSIONPOINTS8_NAMES[1], "", EXTENSIONPOINTS8_CLASSES[1]);
146

    
147
                ep = epMan.add(EXTENSIONPOINT9_NAME, "");
148
                ep.append(EXTENSIONPOINTS9_NAMES[0], "", EXTENSIONPOINTS9_CLASSES[0]);
149
                ep.append(EXTENSIONPOINTS9_NAMES[1], "", EXTENSIONPOINTS9_CLASSES[1]);
150
                ep.append(EXTENSIONPOINTS9_NAMES[2], "", EXTENSIONPOINTS9_CLASSES[2]);
151

    
152
                ep = epMan.add(EXTENSIONPOINT10_NAME, "");
153
                ep.append(EXTENSIONPOINTS10_NAMES[0], "", EXTENSIONPOINTS10_CLASSES[0]);
154
                ep.append(EXTENSIONPOINTS10_NAMES[1], "", EXTENSIONPOINTS10_CLASSES[1]);
155
                ep.append(EXTENSIONPOINTS10_NAMES[2], "", EXTENSIONPOINTS10_CLASSES[2]);
156
                ep.append(EXTENSIONPOINTS10_NAMES[3], "", EXTENSIONPOINTS10_CLASSES[3]);
157
        }
158
}