root / trunk / frameworks / _fwAndami / src / com / iver / andami / ui / mdiManager / MDIManagerFactory.java @ 1153
History | View | Annotate | Download (3.64 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 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 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package com.iver.andami.ui.mdiManager; |
42 |
|
43 |
import com.iver.andami.Launcher; |
44 |
import com.iver.andami.messages.Messages; |
45 |
import com.iver.andami.plugins.PluginClassLoader; |
46 |
import com.iver.andami.plugins.config.generate.SkinExtension; |
47 |
|
48 |
import org.apache.log4j.Logger; |
49 |
|
50 |
|
51 |
/**
|
52 |
* Se encarga de la creaci?n de la clase Skin.
|
53 |
*
|
54 |
* @author Fernando Gonz?lez Cort?s
|
55 |
*/
|
56 |
public class MDIManagerFactory { |
57 |
private static SkinExtension skinExtension = null; |
58 |
private static PluginClassLoader loader = null; |
59 |
private static MDIManager mdiManager = null; |
60 |
private static Logger logger = Logger.getLogger(MDIManagerFactory.class.getName()); |
61 |
|
62 |
/**
|
63 |
* DOCUMENT ME!
|
64 |
*
|
65 |
* @param extension DOCUMENT ME!
|
66 |
* @param loader DOCUMENT ME!
|
67 |
*/
|
68 |
public static void setSkinExtension(SkinExtension extension, |
69 |
PluginClassLoader loader) { |
70 |
MDIManagerFactory.loader = loader; |
71 |
MDIManagerFactory.skinExtension = extension; |
72 |
} |
73 |
|
74 |
/**
|
75 |
* Obtiene una referencia al Skin cargado. El skin cargado es un singleton, se
|
76 |
* devuelve la misma instancia a todas las invocaciones de ?ste m?todo
|
77 |
*
|
78 |
* @return referencia al skin cargado
|
79 |
*/
|
80 |
public static MDIManager createManager() { |
81 |
if (mdiManager != null) return mdiManager; |
82 |
|
83 |
if (skinExtension == null) { |
84 |
throw new NoSkinExtensionException(Messages.getString("MDIManagerFactory.No skin extension in the plugins.")); |
85 |
} else {
|
86 |
try {
|
87 |
mdiManager = (MDIManager) loader.loadClass(skinExtension.getClassName()) |
88 |
.newInstance(); |
89 |
return mdiManager;
|
90 |
} catch (InstantiationException e) { |
91 |
logger.error(Messages.getString("Launcher.Error instanciando la extensi?n"), e);
|
92 |
|
93 |
// return new NewSkin();
|
94 |
} catch (IllegalAccessException e) { |
95 |
logger.error(Messages.getString("Launcher.Error instanciando la extensi?n"), e);
|
96 |
|
97 |
// return new NewSkin();
|
98 |
} catch (ClassNotFoundException e) { |
99 |
logger.error(Messages.getString("Launcher.No se encontr? la clase de la extensi?n"), e);
|
100 |
|
101 |
// return new NewSkin();
|
102 |
} |
103 |
} |
104 |
|
105 |
return null; |
106 |
} |
107 |
|
108 |
/**
|
109 |
* DOCUMENT ME!
|
110 |
*
|
111 |
* @return Returns the skinExtension.
|
112 |
*/
|
113 |
public static SkinExtension getSkinExtension() { |
114 |
return skinExtension;
|
115 |
} |
116 |
} |