Revision 1612

View differences:

tags/org.gvsig.app.document.layout2.app-2.0.282/org.gvsig.app.document.layout2.app.mainplugin/buildNumber.properties
1
#Sun Jul 09 17:50:08 CEST 2023
2
buildNumber=304
tags/org.gvsig.app.document.layout2.app-2.0.282/org.gvsig.app.document.layout2.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>
tags/org.gvsig.app.document.layout2.app-2.0.282/org.gvsig.app.document.layout2.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.
0 9

  
tags/org.gvsig.app.document.layout2.app-2.0.282/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.282/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.282/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.282/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.app.project.documents.layout.report.LayoutReportActionFactory;
46
import org.gvsig.i18n.Messages;
47
import org.gvsig.tools.ToolsLocator;
48
import org.gvsig.tools.persistence.PersistenceManager;
49
import org.gvsig.tools.persistence.PersistentState;
50
import org.gvsig.tools.persistence.text.JavaTextFactory;
51
import org.gvsig.utils.GenericFileFilter;
52

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

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

  
63
    private LayoutPanel layout = null;
64

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

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

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

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

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

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

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

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

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

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

  
173
    @Override
174
    public void postInitialize() {
175
        LayoutReportActionFactory.selfRegister();
176
    }
177
    
178
    private void registerPersistence() {
179
        PersistenceManager manager = ToolsLocator.getPersistenceManager();
180
        JavaTextFactory factory = new JavaTextFactory();
181
        manager.registerFactory(factory);
182
    }
183

  
184
    private void registerIcons() {
185

  
186
        IconThemeHelper.registerIcon("action",
187
                "application-layout-template-save", this);
188

  
189
        IconThemeHelper.registerIcon("action",
190
                "layout-navigation-zoom-in-center", this);
191
        IconThemeHelper.registerIcon("action",
192
                "layout-navigation-zoom-out-center", this);
193
        IconThemeHelper.registerIcon("action",
194
                "layout-navigation-zoom-in-topoint", this);
195
        IconThemeHelper.registerIcon("action",
196
                "layout-navigation-zoom-out-topoint", this);
197
        IconThemeHelper.registerIcon("action", "layout-navigation-zoom-all",
198
                this);
199
        IconThemeHelper.registerIcon("action", "layout-navigation-zoom-real",
200
                this);
201
        IconThemeHelper.registerIcon("action",
202
                "layout-navigation-zoom-selected", this);
203
        IconThemeHelper.registerIcon("action", "layout-navigation-pan", this);
204

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

  
243
        IconThemeHelper.registerIcon("document", "document-map-icon", this);
244
        IconThemeHelper.registerIcon("document", "document-map-icon-sel", this);
245

  
246
        IconThemeHelper.registerIcon("layout", "neresize-icon", this);
247
        IconThemeHelper.registerIcon("layout", "eresize-icon", this);
248
        IconThemeHelper.registerIcon("layout", "nresize-icon", this);
249
        IconThemeHelper.registerIcon("layout", "graphic-move-icon", this);
250

  
251
        IconThemeHelper.registerIcon("layout", "sereresize-icon", this);
252
        IconThemeHelper.registerIcon("layout", "symboltag-icon", this);
253
        IconThemeHelper.registerIcon("layout", "numero-icon", this);
254
        IconThemeHelper.registerIcon("layout", "barra1-icon", this);
255
        IconThemeHelper.registerIcon("layout", "barra2-icon", this);
256
        IconThemeHelper.registerIcon("layout", "barra3-icon", this);
257

  
258
        IconThemeHelper.registerIcon("layout", "text-left-icon", this);
259
        IconThemeHelper.registerIcon("layout", "text-center-v-icon", this);
260
        IconThemeHelper.registerIcon("layout", "text-right-icon", this);
261
        IconThemeHelper.registerIcon("layout", "left-rotation-icon", this);
262
        IconThemeHelper.registerIcon("layout", "text-up-icon", this);
263
        IconThemeHelper.registerIcon("layout", "text-center-h-icon", this);
264
        IconThemeHelper.registerIcon("layout", "text-down-icon", this);
265
        IconThemeHelper.registerIcon("layout", "text-distup-icon", this);
266
        IconThemeHelper.registerIcon("layout", "text-distcenterh-icon", this);
267
        IconThemeHelper.registerIcon("layout", "text-distdown-icon", this);
268
        IconThemeHelper.registerIcon("layout", "text-distleft-icon", this);
269

  
270
        IconThemeHelper.registerIcon("layout", "text-distcenterv-icon", this);
271
        IconThemeHelper.registerIcon("layout", "text-distright-icon", this);
272
        IconThemeHelper.registerIcon("layout", "text-size-width-icon", this);
273
        IconThemeHelper.registerIcon("layout", "text-size-height-icon", this);
274
        IconThemeHelper.registerIcon("layout", "text-size-other-icon", this);
275
        IconThemeHelper.registerIcon("layout", "text-space-right-icon", this);
276
        IconThemeHelper.registerIcon("layout", "text-space-down-icon", this);
277
        IconThemeHelper.registerIcon("layout", "text-inlayout-icon", this);
278
        IconThemeHelper.registerIcon("layout", "layout-pan-icon", this);
279
        IconThemeHelper.registerIcon("layout", "view-pan-icon", this);
280
        IconThemeHelper.registerIcon("layout", "right-rotation-icon", this);
281
    }
282

  
283
    /**
284
     * @see org.gvsig.andami.plugins.IExtension#isEnabled()
285
     */
286
    public boolean isEnabled() {
287
        return true;
288
    }
289

  
290
    /**
291
     * Devuelve el Layout sobre el que se opera.
292
     * 
293
     * @return Layout.
294
     */
295
    public LayoutPanel getLayout() {
296
        return layout;
297
    }
298

  
299
    public IPreference[] getPreferencesPages() {
300
        return new IPreference[] { new LayoutPage() };
301
    }
302
}
tags/org.gvsig.app.document.layout2.app-2.0.282/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 java.io.File;
25
import org.gvsig.andami.IconThemeHelper;
26
import org.gvsig.andami.PluginServices;
27
import org.gvsig.andami.plugins.Extension;
28
import org.gvsig.andami.ui.mdiManager.IWindow;
29
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
30
import org.gvsig.tools.util.ArrayUtils;
31

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

  
39
    private LayoutPanel layoutPanel;
40

  
41
    public void initialize() {
42
        registerIcons();
43
    }
44

  
45
    private void registerIcons() {
46

  
47
        IconThemeHelper.registerIcon("action", "application-export-to-postscript", this);
48
        IconThemeHelper.registerIcon("action", "application-export-to-pdf", this);
49
    }
50

  
51
    /**
52
     * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
53
     */
54
    public void execute(String s) {
55
        this.execute(s, null);
56
    }
57

  
58
    @Override
59
    public void execute(String command, Object[] args) {
60
        layoutPanel = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
61
        if (command.equals("application-export-to-pdf")) {
62
            Object file = ArrayUtils.get(args, 0);
63
            if( file instanceof String ) {
64
                file = new File((String)file);
65
            }
66
            if( file == null ) {
67
                layoutPanel.layoutToPDF();
68
            } else {
69
                layoutPanel.layoutToPDF((File)file);
70
            }
71
        } else if (command.equals("application-export-to-postscript")) {
72
            layoutPanel.layoutToPS();
73
        }
74
    }
75

  
76
    public boolean isEnabled() {
77
        return true;
78
    }
79

  
80
    public boolean isVisible() {
81
        IWindow f = PluginServices.getMDIManager().getActiveWindow();
82

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

  
87
        if (f instanceof LayoutPanel) {
88
            // Layout layout = (Layout) f;
89

  
90
            return true; // layout.m_Display.getMapControl().getMapContext().getLayers().layerCount()
91
            // > 0;
92
        } else {
93
            return false;
94
        }
95
    }
96

  
97
}
tags/org.gvsig.app.document.layout2.app-2.0.282/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.282/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/reportfromlayout/ExportReportToLayoutPanelView.java
1
package org.gvsig.app.extension.reportfromlayout;
2

  
3
import com.jeta.open.i18n.I18NUtils;
4
import com.jgoodies.forms.layout.CellConstraints;
5
import com.jgoodies.forms.layout.FormLayout;
6
import java.awt.BorderLayout;
7
import java.awt.ComponentOrientation;
8
import java.awt.Container;
9
import java.awt.Dimension;
10
import javax.swing.Box;
11
import javax.swing.ImageIcon;
12
import javax.swing.JButton;
13
import javax.swing.JComboBox;
14
import javax.swing.JFrame;
15
import javax.swing.JLabel;
16
import javax.swing.JPanel;
17
import javax.swing.JScrollPane;
18
import javax.swing.JTextField;
19
import javax.swing.JTree;
20
import javax.swing.border.EmptyBorder;
21

  
22

  
23
public class ExportReportToLayoutPanelView extends JPanel
24
{
25
   JLabel lblSource = new JLabel();
26
   JLabel lblReport = new JLabel();
27
   JComboBox cboReport = new JComboBox();
28
   JTree treeSource = new JTree();
29
   JTextField txtFile = new JTextField();
30
   JLabel lblFile = new JLabel();
31
   JButton btnFile = new JButton();
32

  
33
   /**
34
    * Default constructor
35
    */
36
   public ExportReportToLayoutPanelView()
37
   {
38
      initializePanel();
39
   }
40

  
41
   /**
42
    * Adds fill components to empty cells in the first row and first column of the grid.
43
    * This ensures that the grid spacing will be the same as shown in the designer.
44
    * @param cols an array of column indices in the first row where fill components should be added.
45
    * @param rows an array of row indices in the first column where fill components should be added.
46
    */
47
   void addFillComponents( Container panel, int[] cols, int[] rows )
48
   {
49
      Dimension filler = new Dimension(10,10);
50

  
51
      boolean filled_cell_11 = false;
52
      CellConstraints cc = new CellConstraints();
53
      if ( cols.length > 0 && rows.length > 0 )
54
      {
55
         if ( cols[0] == 1 && rows[0] == 1 )
56
         {
57
            /** add a rigid area  */
58
            panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
59
            filled_cell_11 = true;
60
         }
61
      }
62

  
63
      for( int index = 0; index < cols.length; index++ )
64
      {
65
         if ( cols[index] == 1 && filled_cell_11 )
66
         {
67
            continue;
68
         }
69
         panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
70
      }
71

  
72
      for( int index = 0; index < rows.length; index++ )
73
      {
74
         if ( rows[index] == 1 && filled_cell_11 )
75
         {
76
            continue;
77
         }
78
         panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
79
      }
80

  
81
   }
82

  
83
   /**
84
    * Helper method to load an image file from the CLASSPATH
85
    * @param imageName the package and name of the file to load relative to the CLASSPATH
86
    * @return an ImageIcon instance with the specified image file
87
    * @throws IllegalArgumentException if the image resource cannot be loaded.
88
    */
89
   public ImageIcon loadImage( String imageName )
90
   {
91
      try
92
      {
93
         ClassLoader classloader = getClass().getClassLoader();
94
         java.net.URL url = classloader.getResource( imageName );
95
         if ( url != null )
96
         {
97
            ImageIcon icon = new ImageIcon( url );
98
            return icon;
99
         }
100
      }
101
      catch( Exception e )
102
      {
103
         e.printStackTrace();
104
      }
105
      throw new IllegalArgumentException( "Unable to load image: " + imageName );
106
   }
107

  
108
   /**
109
    * Method for recalculating the component orientation for 
110
    * right-to-left Locales.
111
    * @param orientation the component orientation to be applied
112
    */
113
   public void applyComponentOrientation( ComponentOrientation orientation )
114
   {
115
      // Not yet implemented...
116
      // I18NUtils.applyComponentOrientation(this, orientation);
117
      super.applyComponentOrientation(orientation);
118
   }
119

  
120
   public JPanel createPanel()
121
   {
122
      JPanel jpanel1 = new JPanel();
123
      FormLayout formlayout1 = new FormLayout("FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE","CENTER:2DLU:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE");
124
      CellConstraints cc = new CellConstraints();
125
      jpanel1.setLayout(formlayout1);
126

  
127
      lblSource.setName("lblSource");
128
      lblSource.setText("_Source");
129
      lblSource.setVerticalAlignment(JLabel.TOP);
130
      jpanel1.add(lblSource,new CellConstraints(2,2,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));
131

  
132
      lblReport.setName("lblReport");
133
      lblReport.setText("_Report");
134
      jpanel1.add(lblReport,cc.xy(2,4));
135

  
136
      cboReport.setName("cboReport");
137
      jpanel1.add(cboReport,cc.xywh(4,4,3,1));
138

  
139
      treeSource.setName("treeSource");
140
      treeSource.setRootVisible(false);
141
      JScrollPane jscrollpane1 = new JScrollPane();
142
      jscrollpane1.setViewportView(treeSource);
143
      jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
144
      jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
145
      jpanel1.add(jscrollpane1,new CellConstraints(4,2,3,1,CellConstraints.DEFAULT,CellConstraints.FILL));
146

  
147
      txtFile.setName("txtFile");
148
      jpanel1.add(txtFile,cc.xy(4,6));
149

  
150
      lblFile.setName("lblFile");
151
      lblFile.setText("_File");
152
      jpanel1.add(lblFile,cc.xy(2,6));
153

  
154
      btnFile.setActionCommand("JButton");
155
      btnFile.setName("btnFile");
156
      btnFile.setText("...");
157
      EmptyBorder emptyborder1 = new EmptyBorder(2,2,2,2);
158
      btnFile.setBorder(emptyborder1);
159
      jpanel1.add(btnFile,cc.xy(6,6));
160

  
161
      addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7 },new int[]{ 1,2,3,4,5,6,7 });
162
      return jpanel1;
163
   }
164

  
165
   /**
166
    * Initializer
167
    */
168
   protected void initializePanel()
169
   {
170
      setLayout(new BorderLayout());
171
      add(createPanel(), BorderLayout.CENTER);
172
   }
173

  
174

  
175
}
tags/org.gvsig.app.document.layout2.app-2.0.282/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/reportfromlayout/ConfigureReportFromLayoutPanelView.java
1
package org.gvsig.app.extension.reportfromlayout;
2

  
3
import com.jeta.forms.components.separator.TitledSeparator;
4
import com.jeta.open.i18n.I18NUtils;
5
import com.jgoodies.forms.layout.CellConstraints;
6
import com.jgoodies.forms.layout.FormLayout;
7
import java.awt.BorderLayout;
8
import java.awt.ComponentOrientation;
9
import java.awt.Container;
10
import java.awt.Dimension;
11
import javax.swing.Box;
12
import javax.swing.ImageIcon;
13
import javax.swing.JButton;
14
import javax.swing.JCheckBox;
15
import javax.swing.JComboBox;
16
import javax.swing.JFrame;
17
import javax.swing.JLabel;
18
import javax.swing.JPanel;
19
import javax.swing.JScrollPane;
20
import javax.swing.JTextField;
21
import javax.swing.JTree;
22

  
23

  
24
public class ConfigureReportFromLayoutPanelView extends JPanel
25
{
26
   JLabel lblLayout = new JLabel();
27
   JLabel lblSource = new JLabel();
28
   JLabel lblReport = new JLabel();
29
   JLabel lblIdentifier = new JLabel();
30
   JLabel lblLabel = new JLabel();
31
   JCheckBox chkUseInternalPdfViewer = new JCheckBox();
32
   JComboBox cboLayout = new JComboBox();
33
   JTree treeSource = new JTree();
34
   JComboBox cboReport = new JComboBox();
35
   JTextField txtIdentifier = new JTextField();
36
   JTextField txtLabel = new JTextField();
37
   TitledSeparator lblViewSeparator = new TitledSeparator();
38
   JLabel lblView = new JLabel();
39
   JComboBox cboView = new JComboBox();
40
   JCheckBox chkHighlightRecord = new JCheckBox();
41
   JCheckBox chkZoomToCurrentRow = new JCheckBox();
42
   JLabel lblBufferSize = new JLabel();
43
   JTextField txtBufferSize = new JTextField();
44
   JCheckBox chkCenterToCurrentRow = new JCheckBox();
45
   JLabel lblAppySymbolTo = new JLabel();
46
   JComboBox cboApplySymbolTo = new JComboBox();
47
   JButton btnSelectSymbol = new JButton();
48

  
49
   /**
50
    * Default constructor
51
    */
52
   public ConfigureReportFromLayoutPanelView()
53
   {
54
      initializePanel();
55
   }
56

  
57
   /**
58
    * Adds fill components to empty cells in the first row and first column of the grid.
59
    * This ensures that the grid spacing will be the same as shown in the designer.
60
    * @param cols an array of column indices in the first row where fill components should be added.
61
    * @param rows an array of row indices in the first column where fill components should be added.
62
    */
63
   void addFillComponents( Container panel, int[] cols, int[] rows )
64
   {
65
      Dimension filler = new Dimension(10,10);
66

  
67
      boolean filled_cell_11 = false;
68
      CellConstraints cc = new CellConstraints();
69
      if ( cols.length > 0 && rows.length > 0 )
70
      {
71
         if ( cols[0] == 1 && rows[0] == 1 )
72
         {
73
            /** add a rigid area  */
74
            panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
75
            filled_cell_11 = true;
76
         }
77
      }
78

  
79
      for( int index = 0; index < cols.length; index++ )
80
      {
81
         if ( cols[index] == 1 && filled_cell_11 )
82
         {
83
            continue;
84
         }
85
         panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
86
      }
87

  
88
      for( int index = 0; index < rows.length; index++ )
89
      {
90
         if ( rows[index] == 1 && filled_cell_11 )
91
         {
92
            continue;
93
         }
94
         panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
95
      }
96

  
97
   }
98

  
99
   /**
100
    * Helper method to load an image file from the CLASSPATH
101
    * @param imageName the package and name of the file to load relative to the CLASSPATH
102
    * @return an ImageIcon instance with the specified image file
103
    * @throws IllegalArgumentException if the image resource cannot be loaded.
104
    */
105
   public ImageIcon loadImage( String imageName )
106
   {
107
      try
108
      {
109
         ClassLoader classloader = getClass().getClassLoader();
110
         java.net.URL url = classloader.getResource( imageName );
111
         if ( url != null )
112
         {
113
            ImageIcon icon = new ImageIcon( url );
114
            return icon;
115
         }
116
      }
117
      catch( Exception e )
118
      {
119
         e.printStackTrace();
120
      }
121
      throw new IllegalArgumentException( "Unable to load image: " + imageName );
122
   }
123

  
124
   /**
125
    * Method for recalculating the component orientation for 
126
    * right-to-left Locales.
127
    * @param orientation the component orientation to be applied
128
    */
129
   public void applyComponentOrientation( ComponentOrientation orientation )
130
   {
131
      // Not yet implemented...
132
      // I18NUtils.applyComponentOrientation(this, orientation);
133
      super.applyComponentOrientation(orientation);
134
   }
135

  
136
   public JPanel createPanel()
137
   {
138
      JPanel jpanel1 = new JPanel();
139
      FormLayout formlayout1 = new FormLayout("FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:22DLU:GROW(1.0),FILL:4DLU:NONE","CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE");
140
      CellConstraints cc = new CellConstraints();
141
      jpanel1.setLayout(formlayout1);
142

  
143
      lblLayout.setName("lblLayout");
144
      lblLayout.setText("_Layout_template");
145
      jpanel1.add(lblLayout,cc.xy(2,2));
146

  
147
      lblSource.setName("lblSource");
148
      lblSource.setText("_Source");
149
      lblSource.setVerticalAlignment(JLabel.TOP);
150
      jpanel1.add(lblSource,new CellConstraints(2,4,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));
151

  
152
      lblReport.setName("lblReport");
153
      lblReport.setText("_Report");
154
      jpanel1.add(lblReport,cc.xy(2,6));
155

  
156
      lblIdentifier.setName("lblIdentifier");
157
      lblIdentifier.setText("_Identifier");
158
      jpanel1.add(lblIdentifier,cc.xy(2,8));
159

  
160
      lblLabel.setName("lblLabel");
161
      lblLabel.setText("_Label");
162
      jpanel1.add(lblLabel,cc.xy(2,10));
163

  
164
      chkUseInternalPdfViewer.setActionCommand("_Center_to_current_row");
165
      chkUseInternalPdfViewer.setName("chkUseInternalPdfViewer");
166
      chkUseInternalPdfViewer.setText("_Use_internal_pdf_viewer");
167
      chkUseInternalPdfViewer.setToolTipText("_Use_internal_pdf_viewer_description");
168
      jpanel1.add(chkUseInternalPdfViewer,cc.xywh(2,22,3,1));
169

  
170
      cboLayout.setName("cboLayout");
171
      jpanel1.add(cboLayout,cc.xy(4,2));
172

  
173
      treeSource.setName("treeSource");
174
      treeSource.setRootVisible(false);
175
      JScrollPane jscrollpane1 = new JScrollPane();
176
      jscrollpane1.setViewportView(treeSource);
177
      jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
178
      jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
179
      jpanel1.add(jscrollpane1,new CellConstraints(4,4,1,1,CellConstraints.DEFAULT,CellConstraints.FILL));
180

  
181
      cboReport.setName("cboReport");
182
      jpanel1.add(cboReport,cc.xy(4,6));
183

  
184
      txtIdentifier.setName("txtIdentifier");
185
      jpanel1.add(txtIdentifier,cc.xy(4,8));
186

  
187
      txtLabel.setName("txtLabel");
188
      jpanel1.add(txtLabel,cc.xy(4,10));
189

  
190
      lblViewSeparator.setName("lblViewSeparator");
191
      lblViewSeparator.setText("_View");
192
      jpanel1.add(lblViewSeparator,cc.xywh(2,12,3,1));
193

  
194
      lblView.setName("lblView");
195
      lblView.setText("_View");
196
      jpanel1.add(lblView,cc.xy(2,14));
197

  
198
      cboView.setName("cboView");
199
      jpanel1.add(cboView,cc.xy(4,14));
200

  
201
      chkHighlightRecord.setActionCommand("_Center_to_current_row");
202
      chkHighlightRecord.setName("chkHighlightRecord");
203
      chkHighlightRecord.setText("_Highlight_record");
204
      chkHighlightRecord.setToolTipText("_Highlight_record_in_report");
205
      jpanel1.add(chkHighlightRecord,cc.xy(2,16));
206

  
207
      jpanel1.add(createPanel1(),cc.xywh(2,20,3,1));
208
      chkCenterToCurrentRow.setActionCommand("_Center_to_current_row");
209
      chkCenterToCurrentRow.setName("chkCenterToCurrentRow");
210
      chkCenterToCurrentRow.setText("_Center_to_current_row");
211
      chkCenterToCurrentRow.setToolTipText("_Center_to_current_row_description");
212
      jpanel1.add(chkCenterToCurrentRow,cc.xywh(2,18,3,1));
213

  
214
      jpanel1.add(createPanel2(),cc.xy(4,16));
215
      addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 });
216
      return jpanel1;
217
   }
218

  
219
   public JPanel createPanel1()
220
   {
221
      JPanel jpanel1 = new JPanel();
222
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0)","CENTER:DEFAULT:NONE");
223
      CellConstraints cc = new CellConstraints();
224
      jpanel1.setLayout(formlayout1);
225

  
226
      chkZoomToCurrentRow.setActionCommand("_Center_to_current_row");
227
      chkZoomToCurrentRow.setName("chkZoomToCurrentRow");
228
      chkZoomToCurrentRow.setText("_Zoom_to_current_row");
229
      chkZoomToCurrentRow.setToolTipText("_Zoom_to_current_row_description");
230
      jpanel1.add(chkZoomToCurrentRow,cc.xy(1,1));
231

  
232
      lblBufferSize.setName("lblBufferSize");
233
      lblBufferSize.setText("_Buffer_size");
234
      lblBufferSize.setToolTipText("_Buffer_size_description");
235
      jpanel1.add(lblBufferSize,cc.xy(3,1));
236

  
237
      txtBufferSize.setName("txtBufferSize");
238
      txtBufferSize.setToolTipText("_Buffer_size_description");
239
      jpanel1.add(txtBufferSize,cc.xy(5,1));
240

  
241
      addFillComponents(jpanel1,new int[]{ 2,4 },new int[0]);
242
      return jpanel1;
243
   }
244

  
245
   public JPanel createPanel2()
246
   {
247
      JPanel jpanel1 = new JPanel();
248
      FormLayout formlayout1 = new FormLayout("FILL:22DLU:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:8DLU:GROW(1.0)","CENTER:DEFAULT:NONE");
249
      CellConstraints cc = new CellConstraints();
250
      jpanel1.setLayout(formlayout1);
251

  
252
      lblAppySymbolTo.setName("lblAppySymbolTo");
253
      lblAppySymbolTo.setText("_Apply_symbol");
254
      jpanel1.add(lblAppySymbolTo,cc.xy(3,1));
255

  
256
      cboApplySymbolTo.setName("cboApplySymbolTo");
257
      jpanel1.add(cboApplySymbolTo,cc.xy(5,1));
258

  
259
      btnSelectSymbol.setActionCommand("...");
260
      btnSelectSymbol.setName("btnSelectSymbol");
261
      btnSelectSymbol.setText("...");
262
      btnSelectSymbol.setToolTipText("_Select_symbol");
263
      jpanel1.add(btnSelectSymbol,new CellConstraints(1,1,1,1,CellConstraints.FILL,CellConstraints.FILL));
264

  
265
      addFillComponents(jpanel1,new int[]{ 2,4 },new int[0]);
266
      return jpanel1;
267
   }
268

  
269
   /**
270
    * Initializer
271
    */
272
   protected void initializePanel()
273
   {
274
      setLayout(new BorderLayout());
275
      add(createPanel(), BorderLayout.CENTER);
276
   }
277

  
278

  
279
}
tags/org.gvsig.app.document.layout2.app-2.0.282/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/reportfromlayout/ExportReportToLayoutExtension.java
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.app.extension.reportfromlayout;
7

  
8
import java.awt.GridBagConstraints;
9
import java.awt.event.ActionEvent;
10
import java.awt.event.ActionListener;
11
import java.util.Collections;
12
import javax.swing.JComponent;
13
import org.gvsig.andami.plugins.Extension;
14
import org.gvsig.tools.ToolsLocator;
15
import org.gvsig.tools.future.FutureUtils;
16
import org.gvsig.tools.i18n.I18nManager;
17
import org.gvsig.tools.swing.api.ToolsSwingLocator;
18
import org.gvsig.tools.swing.api.windowmanager.Dialog;
19
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
20
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2;
21

  
22
/**
23
 *
24
 * @author fdiaz
25
 */
26
public class ExportReportToLayoutExtension extends Extension {
27

  
28
    @Override
29
    public void initialize() {
30
    }
31

  
32
    @Override
33
    public void execute(String actionCommand) {
34
        switch(actionCommand.toLowerCase()) {
35
        case "layout-exportreporttolayout":
36
            doExportReportToLayout();
37
            break;
38
        }
39
    }
40

  
41
    @Override
42
    public boolean isEnabled() {
43
        return true;
44
    }
45

  
46
    @Override
47
    public boolean isVisible() {
48
        return FutureUtils.use("LAYOUT_REPORT");
49
    }
50
    
51
    @SuppressWarnings("Convert2Lambda")
52
    private void doExportReportToLayout() {
53
        WindowManager_v2 windowManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager();
54
        ExportReportToLayout panel = new ExportReportToLayout();
55
        I18nManager i18n = ToolsLocator.getI18nManager();
56
        Dialog dialog = windowManager.createDialog(
57
                panel,
58
                i18n.getTranslation("_Export_report_to_layout"), 
59
                i18n.getTranslation("_Export_a_report_to_a_layout"),
60
                WindowManager_v2.BUTTONS_OK_CANCEL
61
        );
62
        dialog.setAutoclose(false);
63
        dialog.setButtonLabel(WindowManager_v2.BUTTON_OK, i18n.getTranslation("_Export_report"));
64
        dialog.setButtonLabel(WindowManager_v2.BUTTON_CANCEL, i18n.getTranslation("_Close"));
65
        dialog.addActionListener(new ActionListener() {
66
            @Override
67
            public void actionPerformed(ActionEvent e) {
68
                switch( dialog.getAction()) {
69
                    case WindowManager_v2.BUTTON_OK:
70
                        dialog.setButtonEnabled(WindowManager_v2.BUTTON_OK, false);                        
71
                        ExportReportToLayoutParametersImpl params = new ExportReportToLayoutParametersImpl();
72
                        panel.fetch(params);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff