Revision 426

View differences:

tags/org.gvsig.app.document.layout.app-2.0.28/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.28</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.102</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.28</connection>
16
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-app-document-layout/tags/org.gvsig.app.document.layout.app-2.0.28</developerConnection>
17
        <url>https://devel.gvsig.org/redmine/projects/gvsig-app-document-layout/repository/show/tags/org.gvsig.app.document.layout.app-2.0.28</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.28/org.gvsig.app.document.layout.app.mainplugin/buildNumber.properties
1
#Sun Jul 05 10:00:37 CEST 2015
2
buildNumber=42
tags/org.gvsig.app.document.layout.app-2.0.28/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.28/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/document/layout/app/mainplugin/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.landregistryviewer package documentation</title>
7
</head>
8
<body>
9

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

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

  
tags/org.gvsig.app.document.layout.app-2.0.28/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/gui/preferencespage/LayoutPage.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.gui.preferencespage;
23

  
24
import javax.swing.ImageIcon;
25
import javax.swing.JCheckBox;
26
import javax.swing.JPanel;
27
import javax.swing.JTextField;
28

  
29
import org.gvsig.andami.IconThemeHelper;
30
import org.gvsig.andami.PluginServices;
31
import org.gvsig.andami.preferences.AbstractPreferencePage;
32
import org.gvsig.andami.preferences.StoreException;
33
import org.gvsig.app.project.ProjectManager;
34
import org.gvsig.app.project.documents.layout.Attributes;
35
import org.gvsig.app.project.documents.layout.DefaultLayoutManager;
36
import org.gvsig.utils.XMLEntity;
37

  
38
/**
39
 * Layout preference page where the user can establish default values for
40
 * <ol>
41
 * <li><b>grid horizontal gap</b></li>
42
 * <li><b>grid vertical gap</b></li>
43
 * <li><b>show or hide grid</b></li>
44
 * <li><b>adjust elements to grid</b></li>
45
 * <li><b>show or hide rules</b></li>
46
 * </ol>
47
 * 
48
 * @author jaume dominguez faus - jaume.dominguez@iver.es
49
 * 
50
 */
51
public class LayoutPage extends AbstractPreferencePage {
52

  
53
    private static final long serialVersionUID = -8225970409668105935L;
54
    private static final boolean FACTORY_DEFAULT_LAYOUT_ENABLE_RULES = true;
55
    private static final boolean FACTORY_DEFAULT_LAYOUT_GRID_SHOW = true;
56
    private static final double FACTORY_DEFAULT_VERTICAL_GAP = 1;
57
    private static final double FACTORY_DEFAULT_HORIZONTAL_GAP = 1;
58
    private static final boolean FACTORY_DEFAULT_LAYOUT_GRID_ENABLE = false;
59
    private static final String DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME =
60
        "DefaultShowLayoutGrid";
61
    private static final String DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME =
62
        "DefaultEnableLayoutGrid";
63
    private static final String DEFAULT_SHOW_LAYOUT_RULES_KEY_NAME =
64
        "DefaultShowLayoutRules";
65
    private static final String DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME =
66
        "DefaultGridVerticalGap";
67
    private static final String DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME =
68
        "DefaultGridHorizontalGap";
69
    static String id = LayoutPage.class.getName();;
70
    private ImageIcon icon;
71
    private JCheckBox chkGridEnabled;
72
    private JCheckBox chkShowRules;
73
    private JCheckBox chkShowGrid;
74
    private JTextField txtVGap;
75
    private JTextField txtHGap;
76

  
77
    private static DefaultLayoutManager layoutManager = null;
78

  
79
    /**
80
     * Builds preference page where the user can establish default values for
81
     * <ol>
82
     * <li><b>grid horizontal gap</b></li>
83
     * <li><b>grid vertical gap</b></li>
84
     * <li><b>show or hide grid</b></li>
85
     * <li><b>adjust elements to grid</b></li>
86
     * <li><b>show or hide rules</b></li>
87
     * </ol>
88
     */
89
    public LayoutPage() {
90
        super();
91
        layoutManager =
92
            (DefaultLayoutManager) ProjectManager.getInstance()
93
                .getDocumentManager(DefaultLayoutManager.TYPENAME);
94

  
95
        icon = IconThemeHelper.getImageIcon("document-map-icon");
96

  
97
        // horizontal gap text field
98
        addComponent(PluginServices.getText(this, "espaciado_horizontal"),
99
            txtHGap = new JTextField(5));
100

  
101
        // vertical gap text field
102
        addComponent(PluginServices.getText(this, "espaciado_vertical"),
103
            txtVGap = new JTextField(5));
104

  
105
        // show/hide show check
106
        addComponent(chkShowGrid =
107
            new JCheckBox(PluginServices.getText(this, "visualizar_cuadricula")));
108

  
109
        // enable/disable grid
110
        addComponent(chkGridEnabled =
111
            new JCheckBox(PluginServices.getText(this, "malla_activada")));
112

  
113
        // show/hide rules
114
        addComponent(chkShowRules =
115
            new JCheckBox(PluginServices.getText(this, "activar_regla")));
116

  
117
    }
118

  
119
    public void storeValues() throws StoreException {
120
        double hGap, vGap;
121
        boolean gridEnabled, showRules, showGrid;
122
        try {
123
            hGap = Double.parseDouble(txtHGap.getText());
124
            vGap = Double.parseDouble(txtVGap.getText());
125
            gridEnabled = chkGridEnabled.isSelected();
126
            showGrid = chkShowGrid.isSelected();
127
            showRules = chkShowRules.isSelected();
128
        } catch (Exception e) {
129
            throw new StoreException(PluginServices.getText(this,
130
                "invalid_value_for_gap"));
131
        }
132
        layoutManager.setDefaultShowGrid(showGrid);
133
        layoutManager.setDefaultAdjustToGrid(gridEnabled);
134
        layoutManager.setDefaultShowRulers(showRules);
135
        Attributes.setDefaultGridGap(hGap, vGap);
136
        PluginServices ps = PluginServices.getPluginServices(this);
137
        XMLEntity xml = ps.getPersistentXML();
138
        xml.putProperty(DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME, hGap);
139
        xml.putProperty(DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME, vGap);
140
        xml.putProperty(DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME, showGrid);
141
        xml.putProperty(DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME, gridEnabled);
142
        xml.putProperty(DEFAULT_SHOW_LAYOUT_RULES_KEY_NAME, showRules);
143
    }
144

  
145
    public String getID() {
146
        return id;
147
    }
148

  
149
    public String getTitle() {
150
        return PluginServices.getText(this, "Mapa");
151
    }
152

  
153
    public JPanel getPanel() {
154
        return this;
155
    }
156

  
157
    public void initializeValues() {
158
        PluginServices ps = PluginServices.getPluginServices(this);
159
        XMLEntity xml = ps.getPersistentXML();
160
        double hGap = FACTORY_DEFAULT_HORIZONTAL_GAP;
161
        double vGap = FACTORY_DEFAULT_VERTICAL_GAP;
162
        boolean showGrid = FACTORY_DEFAULT_LAYOUT_GRID_SHOW;
163
        boolean gridEnabled = FACTORY_DEFAULT_LAYOUT_GRID_ENABLE;
164
        boolean showRules = FACTORY_DEFAULT_LAYOUT_ENABLE_RULES;
165
        // horizontal gap
166
        if (xml.contains(DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME)) {
167
            hGap =
168
                xml.getDoubleProperty(DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME);
169
        }
170
        txtHGap.setText(String.valueOf(hGap));
171

  
172
        // vertical gap
173
        if (xml.contains(DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME)) {
174
            vGap =
175
                xml.getDoubleProperty(DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME);
176
        }
177
        txtVGap.setText(String.valueOf(vGap));
178

  
179
        // show/hide grid check
180
        if (xml.contains(DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME)) {
181
            showGrid =
182
                xml.getBooleanProperty(DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME);
183
        }
184
        chkShowGrid.setSelected(showGrid);
185

  
186
        // enable/disable grid check
187
        if (xml.contains(DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME)) {
188
            gridEnabled =
189
                xml.getBooleanProperty(DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME);
190
        }
191
        chkGridEnabled.setSelected(gridEnabled);
192

  
193
        // enable/disable rules
194
        if (xml.contains(DEFAULT_SHOW_LAYOUT_RULES_KEY_NAME)) {
195
            showRules =
196
                xml.getBooleanProperty(DEFAULT_SHOW_LAYOUT_RULES_KEY_NAME);
197
        }
198
        chkShowRules.setSelected(showRules);
199

  
200
        layoutManager.setDefaultShowGrid(showGrid);
201
        layoutManager.setDefaultAdjustToGrid(gridEnabled);
202
        layoutManager.setDefaultShowRulers(showRules);
203
        Attributes.setDefaultGridGap(hGap, vGap);
204
    }
205

  
206
    public void initializeDefaults() {
207
        txtHGap.setText(String.valueOf(FACTORY_DEFAULT_HORIZONTAL_GAP));
208
        txtVGap.setText(String.valueOf(FACTORY_DEFAULT_VERTICAL_GAP));
209
        chkShowGrid.setSelected(FACTORY_DEFAULT_LAYOUT_GRID_SHOW);
210
        chkGridEnabled.setSelected(FACTORY_DEFAULT_LAYOUT_GRID_ENABLE);
211
        chkShowRules.setSelected(FACTORY_DEFAULT_LAYOUT_ENABLE_RULES);
212
    }
213

  
214
    public ImageIcon getIcon() {
215
        return icon;
216
    }
217

  
218
    public boolean isValueChanged() {
219
        return super.hasChanged();
220
    }
221

  
222
    public void setChangesApplied() {
223
        setChanged(false);
224
    }
225
}
tags/org.gvsig.app.document.layout.app-2.0.28/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/gui/preferencespage/PrintPropertiesPage.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.gui.preferencespage;
23

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

  
27
import javax.swing.ButtonGroup;
28
import javax.swing.ImageIcon;
29
import javax.swing.JCheckBox;
30
import javax.swing.JLabel;
31
import javax.swing.JPanel;
32
import javax.swing.JRadioButton;
33
import javax.swing.JTextField;
34

  
35
import org.gvsig.andami.PluginServices;
36
import org.gvsig.andami.preferences.AbstractPreferencePage;
37
import org.gvsig.andami.preferences.StoreException;
38

  
39
public class PrintPropertiesPage extends AbstractPreferencePage {
40

  
41
    private static final long serialVersionUID = 5806304468312341691L;
42
    private static final boolean FACTORY_DEFAULT_LANDSCAPED_PAGE = true;
43
    protected static String id = PrintPropertiesPage.class.getName();
44
    private ImageIcon icon;
45
    private JRadioButton rdBtnPortraitPage;
46
    private JRadioButton rdBtnLandscapePage;
47
    private JCheckBox chkCustomMargins;
48
    private JTextField txtTopMargin;
49
    private JTextField txtLeftMargin;
50
    private JTextField txtBottomMargin;
51
    private JTextField txtRightMargin;
52

  
53
    public PrintPropertiesPage() {
54
        super();
55
        setParentID(LayoutPage.class.getName());
56
        icon = PluginServices.getIconTheme().get("prepare-page-icon");
57
        rdBtnPortraitPage =
58
            new JRadioButton(PluginServices.getText(this,
59
                "options.layout.paper_properties.portrait"));
60
        ImageIcon portrait =
61
            PluginServices.getIconTheme().get("portrait-page-setup");
62
        rdBtnLandscapePage =
63
            new JRadioButton(PluginServices.getText(this,
64
                "options.layout.paper_properties.landscaped"));
65
        ImageIcon landscape =
66
            PluginServices.getIconTheme().get("landscape-page-setup");
67

  
68
        ButtonGroup group = new ButtonGroup();
69
        group.add(rdBtnLandscapePage);
70
        group.add(rdBtnPortraitPage);
71

  
72
        JPanel aux = new JPanel(new GridLayout(2, 2, 10, 0));
73
        aux.setPreferredSize(new Dimension(200, 150));
74
        aux.setSize(200, 150);
75
        aux.add(new JLabel(landscape));
76
        aux.add(new JLabel(portrait));
77
        aux.add(rdBtnLandscapePage);
78
        aux.add(rdBtnPortraitPage);
79

  
80
        addComponent(new JLabel(PluginServices.getText(this,
81
            "options.layout.paper_properties.paper_direction")));
82
        addComponent("", aux);
83
        addComponent(chkCustomMargins =
84
            new JCheckBox(PluginServices.getText(this, "personalizar_margenes")));
85

  
86
        JPanel aux2 = new JPanel(new GridLayout(2, 4, 10, 3));
87
        aux2.add(new JLabel(PluginServices.getText(this, "Superior")));
88
        aux2.add(txtTopMargin = new JTextField(10));
89
        aux2.add(new JLabel(PluginServices.getText(this, "Izquierdo")));
90
        aux2.add(txtLeftMargin = new JTextField(10));
91
        aux2.add(new JLabel(PluginServices.getText(this, "Inferior")));
92
        aux2.add(txtBottomMargin = new JTextField(10));
93
        aux2.add(new JLabel(PluginServices.getText(this, "Derecho")));
94
        aux2.add(txtRightMargin = new JTextField(10));
95
        addComponent("", aux2);
96
    }
97

  
98
    public void storeValues() throws StoreException {
99
        // TODO Auto-generated method stub
100

  
101
    }
102

  
103
    public void setChangesApplied() {
104
        // TODO Auto-generated method stub
105

  
106
    }
107

  
108
    public String getID() {
109
        return id;
110
    }
111

  
112
    public String getTitle() {
113
        return PluginServices.getText(this,
114
            "options.layout.paper_properties.title");
115
    }
116

  
117
    public JPanel getPanel() {
118
        return this;
119
    }
120

  
121
    public void initializeValues() {
122
        // TODO Auto-generated method stub
123

  
124
    }
125

  
126
    public void initializeDefaults() {
127
        rdBtnLandscapePage.setSelected(FACTORY_DEFAULT_LANDSCAPED_PAGE);
128
        rdBtnPortraitPage.setSelected(!FACTORY_DEFAULT_LANDSCAPED_PAGE);
129
    }
130

  
131
    public ImageIcon getIcon() {
132
        return icon;
133
    }
134

  
135
    public boolean isValueChanged() {
136
        // TODO Auto-generated method stub
137
        return false;
138
    }
139

  
140
}
0 141

  
tags/org.gvsig.app.document.layout.app-2.0.28/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/LayoutEvents.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.project.documents.layout;
23

  
24
import java.awt.event.ActionEvent;
25
import java.awt.event.ActionListener;
26
import java.awt.event.ComponentEvent;
27
import java.awt.event.ComponentListener;
28
import java.awt.event.MouseEvent;
29
import java.awt.event.MouseListener;
30
import java.awt.event.MouseMotionListener;
31

  
32
import org.gvsig.app.project.documents.layout.gui.FPopupMenu;
33
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
34
import org.gvsig.fmap.mapcontrol.tools.BehaviorException;
35
import org.gvsig.utils.exceptionHandling.ExceptionHandlingSupport;
36
import org.gvsig.utils.exceptionHandling.ExceptionListener;
37

  
38
/**
39
 * Eventos que se realizan sobre el Layout.
40
 * 
41
 * @author Vicente Caballero Navarro
42
 */
43
public class LayoutEvents implements ActionListener, ComponentListener,
44
    MouseMotionListener, MouseListener {
45

  
46
    private LayoutPanel layout = null;
47
    private ExceptionHandlingSupport exceptionHandlingSupport =
48
        new ExceptionHandlingSupport();
49

  
50
    /**
51
     * Crea un nuevo EventsHandler.
52
     * 
53
     * @param l
54
     *            Referencia al Layout.
55
     */
56
    public LayoutEvents(LayoutPanel l) {
57
        layout = l;
58
    }
59

  
60
    /**
61
     * @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent)
62
     */
63
    public void componentHidden(ComponentEvent arg0) {
64
    }
65

  
66
    /**
67
     * @see java.awt.event.ComponentListener#componentMoved(java.awt.event.ComponentEvent)
68
     */
69
    public void componentMoved(ComponentEvent arg0) {
70
    }
71

  
72
    /**
73
     * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
74
     */
75
    public void componentResized(ComponentEvent arg0) {
76
        layout.getLayoutControl().fullRect();
77
    }
78

  
79
    /**
80
     * @see java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent)
81
     */
82
    public void componentShown(ComponentEvent arg0) {
83
    }
84

  
85
    /**
86
     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
87
     */
88
    public void actionPerformed(ActionEvent arg0) {
89
        layout.repaint();
90
    }
91

  
92
    /**
93
     * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)
94
     */
95
    public void mouseDragged(MouseEvent e) {
96
        if (e.getButton() != MouseEvent.BUTTON3) {
97
            layout.getLayoutControl().setLastPoint();
98
            layout.repaint();
99
        }
100
        try {
101
            layout.getLayoutControl().getCurrentLayoutTool().mouseDragged(e);
102
        } catch (BehaviorException t) {
103
            throwException(t);
104
        }
105
        layout.getLayoutControl().setPosition(e.getPoint());
106
    }
107

  
108
    /**
109
     * @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent)
110
     */
111
    public void mouseMoved(MouseEvent e) {
112
        layout.getLayoutControl().setPosition(e.getPoint());
113
        try {
114
            layout.getLayoutControl().getCurrentLayoutTool().mouseMoved(e);
115
        } catch (BehaviorException t) {
116
            throwException(t);
117
        }       
118
        layout.repaint();
119
    }
120

  
121
    /**
122
     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
123
     */
124
    public void mouseClicked(MouseEvent e) {
125
        try {
126
            layout.getLayoutControl().getCurrentLayoutTool().mouseClicked(e);
127
        } catch (BehaviorException t) {
128
            throwException(t);
129
        }
130
    }
131

  
132
    /**
133
     * A?ade un listener de tipo ExceptionListener.
134
     * 
135
     * @param o
136
     *            ExceptionListener.
137
     */
138
    public void addExceptionListener(ExceptionListener o) {
139
        exceptionHandlingSupport.addExceptionListener(o);
140
    }
141

  
142
    /**
143
     * Borra la ExceptioListener que se pasa como par?metro.
144
     * 
145
     * @param o
146
     *            ExceptionListener.
147
     * 
148
     * @return True si se borra correctamente.
149
     */
150
    public boolean removeExceptionListener(ExceptionListener o) {
151
        return exceptionHandlingSupport.removeExceptionListener(o);
152
    }
153

  
154
    /**
155
     * Lanza una Excepci?n.
156
     * 
157
     * @param t
158
     *            Excepci?n.
159
     */
160
    protected void throwException(Throwable t) {
161
        exceptionHandlingSupport.throwException(t);
162
    }
163

  
164
    /**
165
     * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
166
     */
167
    public void mouseEntered(MouseEvent e) {
168
        layout.getLayoutControl().clearMouseImage();
169
        try {
170
            layout.getLayoutControl().getCurrentLayoutTool().mouseEntered(e);
171
        } catch (BehaviorException t) {
172
            throwException(t);
173
        }
174
    }
175

  
176
    /**
177
     * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
178
     */
179
    public void mouseExited(MouseEvent e) {
180
        try {
181
            layout.getLayoutControl().getCurrentLayoutTool().mouseExited(e);
182
        } catch (BehaviorException t) {
183
            throwException(t);
184
        }
185
    }
186

  
187
    /**
188
     * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
189
     */
190
    public void mousePressed(MouseEvent e) {
191
        if (e.getButton() == MouseEvent.BUTTON1) {
192
            layout.getLayoutControl().setPointAnt();
193
            layout.getLayoutControl().setFirstPoint();
194
            try {
195
                layout.getLayoutControl().getCurrentLayoutTool()
196
                    .mousePressed(e);
197
            } catch (BehaviorException t) {
198
                throwException(t);
199
            }
200
        } else
201
            if (e.getButton() == MouseEvent.BUTTON3) {
202
                FPopupMenu popmenu = new FPopupMenu(layout);
203
                layout.add(popmenu);
204
                popmenu.show(e.getComponent(), e.getX(), e.getY());
205
            }
206
    }
207

  
208
    /**
209
     * @see java.awt.event.MouseListener#mouseReleassed(java.awt.event.MouseEvent)
210
     */
211
    public void mouseReleased(MouseEvent e) {
212
        if (e.getButton() != MouseEvent.BUTTON3) {
213
            layout.getLayoutControl().setLastPoint();
214
        }
215

  
216
        if (e.getButton() == MouseEvent.BUTTON1) {
217
            try {
218
                layout.getLayoutControl().getCurrentLayoutTool()
219
                    .mouseReleased(e);
220
            } catch (BehaviorException t) {
221
                throwException(t);
222
            }
223
            layout.getLayoutControl().setCancelDrawing(false);
224
        } else
225
            if (e.getButton() == MouseEvent.BUTTON3) {
226
            }
227

  
228
    }
229
}
tags/org.gvsig.app.document.layout.app-2.0.28/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/fframes/FFrameGroupFactory.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.project.documents.layout.fframes;
23

  
24
import org.gvsig.andami.PluginServices;
25

  
26
/**
27
 * Factory of FFrameGroup.
28
 * 
29
 * @author Vicente Caballero Navarro
30
 */
