Revision 33573

View differences:

tags/v2_0_0_Build_2011/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_2011/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_2011/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
	<resourceBundle name="text"/>
6
	<libraries library-dir="lib"/>
7
	<extensions>
8
		<extension class-name="org.gvsig.annotation.app.extension.AnnotationExtension"
9
			description=""
10
			active="true"
11
			priority="1">
12
			<menu text="Capa/export_to/annotation"
13
				position="11"
14
				action-command="Annotation"/>
15
		</extension>	
16
		<extension class-name="org.gvsig.annotation.app.extension.AnnotationAboutExtension"
17
			description=""
18
			active="true"
19
			priority="1">			
20
		</extension>		
21
	</extensions>
22
</plugin-config>
0 23

  
tags/v2_0_0_Build_2011/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/main/resources/build.number
1
#Build Number for ANT. Do not edit!
2
#Tue Apr 28 16:00:47 CEST 2009
3
build.number=2005
tags/v2_0_0_Build_2011/extensions/org.gvsig.annotation.app/org.gvsig.annotation.app.extension/src/main/resources/about.htm
1
<html>
2
  <head>
3
    <title>Extesi&oacute;n de la Aplicaci&oacute;n para el manejo de capas de anotaciones.</title>
4
    <meta content="">
5
    <style></style>
6
  </head>
7
  <body>
8
<table width="60%" border="0">
9
  <tr>
10
    <td width="64%"><img src="images/logo_horiz_bicolor_gva.png" width="329" height="50"></td>
11
    <td width="36%"><div align="right"><img src="images/logoIver.png" width="87" height="50"></div></td>
12
  </tr>
13
  <tr>
14
    <td colspan="2"><font face="Arial, Helvetica, sans-serif">&copy; Copyright
15
      Generalitat Valenciana, IVER T.I. 2007.</font></td>
16
  </tr>
17
</table>
18
  <h3>Extensi&oacute;n de la Aplicaci&oacute;n para el para el manejo de capas de anotaciones.</h3>
19
  <p><br><br><b> Build Number: #build.number#</b></p>
20
  </body>
21
</html>
0 22

  
tags/v2_0_0_Build_2011/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
import org.gvsig.annotation.swing.thread.AnnotationCreationTask;
36

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

  
46
    public void showWindow(JAnnotationCreationServicePanel panel, String title, int mode) {
47
        AnnotationWindow window =
48
            new AnnotationWindow(panel, title, mode);
49
        
50
        panel.setAnnotationServicePanelActionListener(new AnnotationWizardListener(window));        
51

  
52
        window.addComponentListener(this);
53

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

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

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

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

  
71
    public void componentShown(ComponentEvent e) {
72
        // Nothing to do
73
    }
74
    
75
    public class AnnotationWizardListener implements AnnotationWizardPanelActionListener{
76
    	private AnnotationWindow annotationWindow = null;
77
    	
78
    	public AnnotationWizardListener(AnnotationWindow annotationWindow) {
79
    		super();
80
    		this.annotationWindow = annotationWindow;
81
    	}
82

  
83
    	public void cancel(
84
    			JAnnotationCreationServicePanel annotationCreationServicePanel) {
85
    		PluginServices.getMDIManager().closeWindow(annotationWindow);	
86
    	}
87

  
88
    	public void finish(
89
    			JAnnotationCreationServicePanel annotationCreationServicePanel) {
90
    		PluginServices.getMDIManager().closeWindow(annotationWindow);		
91
    	}
92
    }
93

  
94
	public void showWindow(AnnotationCreationTask annotationCreationTask) {
95
		PluginServices.cancelableBackgroundExecution(annotationCreationTask);			
96
	}
97

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

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

  
tags/v2_0_0_Build_2011/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_2011/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.PluginServices;
31
import org.gvsig.andami.plugins.Extension;
32
import org.gvsig.app.extension.About;
33
import org.gvsig.app.gui.panels.FPanelAbout;
34
import org.gvsig.i18n.Messages;
35

  
36
/**
37
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
38
 */
39
public class AnnotationAboutExtension extends Extension {
40

  
41
	public void execute(String actionCommand) {
42

  
43
	}
44

  
45
	public void initialize() {
46

  
47
	}
48

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

  
53
	public boolean isVisible() {
54
		return false;
55
	}
56

  
57
	public void postInitialize() {
58
		super.postInitialize();
59
		About about = (About) PluginServices.getExtension(About.class);
60
		FPanelAbout panelAbout = about.getAboutPanel();
61
		java.net.URL aboutURL = this.getClass().getClassLoader().getResource("about.htm");
62
		panelAbout.addAboutUrl(Messages.getText("annotations"),	aboutURL);
63

  
64
	}
65
}
0 66

  
tags/v2_0_0_Build_2011/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_2011/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_2011/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_DIALOG);
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_2011/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_2011/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>org.gvsig.annotation.app.extension</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
		</dependency>
20
		<dependency>
21
			<groupId>org.gvsig</groupId>
22
			<artifactId>org.gvsig.i18n</artifactId>
23
		</dependency>
24
		<dependency>
25
			<groupId>org.gvsig</groupId>
26
			<artifactId>org.gvsig.tools.lib</artifactId>
27
		</dependency>
28
		<dependency>
29
			<groupId>org.gvsig</groupId>
30
			<artifactId>org.gvsig.annotation.lib.api</artifactId>
31
		</dependency>
32
		<dependency>
33
			<groupId>org.gvsig</groupId>
34
			<artifactId>org.gvsig.annotation.swing.api</artifactId>
35
		</dependency>
36
		<dependency>
37
			<groupId>org.gvsig</groupId>
38
			<artifactId>org.gvsig.annotation.lib.impl</artifactId>
39
		</dependency>
40
		<dependency>
41
			<groupId>org.gvsig</groupId>
42
			<artifactId>org.gvsig.annotation.swing.impl</artifactId>
43
		</dependency>
44
		<dependency>
45
			<groupId>org.gvsig</groupId>
46
			<artifactId>org.gvsig.editing</artifactId>
47
		</dependency>
48
	</dependencies>
49
	<profiles>
50
		<profile>
51
			<id>gvsig-install</id>
52
			<activation>
53
				<activeByDefault>true</activeByDefault>
54
			</activation>
55
			<properties>
56
				<!--
57
					Default gvSIG installation folder relative to the current workspace
58
				-->
59
				<gvsig.install.dir>${basedir}/../../build/product</gvsig.install.dir>
60
			</properties>
61
		</profile>
62
	</profiles>
63
</project>
0 64

  
tags/v2_0_0_Build_2011/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
	<dependencySets>
15
		<dependencySet>
16
			<outputDirectory>${extension.install.dir.name}/${library-dir}
17
			</outputDirectory>
18
			<includes>
19
				<include>org.gvsig:org.gvsig.annotation.app.extension</include>
20
				<include>org.gvsig:org.gvsig.annotation.lib.api</include>
21
				<include>org.gvsig:org.gvsig.annotation.swing.api</include>
22
				<include>org.gvsig:org.gvsig.annotation.lib.impl</include>
23
				<include>org.gvsig:org.gvsig.annotation.swing.impl</include>
24
			</includes>
25
		</dependencySet>
26
	</dependencySets>
27
</assembly>
0 28

  
tags/v2_0_0_Build_2011/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_2011/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
	<groupId>org.gvsig</groupId>
7
	<artifactId>org.gvsig.annotation.app</artifactId>
8
	<packaging>pom</packaging>
9
	<version>1.0.0-SNAPSHOT</version>
10
	<name>org.gvsig.annotation.app</name>
11
	<description>Extension of the Annotation example project</description>
12
	<url>http://gvsig-desktop.forge.osor.eu/downloads/pub/projects/gvSIG-desktop/docs/reference/org.gvsig.annotation/${pom.version}/basic/org.gvsig.annotation.app</url>
13
	<parent>
14
		<groupId>org.gvsig</groupId>
15
		<artifactId>org.gvsig.maven.base.extension.pom</artifactId>
16
		<version>1.0.6-SNAPSHOT</version>
17
	</parent>
18

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

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

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

  
135
	<modules>
136
		<module>org.gvsig.annotation.app.extension</module>
137
	</modules>
138

  
139
</project>
0 140

  
tags/v2_0_0_Build_2011/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_2011/extensions/org.gvsig.annotation.app/distribution/distribution.xml
1
<assembly>
2
</assembly>
0 3

  

Also available in: Unified diff