Revision 350

View differences:

tags/org.gvsig.app.document.layout.app-2.0.24/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
    <modelVersion>4.0.0</modelVersion>
3
    <artifactId>org.gvsig.app.document.layout.app</artifactId>
4
    <packaging>pom</packaging>
5
    <version>2.0.24</version>
6
    <name>Document: Layout document support</name>
7
    <description>This plugin adds creation/management of layout (map) documents.</description>
8
    <parent>
9
        <groupId>org.gvsig</groupId>
10
        <artifactId>org.gvsig.desktop</artifactId>
11
        <version>2.0.90</version>
12
    </parent>
13
    <url>https://devel.gvsig.org/redmine/projects/gvsig-app-document-layout</url>
14
    <scm>
15
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-app-document-layout/tags/org.gvsig.app.document.layout.app-2.0.24</connection>
16
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-app-document-layout/tags/org.gvsig.app.document.layout.app-2.0.24</developerConnection>
17
        <url>https://devel.gvsig.org/redmine/projects/gvsig-app-document-layout/repository/show/tags/org.gvsig.app.document.layout.app-2.0.24</url>
18
    </scm>
19
    <repositories>
20
      <repository>
21
        <id>gvsig-public-http-repository</id>
22
        <name>gvSIG maven public HTTP repository</name>
23
        <url>http://devel.gvsig.org/m2repo/j2se</url>
24
        <releases>
25
          <enabled>true</enabled>
26
          <updatePolicy>daily</updatePolicy>
27
          <checksumPolicy>warn</checksumPolicy>
28
        </releases>
29
        <snapshots>
30
          <enabled>true</enabled>
31
          <updatePolicy>daily</updatePolicy>
32
          <checksumPolicy>warn</checksumPolicy>
33
        </snapshots>
34
      </repository>
35
    </repositories>
36
        
37
	<build>
38
		<plugins>
39
			<plugin>
40
				<groupId>org.apache.maven.plugins</groupId>
41
				<artifactId>maven-release-plugin</artifactId>
42
				<configuration>
43
					<tagBase>https://devel.gvsig.org/svn/gvsig-app-document-layout/tags</tagBase>
44
				</configuration>
45
			</plugin>
46
		</plugins>
47
	</build>
48

  
49
	<modules>
50
		<module>org.gvsig.app.document.layout.app.mainplugin</module>
51
	</modules>
52

  
53
</project>
tags/org.gvsig.app.document.layout.app-2.0.24/org.gvsig.app.document.layout.app.mainplugin/buildNumber.properties
1
#Thu Apr 02 09:40:36 CEST 2015
2
buildNumber=38
0 3

  
tags/org.gvsig.app.document.layout.app-2.0.24/org.gvsig.app.document.layout.app.mainplugin/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.
tags/org.gvsig.app.document.layout.app-2.0.24/org.gvsig.app.document.layout.app.mainplugin/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.app.document.layout">
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/org.gvsig.app.document.layout.app-2.0.24/org.gvsig.app.document.layout.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.layout.app-2.0.24/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/extension/LayoutCommandStackExtension.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.app.gui.command.CommandStackDialog;
28
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
29

  
30
public class LayoutCommandStackExtension extends Extension {
31

  
32
    private LayoutPanel layout = null;
33

  
34
    public void initialize() {
35
        registerIcons();
36
    }
37

  
38
    private void registerIcons() {
39
        IconThemeHelper.registerIcon("action", "edit-undo-redo-actions", this);
40
    }
41

  
42
    public void execute(String s) {
43
        layout = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
44
        if (s.equals("edit-undo-redo-actions-layout")) {
45
            CommandStackDialog csd = new CommandStackDialog();
46
            csd.setModel(layout.getLayoutContext().getFrameCommandsRecord());
47
            layout.getLayoutContext().getFrameCommandsRecord()
48
                .addObserver(layout);
49
            PluginServices.getMDIManager().addWindow(csd);
50
            layout.getDocument().setModified(true);
51
        }
52
    }
53

  
54
    public boolean isEnabled() {
55
        layout = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
56
        if (layout.getLayoutContext().isEditable())
57
            return true;
58
        return false;
59
    }
60

  
61
    public boolean isVisible() {
62
        if (PluginServices.getMDIManager().getActiveWindow() instanceof LayoutPanel) {
63
            return true;
64
        }
65
        return false;
66
    }
67

  
68
}
tags/org.gvsig.app.document.layout.app-2.0.24/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/extension/LayoutGraphicControls.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.FLayoutGraphics;
32
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
33

  
34
/**
35
 * Extensi?n que actua sobre el Layout para controlas las diferentes
36
 * operaciones sobre los gr?ficos.
37
 * 
38
 * @author Vicente Caballero Navarro
39
 */
40
public class LayoutGraphicControls extends Extension {
41

  
42
    private static final Logger logger = LoggerFactory
43
        .getLogger(LayoutGraphicControls.class);
44
    private LayoutPanel layout = null;
45

  
46
    /**
47
     * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
48
     */
49
    public void execute(String s) {
50
        layout = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
51
        FLayoutGraphics lg = new FLayoutGraphics(layout);
52
        logger.debug("Comand : " + s);
53

  
54
        if (s.compareTo("layout-graphic-group") == 0) {
55
            layout.getLayoutContext().getFrameCommandsRecord()
56
                .startComplex(PluginServices.getText(this, "group"));
57
            lg.grouping();
58
            layout.getLayoutContext().getFrameCommandsRecord().endComplex();
59
            layout.getDocument().setModified(true);
60
        } else
61
            if (s.compareTo("layout-graphic-ungroup") == 0) {
62
                lg.ungrouping();
63
                layout.getDocument().setModified(true);
64
            } else
65
                if (s.compareTo("layout-graphic-properties") == 0) {
66
                    if (lg.openFFrameDialog()) {
67
                        layout.getDocument().setModified(true);
68
                    }
69
                } else
70
                    if (s.compareTo("layout-graphic-align") == 0) {
71
                        lg.aligning();
72
                        layout.getDocument().setModified(true);
73
                    } else
74
                        if (s.compareTo("layout-graphic-send-back") == 0) {
75
                            lg.behind();
76
                            layout.getDocument().setModified(true);
77
                        } else
78
                            if (s.compareTo("layout-graphic-bring-to-front") == 0) {
79
                                lg.before();
80
                                layout.getDocument().setModified(true);
81
                            } else
82
                                if (s.compareTo("layout-graphic-add-border") == 0) {
83
                                    if (lg.border()) {
84
                                        layout.getDocument().setModified(true);
85
                                    }
86
                                } else
87
                                    if (s.compareTo("layout-graphic-position") == 0) {
88
                                        lg.position();
89
                                        layout.getDocument().setModified(true);
90
                                    }
91
    }
92

  
93
    /**
94
     * @see com.iver.mdiApp.plugins.IExtension#isVisible()
95
     */
96
    public boolean isVisible() {
97
        IWindow f = PluginServices.getMDIManager().getActiveWindow();
98

  
99
        if (f == null) {
100
            return false;
101
        }
102

  
103
        if (f instanceof LayoutPanel) {
104
            return true; // layout.m_Display.getMapControl().getMapContext().getLayers().layerCount()
105
                         // > 0;
106
        }
107
        return false;
108
    }
109

  
110
    /**
111
     * @see org.gvsig.andami.plugins.IExtension#initialize()
112
     */
113
    public void initialize() {
114
        registerIcons();
115
    }
116

  
117
    private void registerIcons() {
118
        
119
        IconThemeHelper.registerIcon("action", "layout-graphic-group", this);
120
        IconThemeHelper.registerIcon("action", "layout-graphic-ungroup", this);
121
        IconThemeHelper.registerIcon("action", "layout-graphic-bring-to-front", this);
122
        IconThemeHelper.registerIcon("action", "layout-graphic-send-back", this);
123
        IconThemeHelper.registerIcon("action", "layout-graphic-position", this);
124
        IconThemeHelper.registerIcon("action", "layout-graphic-add-border", this);
125
    }
126

  
127
    /**
128
     * @see org.gvsig.andami.plugins.IExtension#isEnabled()
129
     */
130
    public boolean isEnabled() {
131
        layout = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
132
        if (!layout.getLayoutContext().isEditable())
133
            return false;
134
        return true;
135
    }
136
}
tags/org.gvsig.app.document.layout.app-2.0.24/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/extension/LayoutUndoExtension.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.messages.NotificationManager;
27
import org.gvsig.andami.plugins.Extension;
28
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
29
import org.gvsig.tools.undo.UndoException;
30

  
31
public class LayoutUndoExtension extends Extension {
32

  
33
    public void initialize() {
34
        registerIcons();
35
    }
36

  
37
    private void registerIcons() {
38
        
39
        IconThemeHelper.registerIcon("action", "edit-undo", this);
40
    }
41

  
42
    public void execute(String actionCommand) {
43
        LayoutPanel layout =
44
            (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
45
        if (actionCommand.equals("edit-undo-layout")) {
46
            try {
47
                layout.getLayoutContext().getFrameCommandsRecord().undo();
48
            } catch (UndoException e) {
49
                NotificationManager.showMessageError("Undo layout", e);
50
            }
51
            layout.getLayoutContext().updateFFrames();
52
            layout.getLayoutControl().refresh();
53
            layout.getDocument().setModified(true);
54
        }
55
    }
56

  
57
    public boolean isEnabled() {
58
        if (PluginServices.getMDIManager().getActiveWindow() instanceof LayoutPanel) {
59
            LayoutPanel layout =
60
                (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
61
            if (layout.getLayoutContext().getFrameCommandsRecord().canUndo()
62
                && layout.getLayoutContext().isEditable())
63
                return true;
64
        }
65
        return false;
66
    }
67

  
68
    public boolean isVisible() {
69
        if (PluginServices.getMDIManager().getActiveWindow() instanceof LayoutPanel) {
70
            return true;
71
        }
72
        return false;
73
    }
74

  
75
}
tags/org.gvsig.app.document.layout.app-2.0.24/org.gvsig.app.document.layout.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().getFFrameSelected();
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().getFFrameSelected();
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.layout.app-2.0.24/org.gvsig.app.document.layout.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

  
103
    // public IPreference getPreferencesPage() {
104
    // return printPropertiesPage;
105
    // }
106
}
tags/org.gvsig.app.document.layout.app-2.0.24/org.gvsig.app.document.layout.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.tools.ToolsLocator;
46
import org.gvsig.tools.persistence.PersistenceManager;
47
import org.gvsig.tools.persistence.PersistentState;
48
import org.gvsig.utils.GenericFileFilter;
49

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

  
57
    private static final Logger logger = LoggerFactory
58
        .getLogger(LayoutExtension.class);
59

  
60
    private LayoutPanel layout = null;
61

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

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

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

  
100
    private void saveLayout() {
101
        layout = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
102
        JFileChooser jfc = new JFileChooser();
103
        jfc.addChoosableFileFilter(new GenericFileFilter(
104
            LayoutManager.TEMPLATE_FILE_POINTEXT,
105
            PluginServices.getText(this, "plantilla")));
106

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

  
128
            try {
129
                FileOutputStream fos =
130
                    new FileOutputStream(file.getAbsolutePath());
131
                // OutputStreamWriter writer = new OutputStreamWriter(fos,
132
                // ProjectExtension.PROJECTENCODING);
133
                // Marshaller m = new Marshaller(writer);
134
                // m.setEncoding(ProjectExtension.PROJECTENCODING);
135
                // XMLEntity xml=layout.getXMLEntity();
136
                // xml.putProperty("followHeaderEncoding", true);
137
                // m.marshal(xml.getXmlTag());
138

  
139
                PersistenceManager persistenceManager =
140
                    ToolsLocator.getPersistenceManager();
141
                PersistentState persistentState =
142
                    persistenceManager.getState(layout);
143
                persistenceManager.saveState(persistentState, fos);
144
            } catch (Exception e) {
145
                NotificationManager.addError(PluginServices.getText(this,
146
                    "Error_guardando_la_plantilla"), e);
147
            }
148
        }
149
    }
150

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

  
157
        if (f == null) {
158
            return false;
159
        }
160

  
161
        if (f instanceof LayoutPanel) {
162
            return true; // layout.m_Display.getMapControl().getMapContext().getLayers().layerCount()
163
                         // > 0;
164
        }
165
        return false;
166
    }
167

  
168
    /**
169
     * @see org.gvsig.andami.plugins.IExtension#initialize()
170
     */
171
    public void initialize() {
172
        registerIcons();
173
    }
174

  
175
    private void registerIcons() {
176
        
177
        IconThemeHelper.registerIcon("action", "application-layout-template-save", this);
178
        
179
        IconThemeHelper.registerIcon("action", "layout-navigation-zoom-in-center", this);
180
        IconThemeHelper.registerIcon("action", "layout-navigation-zoom-out-center", this);
181
        IconThemeHelper.registerIcon("action", "layout-navigation-zoom-in-topoint", this);
182
        IconThemeHelper.registerIcon("action", "layout-navigation-zoom-out-topoint", this);
183
        IconThemeHelper.registerIcon("action", "layout-navigation-zoom-all", this);
184
        IconThemeHelper.registerIcon("action", "layout-navigation-zoom-real", this);
185
        IconThemeHelper.registerIcon("action", "layout-navigation-zoom-selected", this);
186
        IconThemeHelper.registerIcon("action", "layout-navigation-pan", this);
187

  
188
        IconThemeHelper.registerIcon("action", "layout-view-navigation-zoom-in-topoint", this);
189
        IconThemeHelper.registerIcon("action", "layout-view-navigation-zoom-out-topoint", this);
190
        IconThemeHelper.registerIcon("action", "layout-view-navigation-zoom-all", this);
191
        IconThemeHelper.registerIcon("action", "layout-view-navigation-pan", this);
192
        // ================================================
193
        // Cursors
194
        IconThemeHelper.registerIcon("cursor", "cursor-layout-navigation-zoom-in-topoint", this);
195
        IconThemeHelper.registerIcon("cursor", "cursor-layout-navigation-zoom-out-topoint", this);
196
        IconThemeHelper.registerIcon("cursor", "cursor-selection-by-rectangle", this);
197
        IconThemeHelper.registerIcon("cursor", "cursor-selection-simple", this);
198
        IconThemeHelper.registerIcon("cursor", "cursor-selection-complex", this);
199
        IconThemeHelper.registerIcon("cursor", "cursor-layout-graphic-edit-vertex", this);
200
        IconThemeHelper.registerIcon("cursor", "cursor-layout-insert-circle", this);
201
        IconThemeHelper.registerIcon("cursor", "cursor-layout-insert-polyline", this);
202
        IconThemeHelper.registerIcon("cursor", "cursor-layout-insert-point", this);
203
        IconThemeHelper.registerIcon("cursor", "cursor-layout-insert-polygon", this);
204
        IconThemeHelper.registerIcon("cursor", "cursor-layout-insert-rectangle", this);
205
        IconThemeHelper.registerIcon("cursor", "cursor-layout-view-navigation-zoom-in-topoint", this);
206
        IconThemeHelper.registerIcon("cursor", "cursor-layout-view-navigation-zoom-out-topoint", this);
207
        // End cursors
208
        // ================================================
209

  
210
        IconThemeHelper.registerIcon("document", "document-map-icon", this);
211
        IconThemeHelper.registerIcon("document", "document-map-icon-sel", this);
212
        
213
        IconThemeHelper.registerIcon("layout", "neresize-icon", this);
214
        IconThemeHelper.registerIcon("layout", "eresize-icon", this);
215
        IconThemeHelper.registerIcon("layout", "nresize-icon", this);
216
        IconThemeHelper.registerIcon("layout", "graphic-move-icon", this);
217
        
218
        IconThemeHelper.registerIcon("layout", "sereresize-icon", this);
219
        IconThemeHelper.registerIcon("layout", "symboltag-icon", this);
220
        IconThemeHelper.registerIcon("layout", "numero-icon", this);
221
        IconThemeHelper.registerIcon("layout", "barra1-icon", this);
222
        IconThemeHelper.registerIcon("layout", "barra2-icon", this);
223
        IconThemeHelper.registerIcon("layout", "barra3-icon", this);
224

  
225
        IconThemeHelper.registerIcon("layout", "text-left-icon", this);
226
        IconThemeHelper.registerIcon("layout", "text-center-v-icon", this);
227
        IconThemeHelper.registerIcon("layout", "text-right-icon", this);
228
        IconThemeHelper.registerIcon("layout", "left-rotation-icon", this);
229
        IconThemeHelper.registerIcon("layout", "text-up-icon", this);
230
        IconThemeHelper.registerIcon("layout", "text-center-h-icon", this);
231
        IconThemeHelper.registerIcon("layout", "text-down-icon", this);
232
        IconThemeHelper.registerIcon("layout", "text-distup-icon", this);
233
        IconThemeHelper.registerIcon("layout", "text-distcenterh-icon", this);
234
        IconThemeHelper.registerIcon("layout", "text-distdown-icon", this);
235
        IconThemeHelper.registerIcon("layout", "text-distleft-icon", this);
236

  
237
        IconThemeHelper.registerIcon("layout", "text-distcenterv-icon", this);
238
        IconThemeHelper.registerIcon("layout", "text-distright-icon", this);
239
        IconThemeHelper.registerIcon("layout", "text-size-width-icon", this);
240
        IconThemeHelper.registerIcon("layout", "text-size-height-icon", this);
241
        IconThemeHelper.registerIcon("layout", "text-size-other-icon", this);
242
        IconThemeHelper.registerIcon("layout", "text-space-right-icon", this);
243
        IconThemeHelper.registerIcon("layout", "text-space-down-icon", this);
244
        IconThemeHelper.registerIcon("layout", "text-inlayout-icon", this);
245
        IconThemeHelper.registerIcon("layout", "layout-pan-icon", this);
246
        IconThemeHelper.registerIcon("layout", "view-pan-icon", this);
247
        IconThemeHelper.registerIcon("layout", "right-rotation-icon", this);
248
    }
249

  
250
    /**
251
     * @see org.gvsig.andami.plugins.IExtension#isEnabled()
252
     */
253
    public boolean isEnabled() {
254
        return true;
255
    }
256

  
257
    /**
258
     * Devuelve el Layout sobre el que se opera.
259
     * 
260
     * @return Layout.
261
     */
262
    public LayoutPanel getLayout() {
263
        return layout;
264
    }
265

  
266
    public IPreference[] getPreferencesPages() {
267
        return new IPreference[] { new LayoutPage() };
268
    }
269
}
tags/org.gvsig.app.document.layout.app-2.0.24/org.gvsig.app.document.layout.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.layout.app-2.0.24/org.gvsig.app.document.layout.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().getFFrameSelected();
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.layout.app-2.0.24/org.gvsig.app.document.layout.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.layout.app-2.0.24/org.gvsig.app.document.layout.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;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff