Revision 533
tags/org.gvsig.app.document.layout2.app-2.0.75/org.gvsig.app.document.layout2.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Tue Feb 16 23:03:44 CET 2016 |
|
2 |
buildNumber=94 |
tags/org.gvsig.app.document.layout2.app-2.0.75/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.75/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.75/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.75/org.gvsig.app.document.layout2.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 java.awt.GridBagConstraints; |
|
25 |
import java.awt.Insets; |
|
26 |
|
|
27 |
import javax.swing.BorderFactory; |
|
28 |
import javax.swing.ImageIcon; |
|
29 |
import javax.swing.JCheckBox; |
|
30 |
import javax.swing.JComboBox; |
|
31 |
import javax.swing.JLabel; |
|
32 |
import javax.swing.JPanel; |
|
33 |
import javax.swing.JTextField; |
|
34 |
|
|
35 |
import org.gvsig.andami.IconThemeHelper; |
|
36 |
import org.gvsig.andami.PluginServices; |
|
37 |
import org.gvsig.andami.PluginsLocator; |
|
38 |
import org.gvsig.andami.preferences.AbstractPreferencePage; |
|
39 |
import org.gvsig.andami.preferences.StoreException; |
|
40 |
import org.gvsig.app.project.ProjectManager; |
|
41 |
import org.gvsig.app.project.documents.layout.Attributes; |
|
42 |
import org.gvsig.app.project.documents.layout.DefaultLayoutManager; |
|
43 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
44 |
import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
|
45 |
import org.gvsig.i18n.Messages; |
|
46 |
import org.gvsig.utils.XMLEntity; |
|
47 |
|
|
48 |
/** |
|
49 |
* Layout preference page where the user can establish default values for |
|
50 |
* <ol> |
|
51 |
* <li><b>grid horizontal gap</b></li> |
|
52 |
* <li><b>grid vertical gap</b></li> |
|
53 |
* <li><b>show or hide grid</b></li> |
|
54 |
* <li><b>adjust elements to grid</b></li> |
|
55 |
* <li><b>show or hide rules</b></li> |
|
56 |
* </ol> |
|
57 |
* |
|
58 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
|
59 |
* |
|
60 |
*/ |
|
61 |
public class LayoutPage extends AbstractPreferencePage { |
|
62 |
|
|
63 |
private static final long serialVersionUID = -8225970409668105935L; |
|
64 |
static String id = LayoutPage.class.getName();; |
|
65 |
private ImageIcon icon; |
|
66 |
private JCheckBox chkGridEnabled; |
|
67 |
private JCheckBox chkShowRules; |
|
68 |
private JCheckBox chkShowGrid; |
|
69 |
private JTextField txtVGap; |
|
70 |
private JTextField txtHGap; |
|
71 |
private JCheckBox chkShowInitialPageConfig; |
|
72 |
private JCheckBox chkShowLayoutTOC; |
|
73 |
private JComboBox cbHGapUnit; |
|
74 |
private JComboBox cbVGapUnit; |
|
75 |
|
|
76 |
private static DefaultLayoutManager layoutManager = null; |
|
77 |
|
|
78 |
/** |
|
79 |
* Builds preference page where the user can establish default values for |
|
80 |
* <ol> |
|
81 |
* <li><b>grid horizontal gap</b></li> |
|
82 |
* <li><b>grid vertical gap</b></li> |
|
83 |
* <li><b>show or hide grid</b></li> |
|
84 |
* <li><b>adjust elements to grid</b></li> |
|
85 |
* <li><b>show or hide rules</b></li> |
|
86 |
* </ol> |
|
87 |
*/ |
|
88 |
public LayoutPage() { |
|
89 |
super(); |
|
90 |
layoutManager = |
|
91 |
(DefaultLayoutManager) ProjectManager.getInstance() |
|
92 |
.getDocumentManager(DefaultLayoutManager.TYPENAME); |
|
93 |
|
|
94 |
icon = IconThemeHelper.getImageIcon("document-map-icon"); |
|
95 |
|
|
96 |
GridBagLayoutPanel gridRulerPanel = new GridBagLayoutPanel(); |
|
97 |
Insets topInsets = new Insets(10, 10, 0, 10); |
|
98 |
Insets insets = new Insets(8, 10, 0, 10); |
|
99 |
Insets lastInsets = new Insets(8, 10, 12, 10); |
|
100 |
gridRulerPanel.setBorder(BorderFactory.createTitledBorder(Messages.getText("Grid_and_ruler"))); |
|
101 |
|
|
102 |
// horizontal gap text field and units combo |
|
103 |
cbHGapUnit = new JComboBox(); |
|
104 |
String[] names = MapContext.getDistanceNames(); |
|
105 |
for (int i = 0; i < names.length; i++) { |
|
106 |
cbHGapUnit.addItem(PluginServices.getText(this, names[i])); |
|
107 |
} |
|
108 |
gridRulerPanel.addComponent(new JLabel(PluginServices.getText(this, "espaciado_horizontal")), |
|
109 |
txtHGap = new JTextField(5), cbHGapUnit, GridBagConstraints.NONE, insets); |
|
110 |
|
|
111 |
// vertical gap text field and units combo |
|
112 |
cbVGapUnit = new JComboBox(); |
|
113 |
for (int i = 0; i < names.length; i++) { |
|
114 |
cbVGapUnit.addItem(PluginServices.getText(this, names[i])); |
|
115 |
} |
|
116 |
gridRulerPanel.addComponent(new JLabel(PluginServices.getText(this, "espaciado_vertical")), |
|
117 |
txtVGap = new JTextField(5), cbVGapUnit, GridBagConstraints.NONE, insets); |
|
118 |
|
|
119 |
// show/hide show check |
|
120 |
gridRulerPanel.addComponent(chkShowGrid = |
|
121 |
new JCheckBox(PluginServices.getText(this, "visualizar_cuadricula")), insets); |
|
122 |
|
|
123 |
// enable/disable grid |
|
124 |
gridRulerPanel.addComponent(chkGridEnabled = |
|
125 |
new JCheckBox(PluginServices.getText(this, "malla_activada")), insets); |
|
126 |
|
|
127 |
// show/hide rules |
|
128 |
gridRulerPanel.addComponent(chkShowRules = |
|
129 |
new JCheckBox(PluginServices.getText(this, "activar_regla")), lastInsets); |
|
130 |
|
|
131 |
addComponent(gridRulerPanel, topInsets); |
|
132 |
|
|
133 |
GridBagLayoutPanel behaviourPanel = new GridBagLayoutPanel(); |
|
134 |
behaviourPanel.setBorder(BorderFactory.createTitledBorder(Messages.getText("User_interface"))); |
|
135 |
|
|
136 |
behaviourPanel.addComponent( |
|
137 |
chkShowInitialPageConfig = new JCheckBox(Messages.getText("Show_page_config_dialog_when_layout_document_is_created")), |
|
138 |
insets); |
|
139 |
|
|
140 |
behaviourPanel.addComponent( |
|
141 |
chkShowLayoutTOC = new JCheckBox(Messages.getText("Show_table_of_contents_TOC_for_Layout_views")), |
|
142 |
insets); |
|
143 |
|
|
144 |
addComponent(behaviourPanel, lastInsets); |
|
145 |
|
|
146 |
} |
|
147 |
|
|
148 |
public void storeValues() throws StoreException { |
|
149 |
double hGap, vGap; |
|
150 |
boolean gridEnabled, showRules, showGrid, showInitPageConfig, |
|
151 |
showLayoutToc; |
|
152 |
String hGapUnits, vGapUnits; |
|
153 |
try { |
|
154 |
hGap = Double.parseDouble(txtHGap.getText()); |
|
155 |
hGapUnits = MapContext.getDistanceAbbr()[cbHGapUnit.getSelectedIndex()]; |
|
156 |
vGap = Double.parseDouble(txtVGap.getText()); |
|
157 |
vGapUnits = MapContext.getDistanceAbbr()[cbVGapUnit.getSelectedIndex()]; |
|
158 |
gridEnabled = chkGridEnabled.isSelected(); |
|
159 |
showGrid = chkShowGrid.isSelected(); |
|
160 |
showRules = chkShowRules.isSelected(); |
|
161 |
showInitPageConfig = chkShowInitialPageConfig.isSelected(); |
|
162 |
showLayoutToc = chkShowLayoutTOC.isSelected(); |
|
163 |
} catch (Exception e) { |
|
164 |
throw new StoreException(PluginServices.getText(this, |
|
165 |
"invalid_value_for_gap")); |
|
166 |
} |
|
167 |
layoutManager.setDefaultShowGrid(showGrid); |
|
168 |
layoutManager.setDefaultAdjustToGrid(gridEnabled); |
|
169 |
layoutManager.setDefaultShowRulers(showRules); |
|
170 |
Attributes.setDefaultGridGap(hGap, vGap, hGapUnits, vGapUnits); |
|
171 |
PluginServices ps = PluginsLocator.getManager().getPlugin(this); |
|
172 |
XMLEntity xml = ps.getPersistentXML(); |
|
173 |
xml.putProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME, hGap); |
|
174 |
xml.putProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME, vGap); |
|
175 |
xml.putProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_UNITS_KEY_NAME, hGapUnits); |
|
176 |
xml.putProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_VERTICAL_GAP_UNITS_KEY_NAME, vGapUnits); |
|
177 |
xml.putProperty(PreferenceKeys.DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME, showGrid); |
|
178 |
xml.putProperty(PreferenceKeys.DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME, gridEnabled); |
|
179 |
xml.putProperty(PreferenceKeys.DEFAULT_SHOW_LAYOUT_RULERS_KEY_NAME, showRules); |
|
180 |
xml.putProperty(PreferenceKeys.DEFAULT_SHOW_INITIAL_CONFIG_DIALOG_KEY_NAME, showInitPageConfig); |
|
181 |
xml.putProperty(PreferenceKeys.DEFAULT_SHOW_LAYOUT_TOC_KEY_NAME, showLayoutToc); |
|
182 |
} |
|
183 |
|
|
184 |
public String getID() { |
|
185 |
return id; |
|
186 |
} |
|
187 |
|
|
188 |
public String getTitle() { |
|
189 |
return PluginServices.getText(this, "Mapa"); |
|
190 |
} |
|
191 |
|
|
192 |
public JPanel getPanel() { |
|
193 |
return this; |
|
194 |
} |
|
195 |
|
|
196 |
public void initializeValues() { |
|
197 |
PluginServices ps = PluginsLocator.getManager().getPlugin(this); |
|
198 |
XMLEntity xml = ps.getPersistentXML(); |
|
199 |
double hGap = PreferenceKeys.FACTORY_DEFAULT_HORIZONTAL_GAP; |
|
200 |
double vGap = PreferenceKeys.FACTORY_DEFAULT_VERTICAL_GAP; |
|
201 |
boolean showGrid = PreferenceKeys.FACTORY_DEFAULT_LAYOUT_GRID_SHOW; |
|
202 |
boolean gridEnabled = PreferenceKeys.FACTORY_DEFAULT_LAYOUT_GRID_ENABLE; |
|
203 |
boolean showRules = PreferenceKeys.FACTORY_DEFAULT_LAYOUT_ENABLE_RULERS; |
|
204 |
boolean showInitPageConfig = PreferenceKeys.FACTORY_DEFAULT_SHOW_INITIAL_CONFIG_DIALOG_FOR_LAYOUT; |
|
205 |
boolean showLayoutToc = PreferenceKeys.FACTORY_DEFAULT_SHOW_LAYOUT_TOC; |
|
206 |
// horizontal gap |
|
207 |
if (xml.contains(PreferenceKeys.DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME)) { |
|
208 |
hGap = |
|
209 |
xml.getDoubleProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME); |
|
210 |
} |
|
211 |
txtHGap.setText(String.valueOf(hGap)); |
|
212 |
|
|
213 |
// vertical gap |
|
214 |
if (xml.contains(PreferenceKeys.DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME)) { |
|
215 |
vGap = |
|
216 |
xml.getDoubleProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME); |
|
217 |
} |
|
218 |
txtVGap.setText(String.valueOf(vGap)); |
|
219 |
|
|
220 |
String hGapUnit = xml.contains(PreferenceKeys.DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_UNITS_KEY_NAME)? |
|
221 |
xml.getStringProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_UNITS_KEY_NAME): |
|
222 |
PreferenceKeys.FACTORY_DEFAULT_HORIZONTAL_GAP_UNIT; |
|
223 |
cbHGapUnit.setSelectedIndex(Attributes.getDistanceAbbrPosition(hGapUnit)); |
|
224 |
|
|
225 |
String vGapUnit = xml.contains(PreferenceKeys.DEFAULT_LAYOUT_GRID_VERTICAL_GAP_UNITS_KEY_NAME)? |
|
226 |
xml.getStringProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_VERTICAL_GAP_UNITS_KEY_NAME): |
|
227 |
PreferenceKeys.FACTORY_DEFAULT_VERTICAL_GAP_UNIT; |
|
228 |
cbVGapUnit.setSelectedIndex(Attributes.getDistanceAbbrPosition(vGapUnit)); |
|
229 |
|
|
230 |
// show/hide grid check |
|
231 |
if (xml.contains(PreferenceKeys.DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME)) { |
|
232 |
showGrid = |
|
233 |
xml.getBooleanProperty(PreferenceKeys.DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME); |
|
234 |
} |
|
235 |
chkShowGrid.setSelected(showGrid); |
|
236 |
|
|
237 |
// enable/disable grid check |
|
238 |
if (xml.contains(PreferenceKeys.DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME)) { |
|
239 |
gridEnabled = |
|
240 |
xml.getBooleanProperty(PreferenceKeys.DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME); |
|
241 |
} |
|
242 |
chkGridEnabled.setSelected(gridEnabled); |
|
243 |
|
|
244 |
// enable/disable rules |
|
245 |
if (xml.contains(PreferenceKeys.DEFAULT_SHOW_LAYOUT_RULERS_KEY_NAME)) { |
|
246 |
showRules = |
|
247 |
xml.getBooleanProperty(PreferenceKeys.DEFAULT_SHOW_LAYOUT_RULERS_KEY_NAME); |
|
248 |
} |
|
249 |
chkShowRules.setSelected(showRules); |
|
250 |
|
|
251 |
if (xml.contains(PreferenceKeys.DEFAULT_SHOW_INITIAL_CONFIG_DIALOG_KEY_NAME)) { |
|
252 |
showInitPageConfig = xml.getBooleanProperty(PreferenceKeys.DEFAULT_SHOW_INITIAL_CONFIG_DIALOG_KEY_NAME); |
|
253 |
} |
|
254 |
chkShowInitialPageConfig.setSelected(showInitPageConfig); |
|
255 |
|
|
256 |
if (xml.contains(PreferenceKeys.DEFAULT_SHOW_LAYOUT_TOC_KEY_NAME)) { |
|
257 |
showLayoutToc = xml.getBooleanProperty(PreferenceKeys.DEFAULT_SHOW_LAYOUT_TOC_KEY_NAME); |
|
258 |
} |
|
259 |
chkShowLayoutTOC.setSelected(showLayoutToc); |
|
260 |
|
|
261 |
layoutManager.setDefaultShowGrid(showGrid); |
|
262 |
layoutManager.setDefaultAdjustToGrid(gridEnabled); |
|
263 |
layoutManager.setDefaultShowRulers(showRules); |
|
264 |
Attributes.setDefaultGridGap(hGap, vGap, hGapUnit, vGapUnit); |
|
265 |
} |
|
266 |
|
|
267 |
public void initializeDefaults() { |
|
268 |
txtHGap.setText(String.valueOf(PreferenceKeys.FACTORY_DEFAULT_HORIZONTAL_GAP)); |
|
269 |
txtVGap.setText(String.valueOf(PreferenceKeys.FACTORY_DEFAULT_VERTICAL_GAP)); |
|
270 |
cbHGapUnit.setSelectedIndex(Attributes.getDistanceAbbrPosition(PreferenceKeys.FACTORY_DEFAULT_HORIZONTAL_GAP_UNIT)); |
|
271 |
cbVGapUnit.setSelectedIndex(Attributes.getDistanceAbbrPosition(PreferenceKeys.FACTORY_DEFAULT_VERTICAL_GAP_UNIT)); |
|
272 |
chkShowGrid.setSelected(PreferenceKeys.FACTORY_DEFAULT_LAYOUT_GRID_SHOW); |
|
273 |
chkGridEnabled.setSelected(PreferenceKeys.FACTORY_DEFAULT_LAYOUT_GRID_ENABLE); |
|
274 |
chkShowRules.setSelected(PreferenceKeys.FACTORY_DEFAULT_LAYOUT_ENABLE_RULERS); |
|
275 |
chkShowInitialPageConfig.setSelected(PreferenceKeys.FACTORY_DEFAULT_SHOW_INITIAL_CONFIG_DIALOG_FOR_LAYOUT); |
|
276 |
} |
|
277 |
|
|
278 |
public ImageIcon getIcon() { |
|
279 |
return icon; |
|
280 |
} |
|
281 |
|
|
282 |
public boolean isValueChanged() { |
|
283 |
return super.hasChanged(); |
|
284 |
} |
|
285 |
|
|
286 |
public void setChangesApplied() { |
|
287 |
setChanged(false); |
|
288 |
} |
|
289 |
} |
tags/org.gvsig.app.document.layout2.app-2.0.75/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/gui/preferencespage/PreferenceKeys.java | ||
---|---|---|
1 |
package org.gvsig.app.gui.preferencespage; |
|
2 |
|
|
3 |
/** |
|
4 |
* The purpose of this interface is to define the keys used for the |
|
5 |
* persistence of this plugin in order to make these keys available |
|
6 |
* on library level, instead of defining them within the |
|
7 |
* preference page (which has UI dependences). |
|
8 |
* |
|
9 |
* @author Cesar Martinez Izquierdo <cesar.izq@gmail.com> |
|
10 |
* |
|
11 |
*/ |
|
12 |
public interface PreferenceKeys { |
|
13 |
String DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME = "DefaultShowLayoutGrid"; |
|
14 |
String DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME = "DefaultEnableLayoutGrid"; |
|
15 |
String DEFAULT_SHOW_LAYOUT_RULERS_KEY_NAME = "DefaultShowLayoutRules"; |
|
16 |
String DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME = "DefaultGridVerticalGap"; |
|
17 |
String DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME = "DefaultGridHorizontalGap"; |
|
18 |
String DEFAULT_LAYOUT_GRID_VERTICAL_GAP_UNITS_KEY_NAME = "DefaultGridVerticalGapUnits"; |
|
19 |
String DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_UNITS_KEY_NAME = "DefaultGridHorizontalGapUnits"; |
|
20 |
String DEFAULT_SHOW_INITIAL_CONFIG_DIALOG_KEY_NAME = "DefaulShowInitialPageConfigLayout"; |
|
21 |
String DEFAULT_SHOW_LAYOUT_TOC_KEY_NAME = "DefaultShowLayoutToc"; |
|
22 |
boolean FACTORY_DEFAULT_LAYOUT_ENABLE_RULERS = true; |
|
23 |
boolean FACTORY_DEFAULT_LAYOUT_GRID_SHOW = true; |
|
24 |
double FACTORY_DEFAULT_VERTICAL_GAP = 1.0d; |
|
25 |
double FACTORY_DEFAULT_HORIZONTAL_GAP = 1.0d; |
|
26 |
String FACTORY_DEFAULT_VERTICAL_GAP_UNIT = "cm"; |
|
27 |
String FACTORY_DEFAULT_HORIZONTAL_GAP_UNIT = "cm"; |
|
28 |
boolean FACTORY_DEFAULT_LAYOUT_GRID_ENABLE = false; |
|
29 |
boolean FACTORY_DEFAULT_SHOW_INITIAL_CONFIG_DIALOG_FOR_LAYOUT = true; |
|
30 |
boolean FACTORY_DEFAULT_SHOW_LAYOUT_TOC = true; |
|
31 |
|
|
32 |
} |
tags/org.gvsig.app.document.layout2.app-2.0.75/org.gvsig.app.document.layout2.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.layout2.app-2.0.75/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/DefaultLayoutDocument.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.util.Iterator; |
|
25 |
import org.gvsig.app.project.documents.AbstractDocument; |
|
26 |
import org.gvsig.app.project.documents.DocumentManager; |
|
27 |
import org.gvsig.tools.persistence.PersistentState; |
|
28 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
29 |
|
|
30 |
/** |
|
31 |
* Modelo del Layout. |
|
32 |
* |
|
33 |
* @author Fernando Gonz?lez Cort?s |
|
34 |
*/ |
|
35 |
public class DefaultLayoutDocument extends AbstractDocument implements |
|
36 |
LayoutDocument { |
|
37 |
|
|
38 |
private static final long serialVersionUID = 7320640550072493414L; |
|
39 |
public static final String PERSISTENCE_DEFINITION_NAME = "DefaultLayoutDocument"; |
|
40 |
|
|
41 |
static final String LAYOUT_CONTEXT_OBJECT = "layoutContext"; |
|
42 |
|
|
43 |
private LayoutContext layoutContext = null; |
|
44 |
|
|
45 |
public DefaultLayoutDocument(DocumentManager factory) { |
|
46 |
super(factory); |
|
47 |
this.layoutContext = new DefaultLayoutContext(); |
|
48 |
|
|
49 |
} |
|
50 |
|
|
51 |
public DefaultLayoutDocument() { |
|
52 |
this(null); |
|
53 |
} |
|
54 |
|
|
55 |
public void loadFromState(PersistentState state) |
|
56 |
throws PersistenceException { |
|
57 |
super.loadFromState(state); |
|
58 |
this.layoutContext = (LayoutContext) state.get(LAYOUT_CONTEXT_OBJECT); |
|
59 |
} |
|
60 |
|
|
61 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
62 |
super.saveToState(state); |
|
63 |
state.set(LAYOUT_CONTEXT_OBJECT, layoutContext); |
|
64 |
} |
|
65 |
|
|
66 |
public LayoutContext getLayoutContext() { |
|
67 |
return layoutContext; |
|
68 |
} |
|
69 |
|
|
70 |
public Iterator deepiterator() { |
|
71 |
return this.layoutContext.deepiterator(); |
|
72 |
} |
|
73 |
|
|
74 |
public Iterator iterator() { |
|
75 |
return this.layoutContext.iterator(); |
|
76 |
} |
|
77 |
} |
tags/org.gvsig.app.document.layout2.app-2.0.75/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/commands/FrameCommandsRecord.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.commands; |
|
23 |
|
|
24 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
|
25 |
import org.gvsig.tools.undo.command.impl.DefaultUndoRedoCommandStack; |
|
26 |
|
|
27 |
/** |
|
28 |
* Clase en memoria para registrar y gestionar los comandos que vamos |
|
29 |
* realizando. La forma en que ha sido implementada esta clase, en vez de una |
|
30 |
* ?nica lista para albergar los comandos de deshacer(undos) y los de |
|
31 |
* rehacer(redos), se ha optado por dos pilas una para deshacer(undos) y otra |
|
32 |
* para rehacer(redos), de esta forma : Cuando se a?ade un nuevo comando, se |
|
33 |
* inserta este a la pila de deshacer(undos) y se borra de la de |
|
34 |
* rehacer(redos). Si se realiza un deshacer se desapila este comando de la |
|
35 |
* pila deshacer(undos) y se apila en la de rehacer(redos). Y de la misma |
|
36 |
* forma cuando se realiza un rehacer se desapila este comando de la pila de |
|
37 |
* rehacer(redos) y pasa a la de deshacer(undos). |
|
38 |
* |
|
39 |
* @author Vicente Caballero Navarro |
|
40 |
*/ |
|
41 |
public class FrameCommandsRecord extends DefaultUndoRedoCommandStack { |
|
42 |
|
|
43 |
private FrameManager expansionManager; |
|
44 |
|
|
45 |
public FrameCommandsRecord(FrameManager expansionManager) { |
|
46 |
this.expansionManager = expansionManager; |
|
47 |
} |
|
48 |
|
|
49 |
public void insert(IFFrame frame) { |
|
50 |
InsertFrameCommand command = |
|
51 |
new InsertFrameCommand(expansionManager, frame, frame.getName()); |
|
52 |
add(command); |
|
53 |
command.execute(); |
|
54 |
} |
|
55 |
|
|
56 |
public void delete(IFFrame frame) { |
|
57 |
DeleteFrameCommand command = |
|
58 |
new DeleteFrameCommand(expansionManager, frame, frame.getName()); |
|
59 |
add(command); |
|
60 |
command.execute(); |
|
61 |
} |
|
62 |
|
|
63 |
public void update(IFFrame frame, IFFrame oldFrame) { |
|
64 |
UpdateFrameCommand command = |
|
65 |
new UpdateFrameCommand(expansionManager, frame, oldFrame, |
|
66 |
frame.getName()); |
|
67 |
add(command); |
|
68 |
command.execute(); |
|
69 |
} |
|
70 |
|
|
71 |
public void clear() { |
|
72 |
super.clear(); |
|
73 |
expansionManager.clear(); |
|
74 |
} |
|
75 |
|
|
76 |
public FrameManager getFrameManager() { |
|
77 |
return expansionManager; |
|
78 |
} |
|
79 |
} |
tags/org.gvsig.app.document.layout2.app-2.0.75/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/commands/DeleteFrameCommand.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.commands; |
|
23 |
|
|
24 |
import java.io.IOException; |
|
25 |
|
|
26 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
|
27 |
import org.gvsig.tools.undo.command.Command; |
|
28 |
import org.gvsig.tools.undo.command.impl.AbstractCommand; |
|
29 |
|
|
30 |
public class DeleteFrameCommand extends AbstractCommand { |
|
31 |
|
|
32 |
private FrameManager fm; |
|
33 |
private int index; |
|
34 |
|
|
35 |
public DeleteFrameCommand(FrameManager fm, IFFrame frame, String description) { |
|
36 |
super(description); |
|
37 |
this.fm = fm; |
|
38 |
for (int i = 0; i < fm.getAllFFrames().length; i++) { |
|
39 |
if (fm.getFFrame(i).equals(frame)) { |
|
40 |
index = i; |
|
41 |
} |
|
42 |
} |
|
43 |
} |
|
44 |
|
|
45 |
/** |
|
46 |
* @throws DriverIOException |
|
47 |
* @throws IOException |
|
48 |
* @see com.iver.cit.gvsig.fmap.edition.Command#undo() |
|
49 |
*/ |
|
50 |
public void undo() { |
|
51 |
fm.undoRemoveFFrame(index); |
|
52 |
} |
|
53 |
|
|
54 |
/** |
|
55 |
* @throws IOException |
|
56 |
* @throws DriverIOException |
|
57 |
* @see com.iver.cit.gvsig.fmap.edition.Command#redo() |
|
58 |
*/ |
|
59 |
public void redo() { |
|
60 |
fm.doRemoveFFrame(index); |
|
61 |
} |
|
62 |
|
|
63 |
public int getType() { |
|
64 |
return Command.DELETE; |
|
65 |
} |
|
66 |
|
|
67 |
public void execute() { |
|
68 |
if (fm.invalidates().get(index)) { |
|
69 |
return; |
|
70 |
} |
|
71 |
fm.doRemoveFFrame(index); |
|
72 |
} |
|
73 |
} |
tags/org.gvsig.app.document.layout2.app-2.0.75/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/commands/UpdateFrameCommand.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.commands; |
|
23 |
|
|
24 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
|
25 |
import org.gvsig.tools.undo.command.Command; |
|
26 |
import org.gvsig.tools.undo.command.impl.AbstractCommand; |
|
27 |
|
|
28 |
public class UpdateFrameCommand extends AbstractCommand { |
|
29 |
private int index; |
|
30 |
private int newIndex; |
|
31 |
private FrameManager fm; |
|
32 |
private IFFrame frame; |
|
33 |
private IFFrame antFrame; |
|
34 |
|
|
35 |
public UpdateFrameCommand(FrameManager fm, IFFrame antFrame, IFFrame frame, |
|
36 |
String description) { |
|
37 |
super(description); |
|
38 |
this.fm = fm; |
|
39 |
this.frame = frame; |
|
40 |
this.antFrame = antFrame; |
|
41 |
} |
|
42 |
|
|
43 |
public void undo() { |
|
44 |
fm.undoModifyFFrame(index, newIndex); |
|
45 |
} |
|
46 |
|
|
47 |
public void redo() { |
|
48 |
fm.redoModifyFFrame(index, newIndex, frame); |
|
49 |
} |
|
50 |
|
|
51 |
public int getType() { |
|
52 |
return Command.UPDATE; |
|
53 |
} |
|
54 |
|
|
55 |
public void execute() { |
|
56 |
index = -1; |
|
57 |
IFFrame[] fframes = fm.getAllFFrames(); |
|
58 |
for (int i = 0; i < fframes.length; i++) { |
|
59 |
if (fframes[i].equals(antFrame) && !fm.invalidates().get(i)) { |
|
60 |
index = i; |
|
61 |
} |
|
62 |
} |
|
63 |
newIndex = fm.doModifyFFrame(index, frame); |
|
64 |
fm.refreshDependences(antFrame, frame); |
|
65 |
} |
|
66 |
} |
tags/org.gvsig.app.document.layout2.app-2.0.75/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/commands/InsertFrameCommand.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.commands; |
|
23 |
|
|
24 |
import java.io.IOException; |
|
25 |
|
|
26 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
|
27 |
import org.gvsig.tools.undo.command.Command; |
|
28 |
import org.gvsig.tools.undo.command.impl.AbstractCommand; |
|
29 |
|
|
30 |
/** |
|
31 |
* |
|
32 |
*/ |
|
33 |
public class InsertFrameCommand extends AbstractCommand { |
|
34 |
private IFFrame frame; |
|
35 |
private int index; |
|
36 |
private FrameManager fm; |
|
37 |
|
|
38 |
public InsertFrameCommand(FrameManager fm, IFFrame f, String description) { |
|
39 |
super(description); |
|
40 |
this.fm = fm; |
|
41 |
frame = f; |
|
42 |
} |
|
43 |
|
|
44 |
/** |
|
45 |
* @throws IOException |
|
46 |
* @throws DriverIOException |
|
47 |
* @throws IOException |
|
48 |
* @throws DriverIOException |
|
49 |
* @see com.iver.cit.gvsig.fmap.edition.Command#undo() |
|
50 |
*/ |
|
51 |
public void undo() { |
|
52 |
fm.undoAddFFrame(index); |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* @throws DriverIOException |
|
57 |
* @throws IOException |
|
58 |
* @see com.iver.cit.gvsig.fmap.edition.Command#redo() |
|
59 |
*/ |
|
60 |
public void redo() { |
|
61 |
fm.doAddFFrame(frame, index); |
|
62 |
} |
|
63 |
|
|
64 |
public int getType() { |
|
65 |
return Command.INSERT; |
|
66 |
} |
|
67 |
|
|
68 |
public void execute() { |
|
69 |
index = fm.doAddFFrame(frame); |
|
70 |
} |
|
71 |
} |
tags/org.gvsig.app.document.layout2.app-2.0.75/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/commands/FrameManager.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.commands; |
|
23 |
|
|
24 |
import java.util.ArrayList; |
|
25 |
import java.util.BitSet; |
|
26 |
|
|
27 |
import org.gvsig.app.project.documents.layout.fframes.FFrameGroup; |
|
28 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
|
29 |
import org.gvsig.app.project.documents.layout.fframes.IFFrameViewDependence; |
|
30 |
|
|
31 |
public class FrameManager { |
|
32 |
private ArrayList<IFFrame> fframes = new ArrayList<IFFrame>(); |
|
33 |
private BitSet invalidates = new BitSet(); |
|
34 |
|
|
35 |
/** |
|
36 |
* Returns from an index the FFrame. |
|
37 |
* |
|
38 |
* @param index |
|
39 |
* |
|
40 |
* @return FFrame. |
|
41 |
*/ |
|
42 |
public IFFrame getFFrame(int index) { |
|
43 |
return fframes.get(index); |
|
44 |
} |
|
45 |
|
|
46 |
/** |
|
47 |
* Returns the number of FFrame. |
|
48 |
* |
|
49 |
* @return Number of FFrames |
|
50 |
*/ |
|
51 |
public int getFFrameCount() { |
|
52 |
return fframes.size(); |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* Undo add FFrame from index. |
|
57 |
* |
|
58 |
* @param index |
|
59 |
*/ |
|
60 |
public void undoAddFFrame(int index) { |
|
61 |
doRemoveFFrame(index); |
|
62 |
} |
|
63 |
|
|
64 |
/** |
|
65 |
* Add FFrame. |
|
66 |
* |
|
67 |
* @param frame |
|
68 |
* |
|
69 |
* @return index of new fframe. |
|
70 |
*/ |
|
71 |
public int doAddFFrame(IFFrame frame) { |
|
72 |
fframes.add(frame); |
|
73 |
int index = fframes.size() - 1; |
|
74 |
notifyAdded(index); |
|
75 |
return index; |
|
76 |
} |
|
77 |
|
|
78 |
/** |
|
79 |
* Add FFrame from index. |
|
80 |
* |
|
81 |
* @param frame |
|
82 |
* New FFrame. |
|
83 |
* @param index |
|
84 |
* Index of new FFrame. |
|
85 |
*/ |
|
86 |
public void doAddFFrame(IFFrame frame, int index) { |
|
87 |
invalidates.set(index, false); |
|
88 |
fframes.set(index, frame); |
|
89 |
notifyAdded(index); |
|
90 |
} |
|
91 |
|
|
92 |
/** |
|
93 |
* Undo modify an FFrame modified. |
|
94 |
* |
|
95 |
* @param fant |
|
96 |
* Previous fframe. |
|
97 |
* @param fnew |
|
98 |
* New FFrame. |
|
99 |
* @param indexAnt |
|
100 |
* Actual index. |
|
101 |
* @param indexLast |
|
102 |
* Previous index. |
|
103 |
*/ |
|
104 |
public void undoModifyFFrame(int index, int newIndex) { |
|
105 |
undoRemoveFFrame(index); |
|
106 |
undoAddFFrame(newIndex); |
|
107 |
IFFrame fant = fframes.get(newIndex); |
|
108 |
IFFrame fnew = fframes.get(index); |
|
109 |
refreshDependences(fant, fnew); |
|
110 |
} |
|
111 |
|
|
112 |
/** |
|
113 |
* Modify FFrame from index and new FFrame. |
|
114 |
* |
|
115 |
* @param indexAnt |
|
116 |
* Actual index. |
|
117 |
* @param frameNext |
|
118 |
* New FFrame. |
|
119 |
* |
|
120 |
* @return New index of FFrame. |
|
121 |
*/ |
|
122 |
public int doModifyFFrame(int indexAnt, IFFrame frameNext) { |
|
123 |
doRemoveFFrame(indexAnt); |
|
124 |
|
|
125 |
return doAddFFrame(frameNext); |
|
126 |
} |
|
127 |
|
|
128 |
/** |
|
129 |
* Undo Remove FFrame from index. |
|
130 |
* |
|
131 |
* @param index |
|
132 |
* Actual index of FFrame. |
|
133 |
*/ |
|
134 |
public void undoRemoveFFrame(int index) { |
|
135 |
invalidates.set(index, false); |
|
136 |
notifyAdded(index); |
|
137 |
} |
|
138 |
|
|
139 |
/** |
|
140 |
* Remove FFrame from actual index. |
|
141 |
* |
|
142 |
* @param index |
|
143 |
* Actual index. |
|
144 |
*/ |
|
145 |
public void doRemoveFFrame(int index) { |
|
146 |
invalidates.set(index, true); |
|
147 |
notifyRemoved(index); |
|
148 |
} |
|
149 |
|
|
150 |
protected void notifyRemoved(int index) { |
|
151 |
IFFrame frame = fframes.get(index); |
|
152 |
frame.frameRemoved(); |
|
153 |
} |
|
154 |
|
|
155 |
protected void notifyAdded(int index) { |
|
156 |
IFFrame frame = fframes.get(index); |
|
157 |
frame.frameAdded(); |
|
158 |
} |
|
159 |
|
|
160 |
/** |
|
161 |
* Returns all the fframes that are not removed. |
|
162 |
* |
|
163 |
* @return Vector with fframes. |
|
164 |
*/ |
|
165 |
public IFFrame[] getFFrames() { |
|
166 |
ArrayList<IFFrame> frames = new ArrayList<IFFrame>(); |
|
167 |
|
|
168 |
for (int i = 0; i < getFFrameCount(); i++) { |
|
169 |
if (!invalidates.get(i)) { |
|
170 |
frames.add(fframes.get(i)); |
|
171 |
} |
|
172 |
} |
|
173 |
|
|
174 |
IFFrame[] fframesV = frames.toArray(new IFFrame[0]); |
|
175 |
|
|
176 |
return fframesV; |
|
177 |
} |
|
178 |
|
|
179 |
/** |
|
180 |
* Returns all the fframes, remove and done not remove. |
|
181 |
* |
|
182 |
* @return All FFrames. |
|
183 |
*/ |
|
184 |
public IFFrame[] getAllFFrames() { |
|
185 |
return fframes.toArray(new IFFrame[0]); |
|
186 |
} |
|
187 |
|
|
188 |
/** |
|
189 |
* Returns all the fframes, remove and done not remove and the ones that are |
|
190 |
* in the FFrameGroups |
|
191 |
* |
|
192 |
* @return All FFrames. |
|
193 |
*/ |
|
194 |
public IFFrame[] getAllFFrameToDepends() { |
|
195 |
IFFrame[] fs = getAllFFrames(); |
|
196 |
|
|
197 |
return getFFrameToDepends(fs); |
|
198 |
} |
|
199 |
|
|
200 |
private IFFrame[] getFFrameToDepends(IFFrame[] fs) { |
|
201 |
ArrayList<IFFrame> result = new ArrayList<IFFrame>(); |
|
202 |
|
|
203 |
for (int i = 0; i < fs.length; i++) { |
|
204 |
result.add(fs[i]); |
|
205 |
|
|
206 |
if (fs[i] instanceof FFrameGroup) { |
|
207 |
IFFrame[] ffs = |
|
208 |
getFFrameToDepends(((FFrameGroup) fs[i]).getFFrames()); |
|
209 |
|
|
210 |
for (int j = 0; j < ffs.length; j++) { |
|
211 |
result.add(ffs[j]); |
|
212 |
} |
|
213 |
} |
|
214 |
} |
|
215 |
|
|
216 |
return result.toArray(new IFFrame[0]); |
|
217 |
} |
|
218 |
|
|
219 |
public void refreshDependences(IFFrame fant, IFFrame fnew) { |
|
220 |
for (int i = 0; i < fframes.size(); i++) { |
|
221 |
if (fframes.get(i) instanceof IFFrameViewDependence) { |
|
222 |
IFFrameViewDependence f = |
|
223 |
(IFFrameViewDependence) fframes.get(i); |
|
224 |
f.refreshDependence(fant, fnew); |
|
225 |
} |
|
226 |
} |
|
227 |
} |
|
228 |
|
|
229 |
public void redoModifyFFrame(int index, int newIndex, IFFrame frame) { |
|
230 |
doRemoveFFrame(index); |
|
231 |
doAddFFrame(frame, newIndex); |
|
232 |
IFFrame fant = fframes.get(newIndex); |
|
233 |
refreshDependences(fant, frame); |
|
234 |
} |
|
235 |
|
|
236 |
public BitSet invalidates() { |
|
237 |
return invalidates; |
|
238 |
} |
|
239 |
|
|
240 |
public void clear() { |
|
241 |
|
|
242 |
} |
|
243 |
} |
|
0 | 244 |
tags/org.gvsig.app.document.layout2.app-2.0.75/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/LayoutContext.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.geom.AffineTransform; |
|
25 |
import java.util.Iterator; |
|
26 |
|
|
27 |
import org.gvsig.app.project.documents.layout.commands.FrameCommandsRecord; |
|
28 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
|
29 |
import org.gvsig.app.project.documents.layout.toc.TocModelObserver; |
|
30 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
31 |
import org.gvsig.tools.observer.Observable; |
|
32 |
import org.gvsig.tools.persistence.Persistent; |
|
33 |
|
|
34 |
/** |
|
35 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
36 |
*/ |
|
37 |
public interface LayoutContext extends Persistent, Observable { |
|
38 |
|
|
39 |
/** |
|
40 |
* Returns the AffineTransform that is applying in the Layout. |
|
41 |
* |
|
42 |
* @return AffineTransform |
|
43 |
*/ |
|
44 |
public AffineTransform getAT(); |
|
45 |
|
|
46 |
/** |
|
47 |
* Call all LayoutDrawListeners. |
|
48 |
* |
|
49 |
*/ |
|
50 |
public void notifAllObservers(); |
|
51 |
|
|
52 |
/** |
|
53 |
* It returns the print attributes of the Layout. |
|
54 |
* |
|
55 |
* @return Attributes. |
|
56 |
*/ |
|
57 |
public Attributes getAttributes(); |
|
58 |
|
|
59 |
/** |
|
60 |
* Inserts the print attributes of Layout. |
|
61 |
* |
|
62 |
* @param attributes Attributes. |
|
63 |
*/ |
|
64 |
public void setAtributes(Attributes attributes); |
|
65 |
|
|
66 |
/** |
|
67 |
* It obtains the Array with all the FFrames that have been added al Layout. |
|
68 |
* |
|
69 |
* @return Array with all the FFrames that have been added al Layout. |
|
70 |
*/ |
|
71 |
public IFFrame[] getFFrames(); |
|
72 |
|
|
73 |
/** |
|
74 |
* It obtains the FFrame from an index. |
|
75 |
* |
|
76 |
*/ |
|
77 |
public IFFrame getFFrame(int i); |
|
78 |
|
|
79 |
/** |
|
80 |
* It orders the FFrames depending on its position specified by level. |
|
81 |
* |
|
82 |
*/ |
|
83 |
public void updateFFrames(); |
|
84 |
|
|
85 |
/** |
|
86 |
* Remove the fframes selected. |
|
87 |
* |
|
88 |
*/ |
|
89 |
public void delFFrameSelected(); |
|
90 |
|
|
91 |
/** |
|
92 |
* Clear the selection of FFrames. |
|
93 |
* |
|
94 |
*/ |
|
95 |
public void clearSelection(); |
|
96 |
|
|
97 |
/** |
|
98 |
* Remove the fframe of index. |
|
99 |
* |
|
100 |
*/ |
|
101 |
public void delFFrame(int index); |
|
102 |
|
|
103 |
/** |
|
104 |
* Remove the fframe of parameter. |
|
105 |
* |
|
106 |
* @param frame FFrame to remove. |
|
107 |
*/ |
|
108 |
public void delFFrame(IFFrame frame); |
|
109 |
|
|
110 |
/** |
|
111 |
* Returns the EditableFeatureSource, is the control of all change in the |
|
112 |
* FFrames of Layout. |
|
113 |
* |
|
114 |
* @return EditableFatureSource. |
|
115 |
*/ |
|
116 |
public FrameCommandsRecord getFrameCommandsRecord(); |
|
117 |
|
|
118 |
/** |
|
119 |
* It adds a fframe to Arraylist of FFrames . |
|
120 |
* |
|
121 |
* @param frame fframe to add. |
|
122 |
* @param clearSelection True True if clean the selection of the fframes |
|
123 |
* already added and false if intends to maintain the same selection. |
|
124 |
* @param select Boolean that indicates if has to remain selected the FFrame |
|
125 |
* that is added or not. |
|
126 |
*/ |
|
127 |
public void addFFrame(IFFrame frame, boolean clearSelection, boolean select); |
|
128 |
|
|
129 |
/** |
|
130 |
* It adds a fframe to Arraylist of FFrames with the same properties. |
|
131 |
* |
|
132 |
* @param frame fframe to add. |
|
133 |
*/ |
|
134 |
public void addFFrameSameProperties(IFFrame frame); |
|
135 |
|
|
136 |
/** |
Also available in: Unified diff