Revision 538

View differences:

tags/org.gvsig.app.document.layout2.app-2.0.76/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2

  
3
    <modelVersion>4.0.0</modelVersion>
4
    <artifactId>org.gvsig.app.document.layout2.app</artifactId>
5
    <packaging>pom</packaging>
6
    <version>2.0.76</version>
7

  
8
    <name>${project.artifactId}</name>
9
    <description>This plugin adds creation/management of layout (map) documents.</description>
10

  
11
    <parent>
12
        <groupId>org.gvsig</groupId>
13
        <artifactId>org.gvsig.desktop</artifactId>
14
        <version>2.0.130</version>
15
    </parent>
16

  
17
	<url>https://devel.gvsig.org/redmine/projects/gvsig-app-document-layout</url>
18

  
19
    <scm>
20
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-app-document-layout/tags/org.gvsig.app.document.layout2.app-2.0.76</connection>
21
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-app-document-layout/tags/org.gvsig.app.document.layout2.app-2.0.76</developerConnection>
22
        <url>https://devel.gvsig.org/redmine/projects/gvsig-app-document-layout/repository/show/tags/org.gvsig.app.document.layout2.app-2.0.76</url>
23
    </scm>
24
    <repositories>
25
      <repository>
26
        <id>gvsig-public-http-repository</id>
27
        <name>gvSIG maven public HTTP repository</name>
28
        <url>http://devel.gvsig.org/m2repo/j2se</url>
29
        <releases>
30
          <enabled>true</enabled>
31
          <updatePolicy>daily</updatePolicy>
32
          <checksumPolicy>warn</checksumPolicy>
33
        </releases>
34
        <snapshots>
35
          <enabled>true</enabled>
36
          <updatePolicy>daily</updatePolicy>
37
          <checksumPolicy>warn</checksumPolicy>
38
        </snapshots>
39
      </repository>
40
    </repositories>
41

  
42
	<build>
43
		<plugins>
44
			<plugin>
45
				<groupId>org.apache.maven.plugins</groupId>
46
				<artifactId>maven-release-plugin</artifactId>
47
				<configuration>
48
					<tagBase>https://devel.gvsig.org/svn/gvsig-app-document-layout/tags</tagBase>
49
				</configuration>
50
			</plugin>
51
		</plugins>
52
	</build>
53

  
54
    <dependencyManagement>
55
         <dependencies>
56
            <!--
57
            Versions of child projects
58
            -->
59
            <dependency>
60
                <groupId>org.gvsig</groupId>
61
                <artifactId>org.gvsig.app.document.layout2.app.mainplugin</artifactId>
62
                <version>2.0.76</version>
63
            </dependency>
64

  
65
        </dependencies>
66
    </dependencyManagement>
67

  
68
	<modules>
69
		<module>org.gvsig.app.document.layout2.app.mainplugin</module>
70
	</modules>
71

  
72
</project>
tags/org.gvsig.app.document.layout2.app-2.0.76/org.gvsig.app.document.layout2.app.mainplugin/buildNumber.properties
1
#Sun Feb 21 11:41:07 CET 2016
2
buildNumber=95
tags/org.gvsig.app.document.layout2.app-2.0.76/org.gvsig.app.document.layout2.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
1
<assembly>
2
  <id>gvsig-plugin-package</id>
3
  <formats>
4
    <format>zip</format>
5
  </formats>
6
  <baseDirectory>${project.artifactId}</baseDirectory>
7
  <includeBaseDirectory>true</includeBaseDirectory>
8
  <files>
9
    <file>
10
      <source>target/${project.artifactId}-${project.version}.jar</source>
11
      <outputDirectory>lib</outputDirectory>
12
    </file>
13
    <file>
14
      <source>target/package.info</source>
15
    </file>
16
  </files>
17

  
18
  <fileSets>
19
    <fileSet>
20
      <directory>src/main/resources-plugin</directory>
21
      <outputDirectory>.</outputDirectory>
22
    </fileSet>
23
  </fileSets>
24

  
25
  <dependencySets>
26
  
27
  <!--
28
    <dependencySet>
29
      <useProjectArtifact>false</useProjectArtifact>
30
      <useTransitiveDependencies>false</useTransitiveDependencies>
31
      <outputDirectory>lib</outputDirectory>
32
      <includes>
33
      </includes>
34
    </dependencySet>
35
    
36
    -->
37
    
38
  </dependencySets>
39

  
40
</assembly>
0 41

  
tags/org.gvsig.app.document.layout2.app-2.0.76/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/TagExtension.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.app.extension;
23

  
24
import java.awt.Component;
25

  
26
import javax.swing.JOptionPane;
27

  
28
import org.gvsig.andami.IconThemeHelper;
29
import org.gvsig.andami.PluginServices;
30
import org.gvsig.andami.plugins.Extension;
31
import org.gvsig.andami.ui.mdiManager.IWindow;
32
import org.gvsig.app.project.documents.layout.fframes.IFFrame;
33
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
34

  
35
public class TagExtension extends Extension {
36

  
37
    private LayoutPanel layout = null;
38

  
39
    /**
40
     * @see org.gvsig.andami.plugins.IExtension#initialize()
41
     */
42
    public void initialize() {
43
        registerIcons();
44
    }
45

  
46
    private void registerIcons() {
47

  
48
        IconThemeHelper.registerIcon("action", "layout-graphic-show-tags", this);
49
        IconThemeHelper.registerIcon("action", "layout-insert-tag", this);
50

  
51
    }
52

  
53
    /**
54
     * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
55
     */
56
    public void execute(String s) {
57

  
58
        /*
59
         * FLayoutZooms zooms = new FLayoutZooms(layout);
60
         * logger.debug("Comand : " + s);
61
         * if (s.compareTo("SET_TAG") == 0) {
62
         * layout.setTool(Layout.SET_TAG);
63
         * }
64
         */
65

  
66
        // FJP: Cambio: abrimos la ventana de tag para
67
        // asignar el tag a los elementos seleccionados
68
        if (s.equals("layout-insert-tag")) {
69
            IFFrame[] selectedFrames =
70
                layout.getLayoutContext().getSelectedFFrames();
71
            if (selectedFrames.length > 0) {
72
                String defaultStr = "";
73
                if (selectedFrames.length == 1)
74
                    defaultStr = selectedFrames[0].getTag();
75
                String theTag =
76
                    JOptionPane.showInputDialog(
77
                        (Component) PluginServices.getMainFrame(),
78
                        "Introduzca el tag:", defaultStr);
79
                if (theTag != null) {
80
                    for (int i = 0; i < selectedFrames.length; i++)
81
                        selectedFrames[i].setTag(theTag);
82
                }
83
                layout.getDocument().setModified(true);
84
            }
85
        } else
86
            if (s.equals("layout-graphic-show-tags")) {
87
                // IFFrame[] frames = layout.getFFrames();
88
                // for (int i=0; i< frames.length; i++)
89
                // {
90
                // IFFrame f = frames[i];
91
                // if (f instanceof FFrameText)
92
                // {
93
                // FFrameText txt = (FFrameText) f;
94
                // if (f.getTag() != null)
95
                // {
96
                // txt.clearText();
97
                // txt.addText(f.getTag());
98
                // }
99
                // }
100
                // }
101
                layout.setShowIconTag(true);
102
                layout.getLayoutControl().refresh();
103
            }
104
    }
105

  
106
    /**
107
     * @see org.gvsig.andami.plugins.IExtension#isEnabled()
108
     */
109
    public boolean isEnabled() {
110
        IFFrame[] selectedFrames =
111
            layout.getLayoutContext().getSelectedFFrames();
112
        if (selectedFrames == null)
113
            return false;
114
        return (selectedFrames.length > 0);
115
    }
116

  
117
    /**
118
     * @see org.gvsig.andami.plugins.IExtension#isVisible()
119
     */
120
    public boolean isVisible() {
121
        IWindow f = PluginServices.getMDIManager().getActiveWindow();
122

  
123
        if (f != null && f instanceof LayoutPanel) {
124
            layout = (LayoutPanel) f;
125
            return true;
126
        }
127
        return false;
128
    }
129

  
130
}
tags/org.gvsig.app.document.layout2.app-2.0.76/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/PrintProperties.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.app.extension;
23

  
24
/**
25
 */
26
import java.awt.geom.Rectangle2D;
27

  
28
import org.gvsig.andami.IconThemeHelper;
29
import org.gvsig.andami.PluginServices;
30
import org.gvsig.andami.plugins.Extension;
31
import org.gvsig.andami.ui.mdiManager.IWindow;
32
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
33

  
34
/**
35
 * DOCUMENT ME!
36
 * 
37
 * @author vcn
38
 */
39
public class PrintProperties extends Extension /*
40
                                                * implements
41
                                                * IPreferenceExtension
42
                                                */{
43

  
44
    private LayoutPanel l;
45
    // private static final IPreference printPropertiesPage = new
46
    // PrintPropertiesPage();
47
    // private Paper paper;
48
    Rectangle2D.Double aux = null;
49

  
50
    /**
51
     * DOCUMENT ME!
52
     * 
53
     * @param s
54
     *            DOCUMENT ME!
55
     */
56
    public void execute(String s) {
57
        if (s.compareTo("application-page-setup-layout") == 0) {
58
            l = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
59
            l.showFConfig();
60
        }
61
    }
62

  
63
    /**
64
     * DOCUMENT ME!
65
     * 
66
     * @return DOCUMENT ME!
67
     */
68
    public boolean isVisible() {
69
        IWindow f = PluginServices.getMDIManager().getActiveWindow();
70

  
71
        if (f == null) {
72
            return false;
73
        }
74

  
75
        return (f instanceof LayoutPanel);
76
    }
77

  
78
    /**
79
     * @see com.iver.mdiApp.plugins.IExtension#isEnabled()
80
     */
81
    public boolean isEnabled() {
82
        LayoutPanel f =
83
            (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
84

  
85
        if (f == null || !f.getLayoutContext().isEditable()) {
86
            return false;
87
        }
88

  
89
        return true;
90
    }
91

  
92
    /**
93
     * @see org.gvsig.andami.plugins.IExtension#initialize()
94
     */
95
    public void initialize() {
96
        registerIcons();
97
    }
98

  
99
    private void registerIcons() {
100
        IconThemeHelper.registerIcon("action", "application-page-setup", this);
101
    }
102
}
tags/org.gvsig.app.document.layout2.app-2.0.76/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/LayoutExtension.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.app.extension;
23

  
24
import java.awt.Component;
25
import java.io.File;
26
import java.io.FileOutputStream;
27

  
28
import javax.swing.JFileChooser;
29
import javax.swing.JOptionPane;
30

  
31
import org.slf4j.Logger;
32
import org.slf4j.LoggerFactory;
33

  
34
import org.gvsig.andami.IconThemeHelper;
35
import org.gvsig.andami.PluginServices;
36
import org.gvsig.andami.messages.NotificationManager;
37
import org.gvsig.andami.plugins.Extension;
38
import org.gvsig.andami.preferences.IPreference;
39
import org.gvsig.andami.preferences.IPreferenceExtension;
40
import org.gvsig.andami.ui.mdiManager.IWindow;
41
import org.gvsig.app.gui.preferencespage.LayoutPage;
42
import org.gvsig.app.project.documents.layout.FLayoutZooms;
43
import org.gvsig.app.project.documents.layout.LayoutManager;
44
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
45
import org.gvsig.i18n.Messages;
46
import org.gvsig.tools.ToolsLocator;
47
import org.gvsig.tools.persistence.PersistenceManager;
48
import org.gvsig.tools.persistence.PersistentState;
49
import org.gvsig.tools.persistence.text.JavaTextFactory;
50
import org.gvsig.utils.GenericFileFilter;
51

  
52
/**
53
 * Extensi?n para controlar las operaciones basicas sobre el Layout.
54
 * 
55
 * @author Vicente Caballero Navarro
56
 */
57
public class LayoutExtension extends Extension implements IPreferenceExtension {
58

  
59
    private static final Logger logger = LoggerFactory
60
            .getLogger(LayoutExtension.class);
61

  
62
    private LayoutPanel layout = null;
63

  
64
    /**
65
     * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
66
     */
67
    public void execute(String s) {
68
        layout = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
69

  
70
        FLayoutZooms zooms = new FLayoutZooms(layout);
71
        logger.debug("Comand : " + s);
72

  
73
        if (s.equals("layout-navigation-pan")) {
74
            layout.getLayoutControl().setTool("layoutpan");
75
        }
76
        else if (s.equals("layout-navigation-zoom-in-topoint")) {
77
            layout.getLayoutControl().setTool("layoutzoomin");
78
        }
79
        else if (s.equals("layout-navigation-zoom-out-topoint")) {
80
            layout.getLayoutControl().setTool("layoutzoomout");
81
        }
82
        else if (s.equals("layout-navigation-zoom-all")) {
83
            layout.getLayoutControl().fullRect();
84
        }
85
        else if (s.equals("layout-navigation-zoom-real")) {
86
            zooms.realZoom();
87
        }
88
        else if (s.equals("layout-navigation-zoom-out-center")) {
89
            zooms.zoomOut();
90
        }
91
        else if (s.equals("layout-navigation-zoom-in-center")) {
92
            zooms.zoomIn();
93
        }
94
        else if (s.equals("layout-navigation-zoom-selected")) {
95
            zooms.zoomSelect();
96
        }
97
        else if (s.equals("application-layout-template-save")) {
98
            saveLayout();
99
        }
100
    }
101

  
102
    private void saveLayout() {
103
        layout = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
104
        JFileChooser jfc = new JFileChooser();
105
        GenericFileFilter layoutMainFilter = new GenericFileFilter(
106
                LayoutManager.TEMPLATE_FILE_POINTEXT,
107
                Messages.getText("_Layout_template") + " (*"
108
                        + LayoutManager.TEMPLATE_FILE_POINTEXT + ")");
109
        jfc.addChoosableFileFilter(layoutMainFilter);
110
        jfc.setFileFilter(layoutMainFilter);
111

  
112
        if (jfc.showSaveDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION) {
113
            File file = jfc.getSelectedFile();
114
            if (!(file.getPath().endsWith(
115
                    LayoutManager.TEMPLATE_FILE_POINTEXT.toLowerCase()) || file
116
                    .getPath().endsWith(LayoutManager.TEMPLATE_FILE_POINTEXT))) {
117
                file = new File(file.getPath()
118
                        + LayoutManager.TEMPLATE_FILE_POINTEXT);
119
            }
120
            if (file.exists()) {
121
                int resp = JOptionPane.showConfirmDialog(
122
                        (Component) PluginServices.getMainFrame(),
123
                        PluginServices.getText(this,
124
                                "fichero_ya_existe_seguro_desea_guardarlo"),
125
                        PluginServices.getText(this, "guardar"),
126
                        JOptionPane.YES_NO_OPTION);
127
                if (resp != JOptionPane.YES_OPTION) {
128
                    return;
129
                }
130
            }
131

  
132
            try {
133
                FileOutputStream fos = new FileOutputStream(
134
                        file.getAbsolutePath());
135
                PersistenceManager persistenceManager = ToolsLocator
136
                        .getPersistenceManager();
137
                PersistentState persistentState = persistenceManager
138
                        .getState(layout);
139
                persistenceManager.saveState(persistentState, fos);
140
            }
141
            catch (Exception e) {
142
                NotificationManager.addError(PluginServices.getText(this,
143
                        "Error_guardando_la_plantilla"), e);
144
            }
145
        }
146
    }
147

  
148
    /**
149
     * @see com.iver.mdiApp.plugins.IExtension#isVisible()
150
     */
151
    public boolean isVisible() {
152
        IWindow f = PluginServices.getMDIManager().getActiveWindow();
153

  
154
        if (f == null) {
155
            return false;
156
        }
157

  
158
        if (f instanceof LayoutPanel) {
159
            return true;
160
        }
161
        return false;
162
    }
163

  
164
    /**
165
     * @see org.gvsig.andami.plugins.IExtension#initialize()
166
     */
167
    public void initialize() {
168
        registerPersistence();
169
        registerIcons();
170
    }
171

  
172
    private void registerPersistence() {
173
        PersistenceManager manager = ToolsLocator.getPersistenceManager();
174
        JavaTextFactory factory = new JavaTextFactory();
175
        manager.registerFactory(factory);
176
    }
177

  
178
    private void registerIcons() {
179

  
180
        IconThemeHelper.registerIcon("action",
181
                "application-layout-template-save", this);
182

  
183
        IconThemeHelper.registerIcon("action",
184
                "layout-navigation-zoom-in-center", this);
185
        IconThemeHelper.registerIcon("action",
186
                "layout-navigation-zoom-out-center", this);
187
        IconThemeHelper.registerIcon("action",
188
                "layout-navigation-zoom-in-topoint", this);
189
        IconThemeHelper.registerIcon("action",
190
                "layout-navigation-zoom-out-topoint", this);
191
        IconThemeHelper.registerIcon("action", "layout-navigation-zoom-all",
192
                this);
193
        IconThemeHelper.registerIcon("action", "layout-navigation-zoom-real",
194
                this);
195
        IconThemeHelper.registerIcon("action",
196
                "layout-navigation-zoom-selected", this);
197
        IconThemeHelper.registerIcon("action", "layout-navigation-pan", this);
198

  
199
        IconThemeHelper.registerIcon("action",
200
                "layout-view-navigation-zoom-in-topoint", this);
201
        IconThemeHelper.registerIcon("action",
202
                "layout-view-navigation-zoom-out-topoint", this);
203
        IconThemeHelper.registerIcon("action",
204
                "layout-view-navigation-zoom-all", this);
205
        IconThemeHelper.registerIcon("action", "layout-view-navigation-pan",
206
                this);
207
        // ================================================
208
        // Cursors
209
        IconThemeHelper.registerIcon("cursor",
210
                "cursor-layout-navigation-zoom-in-topoint", this);
211
        IconThemeHelper.registerIcon("cursor",
212
                "cursor-layout-navigation-zoom-out-topoint", this);
213
        IconThemeHelper.registerIcon("cursor", "cursor-selection-by-rectangle",
214
                this);
215
        IconThemeHelper.registerIcon("cursor", "cursor-selection-simple", this);
216
        IconThemeHelper
217
                .registerIcon("cursor", "cursor-selection-complex", this);
218
        IconThemeHelper.registerIcon("cursor",
219
                "cursor-layout-graphic-edit-vertex", this);
220
        IconThemeHelper.registerIcon("cursor", "cursor-layout-insert-circle",
221
                this);
222
        IconThemeHelper.registerIcon("cursor", "cursor-layout-insert-polyline",
223
                this);
224
        IconThemeHelper.registerIcon("cursor", "cursor-layout-insert-point",
225
                this);
226
        IconThemeHelper.registerIcon("cursor", "cursor-layout-insert-polygon",
227
                this);
228
        IconThemeHelper.registerIcon("cursor",
229
                "cursor-layout-insert-rectangle", this);
230
        IconThemeHelper.registerIcon("cursor",
231
                "cursor-layout-view-navigation-zoom-in-topoint", this);
232
        IconThemeHelper.registerIcon("cursor",
233
                "cursor-layout-view-navigation-zoom-out-topoint", this);
234
        // End cursors
235
        // ================================================
236

  
237
        IconThemeHelper.registerIcon("document", "document-map-icon", this);
238
        IconThemeHelper.registerIcon("document", "document-map-icon-sel", this);
239

  
240
        IconThemeHelper.registerIcon("layout", "neresize-icon", this);
241
        IconThemeHelper.registerIcon("layout", "eresize-icon", this);
242
        IconThemeHelper.registerIcon("layout", "nresize-icon", this);
243
        IconThemeHelper.registerIcon("layout", "graphic-move-icon", this);
244

  
245
        IconThemeHelper.registerIcon("layout", "sereresize-icon", this);
246
        IconThemeHelper.registerIcon("layout", "symboltag-icon", this);
247
        IconThemeHelper.registerIcon("layout", "numero-icon", this);
248
        IconThemeHelper.registerIcon("layout", "barra1-icon", this);
249
        IconThemeHelper.registerIcon("layout", "barra2-icon", this);
250
        IconThemeHelper.registerIcon("layout", "barra3-icon", this);
251

  
252
        IconThemeHelper.registerIcon("layout", "text-left-icon", this);
253
        IconThemeHelper.registerIcon("layout", "text-center-v-icon", this);
254
        IconThemeHelper.registerIcon("layout", "text-right-icon", this);
255
        IconThemeHelper.registerIcon("layout", "left-rotation-icon", this);
256
        IconThemeHelper.registerIcon("layout", "text-up-icon", this);
257
        IconThemeHelper.registerIcon("layout", "text-center-h-icon", this);
258
        IconThemeHelper.registerIcon("layout", "text-down-icon", this);
259
        IconThemeHelper.registerIcon("layout", "text-distup-icon", this);
260
        IconThemeHelper.registerIcon("layout", "text-distcenterh-icon", this);
261
        IconThemeHelper.registerIcon("layout", "text-distdown-icon", this);
262
        IconThemeHelper.registerIcon("layout", "text-distleft-icon", this);
263

  
264
        IconThemeHelper.registerIcon("layout", "text-distcenterv-icon", this);
265
        IconThemeHelper.registerIcon("layout", "text-distright-icon", this);
266
        IconThemeHelper.registerIcon("layout", "text-size-width-icon", this);
267
        IconThemeHelper.registerIcon("layout", "text-size-height-icon", this);
268
        IconThemeHelper.registerIcon("layout", "text-size-other-icon", this);
269
        IconThemeHelper.registerIcon("layout", "text-space-right-icon", this);
270
        IconThemeHelper.registerIcon("layout", "text-space-down-icon", this);
271
        IconThemeHelper.registerIcon("layout", "text-inlayout-icon", this);
272
        IconThemeHelper.registerIcon("layout", "layout-pan-icon", this);
273
        IconThemeHelper.registerIcon("layout", "view-pan-icon", this);
274
        IconThemeHelper.registerIcon("layout", "right-rotation-icon", this);
275
    }
276

  
277
    /**
278
     * @see org.gvsig.andami.plugins.IExtension#isEnabled()
279
     */
280
    public boolean isEnabled() {
281
        return true;
282
    }
283

  
284
    /**
285
     * Devuelve el Layout sobre el que se opera.
286
     * 
287
     * @return Layout.
288
     */
289
    public LayoutPanel getLayout() {
290
        return layout;
291
    }
292

  
293
    public IPreference[] getPreferencesPages() {
294
        return new IPreference[] { new LayoutPage() };
295
    }
296
}
tags/org.gvsig.app.document.layout2.app-2.0.76/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/ExportLayoutExtension.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.app.extension;
23

  
24
import org.gvsig.andami.IconThemeHelper;
25
import org.gvsig.andami.PluginServices;
26
import org.gvsig.andami.plugins.Extension;
27
import org.gvsig.andami.ui.mdiManager.IWindow;
28
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
29

  
30
/**
31
 * Extension for exporting the layout to PDF or PostScript.
32
 * 
33
 * @author jaume dominguez faus - jaume.dominguez@iver.es
34
 */
35
public class ExportLayoutExtension extends Extension {
36
    private LayoutPanel layoutPanel;
37

  
38
    public void initialize() {
39
        registerIcons();
40
    }
41

  
42
    private void registerIcons() {
43
        
44
        IconThemeHelper.registerIcon("action", "application-export-to-postscript", this);
45
        IconThemeHelper.registerIcon("action", "application-export-to-pdf", this);
46
    }
47

  
48
    /**
49
     * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
50
     */
51
    public void execute(String s) {
52
        layoutPanel = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
53
        if (s.equals("application-export-to-pdf")) {
54
            layoutPanel.layoutToPDF();
55
        } else
56
            if (s.equals("application-export-to-postscript")) {
57
                layoutPanel.layoutToPS();
58
            }
59
    }
60

  
61
    public boolean isEnabled() {
62
        return true;
63
    }
64

  
65
    public boolean isVisible() {
66
        IWindow f = PluginServices.getMDIManager().getActiveWindow();
67

  
68
        if (f == null) {
69
            return false;
70
        }
71

  
72
        if (f instanceof LayoutPanel) {
73
            // Layout layout = (Layout) f;
74

  
75
            return true; // layout.m_Display.getMapControl().getMapContext().getLayers().layerCount()
76
                         // > 0;
77
        } else {
78
            return false;
79
        }
80
    }
81

  
82
}
tags/org.gvsig.app.document.layout2.app-2.0.76/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/FFrameLegendExtension.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.app.extension;
23

  
24
import org.gvsig.andami.PluginServices;
25
import org.gvsig.andami.plugins.Extension;
26
import org.gvsig.andami.ui.mdiManager.IWindow;
27
import org.gvsig.app.project.documents.layout.FLayoutGraphics;
28
import org.gvsig.app.project.documents.layout.fframes.FFrameLegend;
29
import org.gvsig.app.project.documents.layout.fframes.IFFrame;
30
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
31

  
32
/**
33
 * Extensi?n preparada para controlar las opciones que se pueden realizar sobre
34
 * una vista a?adida en el Layout.
35
 * 
36
 * @author Vicente Caballero Navarro
37
 */
38
public class FFrameLegendExtension extends Extension {
39

  
40
    private LayoutPanel layout = null;
41

  
42
    /**
43
     * @see org.gvsig.andami.plugins.IExtension#initialize()
44
     */
45
    public void initialize() {
46
    }
47

  
48
    /**
49
     * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
50
     */
51
    public void execute(String s) {
52
        layout = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
53
        FLayoutGraphics lg = new FLayoutGraphics(layout);
54
        if (s.compareTo("layout-graphic-simplify-legend") == 0) {
55
            lg.simplify();
56
            layout.getDocument().setModified(true);
57
        }
58
    }
59

  
60
    /**
61
     * @see org.gvsig.andami.plugins.IExtension#isEnabled()
62
     */
63
    public boolean isEnabled() {
64
        LayoutPanel l =
65
            (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
66
        IFFrame[] fframes = l.getLayoutContext().getSelectedFFrames();
67
        if (!l.getLayoutContext().isEditable())
68
            return false;
69
        for (int i = 0; i < fframes.length; i++) {
70
            if (fframes[i] instanceof FFrameLegend) {
71
                return true;
72
            }
73
        }
74

  
75
        return false;
76
    }
77

  
78
    /**
79
     * @see org.gvsig.andami.plugins.IExtension#isVisible()
80
     */
81
    public boolean isVisible() {
82
        IWindow f = PluginServices.getMDIManager().getActiveWindow();
83

  
84
        if (f == null) {
85
            return false;
86
        }
87

  
88
        if (f instanceof LayoutPanel) {
89
            return true; // layout.m_Display.getMapControl().getMapContext().getLayers().layerCount()
90
                         // > 0;
91
        } else {
92
            return false;
93
        }
94
    }
95
}
tags/org.gvsig.app.document.layout2.app-2.0.76/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/LayoutEditVertexExtension.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.app.extension;
23

  
24
import org.slf4j.Logger;
25
import org.slf4j.LoggerFactory;
26

  
27
import org.gvsig.andami.IconThemeHelper;
28
import org.gvsig.andami.PluginServices;
29
import org.gvsig.andami.plugins.Extension;
30
import org.gvsig.andami.ui.mdiManager.IWindow;
31
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
32

  
33
/**
34
 * Extensi?n que contiene todas las herramientas de edici?n.
35
 * 
36
 * @author Vicente Caballero Navarro
37
 */
38
public class LayoutEditVertexExtension extends Extension {
39

  
40
    private static final Logger logger = LoggerFactory
41
        .getLogger(LayoutEditVertexExtension.class);;
42
    private LayoutPanel layout = null;
43

  
44
    /**
45
     * DOCUMENT ME!
46
     */
47
    public void initialize() {
48
        // TODO Auto-generated method stub
49
        registerIcons();
50
    }
51

  
52
    private void registerIcons() {
53
        
54
        IconThemeHelper.registerIcon(
55
            "action", "layout-graphic-edit-vertex", this);
56
    }
57

  
58
    /**
59
     * DOCUMENT ME!
60
     * 
61
     * @param s
62
     *            DOCUMENT ME!
63
     */
64
    public void execute(String s) {
65
        layout = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
66

  
67
        logger.debug("Comand : " + s);
68
        if (s.compareTo("layout-graphic-edit-vertex") == 0) {
69
            layout.getLayoutControl().setTool("layoutedit");
70
            layout.getDocument().setModified(true);
71
        }
72
    }
73

  
74
    /**
75
     * DOCUMENT ME!
76
     * 
77
     * @return DOCUMENT ME!
78
     */
79
    public boolean isEnabled() {
80
        IWindow f = PluginServices.getMDIManager().getActiveWindow();
81

  
82
        if (f == null) {
83
            return false;
84
        }
85

  
86
        if (f instanceof LayoutPanel) {
87
            LayoutPanel layout = (LayoutPanel) f;
88
            if (layout.getLayoutContext().isEditable()) {
89
                return true;
90
                // IFFrame[] fframes = layout.getFFrames();
91
                // for (int i = 0; i < fframes.length; i++) {
92
                // if (fframes[i].getSelected() != IFFrame.NOSELECT
93
                // && fframes[i] instanceof IFFrameEditableVertex) {
94
                // return true;
95
                // }
96
                // }
97
            }
98
        }
99
        return false;
100
    }
101

  
102
    /**
103
     * DOCUMENT ME!
104
     * 
105
     * @return DOCUMENT ME!
106
     */
107
    public boolean isVisible() {
108
        IWindow f = PluginServices.getMDIManager().getActiveWindow();
109

  
110
        if (f == null) {
111
            return false;
112
        }
113

  
114
        if (f instanceof LayoutPanel) {
115
            // Layout layout = (Layout) f;
116
            return true; // layout.m_Display.getMapControl().getMapContext().getLayers().layerCount()
117
                         // > 0;
118
        } else {
119
            return false;
120
        }
121
    }
122
}
tags/org.gvsig.app.document.layout2.app-2.0.76/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/LayoutMainExtension.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.app.extension;
23

  
24
import java.awt.Component;
25
import java.io.File;
26
import java.io.FileInputStream;
27
import java.io.FileNotFoundException;
28
import java.io.IOException;
29
import java.text.MessageFormat;
30
import java.util.prefs.Preferences;
31

  
32
import javax.swing.JOptionPane;
33

  
34
import org.gvsig.andami.IconThemeHelper;
35
import org.gvsig.andami.PluginServices;
36
import org.gvsig.andami.messages.NotificationManager;
37
import org.gvsig.andami.plugins.Extension;
38
import org.gvsig.app.ApplicationLocator;
39
import org.gvsig.app.project.Project;
40
import org.gvsig.app.project.ProjectManager;
41
import org.gvsig.app.project.documents.layout.DefaultLayoutManager;
42
import org.gvsig.app.project.documents.layout.LayoutDocument;
43
import org.gvsig.app.project.documents.layout.LayoutManager;
44
import org.gvsig.app.project.documents.layout.contextmenu.gui.BeforeLayoutMenuEntry;
45
import org.gvsig.app.project.documents.layout.contextmenu.gui.BehindLayoutMenuEntry;
46
import org.gvsig.app.project.documents.layout.contextmenu.gui.CancelLayoutMenuEntry;
47
import org.gvsig.app.project.documents.layout.contextmenu.gui.CopyLayoutMenuEntry;
48
import org.gvsig.app.project.documents.layout.contextmenu.gui.CutLayoutMenuEntry;
49
import org.gvsig.app.project.documents.layout.contextmenu.gui.PasteLayoutMenuEntry;
50
import org.gvsig.app.project.documents.layout.contextmenu.gui.PositionLayoutMenuEntry;
51
import org.gvsig.app.project.documents.layout.contextmenu.gui.PropertyLayoutMenuEntry;
52
import org.gvsig.app.project.documents.layout.contextmenu.gui.RefreshLayoutMenuEntry;
53
import org.gvsig.app.project.documents.layout.contextmenu.gui.SelectAllLayoutMenuEntry;
54
import org.gvsig.app.project.documents.layout.contextmenu.gui.SimplifyLayoutMenuEntry;
55
import org.gvsig.app.project.documents.layout.contextmenu.gui.TerminateLayoutMenuEntry;
56
import org.gvsig.app.project.documents.layout.fframes.FFrame;
57
import org.gvsig.app.project.documents.layout.fframes.FFrameBasicFactory;
58
import org.gvsig.app.project.documents.layout.fframes.FFrameGraphics;
59
import org.gvsig.app.project.documents.layout.fframes.FFrameGraphicsFactory;
60
import org.gvsig.app.project.documents.layout.fframes.FFrameGrid;
61
import org.gvsig.app.project.documents.layout.fframes.FFrameGridFactory;
62
import org.gvsig.app.project.documents.layout.fframes.FFrameGroup;
63
import org.gvsig.app.project.documents.layout.fframes.FFrameGroupFactory;
64
import org.gvsig.app.project.documents.layout.fframes.FFrameLegend;
65
import org.gvsig.app.project.documents.layout.fframes.FFrameLegendFactory;
66
import org.gvsig.app.project.documents.layout.fframes.FFrameNorth;
67
import org.gvsig.app.project.documents.layout.fframes.FFrameNorthFactory;
68
import org.gvsig.app.project.documents.layout.fframes.FFrameOverView;
69
import org.gvsig.app.project.documents.layout.fframes.FFrameOverViewFactory;
70
import org.gvsig.app.project.documents.layout.fframes.FFramePicture;
71
import org.gvsig.app.project.documents.layout.fframes.FFramePictureFactory;
72
import org.gvsig.app.project.documents.layout.fframes.FFrameScaleBar;
73
import org.gvsig.app.project.documents.layout.fframes.FFrameScaleBarFactory;
74
import org.gvsig.app.project.documents.layout.fframes.FFrameSymbol;
75
import org.gvsig.app.project.documents.layout.fframes.FFrameSymbolFactory;
76
import org.gvsig.app.project.documents.layout.fframes.FFrameTable;
77
import org.gvsig.app.project.documents.layout.fframes.FFrameTableFactory;
78
import org.gvsig.app.project.documents.layout.fframes.FFrameText;
79
import org.gvsig.app.project.documents.layout.fframes.FFrameTextFactory;
80
import org.gvsig.app.project.documents.layout.fframes.FFrameView;
81
import org.gvsig.app.project.documents.layout.fframes.FFrameViewFactory;
82
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameBoxDialog;
83
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameGraphicsDialog;
84
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameGridDialog;
85
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameGroupDialog;
86
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameLegendDialog;
87
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameNorthDialog;
88
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameOverViewDialog;
89
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFramePictureDialog;
90
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameScaleBarDialog;
91
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameTextDialog;
92
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameViewDialog;
93
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
94
import org.gvsig.gui.beans.swing.JFileChooser;
95
import org.gvsig.i18n.Messages;
96
import org.gvsig.tools.ToolsLocator;
97
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
98
import org.gvsig.tools.persistence.PersistenceManager;
99
import org.gvsig.tools.persistence.PersistentState;
100
import org.gvsig.tools.persistence.exception.PersistenceException;
101
import org.gvsig.utils.GenericFileFilter;
102
import org.slf4j.Logger;
103
import org.slf4j.LoggerFactory;
104

  
105
/**
106
 * Extension que proporciona controles para crear proyectos nuevos, abrirlos y
107
 * guardarlos. Adem?s los tipos de tabla que soporta el proyecto son a?adidos en
108
 * esta clase.
109
 * 
110
 * @author Fernando Gonz?lez Cort?s
111
 */
112
public class LayoutMainExtension extends Extension {
113

  
114
    private static final Logger logger = LoggerFactory
115
            .getLogger(FFrameView.class);
116

  
117
    private String templatesPath;
118

  
119
    public static final String LAYOUT_TEMPLATE_FILECHOOSER_ID = "LAYOUT_TEMPLATE_FILECHOOSER_ID";
120

  
121
    private void registerIcons() {
122

  
123
        IconThemeHelper.registerIcon("action",
124
                "application-layout-template-open", this);
125
    }
126

  
127
    public void initialize() {
128
        registerIcons();
129
    }
130

  
131
    public void postInitialize() {
132
        super.postInitialize();
133
        initializeDocumentActionsExtensionPoint();
134
        registerDocuments();
135
        registerFFrames();
136
        registerContextMenuOptions();
137
    }
138

  
139
    /**
140
     * @see com.iver.mdiApp.plugins.IExtension#updateUI(java.lang.String)
141
     */
142
    public void execute(String actionCommand) {
143
        if ("application-layout-template-open".equals(actionCommand)) {
144
            openLayout();
145
        }
146
    }
147

  
148
    private void openLayout() {
149
        LayoutPanel layout = null;
150

  
151
        if (templatesPath == null) {
152
            Preferences prefs = Preferences.userRoot().node("gvsig.foldering");
153
            templatesPath = prefs.get("TemplatesFolder", null);
154
        }
155

  
156
        JFileChooser jfc = new JFileChooser(LAYOUT_TEMPLATE_FILECHOOSER_ID,
157
                templatesPath);
158
        GenericFileFilter layoutMainExtensionFilter = new GenericFileFilter(
159
                LayoutManager.TEMPLATE_FILE_POINTEXT,
160
                Messages.getText("_Layout_template") + " (*"
161
                        + LayoutManager.TEMPLATE_FILE_POINTEXT + ")");
162
        jfc.addChoosableFileFilter(layoutMainExtensionFilter);
163
        jfc.setFileFilter(layoutMainExtensionFilter);
164

  
165
        if (jfc.showOpenDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION) {
166
            File file = jfc.getSelectedFile();
167
            try {
168
                if (!file.exists()) {
169
                    /*
170
                     * The user has written a file name instead of clicking on
171
                     * one and it does not exist
172
                     */
173
                    File auxfile = new File(file.getPath()
174
                            + LayoutManager.TEMPLATE_FILE_POINTEXT);
175
                    if (!auxfile.exists()) {
176
                        /*
177
                         * Not even this one exists: error
178
                         */
179
                        throw new IOException("File does not exist: "
180
                                + file.getName());
181
                    }
182
                    else {
183
                        file = auxfile;
184
                    }
185
                }
186

  
187
                File xmlFile = new File(file.getAbsolutePath());
188
                FileInputStream is = new FileInputStream(xmlFile);
189

  
190
                PersistenceManager persistenceManager = ToolsLocator
191
                        .getPersistenceManager();
192
                PersistentState persistentState = persistenceManager
193
                        .loadState(is);
194
                layout = (LayoutPanel) persistenceManager
195
                        .create(persistentState);
196

  
197
            }
198
            catch (Exception e) {
199
                String tit = Messages.getText("_Layout_template");
200
                String msg = null;
201

  
202
                if (e instanceof PersistenceException) {
203
                    msg = Messages.getText("_Bad_format_in_layout_template");
204
                }
205
                else {
206
                    msg = Messages.getText("_Cant_load_layout_template");
207
                }
208

  
209
                msg = msg + ": " + file.getPath();
210
                msg = msg + "\n" + e.getMessage();
211
                logger.warn(msg, e);
212
                JOptionPane.showMessageDialog(ApplicationLocator.getManager()
213
                        .getRootComponent(), msg, tit,
214
                        JOptionPane.ERROR_MESSAGE);
215
            }
216

  
217
            if (layout == null) {
218
                return;
219
            }
220

  
221
            LayoutDocument layoutDocument = (LayoutDocument) layout
222
                    .getDocument();
223
            /*
224
             * (LayoutDocument) ProjectManager.getInstance().createDocument(
225
             * DefaultLayoutManager.TYPENAME, file.getName());
226
             */
227

  
228
            Project p = ApplicationLocator.getManager().getProjectManager()
229
                    .getCurrentProject();
230
            p.addDocument(layoutDocument);
231

  
232
            layout.getLayoutControl().setTool("layoutselect");
233

  
234
            LayoutManager lm = (LayoutManager) layoutDocument.getFactory();
235
            layout.setLayoutManager(lm);
236

  
237
            PluginServices.getMDIManager().addWindow(layout);
238

  
239
        }
240
    }
241

  
242
    private void registerDocuments() {
243
        DefaultLayoutManager.register();
244
    }
245

  
246
    private void registerFFrames() {
247
        DefaultLayoutManager layoutManager = (DefaultLayoutManager) ProjectManager
248
                .getInstance()
249
                .getDocumentManager(DefaultLayoutManager.TYPENAME);
250

  
251
        // Register Frames
252
        layoutManager.registerFrameFactory(new FFrameBasicFactory());
253
        layoutManager.registerFrameFactory(new FFrameGraphicsFactory());
254
        layoutManager.registerFrameFactory(new FFrameGroupFactory());
255
        layoutManager.registerFrameFactory(new FFrameLegendFactory());
256
        layoutManager.registerFrameFactory(new FFrameNorthFactory());
257
        layoutManager.registerFrameFactory(new FFrameOverViewFactory());
258
        layoutManager.registerFrameFactory(new FFramePictureFactory());
259
        layoutManager.registerFrameFactory(new FFrameScaleBarFactory());
260
        layoutManager.registerFrameFactory(new FFrameSymbolFactory());
261
        layoutManager.registerFrameFactory(new FFrameTableFactory());
262
        layoutManager.registerFrameFactory(new FFrameTextFactory());
263
        layoutManager.registerFrameFactory(new FFrameViewFactory());
264
        layoutManager.registerFrameFactory(new FFrameGridFactory());
265

  
266
        // Register FFrameDialogs forms
267
        layoutManager.registerFFrameDialog(
268
                FFrameGraphics.PERSISTENCE_DEFINITION_NAME,
269
                FFrameGraphicsDialog.class);
270
        layoutManager.registerFFrameDialog(
271
                FFrameSymbol.PERSISTENCE_DEFINITION_NAME,
272
                FFrameGraphicsDialog.class);
273
        layoutManager.registerFFrameDialog(
274
                FFrameGroup.PERSISTENCE_DEFINITION_NAME,
275
                FFrameGroupDialog.class);
276
        layoutManager.registerFFrameDialog(
277
                FFrameTable.PERSISTENCE_DEFINITION_NAME, FFrameBoxDialog.class);
278
        layoutManager.registerFFrameDialog(
279
                FFrameLegend.PERSISTENCE_DEFINITION_NAME,
280
                FFrameLegendDialog.class);
281
        layoutManager.registerFFrameDialog(
282
                FFramePicture.PERSISTENCE_DEFINITION_NAME,
283
                FFramePictureDialog.class);
284
        layoutManager.registerFFrameDialog(
285
                FFrameNorth.PERSISTENCE_DEFINITION_NAME,
286
                FFrameNorthDialog.class);
287
        layoutManager.registerFFrameDialog(
288
                FFrameScaleBar.PERSISTENCE_DEFINITION_NAME,
289
                FFrameScaleBarDialog.class);
290
        layoutManager.registerFFrameDialog(
291
                FFrameText.PERSISTENCE_DEFINITION_NAME, FFrameTextDialog.class);
292
        layoutManager.registerFFrameDialog(
293
                FFrameView.PERSISTENCE_DEFINITION_NAME, FFrameViewDialog.class);
294
        layoutManager.registerFFrameDialog(
295
                FFrameOverView.PERSISTENCE_DEFINITION_NAME,
296
                FFrameOverViewDialog.class);
297
        layoutManager.registerFFrameDialog(
298
                FFrameGrid.PERSISTENCE_DEFINITION_NAME, FFrameGridDialog.class);
299

  
300
        FFrame.initializeIcons();
301
        FFrameTable.initializeIcons();
302
    }
303

  
304
    private void registerContextMenuOptions() {
305
        LayoutManager layoutManager = (LayoutManager) ProjectManager
306
                .getInstance().getDocumentManager("project.document.layout");
307

  
308
        layoutManager.registerLayoutMenuAction("Terminate",
309
                TerminateLayoutMenuEntry.class);
310
        layoutManager.registerLayoutMenuAction("Cancel",
311
                CancelLayoutMenuEntry.class);
312
        layoutManager.registerLayoutMenuAction("Copy",
313
                CopyLayoutMenuEntry.class);
314
        layoutManager.registerLayoutMenuAction("Cut", CutLayoutMenuEntry.class);
315
        layoutManager.registerLayoutMenuAction("Paste",
316
                PasteLayoutMenuEntry.class);
317
        layoutManager.registerLayoutMenuAction("Simplify",
318
                SimplifyLayoutMenuEntry.class);
319
        layoutManager.registerLayoutMenuAction("Property",
320
                PropertyLayoutMenuEntry.class);
321
        layoutManager.registerLayoutMenuAction("SelectAll",
322
                SelectAllLayoutMenuEntry.class);
323
        layoutManager.registerLayoutMenuAction("Behind",
324
                BehindLayoutMenuEntry.class);
325
        layoutManager.registerLayoutMenuAction("Before",
326
                BeforeLayoutMenuEntry.class);
327
        layoutManager.registerLayoutMenuAction("Position",
328
                PositionLayoutMenuEntry.class);
329
        layoutManager.registerLayoutMenuAction("Refresh",
330
                RefreshLayoutMenuEntry.class);
331

  
332
    }
333

  
334
    private void initializeDocumentActionsExtensionPoint() {
335
        ExtensionPointManager epMan = ToolsLocator.getExtensionPointManager();
336
        epMan.add(
337
                "DocumentActions_Map",
338
                "Context menu options of the map document list"
339
                        + " in the project window "
340
                        + "(register instances of "
341
                        + "org.gvsig.app.project.AbstractDocumentContextMenuAction)");
342
    }
343

  
344
    public boolean isEnabled() {
345
        return true;
346
    }
347

  
348
    public boolean isVisible() {
349
        return true;
350
    }
351
}
tags/org.gvsig.app.document.layout2.app-2.0.76/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/LayoutInsertToolsExtension.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.app.extension;
23

  
24
import org.slf4j.Logger;
25
import org.slf4j.LoggerFactory;
26

  
27
import org.gvsig.andami.IconThemeHelper;
28
import org.gvsig.andami.PluginServices;
29
import org.gvsig.andami.plugins.Extension;
30
import org.gvsig.andami.ui.mdiManager.IWindow;
31
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
32

  
33
/**
34
 * Extensi?n para editar los v?rtices de las geometr?as a?adidas en un
35
 * FFrameGraphics.
36
 * 
37
 * @author Vicente Caballero Navarro
38
 */
39
public class LayoutInsertToolsExtension extends Extension {
40

  
41
    private static final Logger logger = LoggerFactory
42
        .getLogger(LayoutInsertToolsExtension.class);
43

  
44
    private LayoutPanel layout = null;
45

  
46
    public void initialize() {
47
        // TODO Auto-generated method stub
48
        registerIcons();
49
    }
50

  
51
    private void registerIcons() {
52
        
53
        IconThemeHelper.registerIcon("action", "layout-insert-text", this);
54
        IconThemeHelper.registerIcon("action", "layout-insert-point", this);
55
        IconThemeHelper.registerIcon("action", "layout-insert-rectangle", this);
56
        IconThemeHelper.registerIcon("action", "layout-insert-circle", this);
57

  
58
        IconThemeHelper.registerIcon("action", "layout-insert-line", this);
59
        IconThemeHelper.registerIcon("action", "layout-insert-polyline", this);
60
        IconThemeHelper.registerIcon("action", "layout-insert-polygon", this);
61
        IconThemeHelper.registerIcon("action", "layout-insert-image", this);
62

  
63
        IconThemeHelper.registerIcon("action", "layout-insert-view", this);
64
        IconThemeHelper.registerIcon("action", "layout-insert-locator", this);
65
        IconThemeHelper.registerIcon("action", "layout-insert-legend", this);
66
        IconThemeHelper.registerIcon("action", "layout-insert-scalebar", this);
67

  
68
        IconThemeHelper.registerIcon("action", "layout-insert-north", this);
69
        IconThemeHelper.registerIcon("action", "layout-insert-box", this);
70

  
71
        // ============================================================
72
        
73
        IconThemeHelper.registerIcon("action", "edit-delete", this);
74
        IconThemeHelper.registerIcon("action", "selection-by-rectangle", this);
75
    }
76

  
77
    public void execute(String s) {
78
        layout = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
79

  
80
        logger.debug("Comand : " + s);
81
        boolean insertGroupPosibility = false;
82
        
83
        if (s.equals("selection-select-by-rectangle-layout")) {
84
            layout.getLayoutControl().setTool("layoutselect");
85
        } else
86
            if (s.equals("layout-insert-view")) {
87
                layout.getLayoutControl().setTool("layoutaddview");
88
                insertGroupPosibility = true;
89
            } else
90
                if (s.equals("layout-insert-locator")) {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff