Revision 1703

View differences:

tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/.cvsignore
1
bin
0 2

  
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/build.xml
1
<project name="Core plugin" default="dist" basedir=".">
2
    <description>
3
        Instala el plugin
4
    </description>
5
  <!-- set global properties for this build -->
6
  <property name="src" location="src"/>
7
  <property name="build" location="bin"/>
8
  <property name="dist"  location="dist"/>
9
  <property name="plugin" value="com.iver.core"/>
10
  <property name="targetDir" location="../Andami/gvSIG/extensiones"/>
11

  
12
  <target name="init">
13
    <!-- Create the time stamp -->
14
    <tstamp/>
15
    <!-- Create the build directory structure used by compile -->
16
    <mkdir dir="${build}"/>
17
  </target>
18

  
19
  <target name="dist" description="generate the distribution" >
20
    <!-- Create the distribution directory -->
21
    <mkdir dir="${dist}"/>
22

  
23
    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
24
    <copy todir="${build}">
25
    	<fileset dir="${src}" includes="**"/>
26
    </copy>
27
    <jar jarfile="${dist}/${plugin}.jar" basedir="${build}"/>
28
    <copy file="config.xml" todir="${dist}"/>
29
    <copy todir="${dist}">
30
    	<fileset dir="." includes="text*.properties"/>
31
    </copy>
32
    <copy todir="${dist}/images">
33
    	<fileset dir="images/" includes="*"/>
34
    </copy>
35
    <copy todir="${dist}">
36
    	<fileset dir="." includes="*.jar"/>
37
    </copy>
38

  
39
    <move todir="${targetDir}/${plugin}/">
40
    	<fileset dir="${dist}" includes="**/**"/>
41
    </move>
42
  </target>
43

  
44
  <target name="clean"
45
        description="clean up" >
46
    <!-- Delete the ${build} and ${dist} directory trees -->
47
    <delete dir="${build}"/>
48
    <delete dir="${dist}"/>
49
  </target>
50
</project>
51

  
0 52

  
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/text.properties
1
Ver=Ver
2
Consola=Consola
3
Tile=Mosaico
4
Cascada=Cascada
5
Window=Ventana
6
cascada_tooltip=Organiza las ventanas en cascada
7
cascada_enable=Debe haber al menos una ventana abierta
8
tile_tooltip=Organiza las ventanas en mosaico
9
titulo_consola=Consola de informacion
10
todos=Todos
11
info=Informacion
12
warnings=Avisos
13
errores=Errores
14
configurar_ANDAMI=Di?logo de configuraci?n de ANDAMI.
15
extension_activada=Extensi?n activada.
16
examinar=Examinar
17
directorio_extensiones=Directorio de las extensiones.
18
prioridad=Prioridad
19
opciones=Opciones
20
general=General
21
descripcion=Descripci?n
22
directorio=Directorio
23
aceptar=Aceptar
24
cancelar=Cancelar
25
ventana=Ventana
26
Configurar=Configurar
27
__catalan=valenciano
28
muestra_consola_tooltip=Muestra la consola
29
configuracion_andami_tooltip=Configuraci?n de Andami
30
debe_estar_activada=deber?a estar activada
31
mosaico_tooltip=Mosaico
0 32

  
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/.classpath
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5
	<classpathentry kind="lib" path="/Andami/lib/log4j-1.2.8.jar"/>
6
	<classpathentry kind="src" path="/Andami"/>
7
	<classpathentry kind="lib" path="/Andami/lib/castor-0.9.5.3-xml.jar"/>
8
	<classpathentry kind="lib" path="/Andami/lib/iver-utiles.jar"/>
9
	<classpathentry kind="output" path="bin"/>
10
</classpath>
0 11

  
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/text_en.properties
1
Ver=View
2
Consola=Console
3
Tile=Tile
4
Cascada=Cascade
5
Window=Window
6
cascada_tooltip=Arrange the windows in cascade
7
cascada_enable=There must be at least un visible frame
8
tile_tooltip=Arrange the windows in tile
9
titulo_consola=Information console
10
todos=All
11
info=Information
12
warnings=Warnings
13
errores=Errors
14
configurar_ANDAMI=ANDAMI configuration dialog.
15
extension_activada=Active extension.  
16
examinar=Examine
17
directorio_extensiones=Extensions directory.
18
prioridad=Priority
19
opciones=Options
20
general=General
21
descripcion=Description
22
directorio=Directory
23
aceptar=OK
24
cancelar=Cancel
25
ventana=Window
26
Configurar=Configure
27
__catalan=Valencian
0 28

  
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/text_ca.properties
1
Ver=Veure
2
Consola=Consola
3
Tile=Mosaic
4
Cascada=Cascada
5
Window=Finestra
6
cascada_tooltip=Organitzar les finestres en cascada
7
cascada_enable=Ha d'haver-hi almenys una finestra oberta
8
tile_tooltip=Organitzar les finestres en mosaic
9
titulo_consola=Consola d'informaci?
10
todos=Tots
11
info=Informaci?
12
warnings=Avisos
13
errores=Errors
14
configurar_ANDAMI=Di?leg de configuraci? d'ANDAMI
15
extension_activada=Extensi? activada
16
examinar=Examinar
17
directorio_extensiones=Directori de les extensions
18
prioridad=Prioritat
19
opciones=Opcions
20
general=General
21
descripcion=Descripci?
22
directorio=Directori
23
aceptar=Acceptar
24
cancelar=Cancel?lar
25
ventana=Finestra
26
Configurar=Configurar
27
__catalan=valenci?
0 28

  
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/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/DialogStackSupport.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.Cursor;
44
import java.util.ArrayList;
45
import java.util.Iterator;
46

  
47
import javax.swing.JDialog;
48

  
49
import org.apache.log4j.Logger;
50

  
51
import com.iver.andami.ui.mdiFrame.MDIFrame;
52

  
53

  
54
/**
55
 *
56
 */
57
public class DialogStackSupport{
58
    /** log */
59
    private static Logger logger = Logger.getLogger(DialogStackSupport.class.getName());
60

  
61
    /** Pila de di?logos modales mostrados */
62
    private ArrayList dialogStack = new ArrayList(0);
63

  
64
    public DialogStackSupport(MDIFrame frame){
65
    }
66
    
67
    public void pushDialog(JDialog dlg){
68
    	dialogStack.add(dlg);
69
    }
70
    
71
    public JDialog popDialog(){
72
    	return (JDialog) dialogStack.remove(dialogStack.size() - 1);
73
    }
74

  
75
	/**
76
	 * @return
77
	 */
78
	public void setWaitCursor() {
79
		for (Iterator iter = dialogStack.iterator(); iter.hasNext();) {
80
			JDialog dlg = (JDialog) iter.next();
81
			dlg.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
82
 	        dlg.getGlassPane().setVisible(true);
83
 	   }
84
	}
85

  
86
	/**
87
	 * 
88
	 */
89
	public void restoreCursor() {
90
		for (Iterator iter = dialogStack.iterator(); iter.hasNext();) {
91
			JDialog dlg = (JDialog) iter.next();
92
            dlg.setCursor(null);
93
		    dlg.getGlassPane().setVisible(false);
94
		}
95
	}
96
}
0 97

  
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/src/com/iver/core/mdiManager/FrameViewSupport.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.Component;
44
import java.awt.Image;
45
import java.util.Hashtable;
46
import java.util.Iterator;
47

  
48
import javax.swing.ImageIcon;
49
import javax.swing.JDialog;
50
import javax.swing.JFrame;
51
import javax.swing.JInternalFrame;
52
import javax.swing.JPanel;
53

  
54
import com.iver.andami.ui.mdiFrame.MDIFrame;
55
import com.iver.andami.ui.mdiManager.View;
56
import com.iver.andami.ui.mdiManager.ViewInfo;
57

  
58

  
59
/**
60
 *
61
 */
62
public class FrameViewSupport {
63
    private Hashtable frameView = new Hashtable();
64
    private Hashtable viewFrame = new Hashtable();
65
    private Image icon;
66
    private ViewInfoSupport vis;
67
	private JFrame mainFrame;
68

  
69
    /**
70
     * Creates a new FrameViewSupport object.
71
     *
72
     * @param i DOCUMENT ME!
73
     */
74
    public FrameViewSupport(MDIFrame mainFrame) {
75
    	this.mainFrame = mainFrame;
76
        icon = mainFrame.getIconImage();
77
    }
78

  
79
    public Iterator getViewIterator(){
80
    	return viewFrame.keySet().iterator();
81
    }
82
    
83
    public boolean contains(View v){
84
    	return viewFrame.containsKey(v);
85
    }
86

  
87
	/**
88
	 * @param wnd
89
	 * @return
90
	 */
91
	public boolean contains(JInternalFrame wnd) {
92
		return frameView.contains(wnd);
93
	}
94
    
95
    /**
96
     * DOCUMENT ME!
97
     *
98
     * @param p DOCUMENT ME!
99
     *
100
     * @return DOCUMENT ME!
101
     */
102
    public JDialog getJDialog(View p) {
103
        JDialog dlg = (JDialog) viewFrame.get(p);
104

  
105
        if (dlg == null) {
106
            ViewInfo vi = vis.getViewInfo(p);
107
            JDialog nuevo = new JDialog(mainFrame);
108

  
109
            nuevo.getContentPane().add((JPanel) p);
110
            nuevo.setSize(getWidth(p), getHeight(p) + 30);
111
            nuevo.setTitle(vi.getTitle());
112
            nuevo.setResizable(vi.isResizable());
113

  
114
            viewFrame.put(p, nuevo);
115
            frameView.put(nuevo, p);
116

  
117
            nuevo.setModal(vi.isModal());
118
            return nuevo;
119
        } else {
120
            return dlg;
121
        }
122
    }
123

  
124
    /**
125
     * DOCUMENT ME!
126
     *
127
     * @param p DOCUMENT ME!
128
     *
129
     * @return DOCUMENT ME!
130
     */
131
    public JInternalFrame getJInternalFrame(View p) {
132
        JInternalFrame frame = (JInternalFrame) viewFrame.get(p);
133

  
134
        if (frame == null) {
135
        	ViewInfo vi = vis.getViewInfo(p);
136
            JInternalFrame nuevo = new JInternalFrame();
137
            if (icon != null){
138
            	nuevo.setFrameIcon(new ImageIcon(icon));
139
            }
140
            nuevo.getContentPane().add((JPanel) p);
141
            nuevo.setClosable(true);
142
            nuevo.setSize(getWidth(p), getHeight(p));
143
            nuevo.setTitle(vi.getTitle());
144
            nuevo.setVisible(vi.isVisible());
145
            nuevo.setResizable(vi.isResizable());
146
            nuevo.setIconifiable(vi.isIconifiable());
147
            nuevo.setMaximizable(vi.isMaximizable());
148
            nuevo.setLocation(vi.getX(), vi.getY());
149

  
150
            nuevo.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
151

  
152
            viewFrame.put(p, nuevo);
153
            frameView.put(nuevo, p);
154

  
155
            return nuevo;
156
        } else {
157
            return frame;
158
        }
159
    }
160

  
161
    public View getView(Component dlg){
162
    	return (View) frameView.get(dlg);
163
    }
164
    
165
    public void closeView(View v){
166
    	Object c = viewFrame.remove(v);
167
    	frameView.remove(c);
168
    }
169
    
170
    /**
171
     * DOCUMENT ME!
172
     *
173
     * @param v DOCUMENT ME!
174
     * @param x DOCUMENT ME!
175
     */
176
    public void setX(View v, int x) {
177
    	JInternalFrame o = (JInternalFrame) viewFrame.get(v);
178
        o.setLocation(x, o.getY());
179
    }
180

  
181
    /**
182
     * DOCUMENT ME!
183
     *
184
     * @param v DOCUMENT ME!
185
     * @param y DOCUMENT ME!
186
     */
187
    public void setY(View v, int y) {
188
    	JInternalFrame o = (JInternalFrame) viewFrame.get(v);
189

  
190
        o.setLocation(o.getX(), y);
191
    }
192

  
193
    /**
194
     * DOCUMENT ME!
195
     *
196
     * @param v DOCUMENT ME!
197
     * @param height DOCUMENT ME!
198
     */
199
    public void setHeight(View v, int height) {
200
    	JInternalFrame o = (JInternalFrame) viewFrame.get(v);
201

  
202
        o.setSize(o.getWidth(), height);
203
    }
204

  
205
    /**
206
     * DOCUMENT ME!
207
     *
208
     * @param v DOCUMENT ME!
209
     * @param width DOCUMENT ME!
210
     */
211
    public void setWidth(View v, int width) {
212
    	JInternalFrame o = (JInternalFrame) viewFrame.get(v);
213

  
214
    	o.setSize(width, o.getHeight());
215
    }
216

  
217
    /**
218
     * DOCUMENT ME!
219
     *
220
     * @param v DOCUMENT ME!
221
     * @param title DOCUMENT ME!
222
     */
223
    public void setTitle(View v, String title) {
224
    	JInternalFrame o = (JInternalFrame) viewFrame.get(v);
225
        o.setTitle(title);
226
    }
227

  
228
    /**
229
     * DOCUMENT ME!
230
     *
231
     * @param vis The vis to set.
232
     */
233
    public void setVis(ViewInfoSupport vis) {
234
        this.vis = vis;
235
    }
236

  
237
    /**
238
     * DOCUMENT ME!
239
     *
240
     * @param v DOCUMENT ME!
241
     *
242
     * @return DOCUMENT ME!
243
     */
244
    private int getWidth(View v) {
245
        ViewInfo vi = vis.getViewInfo(v);
246

  
247
        if (vi.getWidth() == -1) {
248
            JPanel p = (JPanel) v;
249

  
250
            return p.getSize().width;
251
        } else {
252
            return vi.getWidth();
253
        }
254
    }
255

  
256
    /**
257
     * DOCUMENT ME!
258
     *
259
     * @param v DOCUMENT ME!
260
     *
261
     * @return DOCUMENT ME!
262
     */
263
    private int getHeight(View v) {
264
        ViewInfo vi = vis.getViewInfo(v);
265

  
266
        if (vi.getHeight() == -1) {
267
            JPanel p = (JPanel) v;
268

  
269
            return p.getSize().height;
270
        } else {
271
            return vi.getHeight();
272
        }
273
    }
274
}
0 275

  
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/src/com/iver/core/mdiManager/ViewInfoSupport.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 com.iver.andami.plugins.PluginClassLoader;
44
import com.iver.andami.ui.mdiFrame.MainFrame;
45
import com.iver.andami.ui.mdiFrame.NoSuchMenuException;
46
import com.iver.andami.ui.mdiManager.SingletonView;
47
import com.iver.andami.ui.mdiManager.View;
48
import com.iver.andami.ui.mdiManager.ViewInfo;
49

  
50
import java.beans.PropertyChangeEvent;
51
import java.beans.PropertyChangeListener;
52

  
53
import java.util.Enumeration;
54
import java.util.Hashtable;
55

  
56

  
57
/**
58
 *
59
 */
60
public class ViewInfoSupport {
61
	private static int serialId = 0;
62
	private FrameViewSupport fvs;
63

  
64
	/** Correspondencias entre las vistas y su informacion */
65
	private Hashtable viewInfo = new Hashtable();
66
	private Hashtable infoView = new Hashtable();
67
	private ViewPropertyChangeListener viewInfoListener = new ViewPropertyChangeListener();
68
	private SingletonViewSupport svs;
69
	private MainFrame mdiFrame;
70

  
71
	/**
72
	 * Creates a new ViewInfoSupport object.
73
	 *
74
	 * @param frame DOCUMENT ME!
75
	 * @param fvs DOCUMENT ME!
76
	 * @param svs
77
	 */
78
	public ViewInfoSupport(MainFrame frame, FrameViewSupport fvs,
79
		SingletonViewSupport svs) {
80
		this.fvs = fvs;
81
		this.svs = svs;
82
		this.mdiFrame = frame;
83
	}
84

  
85
	/**
86
	 * Devuelve la vista cuyo identificador es el parametro
87
	 *
88
	 * @param id Identificador de la vista que se quiere obtener
89
	 *
90
	 * @return La vista o null si no hay ninguna vista con ese identificador
91
	 */
92
	public View getViewById(int id) {
93
		Enumeration en = infoView.keys();
94

  
95
		while (en.hasMoreElements()) {
96
			ViewInfo vi = (ViewInfo) en.nextElement();
97

  
98
			if (vi.getId() == id) {
99
				return (View) infoView.get(vi);
100
			}
101
		}
102

  
103
		return null;
104
	}
105

  
106
	/**
107
	 * DOCUMENT ME!
108
	 *
109
	 * @param v DOCUMENT ME!
110
	 *
111
	 * @return DOCUMENT ME!
112
	 */
113
	public synchronized ViewInfo getViewInfo(View v) {
114
		ViewInfo vi = (ViewInfo) viewInfo.get(v);
115

  
116
		if (vi == null) {
117
			vi = v.getViewInfo();
118

  
119
			//Para el t?tulo
120
			if (vi.getHeight() != -1) {
121
				vi.setHeight(vi.getHeight() + 40);
122
			}
123

  
124
			vi.addPropertyChangeListener(viewInfoListener);
125
			viewInfo.put(v, vi);
126
			infoView.put(vi, v);
127
			vi.setId(serialId++);
128
		}
129

  
130
		return vi;
131
	}
132

  
133
	/**
134
	 * DOCUMENT ME!
135
	 *
136
	 * @param p DOCUMENT ME!
137
	 */
138
	public void deleteViewInfo(View p) {
139
		ViewInfo vi = (ViewInfo) viewInfo.remove(p);
140
		infoView.remove(vi);
141
	}
142

  
143
	/**
144
	 * DOCUMENT ME!
145
	 *
146
	 * @author $author$
147
	 * @version $Revision$
148
	 */
149
	public class ViewPropertyChangeListener implements PropertyChangeListener {
150
		/**
151
		 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
152
		 */
153
		public void propertyChange(PropertyChangeEvent evt) {
154
			ViewInfo v = (ViewInfo) evt.getSource();
155
			View view = (View) infoView.get(v);
156

  
157
			if (view instanceof SingletonView) {
158
				SingletonView sv = (SingletonView) view;
159

  
160
				if (evt.getPropertyName().equals("x")) {
161
					svs.setX(sv, ((Integer) evt.getNewValue()).intValue());
162
				} else if (evt.getPropertyName().equals("y")) {
163
					svs.setY(sv, ((Integer) evt.getNewValue()).intValue());
164
				} else if (evt.getPropertyName().equals("height")) {
165
					svs.setHeight(sv, ((Integer) evt.getNewValue()).intValue());
166
				} else if (evt.getPropertyName().equals("width")) {
167
					svs.setWidth(sv, ((Integer) evt.getNewValue()).intValue());
168
				} else if (evt.getPropertyName().equals("title")) {
169
					svs.setTitle(sv, (String) evt.getNewValue());
170

  
171
					try {
172
						mdiFrame.changeMenuName(new String[] {
173
								"ventana", (String) evt.getOldValue()
174
							}, (String) evt.getNewValue(),
175
							(PluginClassLoader) getClass().getClassLoader());
176
					} catch (NoSuchMenuException e) {
177
						/*
178
						 * No se hace nada porque puede modificarse el t?tulo de 
179
						 * una ventana antes de ser a?adida a Andami
180
						 */
181
					}
182
				}
183
			} else {
184
				if (evt.getPropertyName().equals("x")) {
185
					fvs.setX(view, ((Integer) evt.getNewValue()).intValue());
186
				} else if (evt.getPropertyName().equals("y")) {
187
					fvs.setY(view, ((Integer) evt.getNewValue()).intValue());
188
				} else if (evt.getPropertyName().equals("height")) {
189
					fvs.setHeight(view, ((Integer) evt.getNewValue()).intValue());
190
				} else if (evt.getPropertyName().equals("width")) {
191
					fvs.setWidth(view, ((Integer) evt.getNewValue()).intValue());
192
				} else if (evt.getPropertyName().equals("title")) {
193
					fvs.setTitle(view, (String) evt.getNewValue());
194
					try{
195
						mdiFrame.changeMenuName(new String[] {
196
								"ventana", (String) evt.getOldValue()
197
							}, (String) evt.getNewValue(),
198
							(PluginClassLoader) getClass().getClassLoader());
199
					} catch (NoSuchMenuException e) {
200
						/*
201
						 * No se hace nada porque puede modificarse el t?tulo de 
202
						 * una ventana antes de ser a?adida a Andami
203
						 */
204
					}
205
				}
206
			}
207
		}
208
	}
209
}
0 210

  
tags/Root_CorePlugin_pilotoDWG/libraries/libCorePlugin/src/com/iver/core/mdiManager/ComplexDesktopPane.java
1
/*
2
 * Created on 10-mar-2005
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 
21
USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27
 *   Av. Blasco Ib??ez, 50
28
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45
package com.iver.core.mdiManager;
46

  
47
import javax.swing.JPanel;
48

  
49

  
50
import javax.swing.JSplitPane;
51
import java.awt.BorderLayout;
52
import javax.swing.JDesktopPane;
53
import com.iver.utiles.console.JConsole;
54
public class ComplexDesktopPane extends JPanel {
55

  
56
	private JSplitPane jSplitPane = null;
57
	private JDesktopPane jDesktopPane = null;
58
	private JConsole jConsole = null;
59
	/**
60
	 * This is the default constructor
61
	 */
62
	public ComplexDesktopPane() {
63
		super();
64
		initialize();
65
	}
66
	/**
67
	 * This method initializes this
68
	 * 
69
	 * @return void
70
	 */
71
	private  void initialize() {
72
		this.setLayout(new BorderLayout());
73
		this.setSize(300,200);
74
		this.add(getJSplitPane(), java.awt.BorderLayout.CENTER);
75
	}
76
	/**
77
	 * This method initializes jSplitPane	
78
	 * 	
79
	 * @return javax.swing.JSplitPane	
80
	 */    
81
	private JSplitPane getJSplitPane() {
82
		if (jSplitPane == null) {
83
			jSplitPane = new JSplitPane();
84
			jSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
85
			jSplitPane.setResizeWeight(0.8);
86
			jSplitPane.setTopComponent(getDesktopPane());
87
			jSplitPane.setBottomComponent(getJConsole());
88
		}
89
		return jSplitPane;
90
	}
91
	/**
92
	 * This method initializes jDesktopPane	
93
	 * 	
94
	 * @return javax.swing.JDesktopPane	
95
	 */    
96
	public JDesktopPane getDesktopPane() {
97
		if (jDesktopPane == null) {
98
			jDesktopPane = new JDesktopPane();
99
		}
100
		return jDesktopPane;
101
	}
102
	/**
103
	 * This method initializes jConsole	
104
	 * 	
105
	 * @return com.iver.utiles.console.JConsole	
106
	 */    
107
	private JConsole getJConsole() {
108
		if (jConsole == null) {
109
			jConsole = new JConsole();
110
		}
111
		return jConsole;
112
	}
113
   }
0 114

  
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;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff