root / trunk / libraries / libUIComponent / src / org / gvsig / gui / beans / panelGroup / loaders / PanelGroupLoaderFromList.java @ 15734
History | View | Annotate | Download (2.41 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.loaders; |
21 |
|
22 |
import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel; |
23 |
|
24 |
/**
|
25 |
* <p>Panel loader version that doesn't load the panels, only stores and returns them.</p>
|
26 |
* <p>This loader is useful to mask the load of panels and eliminate the dependence to the extension
|
27 |
* points, and, consequently, the dependence between the <i>libUIComponents</i> project to other
|
28 |
* projects.</p>
|
29 |
* <p>This loader is used together with {@link PanelGroupLoaderUtilities PanelGroupLoaderUtilities} (allocated
|
30 |
* in other project), that is which really loads the panels. First use <code>PanelGroupLoaderUtilities</code>
|
31 |
* and after <code>PanelGroupLoaderFromList</code>.</p>
|
32 |
*
|
33 |
* @see IPanelGroupLoader
|
34 |
*
|
35 |
* @version 15/10/2007
|
36 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
|
37 |
*/
|
38 |
public class PanelGroupLoaderFromList implements IPanelGroupLoader { |
39 |
/**
|
40 |
* Array with the panels loaded.
|
41 |
*
|
42 |
* @see #loadPanels()
|
43 |
*/
|
44 |
private Class[] list; |
45 |
|
46 |
/**
|
47 |
* <p>Initializes this loader with the panels.</p>
|
48 |
*
|
49 |
* @param list array with the panels that this loader supposedly load
|
50 |
*/
|
51 |
public PanelGroupLoaderFromList(Class[] list) { |
52 |
this.list = list;
|
53 |
} |
54 |
|
55 |
/*
|
56 |
* (non-Javadoc)
|
57 |
* @see org.gvsig.gui.beans.panelGroup.loaders.IPanelGroupLoader#loadPanels()
|
58 |
*/
|
59 |
public AbstractPanel[] loadPanels() throws Exception { |
60 |
if (list == null) |
61 |
return null; |
62 |
|
63 |
AbstractPanel[] panels = new AbstractPanel[list.length]; |
64 |
|
65 |
for (int i = 0; i< list.length; i++) { |
66 |
if (list[i] != null) |
67 |
panels[i] = (AbstractPanel) list[i].newInstance(); |
68 |
} |
69 |
return panels;
|
70 |
} |
71 |
} |