Revision 37388

View differences:

tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/test/resources/README.txt
1
Put into this folder the resources needed by your test classes.
2

  
3
This folder is added to the Tests classpath, so you can load any resources 
4
through the ClassLoader.
5

  
6
By default, in this folder you can find an example of log4j configuration,
7
prepared to log messages through the console, so logging works when you
8
run your tests classes.
0 9

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/test/resources/log4j.xml
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<!-- 
5
Log4J configuration file for unit tests execution.
6
 -->
7
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
8

  
9
	<!-- Appender configuration to show logging messages through the console -->
10
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
11
		<layout class="org.apache.log4j.PatternLayout">
12
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
13
		</layout>
14
	</appender>
15

  
16
	<!-- 
17
	Activate logging messages of DEBUG level of higher only for the
18
	org.gvsig.tools packages.
19
	You can put full classes names or packages instead, to configure
20
	logging for all the classes and subpackages of the package.
21
	-->
22
	<category name="org.gvsig.tools">
23
		<priority value="DEBUG" />
24
	</category>
25
	<category name="org.gvsig.annotation">
26
		<priority value="DEBUG" />
27
	</category>
28

  
29
	<!-- 
30
	By default, show only logging messages of INFO level or higher, 
31
	through the previously configured CONSOLE appender. 
32
	-->
33
	<root>
34
		<priority value="INFO" />
35
		<appender-ref ref="CONSOLE" />
36
	</root>
37
</log4j:configuration>
0 38

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/AnnotationAboutExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2010 {Prodevelop}   {Task}
26
*/
27
 
28
package org.gvsig.annotation.app.extension;
29

  
30
import org.gvsig.andami.plugins.Extension;
31

  
32
/**
33
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
34
 */
35
public class AnnotationAboutExtension extends Extension {
36

  
37
	public void execute(String actionCommand) {
38
        // Nothing to do
39
	}
40

  
41
	public void initialize() {
42
        // Nothing to do
43
	}
44

  
45
	public boolean isEnabled() {
46
		return false;
47
	}
48

  
49
	public boolean isVisible() {
50
		return false;
51
	}
52

  
53
	public void postInitialize() {
54
		super.postInitialize();
55
	}
56
}
0 57

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/AnnotationWindow.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.annotation.app.extension;
23

  
24
import java.awt.BorderLayout;
25
import java.awt.Dimension;
26

  
27
import javax.swing.JPanel;
28

  
29
import org.gvsig.andami.ui.mdiManager.IWindow;
30
import org.gvsig.andami.ui.mdiManager.WindowInfo;
31
import org.gvsig.annotation.swing.AnnotationWindowManager;
32

  
33
/**
34
 * {@link IWindow} to show a Annotation.
35
 * 
36
 * @author gvSIG Team
37
 * @version $Id$
38
 */
39
public class AnnotationWindow extends JPanel implements IWindow {
40

  
41
    private static final long serialVersionUID = -4401123724140025094L;
42

  
43
    private WindowInfo info;
44

  
45
    private Object profile = WindowInfo.EDITOR_PROFILE;
46

  
47
    /**
48
     * Constructor.
49
     * 
50
     * @param panel
51
     *            the panel to show
52
     * @param title
53
     *            the window title
54
     * @param mode
55
     *            the window mode
56
     * @see {@link AnnotationWindowManager#MODE_DIALOG}
57
     * @see {@link AnnotationWindowManager#MODE_TOOL}
58
     * @see {@link AnnotationWindowManager#MODE_WINDOW}
59
     */
60
    public AnnotationWindow(JPanel panel, String title, int mode) {
61
        this.setLayout(new BorderLayout());
62
    	add(panel, BorderLayout.CENTER);
63
    
64
        Dimension dimension = new Dimension(700, 400);
65
        setSize(dimension);
66
        int code =
67
            WindowInfo.ICONIFIABLE | WindowInfo.MAXIMIZABLE
68
                | WindowInfo.RESIZABLE;
69
        switch (mode) {
70
        case AnnotationWindowManager.MODE_DIALOG:
71
            code |= WindowInfo.MODALDIALOG;
72
            profile = WindowInfo.DIALOG_PROFILE;
73
            break;
74
        case AnnotationWindowManager.MODE_TOOL:
75
            code |= WindowInfo.PALETTE;
76
            profile = WindowInfo.TOOL_PROFILE;
77
            break;
78
        case AnnotationWindowManager.MODE_WINDOW:
79
        default:
80
            code |= WindowInfo.MODELESSDIALOG;
81
            profile = WindowInfo.EDITOR_PROFILE;
82
        }
83
        info = new WindowInfo(code);
84
        info.setTitle(title);
85
        info.setMinimumSize(dimension);
86
    }
87

  
88
    public WindowInfo getWindowInfo() {
89
        return info;
90
    }
91

  
92
    public Object getWindowProfile() {
93
        return profile;
94
    }
95
}
0 96

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/AddLayerFinishAction.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28
package org.gvsig.annotation.app.extension;
29

  
30
import javax.swing.JComponent;
31
import javax.swing.JOptionPane;
32

  
33
import org.gvsig.andami.PluginServices;
34
import org.gvsig.andami.messages.NotificationManager;
35
import org.gvsig.annotation.AnnotationCreationFinishAction;
36
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel;
37
import org.gvsig.fmap.dal.feature.FeatureStore;
38
import org.gvsig.fmap.mapcontext.MapContextLocator;
39
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
40
import org.gvsig.fmap.mapcontext.layers.FLayer;
41
import org.gvsig.tools.locator.LocatorException;
42

  
43
/**
44
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
45
 */
46
public class AddLayerFinishAction implements AnnotationCreationFinishAction {
47
	private DefaultViewPanel viewPanel;
48
	
49
	public AddLayerFinishAction(DefaultViewPanel viewPanel) {
50
		this.viewPanel = viewPanel;
51
	}
52

  
53
	public void finished(FeatureStore featureStore) {
54
		int res = JOptionPane.showConfirmDialog((JComponent) PluginServices.getMDIManager()
55
				.getActiveWindow(),
56
				PluginServices.getText(this,
57
				"insertar_en_la_vista_la_capa_creada"),
58
				PluginServices.getText(this, "insertar_capa"),
59
				JOptionPane.YES_NO_OPTION);
60

  
61
		if (res == JOptionPane.YES_OPTION) {
62
			try {
63
				addShape(featureStore);
64
			} catch (LoadLayerException e) {
65
				NotificationManager.addError(e);
66
			} catch (LocatorException e) {
67
				NotificationManager.addError(e);
68
			}
69
		}
70
	}
71

  
72
	private void addShape(FeatureStore featureStore) throws LoadLayerException, LocatorException {
73
		FLayer layer = MapContextLocator.getMapContextManager().createLayer("Annotations", featureStore);
74
		viewPanel.getMapControl().getMapContext().getLayers().addLayer(layer);		
75
	}
76

  
77
}
78

  
0 79

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/AnnotationExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.annotation.app.extension;
23

  
24
import org.gvsig.andami.PluginServices;
25
import org.gvsig.andami.messages.NotificationManager;
26
import org.gvsig.andami.plugins.Extension;
27
import org.gvsig.annotation.AnnotationCreationService;
28
import org.gvsig.annotation.AnnotationLocator;
29
import org.gvsig.annotation.AnnotationManager;
30
import org.gvsig.annotation.swing.AnnotationSwingLocator;
31
import org.gvsig.annotation.swing.AnnotationSwingManager;
32
import org.gvsig.annotation.swing.AnnotationWindowManager;
33
import org.gvsig.annotation.swing.JAnnotationCreationServicePanel;
34
import org.gvsig.app.project.documents.view.ViewDocument;
35
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel;
36
import org.gvsig.editing.EditionUtilities;
37
import org.gvsig.fmap.dal.feature.FeatureStore;
38
import org.gvsig.fmap.mapcontext.MapContext;
39
import org.gvsig.fmap.mapcontext.layers.FLayer;
40
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
41
import org.gvsig.tools.ToolsLocator;
42
import org.gvsig.tools.extensionpoint.ExtensionPoint;
43
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
44
import org.gvsig.tools.service.ServiceException;
45

  
46
/**
47
 * Andami extension to show Annotation in the application.
48
 * 
49
 * @author gvSIG Team
50
 * @version $Id$
51
 */
52
public class AnnotationExtension extends Extension {
53
	private AnnotationManager manager;
54
	private AnnotationSwingManager swingManager;
55

  
56
	public void initialize() {
57
		ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager();
58
		ExtensionPoint ep = extensionPoints.add("AplicationPreferences", "");
59
		
60
		ep.append("AnnotationPreferencesPage", "", new AnnotationPreferencesPage());
61
		
62
		PluginServices.getIconTheme().registerDefault(
63
				"annotation-properties",
64
				AnnotationPreferencesPage.class.getClassLoader().getResource("images/AnnotationProperties.png")
65
		);
66
	}
67

  
68
	@Override
69
	public void postInitialize() {
70
		super.postInitialize();
71
		manager = AnnotationLocator.getManager();
72
		// Asignamos el locator e iniciamos la instancia
73
		swingManager = AnnotationSwingLocator.getSwingManager();
74

  
75
		swingManager.registerWindowManager(new GvSIGAnnotationWindowManager());
76
	}
77

  
78
	public void execute(String actionCommand) {
79
		org.gvsig.andami.ui.mdiManager.IWindow window = PluginServices.getMDIManager().getActiveWindow();
80

  
81
		if (window instanceof DefaultViewPanel) {
82
			DefaultViewPanel viewPanel = (DefaultViewPanel) window;
83
			ViewDocument viewDocument = viewPanel.getModel();
84
			MapContext mapContext = viewDocument.getMapContext();		
85
			FLayer[] actives = mapContext.getLayers().getActives();
86

  
87
			FLyrVect fLyrVect = null;
88
			for (int i=0 ; i<actives.length ; i++){
89
				if (actives[i] instanceof FLyrVect){
90
					fLyrVect = (FLyrVect)actives[i];
91
					break;
92
				}
93
			}
94

  
95
			if (fLyrVect == null){
96
				return;
97
			}		
98

  
99
			showAnnotation(manager, (FeatureStore)fLyrVect.getDataStore(), viewPanel);
100
		}
101
	}
102

  
103
	public void showAnnotation(AnnotationManager manager, FeatureStore featureStore, DefaultViewPanel defaultViewPanel) {
104
		try {
105
			AnnotationCreationService service =
106
				(AnnotationCreationService) manager.getAnnotationCreationService(featureStore);
107
			service.setAnnotationCreationFinishAction(new AddLayerFinishAction(defaultViewPanel));
108

  
109
			JAnnotationCreationServicePanel panel =
110
				swingManager.createAnnotation(service);
111
			swingManager.getWindowManager().showWindow(panel, "Annotation",
112
					AnnotationWindowManager.MODE_WINDOW);
113

  
114
		} catch (ServiceException e) {
115
			NotificationManager.addError(e);
116
		}
117
	}
118

  
119
	public boolean isEnabled() {
120
		int status = EditionUtilities.getEditionStatus();
121
		if (( status == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE || status == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE)
122
				|| (status == EditionUtilities.EDITION_STATUS_MULTIPLE_VECTORIAL_LAYER_ACTIVE)|| (status == EditionUtilities.EDITION_STATUS_MULTIPLE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE))
123
		{
124
			return true;
125
		}
126
		return false;
127
	}
128

  
129
	public boolean isVisible() {
130
		org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
131
		.getActiveWindow();
132

  
133
		if (f == null) {
134
			return false;
135
		}
136

  
137
		if (f instanceof DefaultViewPanel) {
138
			return true;
139
		}
140
		return false;
141
	}
142
}
0 143

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/AnnotationPreferencesPage.java
1
/* gvSIG. Sistema de Informaciļæ½n Geogrļæ½fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 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

  
42
package org.gvsig.annotation.app.extension;
43

  
44
import java.awt.GridBagConstraints;
45
import java.awt.Insets;
46

  
47
import javax.swing.ImageIcon;
48
import javax.swing.JLabel;
49
import javax.swing.JPanel;
50
import javax.swing.JTextField;
51

  
52
import org.gvsig.andami.PluginServices;
53
import org.gvsig.andami.preferences.AbstractPreferencePage;
54
import org.gvsig.andami.preferences.StoreException;
55
import org.gvsig.annotation.AnnotationLocator;
56
import org.gvsig.annotation.AnnotationManager;
57
import org.gvsig.annotation.swing.AnnotationSwingLocator;
58
import org.gvsig.annotation.swing.JAnnotationPreferencesPanel;
59
import org.gvsig.app.gui.panels.ColorChooserPanel;
60
import org.gvsig.utils.swing.JComboBox;
61
/**
62
 *  Default configuration page.
63
 *  <b><b>
64
 *  Here the user can establish what settings wants to use by default annotations.
65
 *
66
 *
67
 * @author Vicente Caballero Navarro
68
 */
69
public class AnnotationPreferencesPage extends AbstractPreferencePage {
70
	protected String id;
71
	private ImageIcon icon;
72
	private JTextField txtDefaultText;
73
	private JComboBox cmbDefaultTypeFont;
74
	private JComboBox cmbDefaultStyleFont;
75
	private JTextField txtDefaultRotate;
76
	private JTextField txtDefaultHeight;
77
	private ColorChooserPanel jccDefaultColor;
78
	private JAnnotationPreferencesPanel panel = null;
79
	
80
	private AnnotationManager annotationManager = null;
81
	
82

  
83
	/**
84
	 * Creates a new panel containing View preferences settings.
85
	 *
86
	 */
87
	public AnnotationPreferencesPage() {
88
		super();
89
		id = this.getClass().getName();
90
		this.annotationManager = AnnotationLocator.getManager();
91
	}
92

  
93
	public void initializeValues() {
94
		getPanel(); // init UI		
95
	}
96

  
97
	public String getID() {
98
		return id;
99
	}
100

  
101
	public String getTitle() {
102
		return PluginServices.getText(this, "annotation_preferences");
103
	}
104

  
105
	public JPanel getPanel() {
106
			if (panel==null) {
107
				addComponent(new JLabel(PluginServices.getText(this,"text")),
108
						txtDefaultText = new JTextField(), GridBagConstraints.BOTH, new Insets(4,0,4,8));
109
				panel = AnnotationSwingLocator.getSwingManager().createAnnotationPreferences();
110
				addComponent(panel);
111
			}
112
			return this;
113
	}
114

  
115
	public void storeValues() throws StoreException {
116
		annotationManager.setDefaultFontColor(panel.getDefaultFontColor());
117
		annotationManager.setDefaultTextValue(txtDefaultText.getText());
118
		annotationManager.setDefaultFontType(panel.getDefaultFontType());
119
		annotationManager.setDefaultFontStyle(panel.getDefaultFontStyle());
120
		annotationManager.setDefaultFontHeight(panel.getDefaultFontHeight());
121
		annotationManager.setDefaultFontRotation(panel.getDefaultFontRotation());
122
	}
123

  
124

  
125
	public void initializeDefaults() {
126
		txtDefaultText.setText(annotationManager.getDefaultTextValue());
127
		panel.setDefaultFontType(annotationManager.getDefaultFontType());
128
		panel.setDefaultFontStyle(annotationManager.getDefaultFontStyle());
129
		panel.setDefaultFontHeight(annotationManager.getDefaultFontHeight());	
130
		panel.setDefaultFontColor(annotationManager.getDefaultFontColor());
131
		panel.setDefaultFontRotation(annotationManager.getDefaultFontRotation());		
132
	}
133

  
134
	public ImageIcon getIcon() {
135
		if (icon==null)
136
			icon = PluginServices.getIconTheme().get("annotation-properties");
137
		return icon;
138
	}
139

  
140
	public boolean isValueChanged() {
141
		return super.hasChanged();
142
	}
143

  
144
	public void setChangesApplied() {
145
		setChanged(false);
146
	}
147
}
0 148

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/GvSIGAnnotationWindowManager.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.annotation.app.extension;
23

  
24
import java.awt.Component;
25
import java.awt.event.ComponentEvent;
26
import java.awt.event.ComponentListener;
27

  
28
import javax.swing.JOptionPane;
29

  
30
import org.gvsig.andami.PluginServices;
31
import org.gvsig.annotation.swing.AnnotationWindowManager;
32
import org.gvsig.annotation.swing.AnnotationWizardPanelActionListener;
33
import org.gvsig.annotation.swing.JAnnotationCreationServicePanel;
34
import org.gvsig.annotation.swing.JAnnotationPreferencesPanel;
35

  
36
/**
37
 * {@link AnnotationWindowManager} implementation to show Annotation
38
 * windows as gvSIG windows
39
 * 
40
 * @author gvSIG Team
41
 * @version $Id$
42
 */
43
public class GvSIGAnnotationWindowManager implements AnnotationWindowManager, ComponentListener {
44

  
45
    public void showWindow(JAnnotationCreationServicePanel panel, String title, int mode) {
46
        AnnotationWindow window =
47
            new AnnotationWindow(panel, title, mode);
48

  
49
        panel.setAnnotationServicePanelActionListener(new AnnotationWizardListener(window));        
50

  
51
        window.addComponentListener(this);
52

  
53
        PluginServices.getMDIManager().addCentredWindow(window);
54
    }
55

  
56
    public void componentHidden(ComponentEvent componentEvent) {
57
        AnnotationWindow window =
58
            (AnnotationWindow) componentEvent.getSource();
59
        if (window.isVisible()){
60
            PluginServices.getMDIManager().closeWindow(window);
61
        }
62
    }
63

  
64
    public void componentMoved(ComponentEvent e) {
65
        // Nothing to do
66
    }
67

  
68
    public void componentResized(ComponentEvent e) {
69
        // Nothing to do
70
    }
71

  
72
    public void componentShown(ComponentEvent e) {
73
        // Nothing to do
74
    }
75

  
76
    public class AnnotationWizardListener implements AnnotationWizardPanelActionListener{
77
        private AnnotationWindow annotationWindow = null;
78

  
79
        public AnnotationWizardListener(AnnotationWindow annotationWindow) {
80
            super();
81
            this.annotationWindow = annotationWindow;
82
        }
83

  
84
        public void cancel(
85
            JAnnotationCreationServicePanel annotationCreationServicePanel) {
86
            if (annotationWindow.isVisible()){
87
                PluginServices.getMDIManager().closeWindow(annotationWindow); 
88
            }
89
        }
90

  
91
        public void finish(
92
            JAnnotationCreationServicePanel annotationCreationServicePanel) {
93
            if (annotationWindow.isVisible()){
94
                PluginServices.getMDIManager().closeWindow(annotationWindow);    
95
            }
96
        }
97
    }
98

  
99

  
100
    public boolean showFileExistsPopup(String title, String text) {
101
        int resp = JOptionPane.showConfirmDialog(
102
            (Component)PluginServices.getMainFrame(), text,
103
            title, JOptionPane.YES_NO_OPTION);
104
        if (resp == JOptionPane.YES_OPTION) {
105
            return true;
106
        }
107
        return false;
108
    }
109

  
110
    public void showPreferencesWindow(JAnnotationPreferencesPanel panel,
111
        String title, int mode) {
112
        // TODO Auto-generated method stub
113

  
114
    }
115
}
0 116

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/main/java/org/gvsig/annotation/app/extension/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.annotation package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>Annotation gvSIG extension</p>
11
	
12
	<p>
13
	Shows Annotation into gvSIG.
14
	</p>
15

  
16
</body>
17
</html>
0 18

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/main/resources/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="org.gvsig.app" />
4
	<depends plugin-name="org.gvsig.editing" />
5
    <depends plugin-name="org.gvsig.app.document.table.app.mainplugin" />
6
	<resourceBundle name="text"/>
7
	<libraries library-dir="lib"/>
8
	<extensions>
9
		<extension class-name="org.gvsig.annotation.app.extension.AnnotationExtension"
10
			description=""
11
			active="true"
12
			priority="1">
13
			<menu text="Capa/export_to_annotation"
14
				position="35020"
15
				action-command="Annotation"/>
16
		</extension>	
17
		<extension class-name="org.gvsig.annotation.app.extension.AnnotationAboutExtension"
18
			description=""
19
			active="true"
20
			priority="1">			
21
		</extension>		
22
	</extensions>
23
</plugin-config>
0 24

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5
	<modelVersion>4.0.0</modelVersion>
6
	<artifactId>org.gvsig.annotation.app.extension</artifactId>
7
	<packaging>jar</packaging>
8
	<name>Tools: Export to annotation</name>
9
	<parent>
10
		<groupId>org.gvsig</groupId>
11
		<artifactId>org.gvsig.annotation.app</artifactId>
12
		<version>1.0.0-SNAPSHOT</version>
13
	</parent>
14

  
15
	<dependencies>
16
		<dependency>
17
			<groupId>org.gvsig</groupId>
18
			<artifactId>org.gvsig.andami</artifactId>
19
            <scope>compile</scope>
20
		</dependency>
21
		<dependency>
22
			<groupId>org.gvsig</groupId>
23
			<artifactId>org.gvsig.i18n</artifactId>
24
            <scope>compile</scope>
25
		</dependency>
26
		<dependency>
27
			<groupId>org.gvsig</groupId>
28
			<artifactId>org.gvsig.tools.lib</artifactId>
29
            <scope>compile</scope>
30
		</dependency>
31
		<dependency>
32
			<groupId>org.gvsig</groupId>
33
			<artifactId>org.gvsig.annotation.lib.api</artifactId>
34
            <scope>compile</scope>
35
		</dependency>
36
		<dependency>
37
			<groupId>org.gvsig</groupId>
38
			<artifactId>org.gvsig.annotation.swing.api</artifactId>
39
            <scope>compile</scope>
40
		</dependency>
41
		<dependency>
42
			<groupId>org.gvsig</groupId>
43
			<artifactId>org.gvsig.annotation.lib.impl</artifactId>
44
            <scope>compile</scope>
45
		</dependency>
46
		<dependency>
47
			<groupId>org.gvsig</groupId>
48
			<artifactId>org.gvsig.annotation.swing.impl</artifactId>
49
            <scope>compile</scope>
50
		</dependency>
51
		<dependency>
52
			<groupId>org.gvsig</groupId>
53
			<artifactId>org.gvsig.editing</artifactId>
54
            <scope>compile</scope>
55
		</dependency>
56
        <dependency>
57
            <groupId>org.gvsig</groupId>
58
            <artifactId>org.gvsig.fmap.dal</artifactId>
59
            <scope>compile</scope>
60
        </dependency>
61
        <dependency>
62
            <groupId>org.gvsig</groupId>
63
            <artifactId>org.gvsig.fmap.mapcontext</artifactId>
64
            <scope>compile</scope>
65
        </dependency>
66
        <dependency>
67
            <groupId>org.gvsig</groupId>
68
            <artifactId>org.gvsig.utils</artifactId>
69
            <scope>compile</scope>
70
        </dependency>
71
        <dependency>
72
            <groupId>org.gvsig</groupId>
73
            <artifactId>org.gvsig.app</artifactId>
74
            <version>2.0-SNAPSHOT</version>
75
            <scope>compile</scope>
76
        </dependency>
77
        <dependency>
78
            <groupId>org.gvsig</groupId>
79
            <artifactId>org.gvsig.app.document.table.app.mainplugin</artifactId>
80
            <version>2.0.0-SNAPSHOT</version>
81
            <scope>compile</scope>
82
        </dependency>
83
        <dependency>
84
            <groupId>org.gvsig</groupId>
85
            <artifactId>org.gvsig.ui</artifactId>
86
            <scope>compile</scope>
87
        </dependency>
88
        <dependency>
89
            <groupId>org.gvsig</groupId>
90
            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
91
            <scope>compile</scope>
92
        </dependency>
93
        <dependency>
94
            <groupId>org.gvsig</groupId>
95
            <artifactId>org.gvsig.fmap.control</artifactId>
96
            <scope>compile</scope>
97
        </dependency>
98
	</dependencies>
99
	<profiles>
100
		<profile>
101
			<id>gvsig-install</id>
102
			<activation>
103
				<activeByDefault>true</activeByDefault>
104
			</activation>
105
			<properties>
106
				<!--
107
					Default gvSIG installation folder relative to the current workspace
108
				-->
109
				<gvsig.install.dir>${basedir}/../../build/product</gvsig.install.dir>
110
			</properties>
111
		</profile>
112
	</profiles>
113
    <properties>
114
        <package.info.dependencies>required: org.gvsig.app.document.table.app.mainplugin -ge 2</package.info.dependencies>
115
    </properties>
116
</project>
0 117

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/distribution/distribution.xml
1
<assembly>
2
	<id>distribution</id>
3
	<formats>
4
		<format>dir</format>
5
	</formats>
6
	<fileSets>
7
		<!-- Estructure for the extension -->
8
		<fileSet>
9
			<directory>src/main/resources</directory>
10
			<outputDirectory>${extension.install.dir.name}
11
			</outputDirectory>
12
		</fileSet>
13
	</fileSets>
14
    <files>
15
        <file>
16
            <source>package.info</source>
17
            <outputDirectory>${extension.install.dir.name}
18
            </outputDirectory>
19
        </file>
20
    </files>
21
	<dependencySets>
22
		<dependencySet>
23
			<outputDirectory>${extension.install.dir.name}/${library-dir}
24
			</outputDirectory>
25
			<includes>
26
				<include>org.gvsig:org.gvsig.annotation.app.extension</include>
27
				<include>org.gvsig:org.gvsig.annotation.lib.api</include>
28
				<include>org.gvsig:org.gvsig.annotation.swing.api</include>
29
				<include>org.gvsig:org.gvsig.annotation.lib.impl</include>
30
				<include>org.gvsig:org.gvsig.annotation.swing.impl</include>
31
			</includes>
32
		</dependencySet>
33
	</dependencySets>
34
</assembly>
0 35

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/buildNumber.properties
1
#maven.buildNumber.plugin properties file
2
#Fri Nov 18 13:18:37 CET 2011
3
buildNumber=2041
0 4

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/prepare-workspace.xml
1
<project name="org.gvsig.initial.build" default="prepare-workspace">
2
	
3
	<dirname property="org.gvsig.initial.build.basedir" file="${ant.file.org.gvsig.initial.build}"/>
4
	
5
	<property name="workspace.basedir" 
6
			  value="${org.gvsig.initial.build.basedir}/.."/>
7
	<property name="build.basedir" 
8
		      value="${workspace.basedir}/org.gvsig.maven.base.build"
9
		      description="Eclipse workspace location"/>
10
	<property name="build.jar.version" 
11
			 	  value="1.0.6-SNAPSHOT" />
12
	<property name="build.jar.file" 
13
		 	  value="org.gvsig.maven.base.build-${build.jar.version}.jar" />
14
	
15
	<target name="check-maven-base-build-available">
16
		<available file="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" 
17
				   property="maven-base-build-available"/>
18
	</target>
19
	
20
	<target name="get-maven-base-build-local" 
21
			depends="check-maven-base-build-available"
22
			if="maven-base-build-available">
23
		<!-- Unzip de build jar file from the maven repository into the workspace root folder -->
24
		<unzip src="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}"
25
		       dest="${workspace.basedir}">
26
		    <patternset>
27
		        <exclude name="META-INF/**"/>
28
		    </patternset>
29
		</unzip>	
30
	</target>
31
	
32
	<target name="get-maven-base-build-remote" 
33
			depends="check-maven-base-build-available"
34
			unless="maven-base-build-available">
35
		<!-- Download the build jar file -->
36
		<get src="http://gvsig-desktop.forge.osor.eu/downloads/pub/projects/gvSIG-desktop/maven-repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" 
37
			 dest="target/${build.jar.file}"
38
			 verbose="true"/>
39
		
40
		<!-- Unzip de build jar file into the workspace root folder -->
41
		<unzip src="target/${build.jar.file}"
42
		       dest="${workspace.basedir}">
43
		    <patternset>
44
		        <exclude name="META-INF/**"/>
45
		    </patternset>
46
		</unzip>	
47
	</target>
48
	
49
	<target name="prepare-workspace" depends="get-maven-base-build-local,get-maven-base-build-remote">
50
		
51
		<mkdir dir="target"/>
52
	
53
		<chmod dir="${build.basedir}/maven/bin" perm="u+x" includes="m2,mvn,mvnDebug"/>
54
		
55
		<!-- Copy the maven launchers to the workspace metadata folder -->
56
		<copy todir="${workspace.basedir}/.metadata">
57
		    <fileset dir="${build.basedir}/eclipse-launchers"/>
58
		</copy>
59
		
60
		<!-- Configure the eclipse workspace -->
61
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-configure-eclipse-workspace"/>
62

  
63
		<!-- Configure the gvSIG profile -->
64
		<ant antfile="${build.basedir}/check-gvsig-profile.xml" target="initialize"/>
65

  
66
		<!-- Compile, install and generate eclipse projects -->
67
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-install-and-eclipse-eclipse"/>
68
		
69
		<echo>INFORMATION!!!</echo>
70
		<echo>Restart eclipse and then proceed to import the subprojects contained into the main project</echo>
71
		
72
		<!-- TODO: copiar al proyecto de configuraciĆ³n general -->
73
	</target>
74
 	
75
	<target name="clean">
76
		<delete dir="target"/>
77
	</target>
78

  
79
</project>
0 80

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
	<modelVersion>4.0.0</modelVersion>
6
	<artifactId>org.gvsig.annotation.app</artifactId>
7
	<packaging>pom</packaging>
8
	<version>1.0.0-SNAPSHOT</version>
9
	<name>org.gvsig.annotation.app</name>
10
	<description>Anotation layer support:
11
- Create anotation layer
12
- Modify annotation layer (throught standard editing)
13
- Editing single labelling (position and label settings)
14
</description>
15
	<url>http://gvsig-desktop.forge.osor.eu/downloads/pub/projects/gvSIG-desktop/docs/reference/org.gvsig.annotation/${project.version}/basic/org.gvsig.annotation.app</url>
16
    <parent>
17
        <groupId>org.gvsig</groupId>
18
        <artifactId>org.gvsig.maven.base.extension.pom</artifactId>
19
        <version>1.0.8-SNAPSHOT</version>
20
    </parent>
21

  
22
	<scm>
23
		<connection>scm:svn:https://svn.forge.osor.eu/svn/gvsig-annotation/org.gvsig.annotation/extension/trunk</connection>
24
		<developerConnection>scm:svn:https://svn.forge.osor.eu/svn/gvsig-annotation/org.gvsig.annotation/extension/trunk</developerConnection>
25
		<url>https://forge.osor.eu/plugins/scmsvn/viewcvs.php/org.gvsig.annotation/extension/trunk/?root=gvsig-annotation</url>
26
	</scm>
27

  
28
	<developers>
29
		<developer>
30
			<id>jjdelcerro</id>
31
			<name>Joaqu?n Jos? del Cerro</name>
32
			<email>jjdelcerro@gvsig.org</email>
33
			<roles>
34
				<role>Architect</role>
35
				<role>Developer</role>
36
			</roles>
37
		</developer>
38
		<developer>
39
			<id>jbadia</id>
40
			<name>Jos? Bad?a</name>
41
			<email>badia_jos@gva.es</email>
42
			<roles>
43
				<role>Developer</role>
44
			</roles>
45
		</developer>
46
		<developer>
47
			<id>cordinyana</id>
48
			<name>C?sar Ordi?ana</name>
49
			<email>cordinyana@gvsig.com</email>
50
			<roles>
51
				<role>Architect</role>
52
				<role>Developer</role>
53
			</roles>
54
		</developer>
55
	</developers>
56

  
57
	<distributionManagement>
58
		<site>
59
			<id>gvsig-repository</id>
60
			<url>scp://shell.forge.osor.eu/home/groups/gvsig-desktop/www/downloads/pub/projects/gvSIG-desktop/docs/reference/org.gvsig.annotation/${project.version}/basic/org.gvsig.annotation.app</url>
61
		</site>
62
	</distributionManagement>
63
	<repositories>
64
		<repository>
65
			<id>gvsig-public-http-repository</id>
66
			<name>gvSIG maven public HTTP repository</name>
67
			<url>http://gvsig-desktop.forge.osor.eu/downloads/pub/projects/gvSIG-desktop/maven-repository</url>
68
			<releases>
69
				<enabled>true</enabled>
70
				<updatePolicy>daily</updatePolicy>
71
				<checksumPolicy>warn</checksumPolicy>
72
			</releases>
73
			<snapshots>
74
				<enabled>true</enabled>
75
				<updatePolicy>daily</updatePolicy>
76
				<checksumPolicy>warn</checksumPolicy>
77
			</snapshots>
78
		</repository>
79
	</repositories>
80
	<build>
81
		<plugins>
82
			<plugin>
83
				<groupId>org.apache.maven.plugins</groupId>
84
				<artifactId>maven-release-plugin</artifactId>
85
				<configuration>
86
					<tagBase>https://svn.forge.osor.eu/svn/gvsig-annotation/org.gvsig.annotation/extension/tags</tagBase>
87
				</configuration>
88
			</plugin>
89
		</plugins>
90
	</build>
91
    <dependencyManagement>
92
        <dependencies>          
93
            <dependency>
94
                <groupId>org.gvsig</groupId>
95
                <artifactId>org.gvsig.core.maven.dependencies</artifactId>
96
                <version>2.0.1-SNAPSHOT</version>
97
                <type>pom</type>
98
                <scope>import</scope>
99
            </dependency>
100
			<dependency>
101
				<groupId>org.gvsig</groupId>
102
				<artifactId>org.gvsig.editing</artifactId>
103
				<version>2.0-SNAPSHOT</version>
104
                <scope>compile</scope>
105
			</dependency>
106
			<dependency>
107
				<groupId>org.gvsig</groupId>
108
				<artifactId>org.gvsig.annotation.lib.api</artifactId>
109
				<version>1.0.0-SNAPSHOT</version>
110
                <scope>compile</scope>
111
			</dependency>
112
			<dependency>
113
				<groupId>org.gvsig</groupId>
114
				<artifactId>org.gvsig.annotation.lib.impl</artifactId>
115
				<version>1.0.0-SNAPSHOT</version>
116
				<scope>runtime</scope>
117
			</dependency>
118
			<dependency>
119
				<groupId>org.gvsig</groupId>
120
				<artifactId>org.gvsig.annotation.swing.api</artifactId>
121
				<version>1.0.0-SNAPSHOT</version>
122
                <scope>compile</scope>
123
			</dependency>
124
			<dependency>
125
				<groupId>org.gvsig</groupId>
126
				<artifactId>org.gvsig.annotation.swing.impl</artifactId>
127
				<version>1.0.0-SNAPSHOT</version>
128
				<scope>runtime</scope>
129
			</dependency>			
130
		</dependencies>
131
	</dependencyManagement>
132

  
133
	<modules>
134
		<module>org.gvsig.annotation.app.extension</module>
135
	</modules>
136
    
137
</project>
0 138

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/README.txt
1
The first time you checkout the current project to a new workspace, 
2
you have to prepare it to be able to work easily with maven from
3
eclipse itself.
4

  
5
Perform the following steps:
6

  
7
1.- Launch the *prepare-workspace.xml* ant build file. 
8
    You can do it by loading the file into the ant view, 
9
    and running the default task, or right-clicking the 
10
    file from the package explorer or the navigator and
11
    select the option: *Run as > Ant build*. 
12
    
13
2.- Restart eclipse.
14

  
15
3.- Import the subprojects of the project you have just checked out.
16

  
17
Those steps are only needed once per workspace.     
18

  
0 19

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/distribution/distribution.xml
1
<assembly>
2
</assembly>
0 3

  
tags/v2_0_0_Build_2041/extensions/org.gvsig.annotation.app/buildNumber.properties
1
#maven.buildNumber.plugin properties file
2
#Fri Nov 18 13:18:36 CET 2011
3
buildNumber=2049
0 4

  

Also available in: Unified diff