Revision 1703
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>CorePlugin</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
</buildSpec> |
|
14 |
<natures> |
|
15 |
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> |
|
16 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
17 |
<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature> |
|
18 |
</natures> |
|
19 |
</projectDescription> |
|
0 | 20 |
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<libraries library-dir="."/> |
|
4 |
<resourceBundle name="text"/> |
|
5 |
<extensions> |
|
6 |
<extension class-name="com.iver.core.Consola" |
|
7 |
description="Extensi?n encargada de abrir la ventana de la consola." |
|
8 |
active="true" priority="1"> |
|
9 |
<menu text="Ver/Consola" action-command="unico" key="s" |
|
10 |
mnemonic="c" icon="images/console.png" |
|
11 |
tooltip="muestra_consola_tooltip" |
|
12 |
position="0"/> |
|
13 |
<tool-bar name="core"> |
|
14 |
<action-tool icon="images/console.png" |
|
15 |
action-command="consola" tooltip="muestra_consola_tooltip" |
|
16 |
enable-text="debe_estar_activada" last="true"/> |
|
17 |
</tool-bar> |
|
18 |
</extension> |
|
19 |
<extension class-name="com.iver.core.ConfigExtension" |
|
20 |
description="Extensi?n encargada de abrir la ventana de configuraci?n de ANDAMI." |
|
21 |
active="true" priority="2"> |
|
22 |
<menu text="ventana/Configurar" action-command="config" key="s" |
|
23 |
mnemonic="p" icon="images/config.png" |
|
24 |
tooltip="configuracion_andami_tooltip" |
|
25 |
position="2"/> |
|
26 |
<tool-bar name="core"> |
|
27 |
<action-tool icon="images/config.png" |
|
28 |
action-command="configuracion" tooltip="configuracion_andami_tooltip" |
|
29 |
enable-text="debe_estar_activada"/> |
|
30 |
</tool-bar> |
|
31 |
</extension> |
|
32 |
|
|
33 |
<extension class-name="com.iver.core.StatusBar" |
|
34 |
description="Recoge los mensajes del NotificationManager y los muestra por la StatusBar" |
|
35 |
active="true"> |
|
36 |
</extension> |
|
37 |
<skin-extension class-name="com.iver.core.mdiManager.NewSkin"> |
|
38 |
<menu text="ventana/Cascada" action-command="cascada" key="c" |
|
39 |
mnemonic="c" tooltip="cascada_tooltip"/> |
|
40 |
<menu text="ventana/Tile" action-command="mosaico" key="m" |
|
41 |
mnemonic="c" tooltip="mosaico_tooltip"/> |
|
42 |
</skin-extension> |
|
43 |
</extensions> |
|
44 |
</plugin-config> |
|
45 |
|
|
46 |
<!-- |
|
47 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
48 |
<!DOCTYPE plugin SYSTEM "../../plugin.dtd"> |
|
49 |
<plugin> |
|
50 |
<libraries> |
|
51 |
<library file="com.iver.core.jar"/> |
|
52 |
<library file="prulib.jar"/> |
|
53 |
</libraries> |
|
54 |
<resourceBundle name="text"/> |
|
55 |
<labelSet class="com.iver.core.ConsolaFrame"> |
|
56 |
<label text="label1"/> |
|
57 |
<label text="label2"/> |
|
58 |
</labelSet> |
|
59 |
<extension> |
|
60 |
<class name="com.iver.core.Consola"/> |
|
61 |
<menu text="Ver/Consola" key="s"/> |
|
62 |
<toolBar name="Ver"> |
|
63 |
<tool icon="images/console.jpg" |
|
64 |
actionCommand="CONSOLA"/> |
|
65 |
</toolBar> |
|
66 |
</extension> |
|
67 |
<extension> |
|
68 |
<class name="com.iver.core.Cascade"/> |
|
69 |
<menu text="Window/Tile" key="t" mnemonic="t" |
|
70 |
tooltip="tile_tooltip" |
|
71 |
enableText="cascada_enable" |
|
72 |
actionCommand="TILE"/> |
|
73 |
<menu text="Window/Cascada" key="c" mnemonic="c" |
|
74 |
tooltip="cascada_tooltip" |
|
75 |
enableText="cascada_enable" |
|
76 |
actionCommand="CASCADA"/> |
|
77 |
<toolBar name="Window"> |
|
78 |
<tool icon="images/cascada.gif" |
|
79 |
tooltip="cascada_tooltip" |
|
80 |
enableText="cascada_enable" |
|
81 |
actionCommand="CASCADA"/> |
|
82 |
<tool icon="images/tile.gif" |
|
83 |
tooltip="tile_tooltip" |
|
84 |
enableText="cascada_enable" |
|
85 |
actionCommand="TILE"/> |
|
86 |
</toolBar> |
|
87 |
<popupMenu name="cascada"> |
|
88 |
<entry text="Cascada" |
|
89 |
tooltip="cascada_tooltip" |
|
90 |
enableText="cascada_enable" actionCommand="CASCADA"/> |
|
91 |
<entry text="Tile" |
|
92 |
tooltip="tile_tooltip" |
|
93 |
enableText="cascada_enable" actionCommand="CASCADA"/> |
|
94 |
</popupMenu> |
|
95 |
</extension> |
|
96 |
<extension> |
|
97 |
<class name="com.iver.core.StatusBar"/> |
|
98 |
</extension> |
|
99 |
</plugin> |
|
100 |
--> |
|
0 | 101 |
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/text_fr.properties | ||
---|---|---|
1 |
Ver=Afficher |
|
2 |
Consola=Console |
|
3 |
Tile=Mosa?que |
|
4 |
Cascada=Cascade |
|
5 |
Window=Fen?tre |
|
6 |
cascada_tooltip=Organiser les fen?tres en cascade |
|
7 |
cascada_enable=Au moins une fen?tre doit ?tre ouverte |
|
8 |
tile_tooltip=Organiser les fen?tres en mosa?que |
|
9 |
titulo_consola=Console d'information |
|
10 |
todos=Tous |
|
11 |
info=Information |
|
12 |
warnings=Attention |
|
13 |
errores=Erreurs |
|
14 |
configurar_ANDAMI=Fen?tre de configuration d'ANDAMI. |
|
15 |
extension_activada=Extension activ?e. |
|
16 |
examinar=Examiner |
|
17 |
directorio_extensiones=R?pertoire des extensions |
|
18 |
prioridad=Priorit? |
|
19 |
opciones=Options |
|
20 |
general=G?n?ral |
|
21 |
descripcion=Description |
|
22 |
directorio=R?pertoire |
|
23 |
aceptar=Accepter |
|
24 |
cancelar=Annuler |
|
25 |
ventana=Fen?tre |
|
26 |
Configurar=Configurer |
|
27 |
__catalan=valencien |
|
0 | 28 |
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/src/com/iver/core/StatusBar.java | ||
---|---|---|
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.core; |
|
42 |
|
|
43 |
import com.iver.andami.messages.MessageEvent; |
|
44 |
import com.iver.andami.messages.NotificationListener; |
|
45 |
import com.iver.andami.messages.NotificationManager; |
|
46 |
import com.iver.andami.messages.ProgressListener; |
|
47 |
import com.iver.andami.plugins.Extension; |
|
48 |
|
|
49 |
|
|
50 |
/** |
|
51 |
* Plugin que escucha las notificaciones que recive la aplicaci?n y las muestra |
|
52 |
* en la barra de estado |
|
53 |
*/ |
|
54 |
public class StatusBar implements Extension, NotificationListener { |
|
55 |
private int i; |
|
56 |
private int pr; |
|
57 |
/** |
|
58 |
* @see com.iver.mdiApp.Extension#inicializar() |
|
59 |
*/ |
|
60 |
public void inicializar() { |
|
61 |
NotificationManager.addNotificationListener(this); |
|
62 |
} |
|
63 |
|
|
64 |
/** |
|
65 |
* @see com.iver.mdiApp.NotificationListener#errorEvent(java.lang.String) |
|
66 |
*/ |
|
67 |
public void errorEvent(MessageEvent e) { |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* @see com.iver.mdiApp.NotificationListener#warningEvent(java.lang.String) |
|
72 |
*/ |
|
73 |
public void warningEvent(MessageEvent e) { |
|
74 |
} |
|
75 |
|
|
76 |
/** |
|
77 |
* @see com.iver.mdiApp.NotificationListener#infoEvent(java.lang.String) |
|
78 |
*/ |
|
79 |
public void infoEvent(MessageEvent e) { |
|
80 |
} |
|
81 |
|
|
82 |
/* (non-Javadoc) |
|
83 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
84 |
*/ |
|
85 |
public void execute(String actionCommand) { |
|
86 |
// TODO Auto-generated method stub |
|
87 |
|
|
88 |
} |
|
89 |
|
|
90 |
/* (non-Javadoc) |
|
91 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
92 |
*/ |
|
93 |
public boolean isEnabled() { |
|
94 |
// TODO Auto-generated method stub |
|
95 |
return false; |
|
96 |
} |
|
97 |
|
|
98 |
/* (non-Javadoc) |
|
99 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
100 |
*/ |
|
101 |
public boolean isVisible() { |
|
102 |
// TODO Auto-generated method stub |
|
103 |
return false; |
|
104 |
} |
|
105 |
|
|
106 |
|
|
107 |
} |
|
0 | 108 |
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/src/com/iver/core/ConsolaFrame.java | ||
---|---|---|
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.core; |
|
42 |
|
|
43 |
import java.awt.BorderLayout; |
|
44 |
import java.awt.event.MouseEvent; |
|
45 |
import java.awt.event.MouseListener; |
|
46 |
|
|
47 |
import javax.swing.JEditorPane; |
|
48 |
import javax.swing.JPanel; |
|
49 |
import javax.swing.JScrollPane; |
|
50 |
import javax.swing.JTabbedPane; |
|
51 |
import javax.swing.SwingUtilities; |
|
52 |
|
|
53 |
import com.iver.andami.PluginServices; |
|
54 |
import com.iver.andami.messages.MessageEvent; |
|
55 |
import com.iver.andami.messages.NotificationListener; |
|
56 |
import com.iver.andami.ui.mdiManager.SingletonView; |
|
57 |
import com.iver.andami.ui.mdiManager.View; |
|
58 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
|
59 |
|
|
60 |
/** |
|
61 |
* Frame que escucha los eventos del sistema de mensajes de la aplicaci?n y los |
|
62 |
* muestra. |
|
63 |
*/ |
|
64 |
public class ConsolaFrame extends JPanel implements View, SingletonView, NotificationListener { |
|
65 |
private StringBuffer info = new StringBuffer(); |
|
66 |
private StringBuffer warn = new StringBuffer(); |
|
67 |
private StringBuffer error = new StringBuffer(); |
|
68 |
private StringBuffer all = new StringBuffer(); |
|
69 |
private JEditorPane textoInfos; |
|
70 |
private JEditorPane textoWarnings; |
|
71 |
private JEditorPane textoErrores; |
|
72 |
private JEditorPane textoAll; |
|
73 |
|
|
74 |
private final static String marcaInfo ="font size='3' color='#000000'"; |
|
75 |
private final static String marcaWarning ="font size='3' color='#800000'"; |
|
76 |
private final static String marcaError ="font size='3' color='#FF0000'"; |
|
77 |
private JTabbedPane tabs; |
|
78 |
private JPanel panelErrores; |
|
79 |
|
|
80 |
/** |
|
81 |
* Crea la consola con los mensajes producidos hasta el momento de la |
|
82 |
* creaci?n de este objeto. |
|
83 |
* |
|
84 |
* @param todo Array de todos los mensajes |
|
85 |
* @param infos Array de los mensajes de informaci?n |
|
86 |
* @param warns Array de los mensajes de warning |
|
87 |
* @param errors Array de los mensajes de error |
|
88 |
*/ |
|
89 |
public ConsolaFrame() { |
|
90 |
|
|
91 |
this.setSize(400, 325); |
|
92 |
|
|
93 |
//Las cajas de texto donde van los mensajes |
|
94 |
textoInfos = new JEditorPane(); |
|
95 |
textoInfos.setEditable(false); |
|
96 |
textoInfos.setContentType("text/html"); |
|
97 |
textoWarnings = new JEditorPane(); |
|
98 |
textoWarnings.setEditable(false); |
|
99 |
textoWarnings.setContentType("text/html"); |
|
100 |
textoErrores = new JEditorPane(); |
|
101 |
textoErrores.setEditable(false); |
|
102 |
textoErrores.setContentType("text/html"); |
|
103 |
textoAll = new JEditorPane(); |
|
104 |
textoAll.setEditable(false); |
|
105 |
textoAll.setContentType("text/html"); |
|
106 |
|
|
107 |
JScrollPane scroll = new JScrollPane(textoAll); |
|
108 |
scroll.setVerticalScrollBarPolicy( |
|
109 |
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
|
110 |
scroll.setHorizontalScrollBarPolicy( |
|
111 |
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
|
112 |
// scroll.setPreferredSize(new Dimension(500, 500)); |
|
113 |
// scroll.setMinimumSize(new Dimension(10, 10)); |
|
114 |
JPanel panelAll = new JPanel(new BorderLayout()); |
|
115 |
panelAll.add(scroll, BorderLayout.CENTER); |
|
116 |
|
|
117 |
scroll = new JScrollPane(textoInfos); |
|
118 |
scroll.setVerticalScrollBarPolicy( |
|
119 |
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
|
120 |
scroll.setHorizontalScrollBarPolicy( |
|
121 |
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
|
122 |
// scroll.setPreferredSize(new Dimension(250, 145)); |
|
123 |
// scroll.setMinimumSize(new Dimension(10, 10)); |
|
124 |
JPanel panelInfos = new JPanel(new BorderLayout()); |
|
125 |
panelInfos.add(scroll, BorderLayout.CENTER); |
|
126 |
|
|
127 |
scroll = new JScrollPane(textoWarnings); |
|
128 |
scroll.setVerticalScrollBarPolicy( |
|
129 |
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
|
130 |
scroll.setHorizontalScrollBarPolicy( |
|
131 |
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
|
132 |
// scroll.setPreferredSize(new Dimension(250, 145)); |
|
133 |
// scroll.setMinimumSize(new Dimension(10, 10)); |
|
134 |
JPanel panelWarnings = new JPanel(new BorderLayout()); |
|
135 |
panelWarnings.add(scroll, BorderLayout.CENTER); |
|
136 |
|
|
137 |
scroll = new JScrollPane(textoErrores); |
|
138 |
scroll.setVerticalScrollBarPolicy( |
|
139 |
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
|
140 |
scroll.setHorizontalScrollBarPolicy( |
|
141 |
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
|
142 |
// scroll.setPreferredSize(new Dimension(250, 145)); |
|
143 |
// scroll.setMinimumSize(new Dimension(10, 10)); |
|
144 |
panelErrores = new JPanel(new BorderLayout()); |
|
145 |
panelErrores.add(scroll, BorderLayout.CENTER); |
|
146 |
|
|
147 |
// rellenar(infos, textoInfos, info, marcaInfo); |
|
148 |
// rellenar(warns, textoWarnings, warn, marcaWarning); |
|
149 |
// rellenar(errors, textoErrores, error, marcaError); |
|
150 |
// rellenarTodo(todo, textoAll); |
|
151 |
|
|
152 |
//Las pesta?as |
|
153 |
tabs = new JTabbedPane(); |
|
154 |
tabs.addTab(PluginServices.getText( this ,"todos"), panelAll); |
|
155 |
tabs.addTab(PluginServices.getText( this ,"info"), panelInfos); |
|
156 |
tabs.addTab(PluginServices.getText( this ,"warnings"), panelWarnings); |
|
157 |
tabs.addTab(PluginServices.getText( this ,"errores"), panelErrores); |
|
158 |
this.setLayout(new BorderLayout()); |
|
159 |
this.add(tabs, BorderLayout.CENTER); |
|
160 |
|
|
161 |
} |
|
162 |
|
|
163 |
/** |
|
164 |
* M?todo de utilidad para rellenar los cuadros de texto con un array de |
|
165 |
* cadenas |
|
166 |
* |
|
167 |
* @param contenido array de cadenas que se mostrar?n en el cuadro de texto |
|
168 |
* separadas por un retorno de carro |
|
169 |
* @param control Control en el que se pondr?n las cadenas |
|
170 |
*/ |
|
171 |
private void rellenar(String[] contenido, JEditorPane control, StringBuffer buffer, String marca) { |
|
172 |
String content = ""; |
|
173 |
for (int i = 0; i < contenido.length; i++) { |
|
174 |
content = content + "<"+marca+">"+contenido[i] + "</"+marca+"><br/"; |
|
175 |
} |
|
176 |
|
|
177 |
buffer.append(content); |
|
178 |
|
|
179 |
control.setContentType("text/html"); |
|
180 |
control.setText(content); |
|
181 |
} |
|
182 |
|
|
183 |
/* |
|
184 |
* M?todo de utilidad para rellenar los cuadros de texto con un array de |
|
185 |
* cadenas |
|
186 |
* |
|
187 |
* @param contenido array de cadenas que se mostrar?n en el cuadro de texto |
|
188 |
* separadas por un retorno de carro |
|
189 |
* @param control Control en el que se pondr?n las cadenas |
|
190 |
* |
|
191 |
private void rellenarTodo(Message[] contenido, JEditorPane control) { |
|
192 |
HashMap marcasTipoMsg = new HashMap(); |
|
193 |
marcasTipoMsg.put(new Integer(Message.INFO), marcaInfo); |
|
194 |
marcasTipoMsg.put(new Integer(Message.WARNING), marcaWarning); |
|
195 |
marcasTipoMsg.put(new Integer(Message.ERROR), marcaError); |
|
196 |
|
|
197 |
String content = ""; |
|
198 |
for (int i = 0; i < contenido.length; i++) { |
|
199 |
String marca = (String) marcasTipoMsg.get(new Integer(contenido[i].tipo)); |
|
200 |
content = content + "<"+marca+">"+contenido[i].texto + "</"+marca+"><br/"; |
|
201 |
} |
|
202 |
|
|
203 |
all.append(content); |
|
204 |
|
|
205 |
control.setContentType("text/html"); |
|
206 |
control.setText(content); |
|
207 |
}*/ |
|
208 |
|
|
209 |
|
|
210 |
/** |
|
211 |
* Obtiene un string con la traza de una excepci?n a la consola |
|
212 |
* |
|
213 |
* @param t Elemento throwable |
|
214 |
*/ |
|
215 |
private static String dumpStackTrace(Throwable t) { |
|
216 |
if ( t == null ) return ""; |
|
217 |
StackTraceElement[] stes = t.getStackTrace(); |
|
218 |
String todo = "<"+marcaWarning+">" + t.getClass().getName() + ": " + t.getLocalizedMessage() + |
|
219 |
"<"+marcaWarning+">" + "<br/"; |
|
220 |
|
|
221 |
for (int i = 0; i < stes.length; i++) { |
|
222 |
todo += ("<"+marcaWarning+"> " + stes[i].toString() + "<br/"); |
|
223 |
} |
|
224 |
|
|
225 |
if (t.getCause() != null) { |
|
226 |
todo = todo + dumpStackTrace(t.getCause()); |
|
227 |
} |
|
228 |
|
|
229 |
return todo; |
|
230 |
} |
|
231 |
|
|
232 |
/** |
|
233 |
* @see com.iver.mdiApp.NotificationListener#errorEvent(java.lang.String) |
|
234 |
*/ |
|
235 |
public void errorEvent(MessageEvent e) { |
|
236 |
for (int i = 0; i < e.getMessages().length; i++){ |
|
237 |
String traza = dumpStackTrace(e.getExceptions()[i]); |
|
238 |
|
|
239 |
error.append("<"+marcaError+">" + e.getMessages()[i] + "</"+marcaError+"><br/" + traza); |
|
240 |
all.append("<"+marcaError+">" + e.getMessages()[i] + "</"+marcaError+"><br/" + traza); |
|
241 |
} |
|
242 |
textoErrores.setText(error.toString()); |
|
243 |
textoAll.setText(all.toString()); |
|
244 |
|
|
245 |
if (SwingUtilities.isEventDispatchThread()){ |
|
246 |
PluginServices.getMDIManager().addView(this); |
|
247 |
tabs.setSelectedComponent(panelErrores); |
|
248 |
}else{ |
|
249 |
SwingUtilities.invokeLater(new Runnable() { |
|
250 |
public void run() { |
|
251 |
PluginServices.getMDIManager().addView(ConsolaFrame.this); |
|
252 |
tabs.setSelectedComponent(panelErrores); |
|
253 |
} |
|
254 |
}); |
|
255 |
} |
|
256 |
} |
|
257 |
|
|
258 |
/** |
|
259 |
* @see com.iver.mdiApp.NotificationListener#warningEvent(java.lang.String) |
|
260 |
*/ |
|
261 |
public void warningEvent(MessageEvent e) { |
|
262 |
for (int i = 0; i < e.getMessages().length; i++){ |
|
263 |
String traza = dumpStackTrace(e.getExceptions()[i]); |
|
264 |
|
|
265 |
warn.append("<"+marcaWarning+">" + e.getMessages()[i] + "</"+marcaWarning+"><br/" + traza); |
|
266 |
all.append("<"+marcaWarning+">" + e.getMessages()[i] + "</"+marcaWarning+"><br/" + traza); |
|
267 |
} |
|
268 |
textoWarnings.setText(warn.toString()); |
|
269 |
textoAll.setText(all.toString()); |
|
270 |
} |
|
271 |
|
|
272 |
/** |
|
273 |
* @see com.iver.mdiApp.NotificationListener#infoEvent(java.lang.String) |
|
274 |
*/ |
|
275 |
public void infoEvent(MessageEvent e) { |
|
276 |
for (int i = 0; i < e.getMessages().length; i++){ |
|
277 |
String traza = dumpStackTrace(e.getExceptions()[i]); |
|
278 |
|
|
279 |
info.append("<"+marcaInfo+">" + e.getMessages()[i] + "</"+marcaInfo+"><br/" + traza); |
|
280 |
all.append("<"+marcaInfo+">" + e.getMessages()[i] + "</"+marcaInfo+"><br/" + traza); |
|
281 |
} |
|
282 |
textoInfos.setText(info.toString() ); |
|
283 |
textoAll.setText(all.toString()); |
|
284 |
|
|
285 |
} |
|
286 |
|
|
287 |
/** |
|
288 |
* @see com.iver.mdiApp.ui.MDIManager.View#getModel() |
|
289 |
*/ |
|
290 |
public Object getViewModel() { |
|
291 |
return "consola"; |
|
292 |
} |
|
293 |
|
|
294 |
/** |
|
295 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo() |
|
296 |
*/ |
|
297 |
public ViewInfo getViewInfo() { |
|
298 |
ViewInfo info = new ViewInfo(ViewInfo.MODELESSDIALOG|ViewInfo.RESIZABLE|ViewInfo.MAXIMIZABLE|ViewInfo.ICONIFIABLE); |
|
299 |
info.setTitle(PluginServices.getText(this, "titulo_consola")); |
|
300 |
return info; |
|
301 |
} |
|
302 |
} |
|
0 | 303 |
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/src/com/iver/core/Consola.java | ||
---|---|---|
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.core; |
|
42 |
|
|
43 |
import com.iver.andami.PluginServices; |
|
44 |
import com.iver.andami.messages.NotificationManager; |
|
45 |
import com.iver.andami.plugins.Extension; |
|
46 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
|
47 |
import com.iver.utiles.XMLEntity; |
|
48 |
|
|
49 |
|
|
50 |
/** |
|
51 |
* Extensi?n que registra un frame en la aplicaci?n que recibe los eventos de |
|
52 |
* la consola de la aplicaci?n y los muestra en el frame |
|
53 |
*/ |
|
54 |
public class Consola implements Extension { |
|
55 |
static PluginServices ps; |
|
56 |
private ConsolaFrame consolaFrame; |
|
57 |
|
|
58 |
/** |
|
59 |
* @see com.iver.mdiApp.Extension#inicializar() |
|
60 |
*/ |
|
61 |
public void inicializar() { |
|
62 |
ps = PluginServices.getPluginServices(this); |
|
63 |
consolaFrame = new ConsolaFrame(); |
|
64 |
NotificationManager.addNotificationListener(consolaFrame); |
|
65 |
} |
|
66 |
|
|
67 |
/* (non-Javadoc) |
|
68 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
69 |
*/ |
|
70 |
public void execute(String actionCommand) { |
|
71 |
PluginServices.getMDIManager().addView(consolaFrame); |
|
72 |
} |
|
73 |
|
|
74 |
/* (non-Javadoc) |
|
75 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
76 |
*/ |
|
77 |
public boolean isEnabled() { |
|
78 |
return true; |
|
79 |
} |
|
80 |
|
|
81 |
/* (non-Javadoc) |
|
82 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
83 |
*/ |
|
84 |
public boolean isVisible() { |
|
85 |
return true; |
|
86 |
} |
|
87 |
} |
|
0 | 88 |
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/src/com/iver/core/ConfigExtension.java | ||
---|---|---|
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.core; |
|
42 |
|
|
43 |
|
|
44 |
/** |
|
45 |
*/ |
|
46 |
import com.iver.andami.PluginServices; |
|
47 |
import com.iver.andami.plugins.Extension; |
|
48 |
import com.iver.core.configExtensions.ConfigPlugins; |
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
/** |
|
53 |
* Extensi?n para abrir el di?logo de configuraci?n de ANDAMI. |
|
54 |
* |
|
55 |
* @author Vicente Caballero Navarro |
|
56 |
* |
|
57 |
* |
|
58 |
*/ |
|
59 |
public class ConfigExtension implements Extension { |
|
60 |
|
|
61 |
/* (non-Javadoc) |
|
62 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
63 |
*/ |
|
64 |
public void execute(String actionCommand) { |
|
65 |
ConfigPlugins cp=new ConfigPlugins(); |
|
66 |
PluginServices.getMDIManager().addView(cp); |
|
67 |
} |
|
68 |
|
|
69 |
/** |
|
70 |
* DOCUMENT ME! |
|
71 |
* |
|
72 |
* @return DOCUMENT ME! |
|
73 |
*/ |
|
74 |
public boolean isVisible() { |
|
75 |
return true; |
|
76 |
} |
|
77 |
|
|
78 |
/** |
|
79 |
* @see com.iver.mdiApp.plugins.Extension#isEnabled() |
|
80 |
*/ |
|
81 |
public boolean isEnabled() { |
|
82 |
return true; |
|
83 |
} |
|
84 |
|
|
85 |
/** |
|
86 |
* @see com.iver.andami.plugins.Extension#inicializar() |
|
87 |
*/ |
|
88 |
public void inicializar() { |
|
89 |
} |
|
90 |
} |
|
0 | 91 |
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/src/com/iver/core/mdiManager/SingletonViewSupport.java | ||
---|---|---|
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.core.mdiManager; |
|
42 |
|
|
43 |
import java.util.ArrayList; |
|
44 |
import java.util.Comparator; |
|
45 |
import java.util.Iterator; |
|
46 |
import java.util.TreeMap; |
|
47 |
|
|
48 |
import javax.swing.JComponent; |
|
49 |
import javax.swing.JInternalFrame; |
|
50 |
|
|
51 |
import com.iver.andami.ui.mdiManager.SingletonDialogAlreadyShownException; |
|
52 |
import com.iver.andami.ui.mdiManager.SingletonView; |
|
53 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
|
54 |
|
|
55 |
|
|
56 |
/** |
|
57 |
* DOCUMENT ME! |
|
58 |
* |
|
59 |
* @author $author$ |
|
60 |
* @version $Revision$ |
|
61 |
*/ |
|
62 |
public class SingletonViewSupport { |
|
63 |
/** Hashtable que asocia contenido con vistas */ |
|
64 |
private TreeMap contentViewInfo = new TreeMap(new SingletonViewInfoComparator()); |
|
65 |
private ViewInfoSupport vis; |
|
66 |
private FrameViewSupport frameViewSupport; |
|
67 |
private TreeMap contentFrame = new TreeMap(new SingletonViewInfoComparator()); |
|
68 |
|
|
69 |
/** |
|
70 |
* DOCUMENT ME! |
|
71 |
* |
|
72 |
* @param vis DOCUMENT ME! |
|
73 |
* @param fvs |
|
74 |
* |
|
75 |
* @see com.iver.andami.ui.mdiManager.MDIManager#init(com.iver.andami.ui.mdiFrame.MDIFrame) |
|
76 |
*/ |
|
77 |
public SingletonViewSupport(ViewInfoSupport vis, FrameViewSupport fvs) { |
|
78 |
this.vis = vis; |
|
79 |
this.frameViewSupport = fvs; |
|
80 |
} |
|
81 |
|
|
82 |
/** |
|
83 |
* Devuelve una referencia a la vista si ya est? mostrada o null si la |
|
84 |
* vista no ha sido a?adida o ya fue cerrada |
|
85 |
* |
|
86 |
* @param viewClass DOCUMENT ME! |
|
87 |
* @param model DOCUMENT ME! |
|
88 |
* @param vi DOCUMENT ME! |
|
89 |
* |
|
90 |
* @return true si la vista existe ya y false si la vista no existe |
|
91 |
* |
|
92 |
* @throws SingletonDialogAlreadyShownException DOCUMENT ME! |
|
93 |
*/ |
|
94 |
public boolean registerView(Class viewClass, Object model, ViewInfo vi) { |
|
95 |
//Se comprueba si la vista est? siendo mostrada |
|
96 |
SingletonViewInfo svi = new SingletonViewInfo(viewClass, model); |
|
97 |
|
|
98 |
if (contentViewInfo.containsKey(svi)) { |
|
99 |
if (vi.isModal()) { |
|
100 |
throw new SingletonDialogAlreadyShownException(); |
|
101 |
} |
|
102 |
|
|
103 |
vi.setViewInfo((ViewInfo)contentViewInfo.get(svi)); |
|
104 |
|
|
105 |
return true; |
|
106 |
} else { |
|
107 |
//La vista singleton no estaba mostrada |
|
108 |
//Se asocia el modelo con la vista |
|
109 |
contentViewInfo.put(svi, vi); |
|
110 |
return false; |
|
111 |
} |
|
112 |
} |
|
113 |
|
|
114 |
public void openSingletonView(SingletonView sv, JComponent frame){ |
|
115 |
SingletonViewInfo svi = new SingletonViewInfo(sv.getClass(), sv.getViewModel()); |
|
116 |
contentFrame.put(svi, frame); |
|
117 |
} |
|
118 |
|
|
119 |
public boolean contains(SingletonView sv){ |
|
120 |
SingletonViewInfo svi = new SingletonViewInfo(sv.getClass(), sv.getViewModel()); |
|
121 |
return contentFrame.containsKey(svi); |
|
122 |
} |
|
123 |
|
|
124 |
/** |
|
125 |
* DOCUMENT ME! |
|
126 |
* |
|
127 |
* @param s |
|
128 |
*/ |
|
129 |
public void closeView(SingletonView s) { |
|
130 |
SingletonViewInfo svi = new SingletonViewInfo(s.getClass(), s.getViewModel()); |
|
131 |
ViewInfo viewInfo = (ViewInfo) contentViewInfo.get(svi); |
|
132 |
JInternalFrame c = (JInternalFrame) contentFrame.get(svi); |
|
133 |
viewInfo.setWidth(c.getWidth()); |
|
134 |
viewInfo.setHeight(c.getHeight()); |
|
135 |
viewInfo.setX(c.getX()); |
|
136 |
viewInfo.setY(c.getY()); |
|
137 |
|
|
138 |
contentFrame.remove(svi); |
|
139 |
} |
|
140 |
|
|
141 |
/** |
|
142 |
* Representa una vista singleton manteniendo el modelo y la clase de la |
|
143 |
* vista que lo muestra |
|
144 |
* |
|
145 |
* @author Fernando Gonz?lez Cort?s |
|
146 |
*/ |
|
147 |
public class SingletonViewInfo { |
|
148 |
/** Clase de la vista */ |
|
149 |
public Class clase; |
|
150 |
|
|
151 |
/** Modelo que representa la vista */ |
|
152 |
public Object modelo; |
|
153 |
|
|
154 |
/** |
|
155 |
* Creates a new SingletonView object. |
|
156 |
* |
|
157 |
* @param clase Clase de la vista |
|
158 |
* @param modelo Modelo que representa la vista |
|
159 |
*/ |
|
160 |
public SingletonViewInfo(Class clase, Object modelo) { |
|
161 |
this.clase = clase; |
|
162 |
this.modelo = modelo; |
|
163 |
} |
|
164 |
|
|
165 |
/** |
|
166 |
* @see java.lang.Object#equals(java.lang.Object) |
|
167 |
*/ |
|
168 |
public boolean equals(Object obj) { |
|
169 |
if (obj.getClass() != SingletonViewInfo.class) { |
|
170 |
throw new IllegalArgumentException(); |
|
171 |
} |
|
172 |
|
|
173 |
SingletonViewInfo s = (SingletonViewInfo) obj; |
|
174 |
|
|
175 |
if ((clase == s.clase) && (modelo == s.modelo)) { |
|
176 |
return true; |
|
177 |
} else { |
|
178 |
return false; |
|
179 |
} |
|
180 |
} |
|
181 |
} |
|
182 |
|
|
183 |
/** |
|
184 |
* DOCUMENT ME! |
|
185 |
* |
|
186 |
* @author $author$ |
|
187 |
* @version $Revision$ |
|
188 |
*/ |
|
189 |
public class SingletonViewInfoComparator implements Comparator { |
|
190 |
/** |
|
191 |
* @see java.util.Comparator#compare(java.lang.Object, |
|
192 |
* java.lang.Object) |
|
193 |
*/ |
|
194 |
public int compare(Object o1, Object o2) { |
|
195 |
try{ |
|
196 |
SingletonViewInfo s1 = (SingletonViewInfo) o1; |
|
197 |
SingletonViewInfo s2 = (SingletonViewInfo) o2; |
|
198 |
|
|
199 |
if ((s1.clase.getName().equals(s2.clase.getName())) && |
|
200 |
(s1.modelo == s2.modelo)) { |
|
201 |
return 0; |
|
202 |
} else { |
|
203 |
return (s1.clase.getName() + s1.modelo + "_").compareTo(s2.clase.getName() + |
|
204 |
s2.modelo); |
|
205 |
} |
|
206 |
}catch(ClassCastException e){ |
|
207 |
e.printStackTrace(); |
|
208 |
return 0; |
|
209 |
} |
|
210 |
} |
|
211 |
} |
|
212 |
|
|
213 |
private JInternalFrame getFrame(SingletonViewInfo svi){ |
|
214 |
ViewInfo vi = (ViewInfo) contentViewInfo.get(svi); |
|
215 |
return (JInternalFrame) contentFrame.get(svi); |
|
216 |
} |
|
217 |
|
|
218 |
public JInternalFrame getFrame(Class viewClass, Object model){ |
|
219 |
SingletonViewInfo svi = new SingletonViewInfo(viewClass, model); |
|
220 |
return getFrame(svi); |
|
221 |
} |
|
222 |
|
|
223 |
/** |
|
224 |
* @param model |
|
225 |
* @return |
|
226 |
*/ |
|
227 |
public JInternalFrame[] getFrames(Object model) { |
|
228 |
ArrayList ret = new ArrayList(); |
|
229 |
|
|
230 |
Iterator keys = contentFrame.keySet().iterator(); |
|
231 |
while (keys.hasNext()) { |
|
232 |
SingletonViewInfo svi = (SingletonViewInfo) keys.next(); |
|
233 |
|
|
234 |
if (svi.modelo == model){ |
|
235 |
ret.add(contentFrame.get(svi)); |
|
236 |
} |
|
237 |
} |
|
238 |
|
|
239 |
return (JInternalFrame[]) ret.toArray(new JInternalFrame[0]); |
|
240 |
} |
|
241 |
|
|
242 |
/** |
|
243 |
* @param view |
|
244 |
* @return |
|
245 |
*/ |
|
246 |
public JInternalFrame getFrame(SingletonView sv) { |
|
247 |
SingletonViewInfo svi = new SingletonViewInfo(sv.getClass(), sv.getViewModel()); |
|
248 |
return getFrame(svi); |
|
249 |
} |
|
250 |
|
|
251 |
/** |
|
252 |
* @param sv |
|
253 |
* @param i |
|
254 |
*/ |
|
255 |
public void setX(SingletonView sv, int x) { |
|
256 |
JInternalFrame o = (JInternalFrame) contentFrame.get(new SingletonViewInfo(sv.getClass(), sv.getViewModel())); |
|
257 |
|
|
258 |
if (o == null) return; |
|
259 |
o.setLocation(x, o.getY()); |
|
260 |
} |
|
261 |
|
|
262 |
/** |
|
263 |
* @param sv |
|
264 |
* @param i |
|
265 |
*/ |
|
266 |
public void setY(SingletonView sv, int y) { |
|
267 |
JInternalFrame o = (JInternalFrame) contentFrame.get(new SingletonViewInfo(sv.getClass(), sv.getViewModel())); |
|
268 |
|
|
269 |
if (o == null) return; |
|
270 |
|
|
271 |
o.setLocation(o.getX(), y); |
|
272 |
} |
|
273 |
|
|
274 |
/** |
|
275 |
* @param sv |
|
276 |
* @param i |
|
277 |
*/ |
|
278 |
public void setHeight(SingletonView sv, int height) { |
|
279 |
JInternalFrame o = (JInternalFrame) contentFrame.get(new SingletonViewInfo(sv.getClass(), sv.getViewModel())); |
|
280 |
|
|
281 |
if (o == null) return; |
|
282 |
|
|
283 |
o.setSize(o.getWidth(), height); |
|
284 |
} |
|
285 |
|
|
286 |
/** |
|
287 |
* @param sv |
|
288 |
* @param i |
|
289 |
*/ |
|
290 |
public void setWidth(SingletonView sv, int width) { |
|
291 |
JInternalFrame o = (JInternalFrame) contentFrame.get(new SingletonViewInfo(sv.getClass(), sv.getViewModel())); |
|
292 |
|
|
293 |
if (o == null) return; |
|
294 |
o.setSize(width, o.getHeight()); |
|
295 |
} |
|
296 |
|
|
297 |
/** |
|
298 |
* @param sv |
|
299 |
* @param string |
|
300 |
*/ |
|
301 |
public void setTitle(SingletonView sv, String title) { |
|
302 |
JInternalFrame o = (JInternalFrame) contentFrame.get(new SingletonViewInfo(sv.getClass(), sv.getViewModel())); |
|
303 |
|
|
304 |
if (o == null) return; |
|
305 |
o.setTitle(title); |
|
306 |
} |
|
307 |
} |
|
0 | 308 |
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/src/com/iver/core/mdiManager/ViewStackSupport.java | ||
---|---|---|
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.core.mdiManager; |
|
42 |
|
|
43 |
import java.awt.event.ActionEvent; |
|
44 |
import java.awt.event.ActionListener; |
|
45 |
import java.lang.reflect.InvocationTargetException; |
|
46 |
import java.util.Hashtable; |
|
47 |
import java.util.Vector; |
|
48 |
|
|
49 |
import javax.swing.SwingUtilities; |
|
50 |
|
|
51 |
import com.iver.andami.PluginServices; |
|
52 |
import com.iver.andami.persistence.generate.PluginsStatus; |
|
53 |
import com.iver.andami.plugins.config.generate.Menu; |
|
54 |
import com.iver.andami.ui.mdiManager.View; |
|
55 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
|
56 |
|
|
57 |
/** |
|
58 |
* |
|
59 |
*/ |
|
60 |
public class ViewStackSupport { |
|
61 |
private Vector vistas = new Vector(); |
|
62 |
|
|
63 |
private ViewInfoSupport vis; |
|
64 |
|
|
65 |
private Hashtable viewMenu = new Hashtable(); |
|
66 |
|
|
67 |
/** |
|
68 |
* @param vis |
|
69 |
*/ |
|
70 |
public ViewStackSupport(ViewInfoSupport vis) { |
|
71 |
this.vis = vis; |
|
72 |
} |
|
73 |
|
|
74 |
public void add(View v, final ActionListener listener) { |
|
75 |
vistas.add(v); |
|
76 |
ViewInfo vi = vis.getViewInfo(v); |
|
77 |
int id = vi.getId(); |
|
78 |
Menu m = new Menu(); |
|
79 |
m.setActionCommand(""+id); |
|
80 |
m.setTooltip("activa la ventana"); |
|
81 |
m.setText("ventana/"+vi.getTitle()); |
|
82 |
viewMenu.put(v, m); |
|
83 |
PluginServices.getMainFrame().addMenu(m, listener, PluginServices.getPluginServices(this).getClassLoader() ); |
|
84 |
} |
|
85 |
|
|
86 |
public void remove(View v){ |
|
87 |
Menu m = (Menu) viewMenu.get(v); |
|
88 |
if (m == null) return; |
|
89 |
PluginServices.getMainFrame().removeMenu(m); |
|
90 |
viewMenu.remove(v); |
|
91 |
vistas.remove(v); |
|
92 |
} |
|
93 |
|
|
94 |
public void ctrltab(){ |
|
95 |
View v = (View) vistas.remove(vistas.size() - 1); |
|
96 |
vistas.add(0, v); |
|
97 |
} |
|
98 |
|
|
99 |
public View getActiveView(){ |
|
100 |
if (vistas.size() == 0) return null; |
|
101 |
return (View) vistas.get(vistas.size() - 1); |
|
102 |
} |
|
103 |
} |
|
0 | 104 |
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/src/com/iver/core/mdiManager/NewSkin.java | ||
---|---|---|
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.core.mdiManager; |
|
42 |
|
|
43 |
import java.awt.BorderLayout; |
|
44 |
import java.awt.Component; |
|
45 |
import java.awt.Cursor; |
|
46 |
import java.awt.event.ActionEvent; |
|
47 |
import java.awt.event.ActionListener; |
|
48 |
import java.awt.event.WindowAdapter; |
|
49 |
import java.awt.event.WindowEvent; |
|
50 |
import java.beans.PropertyVetoException; |
|
51 |
import java.util.ArrayList; |
|
52 |
import java.util.Iterator; |
|
53 |
|
|
54 |
import javax.swing.DefaultDesktopManager; |
|
55 |
import javax.swing.DesktopManager; |
|
56 |
import javax.swing.FocusManager; |
|
57 |
import javax.swing.JDesktopPane; |
|
58 |
import javax.swing.JDialog; |
|
59 |
import javax.swing.JInternalFrame; |
|
60 |
import javax.swing.event.InternalFrameEvent; |
|
61 |
import javax.swing.event.InternalFrameListener; |
|
62 |
|
|
63 |
import org.apache.log4j.Logger; |
|
64 |
|
|
65 |
import com.iver.andami.plugins.Extension; |
|
66 |
import com.iver.andami.ui.mdiFrame.GlassPane; |
|
67 |
import com.iver.andami.ui.mdiFrame.MDIFrame; |
|
68 |
import com.iver.andami.ui.mdiManager.MDIManager; |
|
69 |
import com.iver.andami.ui.mdiManager.MDIUtilities; |
|
70 |
import com.iver.andami.ui.mdiManager.SingletonDialogAlreadyShownException; |
|
71 |
import com.iver.andami.ui.mdiManager.SingletonView; |
|
72 |
import com.iver.andami.ui.mdiManager.View; |
|
73 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
|
74 |
import com.iver.andami.ui.mdiManager.ViewListener; |
|
75 |
|
|
76 |
|
|
77 |
/** |
|
78 |
* |
|
79 |
*/ |
|
80 |
public class NewSkin implements MDIManager, Extension { |
|
81 |
/** |
|
82 |
* Variable privada <code>desktopManager</code> para usarlo cuando sale una |
|
83 |
* ventana que no queremos que nos restaure las que tenemos maximizadas. |
|
84 |
* Justo antes de usar el setMaximize(false), le pegamos el cambiazo. |
|
85 |
*/ |
|
86 |
private static DesktopManager desktopManager = new DefaultDesktopManager(); |
|
87 |
|
|
88 |
/** log */ |
|
89 |
private static Logger logger = Logger.getLogger(NewSkin.class.getName()); |
|
90 |
|
|
91 |
/** Panel de la MDIFrame */ |
|
92 |
private JDesktopPane panel; |
|
93 |
|
|
94 |
/** MDIFrame */ |
|
95 |
private MDIFrame mainFrame; |
|
96 |
private GlassPane glassPane = new GlassPane(); |
|
97 |
private DialogStackSupport dss; |
|
98 |
private FrameViewSupport fvs; |
|
99 |
private ViewInfoSupport vis; |
|
100 |
private ViewStackSupport vss; |
|
101 |
private SingletonViewSupport svs; |
|
102 |
|
|
103 |
/** |
|
104 |
* @see com.iver.andami.ui.mdiManager.MDIManager#init(com.iver.andami.ui.mdiFrame.MDIFrame) |
|
105 |
*/ |
|
106 |
public void init(MDIFrame f) { |
|
107 |
//Inicializa el Frame y la consola |
|
108 |
mainFrame = f; |
|
109 |
mainFrame.setGlassPane(glassPane); |
|
110 |
panel = mainFrame.getDesktopPane(); |
|
111 |
panel.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); |
|
112 |
|
|
113 |
panel.setDesktopManager(desktopManager); |
|
114 |
|
|
115 |
fvs = new FrameViewSupport(mainFrame); |
|
116 |
dss = new DialogStackSupport(mainFrame); |
|
117 |
svs = new SingletonViewSupport(vis, fvs); |
|
118 |
vis = new ViewInfoSupport(mainFrame, fvs, svs); |
|
119 |
fvs.setVis(vis); |
|
120 |
vss = new ViewStackSupport(vis); |
|
121 |
} |
|
122 |
|
|
123 |
/** |
|
124 |
* @see com.iver.andami.ui.mdiManager.MDIManager#addView(com.iver.andami.ui.mdiManager.View) |
|
125 |
*/ |
|
126 |
public View addView(View p) throws SingletonDialogAlreadyShownException { |
|
127 |
//se obtiene la informaci?n de la vista |
|
128 |
ViewInfo vi = vis.getViewInfo(p); |
|
129 |
|
|
130 |
//Se comprueban las incompatibilidades que pudieran haber en la vista |
|
131 |
MDIUtilities.checkViewInfo(vi); |
|
132 |
if ((p instanceof SingletonView) && (vi.isModal())){ |
|
133 |
throw new RuntimeException("A modal view cannot be a SingletonView"); |
|
134 |
} |
|
135 |
|
|
136 |
/* |
|
137 |
* Se obtiene la referencia a la vista anterior por si es una singleton y est? |
|
138 |
* siendo mostrada. Se obtiene su informaci?n si ya fue mostrada |
|
139 |
*/ |
|
140 |
boolean singletonPreviouslyAdded = false; |
|
141 |
|
|
142 |
if (p instanceof SingletonView){ |
|
143 |
SingletonView sv = (SingletonView) p; |
|
144 |
if (svs.registerView(sv.getClass(), sv.getViewModel(), vis.getViewInfo(sv))){ |
|
145 |
singletonPreviouslyAdded = true; |
|
146 |
} |
|
147 |
} |
|
148 |
|
|
149 |
if (singletonPreviouslyAdded){ |
|
150 |
//Si la vista no est? actualmente abierta |
|
151 |
if (!svs.contains((SingletonView)p)){ |
|
152 |
JInternalFrame frame = fvs.getJInternalFrame(p); |
|
153 |
svs.openSingletonView((SingletonView)p, frame); |
|
154 |
addJInternalFrame(frame, vi); |
|
155 |
vss.add(p, |
|
156 |
new ActionListener() { |
|
157 |
public void actionPerformed(ActionEvent e) { |
|
158 |
View v = vis.getViewById(Integer.parseInt( |
|
159 |
e.getActionCommand())); |
|
160 |
JInternalFrame f = fvs.getJInternalFrame(v); |
|
161 |
activateJInternalFrame(f); |
|
162 |
} |
|
163 |
}); |
|
164 |
return p; |
|
165 |
}else{ |
|
166 |
//La vista est? actualmente abierta |
|
167 |
JInternalFrame frame = (JInternalFrame) svs.getFrame((SingletonView)p); |
|
168 |
activateJInternalFrame((JInternalFrame) frame); |
|
169 |
return fvs.getView((JInternalFrame) frame); |
|
170 |
} |
|
171 |
} else { |
|
172 |
if (vi.isModal()) { |
|
173 |
addJDialog(p); |
|
174 |
} else { |
|
175 |
//Se sit?a la vista en la pila de vistas |
|
176 |
vss.add(p, |
|
177 |
new ActionListener() { |
Also available in: Unified diff