31
public class FFrameGroupFactory extends FrameFactory {
32

  
33
    /**
34
     * Create a new IFFrame.
35
     * 
36
     * @return IFFrame.
37
     */
38
    public IFFrame createFrame() {
39
        FFrameGroup group = new FFrameGroup();
40
        group.setFrameFactory(this);
41
        return group;
42
    }
43

  
44
    /**
45
     * Returns the name of registration in the point of extension.
46
     * 
47
     * @return Name of registration
48
     */
49
    public String getRegisterName() {
50
        return FFrameGroup.PERSISTENCE_DEFINITION_NAME;
51
    }
52

  
53
    /**
54
     * Returns the name of IFFrame.
55
     * 
56
     * @return Name of IFFrame.
57
     */
58
    public String getNameType() {
59
        return PluginServices.getText(this, "FFrameGroup");
60
    }
61
}
tags/org.gvsig.app.document.layout.app-2.0.28/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/fframes/ListWithoutOverViewModel.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.project.documents.layout.fframes;
23

  
24
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
25

  
26
/**
27
 * Modelo de la Lista de vistas a seleccionar sin incluir los localizadores.
28
 * 
29
 * @author Vicente Caballero Navarro
30
 */
31
public class ListWithoutOverViewModel extends ListViewModel {
32

  
33
    private static final long serialVersionUID = -1517908986169830326L;
34

  
35
    /**
36
     * Add all fframeviews into a list.
37
     * 
38
     * @param l
39
     *            Layout.
40
     */
41
    public void addViews(LayoutPanel l) {
42
        int num = 0;
43
        l.getLayoutContext().updateFFrames();
44
        IFFrame[] fframes = l.getLayoutContext().getFFrames();
45
        for (int i = 0; i < fframes.length; i++) {
46
            IFFrame f = fframes[i];
47

  
48
            if (f instanceof FFrameView && !(f instanceof FFrameOverView)) {
49
                views.add(f);
50
                ((FFrameView) f).setNum(num);
51
                num++;
52
            }
53
        }
54
    }
55
}
tags/org.gvsig.app.document.layout.app-2.0.28/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/fframes/FFrameTable.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.project.documents.layout.fframes;
23

  
24
import java.awt.Color;
25
import java.awt.Graphics2D;
26
import java.awt.Image;
27
import java.awt.event.MouseEvent;
28
import java.awt.geom.AffineTransform;
29
import java.awt.geom.Point2D;
30
import java.awt.geom.Rectangle2D;
31
import java.awt.image.BufferedImage;
32
import java.util.ArrayList;
33
import java.util.List;
34

  
35
import org.gvsig.andami.PluginServices;
36
import org.gvsig.fmap.dal.exception.ReadException;
37
import org.gvsig.tools.ToolsLocator;
38
import org.gvsig.tools.dynobject.DynStruct;
39
import org.gvsig.tools.persistence.PersistenceManager;
40
import org.gvsig.tools.persistence.PersistentState;
41
import org.gvsig.tools.persistence.exception.PersistenceException;
42

  
43
/**
44
 * DOCUMENT ME!
45
 * 
46
 * @author Vicente Caballero Navarro
47
 */
48
public class FFrameTable extends FFrameGroup implements IFFrameGroupSelectable {
49

  
50
    public static final String PERSISTENCE_DEFINITION_NAME = "FFrameTable";
51

  
52
    private static final String NUMCOLUMNS_FIELD = "numColumns";
53
    private static final String NUMROWS_FIELD = "numRows";
54

  
55
    private int numColumns = 2;
56
    private int numRows = 2;
57
    private static AffineTransform identity = new AffineTransform();
58
    private boolean selectFFrameBasic = false;
59
    private static Image iMove = null;
60

  
61
    /**
62
     * DOCUMENT ME!
63
     * 
64
     * @param g
65
     *            DOCUMENT ME!
66
     * @param at
67
     *            DOCUMENT ME!
68
     * @param rv
69
     *            DOCUMENT ME!
70
     * @param imgBase
71
     *            DOCUMENT ME!
72
     */
73
    public void draw(Graphics2D g, AffineTransform at, Rectangle2D rv,
74
        BufferedImage imgBase) {
75
        Rectangle2D.Double r = getBoundingBox(at);
76
        g.setColor(Color.black);
77
        g.rotate(Math.toRadians(getRotation()), r.x + (r.width / 2), r.y
78
            + (r.height / 2));
79
        drawRectangles(g, at, rv, imgBase);
80
        g.rotate(Math.toRadians(-getRotation()), r.x + (r.width / 2), r.y
81
            + (r.height / 2));
82
        super.draw(g, at, rv, imgBase);
83
    }
84

  
85
    private void drawRectangles(Graphics2D g, AffineTransform at,
86
        Rectangle2D rv, BufferedImage imgBase) {
87
        IFFrame[] fframes = getFFrames();
88
        for (int i = 0; i < fframes.length; i++) {
89
            FFrameBasic basic = (FFrameBasic) fframes[i];
90
            basic.draw(g, at, rv, imgBase);
91
        }
92
    }
93

  
94
    /**
95
     * DOCUMENT ME!
96
     * 
97
     * @param r
98
     *            DOCUMENT ME!
99
     * @param g
100
     *            DOCUMENT ME!
101
     */
102
    public void drawBox(Rectangle2D r, Graphics2D g) {
103
        calculateTable(r);
104
        IFFrame[] fframes = getFFrames();
105
        for (int i = 0; i < fframes.length; i++) {
106
            FFrameBasic basic = (FFrameBasic) fframes[i];
107
            basic.draw(g, identity, null, null);
108
        }
109
    }
110

  
111
    /**
112
     * DOCUMENT ME!
113
     * 
114
     * @param g
115
     *            DOCUMENT ME!
116
     * @param at
117
     *            DOCUMENT ME!
118
     * 
119
     * @throws ReadDriverException
120
     */
121
    public void print(Graphics2D g, AffineTransform at) throws ReadException {
122
        draw(g, at, null, null);
123
    }
124

  
125
    /**
126
     * DOCUMENT ME!
127
     * 
128
     * @return DOCUMENT ME!
129
     */
130
    public String getNameFFrame() {
131
        return PluginServices.getText(this, "box") + num;
132
    }
133

  
134
    public String getName() {
135
        return PERSISTENCE_DEFINITION_NAME;
136
    }
137

  
138
    /**
139
     * DOCUMENT ME!
140
     * 
141
     * @return DOCUMENT ME!
142
     */
143
    public int getNumColumns() {
144
        return numColumns;
145
    }
146

  
147
    /**
148
     * DOCUMENT ME!
149
     * 
150
     * @param numColumns
151
     *            DOCUMENT ME!
152
     */
153
    public void setNumColumns(int numColumns) {
154
        this.numColumns = numColumns;
155
    }
156

  
157
    /**
158
     * DOCUMENT ME!
159
     * 
160
     * @return DOCUMENT ME!
161
     */
162
    public int getNumRows() {
163
        return numRows;
164
    }
165

  
166
    /**
167
     * DOCUMENT ME!
168
     * 
169
     * @param numRows
170
     *            DOCUMENT ME!
171
     */
172
    public void setNumRows(int numRows) {
173
        this.numRows = numRows;
174
    }
175

  
176
    public void calculateTable(Rectangle2D r) {
177
        double wC = r.getWidth() / numColumns;
178
        double hR = r.getHeight() / numRows;
179
        int rows = numRows;
180
        clearFFrames();
181
        for (int i = 0; i < numColumns; i++) {
182
            for (int j = 0; j < rows; j++) {
183
                double x = r.getX() + (wC * i);
184
                double y = r.getY() + (hR * j);
185
                double w = wC;
186
                double h = hR;
187
                Rectangle2D rBasic = new Rectangle2D.Double(x, y, w, h);
188
                FFrameBasic basic =
189
                    (FFrameBasic) layoutManager
190
                        .createFrame(FFrameBasic.PERSISTENCE_DEFINITION_NAME);
191
                basic.setRectangle(rBasic);
192
                addFFrame(basic);
193
            }
194
        }
195
    }
196

  
197
    public void selectFFrame(boolean b) {
198
        selectFFrameBasic = b;
199
    }
200

  
201
    public IFFrame joinFFrame() {
202
        IFFrame[] fframes = this.getFFrames();
203
        Rectangle2D r = null;
204

  
205
        for (int i = fframes.length - 1; i >= 0; i--) {
206
            if (fframes[i].getSelected() != IFFrame.NOSELECT) {
207
                if (r == null) {
208
                    r = (Rectangle2D) fframes[i].getBoundBox().clone();
209
                } else {
210
                    r.add(fframes[i].getBoundBox());
211
                }
212
                this.removeFFrame(i);
213
            }
214
        }
215
        if (r != null) {
216
            // Layout
217
            FFrameBasic basic =
218
                (FFrameBasic) layoutManager
219
                    .createFrame(FFrameBasic.PERSISTENCE_DEFINITION_NAME);
220
            basic.setRectangle(r);
221
            this.addFFrame(basic);
222
            return this;
223
        }
224

  
225
        return null;
226
    }
227

  
228
    public void setSelected(Point2D p, MouseEvent e) {
229
        if (!selectFFrameBasic) {
230
            super.setSelected(p, e);
231
        } else {
232
            setSelectedGroup(p, e);
233
        }
234
    }
235

  
236
    public boolean contains(Point2D p) {
237
        if (!selectFFrameBasic) {
238
            return super.contains(p);
239
        }
240
        return contains(p);
241
    }
242

  
243
    public void drawHandlers(Graphics2D g) {
244
        if (!selectFFrameBasic) {
245
            super.drawHandlers(g);
246
        } else {
247
            drawHandlersGroup(g);
248

  
249
        }
250
    }
251

  
252
    public int getContains(Point2D p) {
253
        if (!selectFFrameBasic) {
254
            return super.getContains(p);
255
        }
256
        return getContainsGroup(p);
257
    }
258

  
259
    public Rectangle2D getMovieRect(int difx, int dify) {
260
        // TODO Esto de momento lo dejo que no se pueda mover
261
        // cuando se tiene seleccionada la herramienta de selecci�n de un
262
        // FFrameBasic.
263
        Rectangle2D r = super.getMovieRect(difx, dify);
264
        if (!selectFFrameBasic) {
265
            return r;
266
        }
267
        r = super.getMovieRect(0, 0);
268
        return r;
269
    }
270

  
271
    public Rectangle2D getMovieRectGroup(int difX, int difY) {
272
        Rectangle2D r = null;
273
        IFFrame[] fframes = getFFrames();
274
        List<IFFrame> selected = new ArrayList<IFFrame>();
275
        for (int i = 0; i < fframes.length; i++) {
276
            IFFrame fframe = fframes[i];
277
            if (fframe.getSelected() != IFFrame.NOSELECT) {
278
                selected.add(fframe);
279
            }
280
        }
281

  
282
        for (int i = 0; i < selected.size(); i++) {
283

  
284
            if (i == 0) {
285
                r = selected.get(i).getMovieRect(difX, difY);
286
            } else {
287
                r.add(selected.get(i).getMovieRect(difX, difY));
288
            }
289
        }
290
        return r;
291
    }
292

  
293
    public int getContainsGroup(Point2D p) {
294
        List<IFFrame> selected = new ArrayList<IFFrame>();
295
        IFFrame[] fframes = getFFrames();
296
        for (int i = 0; i < fframes.length; i++) {
297
            IFFrame fframe = fframes[i];
298
            int contains = fframe.getContains(p);
299
            if (contains != IFFrame.NOSELECT) {
300
                if (contains == IFFrame.RECT) {
301
                    selected.add(fframe);
302
                } else {
303
                    return contains;
304
                }
305
            }
306
        }
307
        if (selected.size() > 0) {
308
            return selected.get(0).getContains(p);
309
        }
310
        return 0;
311
    }
312

  
313
    /**
314
     * Dibuja los handlers sobre el boundingBox en el graphics que se pasa como
315
     * par�metro.
316
     * 
317
     * @param g
318
     *            Graphics sobre el que dibujar.
319
     */
320
    public void drawHandlersGroup(Graphics2D g) {
321
        int size = 8;
322
        g.setColor(Color.gray);
323
        IFFrame[] fframes = getFFrames();
324
        for (int i = 0; i < fframes.length; i++) {
325
            IFFrame fframe = fframes[i];
326
            if (fframe.getSelected() != IFFrame.NOSELECT) {
327
                Rectangle2D r = fframe.getBoundingBox(null);
328
                Point2D p = new Point2D.Double();
329
                g.rotate(Math.toRadians(getRotation()),
330
                    r.getX() + (r.getWidth() / 2), r.getY()
331
                        + (r.getHeight() / 2));
332

  
333
                AffineTransform atRotate = new AffineTransform();
334
                atRotate.rotate(Math.toRadians(getRotation()),
335
                    r.getX() + (r.getWidth() / 2), r.getY()
336
                        + (r.getHeight() / 2));
337

  
338
                g.fillRect((int) r.getX() - size / 2,
339
                    (int) r.getY() - size / 2, size, size);
340
                atRotate
341
                    .transform(new Point2D.Double(r.getX() - size / 2, r.getY()
342
                        - size / 2), p);
343
                no.setRect((int) p.getX(), (int) p.getY(), size, size);
344

  
345
                g.fillRect((int) r.getMaxX() - size / 2, (int) r.getY() - size
346
                    / 2, size, size);
347
                atRotate.transform(
348
                    new Point2D.Double(r.getMaxX() - size / 2, r.getY() - size
349
                        / 2), p);
350
                ne.setRect((int) p.getX(), (int) p.getY(), size, size);
351

  
352
                g.fillRect((int) r.getX() - size / 2, (int) r.getMaxY() - size
353
                    / 2, size, size);
354
                atRotate.transform(
355
                    new Point2D.Double(r.getX() - size / 2, r.getMaxY() - size
356
                        / 2), p);
357
                so.setRect((int) p.getX(), (int) p.getY(), size, size);
358

  
359
                g.fillRect((int) r.getMaxX() - size / 2, (int) r.getMaxY()
360
                    - size / 2, size, size);
361
                atRotate.transform(
362
                    new Point2D.Double(r.getMaxX() - size / 2, r.getMaxY()
363
                        - size / 2), p);
364
                se.setRect((int) p.getX(), (int) p.getY(), size, size);
365

  
366
                g.fillRect((int) r.getCenterX() - (size / 2), (int) r.getY()
367
                    - size / 2, size, size);
368
                atRotate.transform(new Point2D.Double(r.getCenterX()
369
                    - (size / 2), r.getY() - size / 2), p);
370
                n.setRect((int) p.getX(), (int) p.getY(), size, size);
371

  
372
                g.fillRect((int) r.getCenterX() - (size / 2), (int) r.getMaxY()
373
                    - size / 2, size, size);
374
                atRotate.transform(new Point2D.Double(r.getCenterX()
375
                    - (size / 2), r.getMaxY() - size / 2), p);
376
                s.setRect((int) p.getX(), (int) p.getY(), size, size);
377

  
378
                g.fillRect((int) r.getX() - size / 2, (int) r.getCenterY()
379
                    - (size / 2), size, size);
380
                atRotate.transform(
381
                    new Point2D.Double(r.getX() - size / 2, r.getCenterY()
382
                        - (size / 2)), p);
383
                o.setRect((int) p.getX(), (int) p.getY(), size, size);
384

  
385
                g.fillRect((int) r.getMaxX() - size / 2, (int) r.getCenterY()
386
                    - (size / 2), size, size);
387
                atRotate.transform(
388
                    new Point2D.Double(r.getMaxX() - size / 2, r.getCenterY()
389
                        - (size / 2)), p);
390
                e.setRect((int) p.getX() - size / 2, (int) p.getY() - size / 2,
391
                    size, size);
392
                g.rotate(Math.toRadians(-getRotation()),
393
                    r.getX() + (r.getWidth() / 2), r.getY()
394
                        + (r.getHeight() / 2));
395
            }
396
        }
397

  
398
    }
399

  
400
    public boolean containsGroup(Point2D p) {
401
        IFFrame[] fframes = getFFrames();
402
        for (int i = 0; i < fframes.length; i++) {
403
            IFFrame fframe = fframes[i];
404
            if (fframe.contains(p)) {
405
                return true;
406
            }
407
        }
408
        return false;
409
    }
410

  
411
    public void setSelectedGroup(Point2D p, MouseEvent e) {
412
        IFFrame[] fframes = getFFrames();
413
        if (!e.isShiftDown()) {
414
            for (int j = 0; j < fframes.length; j++) {
415
                fframes[j].setSelected(false);
416
            }
417
            for (int i = 0; i < fframes.length; i++) {
418
                IFFrame fframe = fframes[i];
419
                fframe.setSelected(p, e);
420
            }
421
        } else {
422
            for (int i = 0; i < fframes.length; i++) {
423
                IFFrame fframe = fframes[i];
424
                if (fframe.contains(p)) {
425
                    if ((fframe.getSelected() == IFFrame.NOSELECT)) {
426
                        fframe.setSelected(p, e);
427
                    } else {
428
                        fframe.setSelected(false);
429
                    }
430
                }
431
            }
432
        }
433
    }
434

  
435
    public int getSelectedGroup() {
436
        return 0;
437
    }
438

  
439
    public Image getMapCursor(Point2D p) {
440
        if (!selectFFrameBasic) {
441
            return super.getMapCursor(p);
442
        }
443
        return getMapCursorGroup(p);
444
    }
445

  
446
    public Image getMapCursorGroup(Point2D p) {
447
        int select = getContains(p);
448
        switch (select) {
449
        case (RECT):
450
            return iMove;
451
        }
452
        return null;
453
    }
454

  
455
    /**
456
     * Initilizes the static icons
457
     */
458
    public static void initializeIcons() {
459
        iMove = PluginServices.getIconTheme().get("graphic-move-icon").getImage();
460
    }
461

  
462
    public static void registerPersistent() {
463
        PersistenceManager manager = ToolsLocator.getPersistenceManager();
464
        if (manager.getDefinition(PERSISTENCE_DEFINITION_NAME) == null) {
465
            DynStruct definition =
466
                manager.addDefinition(FFrameTable.class,
467
                    PERSISTENCE_DEFINITION_NAME,
468
                    "FFrameTable persistence definition", null, null);
469

  
470
            definition.extend(manager
471
                .getDefinition(FFrameGroup.PERSISTENCE_DEFINITION_NAME));
472

  
473
            definition.addDynFieldInt(NUMCOLUMNS_FIELD).setMandatory(true);
474
            definition.addDynFieldInt(NUMROWS_FIELD).setMandatory(true);
475
        }
476
    }
477

  
478
    @Override
479
    public void loadFromState(PersistentState state)
480
        throws PersistenceException {
481
        super.loadFromState(state);
482
        numColumns = state.getInt(NUMCOLUMNS_FIELD);
483
        numRows = state.getInt(NUMROWS_FIELD);
484
    }
485

  
486
    @Override
487
    public void saveToState(PersistentState state) throws PersistenceException {
488
        super.saveToState(state);
489
        state.set(NUMCOLUMNS_FIELD, numColumns);
490
        state.set(NUMROWS_FIELD, numRows);
491
    }
492
}
tags/org.gvsig.app.document.layout.app-2.0.28/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/fframes/FFrameGraphicsFactory.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
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff