Revision 1608
trunk/org.gvsig.app.document.layout2.app/pom.xml | ||
---|---|---|
11 | 11 |
<parent> |
12 | 12 |
<groupId>org.gvsig</groupId> |
13 | 13 |
<artifactId>org.gvsig.desktop</artifactId> |
14 |
<version>2.0.424</version>
|
|
14 |
<version>2.0.425-SNAPSHOT</version>
|
|
15 | 15 |
</parent> |
16 | 16 |
|
17 | 17 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-app-document-layout</url> |
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties | ||
---|---|---|
85 | 85 |
_Highlight_record=Highlight record |
86 | 86 |
_Line_color=Line color |
87 | 87 |
_Transparency=Transparency |
88 |
_Select_symbol=Select symbol |
|
88 |
_Select_symbol=Select symbol |
|
89 |
_to_record=to record |
|
90 |
_to_everything_except_record=to everything except record |
|
91 |
_Apply_symbol=Apply symbol |
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/resources-plugin/i18n/text.properties | ||
---|---|---|
85 | 85 |
_Highlight_record=Resaltar registro |
86 | 86 |
_Line_color=Color de la linea |
87 | 87 |
_Transparency=Transparencia |
88 |
_Select_symbol=Seleccionar s\u00edmbolo |
|
88 |
_Select_symbol=Seleccionar s\u00edmbolo |
|
89 |
_to_record=al registro |
|
90 |
_to_everything_except_record=a todo excepto al registro |
|
91 |
_Apply_symbol=Aplicar s\u00edmbolo |
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/reportfromlayout/ConfigureReportFromLayoutParametersImpl.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package org.gvsig.app.extension.reportfromlayout; |
|
7 |
|
|
8 |
import java.awt.Color; |
|
9 |
import org.gvsig.app.project.documents.layout.LayoutDocument; |
|
10 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
11 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
12 |
|
|
13 |
/** |
|
14 |
* |
|
15 |
* @author fdiaz |
|
16 |
*/ |
|
17 |
public class ConfigureReportFromLayoutParametersImpl implements ConfigureReportFromLayoutParameters { |
|
18 |
LayoutDocument layout; |
|
19 |
FeatureStore source; |
|
20 |
String identifier; |
|
21 |
String label; |
|
22 |
private boolean centerToCurrentRow; |
|
23 |
private boolean zoomToCurrentRow; |
|
24 |
private double bufferSize; |
|
25 |
private boolean useIntervalPdfViewer; |
|
26 |
private boolean highlightRecord; |
|
27 |
private String viewTag; |
|
28 |
// private Color fillColor; |
|
29 |
// private Color lineColor; |
|
30 |
private ISymbol highLightSymbol; |
|
31 |
|
|
32 |
@Override |
|
33 |
public LayoutDocument getLayout() { |
|
34 |
return layout; |
|
35 |
} |
|
36 |
|
|
37 |
@Override |
|
38 |
public void setLayout(LayoutDocument layout) { |
|
39 |
this.layout = layout; |
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
public FeatureStore getSource() { |
|
44 |
return source; |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
public void setSource(FeatureStore source) { |
|
49 |
this.source = source; |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
public String getIdentifier() { |
|
54 |
return identifier; |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 |
public void setIdentifier(String identifier) { |
|
59 |
this.identifier = identifier; |
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public String getLabel() { |
|
64 |
return this.label; |
|
65 |
} |
|
66 |
|
|
67 |
@Override |
|
68 |
public void setLabel(String label) { |
|
69 |
this.label = label; |
|
70 |
} |
|
71 |
|
|
72 |
@Override |
|
73 |
public boolean isCenterToCurrentRow() { |
|
74 |
return this.centerToCurrentRow; |
|
75 |
} |
|
76 |
|
|
77 |
@Override |
|
78 |
public void setCenterToCurrentRow(boolean centerToCurrentRow) { |
|
79 |
this.centerToCurrentRow = centerToCurrentRow; |
|
80 |
} |
|
81 |
|
|
82 |
@Override |
|
83 |
public boolean isZoomToCurrentRow() { |
|
84 |
return this.zoomToCurrentRow; |
|
85 |
} |
|
86 |
|
|
87 |
@Override |
|
88 |
public void setZoomToCurrentRow(boolean zoomToCurrentRow) { |
|
89 |
this.zoomToCurrentRow = zoomToCurrentRow; |
|
90 |
} |
|
91 |
|
|
92 |
@Override |
|
93 |
public double getBufferSize() { |
|
94 |
return this.bufferSize; |
|
95 |
} |
|
96 |
|
|
97 |
@Override |
|
98 |
public void setBufferSize(double bufferSize) { |
|
99 |
this.bufferSize = bufferSize; |
|
100 |
} |
|
101 |
|
|
102 |
@Override |
|
103 |
public boolean isHighlightRecord() { |
|
104 |
return this.highlightRecord; |
|
105 |
} |
|
106 |
|
|
107 |
@Override |
|
108 |
public void setHighlightRecord(boolean b) { |
|
109 |
this.highlightRecord = b; |
|
110 |
} |
|
111 |
|
|
112 |
@Override |
|
113 |
public boolean isUseIntervalPdfViewer() { |
|
114 |
return useIntervalPdfViewer; |
|
115 |
} |
|
116 |
|
|
117 |
@Override |
|
118 |
public void setUseIntervalPdfViewer(boolean useIntervalPdfViewer) { |
|
119 |
this.useIntervalPdfViewer = useIntervalPdfViewer; |
|
120 |
} |
|
121 |
|
|
122 |
@Override |
|
123 |
public String getViewTag() { |
|
124 |
return this.viewTag; |
|
125 |
} |
|
126 |
|
|
127 |
@Override |
|
128 |
public void setViewTag(String viewTag) { |
|
129 |
this.viewTag = viewTag; |
|
130 |
} |
|
131 |
|
|
132 |
// @Override |
|
133 |
// public Color getFillColor() { |
|
134 |
// return this.fillColor; |
|
135 |
// } |
|
136 |
// |
|
137 |
// @Override |
|
138 |
// public void setFillColor(Color color) { |
|
139 |
// this.fillColor = color; |
|
140 |
// } |
|
141 |
// |
|
142 |
// @Override |
|
143 |
// public Color getLineColor() { |
|
144 |
// return this.lineColor; |
|
145 |
// } |
|
146 |
// |
|
147 |
// @Override |
|
148 |
// public void setLineColor(Color color) { |
|
149 |
// this.lineColor = color; |
|
150 |
// } |
|
151 |
|
|
152 |
@Override |
|
153 |
public ISymbol getHighlightSymbol() { |
|
154 |
return highLightSymbol; |
|
155 |
} |
|
156 |
|
|
157 |
@Override |
|
158 |
public void setHighlightSymbol(ISymbol symbol) { |
|
159 |
this.highLightSymbol = symbol; |
|
160 |
} |
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
} |
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/reportfromlayout/ConfigureReportFromLayoutParameters.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package org.gvsig.app.extension.reportfromlayout; |
|
7 |
|
|
8 |
import java.awt.Color; |
|
9 |
import org.gvsig.app.project.documents.layout.LayoutDocument; |
|
10 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
11 |
import org.gvsig.fmap.dal.swing.report.ReportAction; |
|
12 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
13 |
|
|
14 |
/** |
|
15 |
* |
|
16 |
* @author fdiaz |
|
17 |
*/ |
|
18 |
public interface ConfigureReportFromLayoutParameters { |
|
19 |
|
|
20 |
public LayoutDocument getLayout(); |
|
21 |
|
|
22 |
public void setLayout(LayoutDocument layout); |
|
23 |
|
|
24 |
public FeatureStore getSource(); |
|
25 |
|
|
26 |
public void setSource(FeatureStore source); |
|
27 |
|
|
28 |
public String getIdentifier(); |
|
29 |
|
|
30 |
public void setIdentifier(String identifier); |
|
31 |
|
|
32 |
public String getLabel(); |
|
33 |
|
|
34 |
public void setLabel(String label); |
|
35 |
|
|
36 |
public boolean isCenterToCurrentRow(); |
|
37 |
|
|
38 |
public void setCenterToCurrentRow(boolean centerToCurrentRow); |
|
39 |
|
|
40 |
public boolean isZoomToCurrentRow(); |
|
41 |
|
|
42 |
public void setZoomToCurrentRow(boolean zoomToCurrentRow); |
|
43 |
|
|
44 |
public double getBufferSize(); |
|
45 |
|
|
46 |
public void setBufferSize(double bufferSize); |
|
47 |
|
|
48 |
public boolean isHighlightRecord(); |
|
49 |
|
|
50 |
public void setHighlightRecord(boolean b); |
|
51 |
|
|
52 |
public boolean isUseIntervalPdfViewer(); |
|
53 |
|
|
54 |
public void setUseIntervalPdfViewer(boolean useIntervalPdfViewer); |
|
55 |
|
|
56 |
public String getViewTag(); |
|
57 |
|
|
58 |
public void setViewTag(String tag); |
|
59 |
|
|
60 |
// public Color getFillColor(); |
|
61 |
// |
|
62 |
// public void setFillColor(Color color); |
|
63 |
// |
|
64 |
// public Color getLineColor(); |
|
65 |
// |
|
66 |
// public void setLineColor(Color color); |
|
67 |
|
|
68 |
public ISymbol getHighlightSymbol(); |
|
69 |
|
|
70 |
public void setHighlightSymbol(ISymbol symbol); |
|
71 |
|
|
72 |
|
|
73 |
} |
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/reportfromlayout/ExportReportToLayoutParametersImpl.java | ||
---|---|---|
6 | 6 |
package org.gvsig.app.extension.reportfromlayout; |
7 | 7 |
|
8 | 8 |
import java.io.File; |
9 |
import org.gvsig.app.project.documents.layout.LayoutDocument;
|
|
9 |
import org.gvsig.app.project.documents.layout.report.LayoutReportAction;
|
|
10 | 10 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
11 |
import org.gvsig.fmap.dal.swing.report.ReportAction; |
|
12 | 11 |
|
13 | 12 |
/** |
14 | 13 |
* |
15 | 14 |
* @author fdiaz |
16 | 15 |
*/ |
17 | 16 |
public class ExportReportToLayoutParametersImpl implements ExportReportToLayoutParameters { |
18 |
ReportAction report; |
|
17 |
LayoutReportAction report;
|
|
19 | 18 |
FeatureStore source; |
20 | 19 |
File file; |
21 | 20 |
|
... | ... | |
30 | 29 |
} |
31 | 30 |
|
32 | 31 |
@Override |
33 |
public ReportAction getReportAction() { |
|
32 |
public LayoutReportAction getReportAction() {
|
|
34 | 33 |
return this.report; |
35 | 34 |
} |
36 | 35 |
|
37 | 36 |
@Override |
38 |
public void setReportAction(ReportAction report) { |
|
37 |
public void setReportAction(LayoutReportAction report) {
|
|
39 | 38 |
this.report = report; |
40 | 39 |
} |
41 | 40 |
|
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/reportfromlayout/ConfigureReportFromLayoutPanelView.java | ||
---|---|---|
41 | 41 |
JCheckBox chkZoomToCurrentRow = new JCheckBox(); |
42 | 42 |
JLabel lblBufferSize = new JLabel(); |
43 | 43 |
JTextField txtBufferSize = new JTextField(); |
44 |
JCheckBox chkCenterToCurrentRow = new JCheckBox(); |
|
45 |
JLabel lblAppySymbolTo = new JLabel(); |
|
46 |
JComboBox cboApplySymbolTo = new JComboBox(); |
|
44 | 47 |
JButton btnSelectSymbol = new JButton(); |
45 |
JCheckBox chkCenterToCurrentRow = new JCheckBox(); |
|
46 | 48 |
|
47 | 49 |
/** |
48 | 50 |
* Default constructor |
... | ... | |
134 | 136 |
public JPanel createPanel() |
135 | 137 |
{ |
136 | 138 |
JPanel jpanel1 = new JPanel(); |
137 |
FormLayout formlayout1 = new FormLayout("FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE","CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE");
|
|
139 |
FormLayout formlayout1 = new FormLayout("FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:22DLU:GROW(1.0),FILL:4DLU:NONE","CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE");
|
|
138 | 140 |
CellConstraints cc = new CellConstraints(); |
139 | 141 |
jpanel1.setLayout(formlayout1); |
140 | 142 |
|
... | ... | |
203 | 205 |
jpanel1.add(chkHighlightRecord,cc.xy(2,16)); |
204 | 206 |
|
205 | 207 |
jpanel1.add(createPanel1(),cc.xywh(2,20,3,1)); |
206 |
btnSelectSymbol.setActionCommand("_Select_symbol"); |
|
207 |
btnSelectSymbol.setName("btnSelectSymbol"); |
|
208 |
btnSelectSymbol.setText("_Select_symbol"); |
|
209 |
jpanel1.add(btnSelectSymbol,new CellConstraints(4,16,1,1,CellConstraints.LEFT,CellConstraints.DEFAULT)); |
|
210 |
|
|
211 | 208 |
chkCenterToCurrentRow.setActionCommand("_Center_to_current_row"); |
212 | 209 |
chkCenterToCurrentRow.setName("chkCenterToCurrentRow"); |
213 | 210 |
chkCenterToCurrentRow.setText("_Center_to_current_row"); |
214 | 211 |
chkCenterToCurrentRow.setToolTipText("_Center_to_current_row_description"); |
215 | 212 |
jpanel1.add(chkCenterToCurrentRow,cc.xywh(2,18,3,1)); |
216 | 213 |
|
214 |
jpanel1.add(createPanel2(),cc.xy(4,16)); |
|
217 | 215 |
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 }); |
218 | 216 |
return jpanel1; |
219 | 217 |
} |
... | ... | |
244 | 242 |
return jpanel1; |
245 | 243 |
} |
246 | 244 |
|
245 |
public JPanel createPanel2() |
|
246 |
{ |
|
247 |
JPanel jpanel1 = new JPanel(); |
|
248 |
FormLayout formlayout1 = new FormLayout("FILL:22DLU:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:8DLU:GROW(1.0)","CENTER:DEFAULT:NONE"); |
|
249 |
CellConstraints cc = new CellConstraints(); |
|
250 |
jpanel1.setLayout(formlayout1); |
|
251 |
|
|
252 |
lblAppySymbolTo.setName("lblAppySymbolTo"); |
|
253 |
lblAppySymbolTo.setText("_Apply_symbol"); |
|
254 |
jpanel1.add(lblAppySymbolTo,cc.xy(3,1)); |
|
255 |
|
|
256 |
cboApplySymbolTo.setName("cboApplySymbolTo"); |
|
257 |
jpanel1.add(cboApplySymbolTo,cc.xy(5,1)); |
|
258 |
|
|
259 |
btnSelectSymbol.setActionCommand("..."); |
|
260 |
btnSelectSymbol.setName("btnSelectSymbol"); |
|
261 |
btnSelectSymbol.setText("..."); |
|
262 |
btnSelectSymbol.setToolTipText("_Select_symbol"); |
|
263 |
jpanel1.add(btnSelectSymbol,new CellConstraints(1,1,1,1,CellConstraints.FILL,CellConstraints.FILL)); |
|
264 |
|
|
265 |
addFillComponents(jpanel1,new int[]{ 2,4 },new int[0]); |
|
266 |
return jpanel1; |
|
267 |
} |
|
268 |
|
|
247 | 269 |
/** |
248 | 270 |
* Initializer |
249 | 271 |
*/ |
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/reportfromlayout/ConfigureReportFromLayoutExtension.java | ||
---|---|---|
16 | 16 |
import org.gvsig.app.project.Project; |
17 | 17 |
import org.gvsig.app.project.documents.Document; |
18 | 18 |
import org.gvsig.app.project.documents.layout.LayoutDocument; |
19 |
import org.gvsig.app.project.documents.layout.report.LayoutReportActionParameters; |
|
19 | 20 |
import org.gvsig.tools.ToolsLocator; |
20 | 21 |
import org.gvsig.tools.future.FutureUtils; |
21 | 22 |
import org.gvsig.tools.i18n.I18nManager; |
... | ... | |
78 | 79 |
switch( dialog.getAction()) { |
79 | 80 |
case WindowManager_v2.BUTTON_OK: |
80 | 81 |
dialog.setButtonEnabled(WindowManager_v2.BUTTON_OK, false); |
81 |
ConfigureReportFromLayoutParameters params = new ConfigureReportFromLayoutParametersImpl();
|
|
82 |
LayoutReportActionParameters params = LayoutReportActionParameters.create();
|
|
82 | 83 |
panel.fetch(params); |
83 |
if(panel.doConfigureReportFromLayout(params)){ |
|
84 |
if(panel.doConfigureReportFromLayout(params, panel.getLayoutDocument(), panel.getStore())){
|
|
84 | 85 |
((JComponent)dialog).setVisible(false); |
85 |
};
|
|
86 |
} |
|
86 | 87 |
break; |
87 | 88 |
|
89 |
|
|
88 | 90 |
case WindowManager_v2.BUTTON_CANCEL: |
89 | 91 |
((JComponent)dialog).setVisible(false); |
90 | 92 |
break; |
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/reportfromlayout/ConfigureReportFromLayoutPanel.xml | ||
---|---|---|
27 | 27 |
<at name="id">/home/fdiaz/projects/gvSIG/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/reportfromlayout/ConfigureReportFromLayoutPanel.xml</at> |
28 | 28 |
<at name="path">projects/gvSIG/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/reportfromlayout/ConfigureReportFromLayoutPanel.xml</at> |
29 | 29 |
<at name="rowspecs">CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE</at> |
30 |
<at name="colspecs">FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE</at>
|
|
30 |
<at name="colspecs">FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:22DLU:GROW(1.0),FILL:4DLU:NONE</at>
|
|
31 | 31 |
<at name="components"> |
32 | 32 |
<object classname="java.util.LinkedList"> |
33 | 33 |
<item > |
... | ... | |
377 | 377 |
</at> |
378 | 378 |
<at name="actionCommand">_Center_to_current_row</at> |
379 | 379 |
<at name="name">chkUseInternalPdfViewer</at> |
380 |
<at name="width">1183</at>
|
|
380 |
<at name="width">1097</at>
|
|
381 | 381 |
<at name="text">_Use_internal_pdf_viewer</at> |
382 | 382 |
<at name="toolTipText">_Use_internal_pdf_viewer_description</at> |
383 | 383 |
<at name="height">22</at> |
... | ... | |
433 | 433 |
</object> |
434 | 434 |
</at> |
435 | 435 |
<at name="name">cboLayout</at> |
436 |
<at name="width">1021</at>
|
|
436 |
<at name="width">935</at>
|
|
437 | 437 |
<at name="items"> |
438 | 438 |
<object classname="com.jeta.forms.store.properties.ItemsProperty"> |
439 | 439 |
<at name="name">items</at> |
... | ... | |
494 | 494 |
<at name="scrollableTracksViewportHeight">true</at> |
495 | 495 |
<at name="scrollableTracksViewportWidth">true</at> |
496 | 496 |
<at name="name">treeSource</at> |
497 |
<at name="width">1019</at>
|
|
497 |
<at name="width">933</at>
|
|
498 | 498 |
<at name="rowCount">3</at> |
499 | 499 |
<at name="scollBars"> |
500 | 500 |
<object classname="com.jeta.forms.store.properties.ScrollBarsProperty"> |
... | ... | |
524 | 524 |
</object> |
525 | 525 |
</at> |
526 | 526 |
<at name="rootVisible">false</at> |
527 |
<at name="height">504</at>
|
|
527 |
<at name="height">476</at>
|
|
528 | 528 |
</object> |
529 | 529 |
</at> |
530 | 530 |
</object> |
... | ... | |
577 | 577 |
</object> |
578 | 578 |
</at> |
579 | 579 |
<at name="name">cboReport</at> |
580 |
<at name="width">1021</at>
|
|
580 |
<at name="width">935</at>
|
|
581 | 581 |
<at name="items"> |
582 | 582 |
<object classname="com.jeta.forms.store.properties.ItemsProperty"> |
583 | 583 |
<at name="name">items</at> |
... | ... | |
636 | 636 |
</object> |
637 | 637 |
</at> |
638 | 638 |
<at name="name">txtIdentifier</at> |
639 |
<at name="width">1021</at>
|
|
639 |
<at name="width">935</at>
|
|
640 | 640 |
<at name="height">21</at> |
641 | 641 |
</object> |
642 | 642 |
</at> |
... | ... | |
690 | 690 |
</object> |
691 | 691 |
</at> |
692 | 692 |
<at name="name">txtLabel</at> |
693 |
<at name="width">1021</at>
|
|
693 |
<at name="width">935</at>
|
|
694 | 694 |
<at name="height">21</at> |
695 | 695 |
</object> |
696 | 696 |
</at> |
... | ... | |
744 | 744 |
</object> |
745 | 745 |
</at> |
746 | 746 |
<at name="name">lblViewSeparator</at> |
747 |
<at name="width">1183</at>
|
|
747 |
<at name="width">1097</at>
|
|
748 | 748 |
<at name="text">_View</at> |
749 | 749 |
<at name="height">17</at> |
750 | 750 |
</object> |
... | ... | |
859 | 859 |
</object> |
860 | 860 |
</at> |
861 | 861 |
<at name="name">cboView</at> |
862 |
<at name="width">1021</at>
|
|
862 |
<at name="width">935</at>
|
|
863 | 863 |
<at name="items"> |
864 | 864 |
<object classname="com.jeta.forms.store.properties.ItemsProperty"> |
865 | 865 |
<at name="name">items</at> |
... | ... | |
947 | 947 |
</at> |
948 | 948 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
949 | 949 |
</super> |
950 |
<at name="id">embedded.900460273</at>
|
|
950 |
<at name="id">embedded.297351574</at>
|
|
951 | 951 |
<at name="rowspecs">CENTER:DEFAULT:NONE</at> |
952 | 952 |
<at name="colspecs">FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0)</at> |
953 | 953 |
<at name="components"> |
... | ... | |
1115 | 1115 |
</object> |
1116 | 1116 |
</at> |
1117 | 1117 |
<at name="name">txtBufferSize</at> |
1118 |
<at name="width">878</at>
|
|
1118 |
<at name="width">792</at>
|
|
1119 | 1119 |
<at name="toolTipText">_Buffer_size_description</at> |
1120 | 1120 |
<at name="height">21</at> |
1121 | 1121 |
</object> |
... | ... | |
1142 | 1142 |
</at> |
1143 | 1143 |
</object> |
1144 | 1144 |
</at> |
1145 |
<at name="name"></at>
|
|
1145 |
<at name="name"/>
|
|
1146 | 1146 |
<at name="fill"> |
1147 | 1147 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
1148 | 1148 |
<at name="name">fill</at> |
... | ... | |
1213 | 1213 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
1214 | 1214 |
<at name="cellconstraints"> |
1215 | 1215 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
1216 |
<at name="column">4</at>
|
|
1217 |
<at name="row">16</at>
|
|
1218 |
<at name="colspan">1</at>
|
|
1216 |
<at name="column">2</at>
|
|
1217 |
<at name="row">18</at>
|
|
1218 |
<at name="colspan">3</at>
|
|
1219 | 1219 |
<at name="rowspan">1</at> |
1220 |
<at name="halign">left</at>
|
|
1220 |
<at name="halign">default</at>
|
|
1221 | 1221 |
<at name="valign">default</at> |
1222 | 1222 |
<at name="insets" object="insets">0,0,0,0</at> |
1223 | 1223 |
</object> |
... | ... | |
1225 | 1225 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
1226 | 1226 |
</super> |
1227 | 1227 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
1228 |
<at name="beanclass">javax.swing.JButton</at>
|
|
1228 |
<at name="beanclass">javax.swing.JCheckBox</at>
|
|
1229 | 1229 |
<at name="beanproperties"> |
1230 | 1230 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
1231 |
<at name="classname">javax.swing.JButton</at>
|
|
1231 |
<at name="classname">javax.swing.JCheckBox</at>
|
|
1232 | 1232 |
<at name="properties"> |
1233 | 1233 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
1234 | 1234 |
<at name="border"> |
... | ... | |
1251 | 1251 |
</at> |
1252 | 1252 |
</object> |
1253 | 1253 |
</at> |
1254 |
<at name="actionCommand">_Select_symbol</at> |
|
1255 |
<at name="name">btnSelectSymbol</at> |
|
1256 |
<at name="width">113</at> |
|
1257 |
<at name="text">_Select_symbol</at> |
|
1254 |
<at name="actionCommand">_Center_to_current_row</at> |
|
1255 |
<at name="name">chkCenterToCurrentRow</at> |
|
1256 |
<at name="width">1097</at> |
|
1257 |
<at name="text">_Center_to_current_row</at> |
|
1258 |
<at name="toolTipText">_Center_to_current_row_description</at> |
|
1258 | 1259 |
<at name="height">22</at> |
1259 | 1260 |
</object> |
1260 | 1261 |
</at> |
... | ... | |
1265 | 1266 |
</item> |
1266 | 1267 |
<item > |
1267 | 1268 |
<at name="value"> |
1268 |
<object classname="com.jeta.forms.store.memento.BeanMemento">
|
|
1269 |
<object classname="com.jeta.forms.store.memento.FormMemento">
|
|
1269 | 1270 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
1270 | 1271 |
<at name="cellconstraints"> |
1271 | 1272 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
1272 |
<at name="column">2</at>
|
|
1273 |
<at name="row">18</at>
|
|
1274 |
<at name="colspan">3</at>
|
|
1273 |
<at name="column">4</at>
|
|
1274 |
<at name="row">16</at>
|
|
1275 |
<at name="colspan">1</at>
|
|
1275 | 1276 |
<at name="rowspan">1</at> |
1276 | 1277 |
<at name="halign">default</at> |
1277 | 1278 |
<at name="valign">default</at> |
1278 | 1279 |
<at name="insets" object="insets">0,0,0,0</at> |
1279 | 1280 |
</object> |
1280 | 1281 |
</at> |
1281 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
|
|
1282 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at>
|
|
1282 | 1283 |
</super> |
1283 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
1284 |
<at name="beanclass">javax.swing.JCheckBox</at> |
|
1285 |
<at name="beanproperties"> |
|
1284 |
<at name="id">embedded.O757869dfK1892a33c9fbKK7fff</at> |
|
1285 |
<at name="rowspecs">CENTER:DEFAULT:NONE</at> |
|
1286 |
<at name="colspecs">FILL:22DLU:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:8DLU:GROW(1.0)</at> |
|
1287 |
<at name="components"> |
|
1288 |
<object classname="java.util.LinkedList"> |
|
1289 |
<item > |
|
1290 |
<at name="value"> |
|
1291 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
1292 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
1293 |
<at name="cellconstraints"> |
|
1294 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
1295 |
<at name="column">3</at> |
|
1296 |
<at name="row">1</at> |
|
1297 |
<at name="colspan">1</at> |
|
1298 |
<at name="rowspan">1</at> |
|
1299 |
<at name="halign">default</at> |
|
1300 |
<at name="valign">default</at> |
|
1301 |
<at name="insets" object="insets">0,0,0,0</at> |
|
1302 |
</object> |
|
1303 |
</at> |
|
1304 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
1305 |
</super> |
|
1306 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
1307 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
1308 |
<at name="beanproperties"> |
|
1309 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
1310 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
1311 |
<at name="properties"> |
|
1312 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
1313 |
<at name="border"> |
|
1314 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
1315 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
1316 |
<at name="name">border</at> |
|
1317 |
</super> |
|
1318 |
<at name="borders"> |
|
1319 |
<object classname="java.util.LinkedList"> |
|
1320 |
<item > |
|
1321 |
<at name="value"> |
|
1322 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
1323 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
1324 |
<at name="name">border</at> |
|
1325 |
</super> |
|
1326 |
</object> |
|
1327 |
</at> |
|
1328 |
</item> |
|
1329 |
</object> |
|
1330 |
</at> |
|
1331 |
</object> |
|
1332 |
</at> |
|
1333 |
<at name="name">lblAppySymbolTo</at> |
|
1334 |
<at name="width">101</at> |
|
1335 |
<at name="text">_Apply_symbol</at> |
|
1336 |
<at name="fill"> |
|
1337 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
1338 |
<at name="name">fill</at> |
|
1339 |
</object> |
|
1340 |
</at> |
|
1341 |
<at name="height">17</at> |
|
1342 |
</object> |
|
1343 |
</at> |
|
1344 |
</object> |
|
1345 |
</at> |
|
1346 |
</object> |
|
1347 |
</at> |
|
1348 |
</item> |
|
1349 |
<item > |
|
1350 |
<at name="value"> |
|
1351 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
1352 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
1353 |
<at name="cellconstraints"> |
|
1354 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
1355 |
<at name="column">5</at> |
|
1356 |
<at name="row">1</at> |
|
1357 |
<at name="colspan">1</at> |
|
1358 |
<at name="rowspan">1</at> |
|
1359 |
<at name="halign">default</at> |
|
1360 |
<at name="valign">default</at> |
|
1361 |
<at name="insets" object="insets">0,0,0,0</at> |
|
1362 |
</object> |
|
1363 |
</at> |
|
1364 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
1365 |
</super> |
|
1366 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
1367 |
<at name="beanclass">javax.swing.JComboBox</at> |
|
1368 |
<at name="beanproperties"> |
|
1369 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
1370 |
<at name="classname">javax.swing.JComboBox</at> |
|
1371 |
<at name="properties"> |
|
1372 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
1373 |
<at name="border"> |
|
1374 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
1375 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
1376 |
<at name="name">border</at> |
|
1377 |
</super> |
|
1378 |
<at name="borders"> |
|
1379 |
<object classname="java.util.LinkedList"> |
|
1380 |
<item > |
|
1381 |
<at name="value"> |
|
1382 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
1383 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
1384 |
<at name="name">border</at> |
|
1385 |
</super> |
|
1386 |
</object> |
|
1387 |
</at> |
|
1388 |
</item> |
|
1389 |
</object> |
|
1390 |
</at> |
|
1391 |
</object> |
|
1392 |
</at> |
|
1393 |
<at name="name">cboApplySymbolTo</at> |
|
1394 |
<at name="width">765</at> |
|
1395 |
<at name="items"> |
|
1396 |
<object classname="com.jeta.forms.store.properties.ItemsProperty"> |
|
1397 |
<at name="name">items</at> |
|
1398 |
</object> |
|
1399 |
</at> |
|
1400 |
<at name="height">23</at> |
|
1401 |
</object> |
|
1402 |
</at> |
|
1403 |
</object> |
|
1404 |
</at> |
|
1405 |
</object> |
|
1406 |
</at> |
|
1407 |
</item> |
|
1408 |
<item > |
|
1409 |
<at name="value"> |
|
1410 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
1411 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
1412 |
<at name="cellconstraints"> |
|
1413 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
1414 |
<at name="column">1</at> |
|
1415 |
<at name="row">1</at> |
|
1416 |
<at name="colspan">1</at> |
|
1417 |
<at name="rowspan">1</at> |
|
1418 |
<at name="halign">fill</at> |
|
1419 |
<at name="valign">fill</at> |
|
1420 |
<at name="insets" object="insets">0,0,0,0</at> |
|
1421 |
</object> |
|
1422 |
</at> |
|
1423 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
1424 |
</super> |
|
1425 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
1426 |
<at name="beanclass">javax.swing.JButton</at> |
|
1427 |
<at name="beanproperties"> |
|
1428 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
1429 |
<at name="classname">javax.swing.JButton</at> |
|
1430 |
<at name="properties"> |
|
1431 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
1432 |
<at name="border"> |
|
1433 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
1434 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
1435 |
<at name="name">border</at> |
|
1436 |
</super> |
|
1437 |
<at name="borders"> |
|
1438 |
<object classname="java.util.LinkedList"> |
|
1439 |
<item > |
|
1440 |
<at name="value"> |
|
1441 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
1442 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
1443 |
<at name="name">border</at> |
|
1444 |
</super> |
|
1445 |
</object> |
|
1446 |
</at> |
|
1447 |
</item> |
|
1448 |
</object> |
|
1449 |
</at> |
|
1450 |
</object> |
|
1451 |
</at> |
|
1452 |
<at name="actionCommand">...</at> |
|
1453 |
<at name="name">btnSelectSymbol</at> |
|
1454 |
<at name="width">40</at> |
|
1455 |
<at name="text">...</at> |
|
1456 |
<at name="toolTipText">_Select_symbol</at> |
|
1457 |
<at name="height">23</at> |
|
1458 |
</object> |
|
1459 |
</at> |
|
1460 |
</object> |
|
1461 |
</at> |
|
1462 |
</object> |
|
1463 |
</at> |
|
1464 |
</item> |
|
1465 |
</object> |
|
1466 |
</at> |
|
1467 |
<at name="properties"> |
|
1286 | 1468 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
1287 |
<at name="classname">javax.swing.JCheckBox</at>
|
|
1469 |
<at name="classname">com.jeta.forms.gui.form.GridView</at>
|
|
1288 | 1470 |
<at name="properties"> |
1289 | 1471 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
1290 | 1472 |
<at name="border"> |
... | ... | |
1293 | 1475 |
<at name="name">border</at> |
1294 | 1476 |
</super> |
1295 | 1477 |
<at name="borders"> |
1296 |
<object classname="java.util.LinkedList"> |
|
1297 |
<item > |
|
1298 |
<at name="value"> |
|
1299 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
1300 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
1301 |
<at name="name">border</at> |
|
1302 |
</super> |
|
1303 |
</object> |
|
1304 |
</at> |
|
1305 |
</item> |
|
1306 |
</object> |
|
1478 |
<object classname="java.util.LinkedList"/> |
|
1307 | 1479 |
</at> |
1308 | 1480 |
</object> |
1309 | 1481 |
</at> |
1310 |
<at name="actionCommand">_Center_to_current_row</at> |
|
1311 |
<at name="name">chkCenterToCurrentRow</at> |
|
1312 |
<at name="width">1183</at> |
|
1313 |
<at name="text">_Center_to_current_row</at> |
|
1314 |
<at name="toolTipText">_Center_to_current_row_description</at> |
|
1315 |
<at name="height">22</at> |
|
1482 |
<at name="name"></at> |
|
1483 |
<at name="fill"> |
|
1484 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
1485 |
<at name="name">fill</at> |
|
1486 |
</object> |
|
1487 |
</at> |
|
1488 |
<at name="scollBars"> |
|
1489 |
<object classname="com.jeta.forms.store.properties.ScrollBarsProperty"> |
|
1490 |
<at name="name">scollBars</at> |
|
1491 |
<at name="verticalpolicy">21</at> |
|
1492 |
<at name="horizontalpolicy">31</at> |
|
1493 |
</object> |
|
1494 |
</at> |
|
1316 | 1495 |
</object> |
1317 | 1496 |
</at> |
1318 | 1497 |
</object> |
1319 | 1498 |
</at> |
1499 |
<at name="cellpainters"> |
|
1500 |
<object classname="com.jeta.forms.store.support.Matrix"> |
|
1501 |
<at name="rows"> |
|
1502 |
<object classname="[Ljava.lang.Object;" size="1"> |
|
1503 |
<at name="item" index="0"> |
|
1504 |
<object classname="[Ljava.lang.Object;" size="5"/> |
|
1505 |
</at> |
|
1506 |
</object> |
|
1507 |
</at> |
|
1508 |
</object> |
|
1509 |
</at> |
|
1510 |
<at name="rowgroups"> |
|
1511 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
1512 |
<at name="groups"> |
|
1513 |
<object classname="java.util.HashMap"/> |
|
1514 |
</at> |
|
1515 |
</object> |
|
1516 |
</at> |
|
1517 |
<at name="colgroups"> |
|
1518 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
1519 |
<at name="groups"> |
|
1520 |
<object classname="java.util.HashMap"/> |
|
1521 |
</at> |
|
1522 |
</object> |
|
1523 |
</at> |
|
1320 | 1524 |
</object> |
1321 | 1525 |
</at> |
1322 | 1526 |
</item> |
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/reportfromlayout/ExportReportToLayout.java | ||
---|---|---|
9 | 9 |
import java.awt.event.ActionEvent; |
10 | 10 |
import java.io.File; |
11 | 11 |
import java.io.FileOutputStream; |
12 |
import java.io.InputStream; |
|
13 | 12 |
import java.util.List; |
14 | 13 |
import java.util.function.Predicate; |
15 | 14 |
import javax.json.JsonObject; |
... | ... | |
19 | 18 |
import javax.swing.event.ChangeEvent; |
20 | 19 |
import javax.swing.event.TreeSelectionEvent; |
21 | 20 |
import org.apache.commons.io.IOUtils; |
22 |
import org.apache.commons.lang3.StringUtils; |
|
23 | 21 |
import org.gvsig.app.ApplicationLocator; |
24 | 22 |
import org.gvsig.app.project.documents.layout.LayoutManager; |
25 |
import org.gvsig.app.project.documents.layout.report.LayoutReportActionImpl;
|
|
23 |
import org.gvsig.app.project.documents.layout.report.LayoutReportAction; |
|
26 | 24 |
import org.gvsig.app.project.documents.layout.report.LayoutReportActionFactory; |
27 | 25 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
28 | 26 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
... | ... | |
30 | 28 |
import org.gvsig.fmap.dal.swing.report.ReportAction; |
31 | 29 |
import org.gvsig.fmap.dal.swing.storesrepository.StoresRepositoryController; |
32 | 30 |
import org.gvsig.i18n.Messages; |
33 |
import org.gvsig.json.Json; |
|
34 | 31 |
import org.gvsig.tools.ToolsLocator; |
35 | 32 |
import org.gvsig.tools.dispose.DisposeUtils; |
36 | 33 |
import org.gvsig.tools.i18n.I18nManager; |
... | ... | |
144 | 141 |
|
145 | 142 |
private void fillCboReport() { |
146 | 143 |
DataSwingManager dataSwingManager = DALSwingLocator.getDataSwingManager(); |
147 |
DefaultComboBoxModel<LabeledValue<ReportAction>> model = new DefaultComboBoxModel(); |
|
144 |
DefaultComboBoxModel<LabeledValue<LayoutReportAction>> model = new DefaultComboBoxModel();
|
|
148 | 145 |
if(this.source == null) { |
149 | 146 |
this.cboReport.setModel(model); |
150 | 147 |
return; |
151 | 148 |
} |
152 |
List<ReportAction> reports = dataSwingManager.getReportActions(source, (Predicate<JsonObject>) (JsonObject t) -> LayoutReportActionFactory.isJsonApplicable(t)); |
|
149 |
List<ReportAction> reports = dataSwingManager.getReportActions( |
|
150 |
source, |
|
151 |
(Predicate<JsonObject>) (JsonObject t) -> LayoutReportActionFactory.isJsonApplicable(t) |
|
152 |
); |
|
153 | 153 |
|
154 | 154 |
for (ReportAction report : reports) { |
155 |
model.addElement(new LabeledValueImpl<>(report.getReportLabel(), report)); |
|
155 |
model.addElement(new LabeledValueImpl<>(report.getReportLabel(), (LayoutReportAction)report));
|
|
156 | 156 |
} |
157 | 157 |
cboReport.setModel(model); |
158 | 158 |
|
159 | 159 |
} |
160 | 160 |
|
161 |
// List<Document> getLayouts() { |
|
162 |
// |
|
163 |
// List<Document> layouts = ApplicationLocator.getProjectManager().getCurrentProject().getDocuments(LayoutDocument.class); |
|
164 |
// |
|
165 |
// return layouts; |
|
166 |
// |
|
167 |
// } |
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
// private void fillCboLayout() { |
|
172 |
// DefaultComboBoxModel<LabeledValue<LayoutDocument>> model = new DefaultComboBoxModel(); |
|
173 |
// List<Document> layouts = getLayouts(); |
|
174 |
// |
|
175 |
// if(layouts.size() > 1){ |
|
176 |
// Collections.sort(layouts, new CompareUtils.NullSafeComparator<Document>() { |
|
177 |
// @Override |
|
178 |
// public int safeCompare(Document o1, Document o2) { |
|
179 |
// return StringUtils.compare(o1.getName(), o2.getName()); |
|
180 |
// } |
|
181 |
// }); |
|
182 |
// } |
|
183 |
// |
|
184 |
// for (Document layout : layouts) { |
|
185 |
// if(layout instanceof LayoutDocument){ |
|
186 |
// model.addElement(new LabeledValueImpl<>(layout.getName(), (LayoutDocument)layout)); |
|
187 |
// } |
|
188 |
// } |
|
189 |
// cboLayout.setModel(model); |
|
190 |
// |
|
191 |
// } |
|
192 |
|
|
193 |
private ReportAction getReportAction(){ |
|
194 |
return (ReportAction) ((LabeledValue)cboReport.getSelectedItem()).getValue(); |
|
161 |
private LayoutReportAction getReportAction(){ |
|
162 |
return (LayoutReportAction) ((LabeledValue)cboReport.getSelectedItem()).getValue(); |
|
195 | 163 |
} |
196 | 164 |
|
197 |
// private LayoutDocument getLayoutDocument(){ |
|
198 |
// return (LayoutDocument) ((LabeledValue)cboLayout.getSelectedItem()).getValue(); |
|
199 |
// } |
|
200 |
|
|
201 | 165 |
public void fetch(ExportReportToLayoutParameters params){ |
202 | 166 |
params.setSource(this.source); |
203 | 167 |
params.setReportAction(this.getReportAction()); |
... | ... | |
206 | 170 |
|
207 | 171 |
public boolean doExportReportToLayout(ExportReportToLayoutParameters params) { |
208 | 172 |
FeatureStore source = params.getSource(); |
209 |
ReportAction report = params.getReportAction(); |
|
173 |
LayoutReportAction report = params.getReportAction();
|
|
210 | 174 |
File file = params.getFile(); |
211 | 175 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
212 | 176 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
... | ... | |
244 | 208 |
|
245 | 209 |
} |
246 | 210 |
|
247 |
public boolean doExportReportToLayout(FeatureStore store, ReportAction report, File templateFile) { |
|
211 |
public boolean doExportReportToLayout(FeatureStore store, LayoutReportAction report, File templateFile) {
|
|
248 | 212 |
|
249 |
|
|
250 |
ResourcesStorage.Resource resourceReport = null; |
|
251 | 213 |
ResourcesStorage.Resource resourceLayout = null; |
252 | 214 |
FileOutputStream templateOs = null; |
253 | 215 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
254 | 216 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
255 | 217 |
try { |
256 |
ResourcesStorage resources = store.getResourcesStorage(); |
|
257 |
|
|
258 |
String resourceReportName = getResourceName(resources, report.getReportName()); |
|
259 |
if (resourceReportName == null) { |
|
260 |
dialogs.messageDialog( |
|
261 |
i18n.getTranslation("_Cant_find_resource_XreportnameX", |
|
262 |
new String[]{ |
|
263 |
resourceReportName, |
|
264 |
} |
|
265 |
), |
|
266 |
null, |
|
267 |
i18n.getTranslation("_Export_report_to_layout"), |
|
268 |
JOptionPane.WARNING_MESSAGE); |
|
269 |
return false; |
|
270 |
} |
|
218 |
resourceLayout = report.getTemplateAsResource(); |
|
271 | 219 |
|
272 |
resourceReport = resources.getResource(resourceReportName); |
|
273 |
|
|
274 |
JsonObject jsonReport = Json.createObject(resourceReport.asInputStream()); |
|
275 |
|
|
276 |
String templateName = jsonReport.getString(LayoutReportActionImpl.LAYOUT_REPORT_TEMPLATE_NAME, LayoutReportActionImpl.LAYOUT_REPORT_DEFAULT_TEMPLATE_NAME); |
|
277 |
|
|
278 |
if(StringUtils.isBlank(templateName)){ |
|
279 |
|
|
280 |
dialogs.messageDialog( |
|
281 |
i18n.getTranslation("_Template_name_is_blank"//, |
|
282 |
// new String[]{ |
|
283 |
// resourceReportName, |
|
284 |
// } |
|
285 |
), |
|
286 |
null, |
|
287 |
i18n.getTranslation("_Export_report_to_layout"), |
|
288 |
JOptionPane.WARNING_MESSAGE); |
|
289 |
return false; |
|
290 |
} |
|
291 |
|
|
292 |
resourceLayout = resources.getResource(templateName); |
|
293 |
|
|
294 | 220 |
if (!(templateFile.getPath().toLowerCase().endsWith(LayoutManager.TEMPLATE_FILE_POINTEXT.toLowerCase()))) { |
295 | 221 |
templateFile = new File(templateFile.getPath() + LayoutManager.TEMPLATE_FILE_POINTEXT); |
296 | 222 |
} |
... | ... | |
308 | 234 |
return false; |
309 | 235 |
} finally { |
310 | 236 |
IOUtils.closeQuietly(templateOs); |
311 |
IOUtils.closeQuietly(resourceReport); |
|
312 | 237 |
IOUtils.closeQuietly(resourceLayout); |
313 | 238 |
} |
314 | 239 |
|
315 |
|
|
316 | 240 |
} |
317 | 241 |
|
318 |
// private String getNextResourceName(ResourcesStorage resources, String resourceName){ |
|
319 |
// List<ResourcesStorage.Resource> reports = resources.getResources(resourceName); |
|
320 |
// if(reports == null || reports.isEmpty()){ |
|
321 |
// return resourceName; |
|
322 |
// } |
|
323 |
// int n = -1; |
|
324 |
// for (ResourcesStorage.Resource report : reports) { |
|
325 |
// if(StringUtils.contains(report.getName(), resources.getSeparator())){ |
|
326 |
// String[] s = StringUtils.split(report.getName(), resources.getSeparator()); |
|
327 |
// n = Math.max(n, Integer.parseInt(s[0])); |
|
328 |
// } else { |
|
329 |
// n=0; |
|
330 |
// } |
|
331 |
// } |
|
332 |
// |
|
333 |
// if (n < 0) { |
|
334 |
// return resourceName; |
|
335 |
// } |
|
336 |
// |
|
337 |
// n++; |
|
338 |
// return String.valueOf(n) + resources.getSeparator() + resourceName; |
|
339 |
// |
|
340 |
// |
|
341 |
// } |
|
342 |
// |
|
343 |
private String getResourceName(ResourcesStorage resources, String reportName) { |
|
344 |
try { |
|
345 |
if (resources != null) { |
|
346 |
List<ResourcesStorage.Resource> reportsResources = resources.getResources("report"); |
|
347 |
if (reportsResources != null && !reportsResources.isEmpty()) { |
|
348 |
for (ResourcesStorage.Resource resource : reportsResources) { |
|
349 |
InputStream is = null; |
|
350 |
try { |
|
351 |
is = resource.asInputStream(); |
|
352 |
JsonObject json = javax.json.Json.createReader(is).readObject(); |
|
353 |
String name = json.getString(LayoutReportActionImpl.LAYOUT_REPORT_NAME, null); |
|
354 |
if(StringUtils.equalsIgnoreCase(name, reportName)){ |
|
355 |
return resource.getName(); |
|
356 |
} |
|
357 |
} catch (Exception ex) { |
|
358 |
LOGGER.warn("Can't load report form resource (" + resource.getURL() + ")", ex); |
|
359 |
} finally { |
|
360 |
IOUtils.closeQuietly(is); |
|
361 |
} |
|
362 |
DisposeUtils.disposeQuietly(resource); |
|
363 |
} |
|
364 |
} |
|
365 |
} |
|
366 |
} finally { |
|
367 |
DisposeUtils.disposeQuietly(resources); |
|
368 |
} |
|
369 |
return null; |
|
370 |
} |
|
371 |
|
|
372 |
|
|
373 | 242 |
private void doChangeReport() { |
374 |
ReportAction report = getReportAction(); |
|
243 |
// ReportAction report = getReportAction();
|
|
375 | 244 |
this.pickerFile.set(null); |
376 | 245 |
// if(report == null){ |
377 | 246 |
// this.txtIdentifier.setText(""); |
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/reportfromlayout/ConfigureReportFromLayout.java | ||
---|---|---|
8 | 8 |
import java.awt.Dimension; |
9 | 9 |
import java.awt.event.ActionEvent; |
10 | 10 |
import java.awt.event.ActionListener; |
11 |
import java.io.ByteArrayOutputStream; |
|
12 |
import java.io.InputStream; |
|
13 |
import java.nio.charset.StandardCharsets; |
|
14 | 11 |
import java.util.List; |
15 | 12 |
import java.util.function.Predicate; |
16 | 13 |
import javax.json.JsonObject; |
... | ... | |
18 | 15 |
import javax.swing.JComponent; |
19 | 16 |
import javax.swing.JOptionPane; |
20 | 17 |
import javax.swing.SwingUtilities; |
18 |
import javax.swing.event.ChangeEvent; |
|
21 | 19 |
import javax.swing.event.DocumentEvent; |
22 | 20 |
import javax.swing.event.DocumentListener; |
23 | 21 |
import javax.swing.event.TreeSelectionEvent; |
24 |
import org.apache.commons.codec.binary.Hex; |
|
25 |
import org.apache.commons.io.IOUtils; |
|
26 | 22 |
import org.apache.commons.lang3.StringUtils; |
27 | 23 |
import org.gvsig.app.ApplicationLocator; |
28 |
import org.gvsig.app.gui.styling.SymbolSelector; |
|
29 | 24 |
import org.gvsig.app.project.documents.Document; |
30 | 25 |
import org.gvsig.app.project.documents.layout.LayoutDocument; |
31 | 26 |
import org.gvsig.app.project.documents.layout.fframes.FFrameView; |
32 | 27 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
33 | 28 |
import org.gvsig.app.project.documents.layout.report.LayoutReportAction; |
34 | 29 |
import org.gvsig.app.project.documents.layout.report.LayoutReportActionFactory; |
35 |
import org.gvsig.app.project.documents.layout.report.LayoutReportActionImpl; |
|
36 |
import org.gvsig.app.project.documents.view.legend.gui.ISymbolSelector; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
30 |
import org.gvsig.app.project.documents.layout.report.LayoutReportActionParameters; |
|
38 | 31 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
39 | 32 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
40 | 33 |
import org.gvsig.fmap.dal.swing.DataSwingManager; |
41 | 34 |
import org.gvsig.fmap.dal.swing.report.ReportAction; |
42 | 35 |
import org.gvsig.fmap.dal.swing.storesrepository.StoresRepositoryController; |
43 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
44 | 36 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
45 |
import org.gvsig.json.Json; |
|
46 |
import org.gvsig.json.JsonObjectBuilder; |
|
37 |
import org.gvsig.symbology.swing.SymbologySwingLocator; |
|
47 | 38 |
import org.gvsig.tools.ToolsLocator; |
48 | 39 |
import org.gvsig.tools.dispose.DisposeUtils; |
49 | 40 |
import org.gvsig.tools.i18n.I18nManager; |
50 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
51 |
import org.gvsig.tools.persistence.PersistentState; |
|
52 |
import org.gvsig.tools.resourcesstorage.ResourcesStorage; |
|
53 | 41 |
import org.gvsig.tools.swing.api.ListElement; |
54 | 42 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
55 | 43 |
import org.gvsig.tools.swing.api.ToolsSwingManager; |
56 | 44 |
import org.gvsig.tools.swing.api.ToolsSwingUtils; |
57 | 45 |
import org.gvsig.tools.swing.api.documentfilters.PositiveDoubleDocumentFilter; |
46 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
|
58 | 47 |
import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
59 | 48 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
60 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
61 | 49 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
62 | 50 |
import org.gvsig.tools.util.LabeledValue; |
63 | 51 |
import org.gvsig.tools.util.LabeledValueImpl; |
... | ... | |
71 | 59 |
public class ConfigureReportFromLayout extends ConfigureReportFromLayoutPanelView { |
72 | 60 |
|
73 | 61 |
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigureReportFromLayout.class); |
62 |
private static final int TO_RECORD_VALUE = 1; |
|
63 |
private static final int TO_EVERYTIHNG_EXCEPT_RECORD_VALUE = 2; |
|
74 | 64 |
|
75 | 65 |
private StoresRepositoryController treeSourceController; |
76 | 66 |
private FeatureStore source; |
77 | 67 |
private Dialog dialog; |
78 | 68 |
private ISymbol highlightSymbol; |
69 |
private PickerController<ISymbol> symbolPicker; |
|
79 | 70 |
|
80 | 71 |
public ConfigureReportFromLayout() { |
81 | 72 |
this.initComponents(); |
... | ... | |
127 | 118 |
doUpdateComponents(); |
128 | 119 |
}); |
129 | 120 |
|
130 |
this.btnSelectSymbol.addActionListener((ActionEvent e) -> {
|
|
131 |
doSelectSymbol();
|
|
121 |
this.chkHighlightRecord.addActionListener((ActionEvent e) -> {
|
|
122 |
doUpdateComponents();
|
|
132 | 123 |
}); |
133 | 124 |
|
134 |
ToolsSwingManager toolsSwingManager = ToolsSwingLocator.getToolsSwingManager();
|
|
125 |
fillCboApplyTo();
|
|
135 | 126 |
|
127 |
this.symbolPicker = SymbologySwingLocator.getSwingManager().createSymbolPickerController(btnSelectSymbol, highlightSymbol); |
|
128 |
this.symbolPicker.addChangeListener((ChangeEvent e) -> { |
|
129 |
this.highlightSymbol = this.symbolPicker.get(); |
|
130 |
}); |
|
131 |
|
|
136 | 132 |
PositiveDoubleDocumentFilter.install(txtBufferSize); |
137 | 133 |
|
138 | 134 |
Dimension screensize = ApplicationLocator.getApplicationManager().getUIManager().getInternalSize(); |
... | ... | |
166 | 162 |
doUpdateComponents(); |
167 | 163 |
} |
168 | 164 |
|
169 |
private void doSelectSymbol() { |
|
170 |
|
|
171 |
if(this.source == null){ |
|
172 |
return; |
|
173 |
} |
|
174 |
FeatureAttributeDescriptor geomAttr = this.source.getDefaultFeatureTypeQuietly().getDefaultGeometryAttribute(); |
|
175 |
if(geomAttr == null){ |
|
176 |
return; |
|
177 |
} |
|
178 |
int geomType = geomAttr.getGeomType().getType(); |
|
179 |
|
|
180 |
if(this.highlightSymbol == null) { |
|
181 |
this.highlightSymbol = MapContextLocator.getMapContextManager().createSymbol(geomType); |
|
182 |
} |
|
183 |
ISymbolSelector symSel = SymbolSelector.createSymbolSelector(this.highlightSymbol, geomType); |
|
184 |
|
|
185 |
WindowManager_v2 windowManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
186 |
windowManager.showWindow((JComponent)symSel, "_Symbol", WindowManager.MODE.DIALOG); |
|
187 |
this.highlightSymbol = (ISymbol) symSel.getSelectedObject(); |
|
188 |
|
|
189 |
} |
|
165 |
// private void doChangeApplySymbolTo() { |
|
166 |
// Object item = cboApplySymbolTo.getSelectedItem(); |
|
167 |
// ((LabeledValue)item) |
|
168 |
// doUpdateComponents(); |
|
169 |
// } |
|
190 | 170 |
|
191 |
|
|
192 | 171 |
private void doUpdateComponents() { |
193 | 172 |
this.treeSourceController.setEnabled(true); |
194 | 173 |
|
... | ... | |
196 | 175 |
|
197 | 176 |
this.txtBufferSize.setEnabled(this.chkZoomToCurrentRow.isSelected()); |
198 | 177 |
|
178 |
this.btnSelectSymbol.setEnabled(this.chkHighlightRecord.isSelected()); |
|
179 |
this.cboApplySymbolTo.setEnabled(this.chkHighlightRecord.isSelected()); |
|
180 |
|
|
199 | 181 |
if(this.dialog != null){ |
200 | 182 |
boolean enabled = (this.source != null) && (this.getLayoutDocument() != null) && StringUtils.isNotBlank(this.txtIdentifier.getText()); |
201 | 183 |
this.dialog.setButtonEnabled(WindowManager_v2.BUTTON_OK, enabled); |
... | ... | |
265 | 247 |
} |
266 | 248 |
this.cboView.setModel(model); |
267 | 249 |
} |
250 |
|
|
251 |
private void fillCboApplyTo() { |
|
252 |
DefaultComboBoxModel<LabeledValue<Integer>> model = new DefaultComboBoxModel(); |
|
253 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
254 |
|
|
255 |
model.addElement(new LabeledValueImpl<>(i18n.getTranslation("_to_record"), TO_RECORD_VALUE)); |
|
256 |
model.addElement(new LabeledValueImpl<>(i18n.getTranslation("_to_everything_except_record"), TO_EVERYTIHNG_EXCEPT_RECORD_VALUE)); |
|
257 |
|
|
258 |
this.cboApplySymbolTo.setModel(model); |
|
259 |
} |
|
268 | 260 |
|
261 |
|
|
269 | 262 |
private LayoutReportAction getReportAction(){ |
270 | 263 |
LabeledValue<LayoutReportAction> selected = (LabeledValue<LayoutReportAction>)cboReport.getSelectedItem(); |
271 | 264 |
if(selected == null){ |
... | ... | |
274 | 267 |
return selected.getValue(); |
275 | 268 |
} |
276 | 269 |
|
277 |
private LayoutDocument getLayoutDocument(){
|
|
270 |
public LayoutDocument getLayoutDocument(){
|
|
278 | 271 |
LabeledValue<LayoutDocument> selected = (LabeledValue<LayoutDocument>)cboLayout.getSelectedItem(); |
279 | 272 |
if(selected == null){ |
280 | 273 |
return null; |
... | ... | |
290 | 283 |
return selected.getValue(); |
291 | 284 |
} |
292 | 285 |
|
293 |
public void fetch(ConfigureReportFromLayoutParameters params){
|
|
294 |
params.setLayout(this.getLayoutDocument()); |
|
295 |
params.setSource(this.source); |
|
286 |
public void fetch(LayoutReportActionParameters params){
|
|
287 |
// params.setLayout(this.getLayoutDocument());
|
|
288 |
// params.setSource(this.source);
|
|
296 | 289 |
params.setIdentifier(this.txtIdentifier.getText()); |
297 | 290 |
params.setLabel(this.txtLabel.getText()); |
298 | 291 |
|
... | ... | |
301 | 294 |
double bufferSize = PositiveDoubleDocumentFilter.getValue(this.txtBufferSize); |
302 | 295 |
params.setBufferSize(bufferSize); |
303 | 296 |
params.setViewTag(this.getViewTag()); |
304 |
params.setUseIntervalPdfViewer(this.chkUseInternalPdfViewer.isSelected());
|
|
297 |
params.setUseInternalPdfViewer(this.chkUseInternalPdfViewer.isSelected());
|
|
305 | 298 |
params.setHighlightRecord(this.chkHighlightRecord.isSelected()); |
306 | 299 |
params.setHighlightSymbol(this.highlightSymbol); |
300 |
Object applyToItem = this.cboApplySymbolTo.getSelectedItem(); |
|
301 |
if(applyToItem == null){ |
|
302 |
params.setApplySymbolToRecord(false); |
|
303 |
params.setApplySymbolToEverythingExceptRecord(false); |
|
304 |
} else { |
|
305 |
switch ((int)((LabeledValue)applyToItem).getValue()) { |
|
306 |
case TO_RECORD_VALUE: |
|
307 |
params.setApplySymbolToRecord(true); |
|
308 |
params.setApplySymbolToEverythingExceptRecord(false); |
|
309 |
break; |
|
310 |
case TO_EVERYTIHNG_EXCEPT_RECORD_VALUE: |
|
311 |
params.setApplySymbolToRecord(false); |
|
312 |
params.setApplySymbolToEverythingExceptRecord(true); |
|
313 |
break; |
|
314 |
default: |
|
315 |
params.setApplySymbolToRecord(false); |
|
316 |
params.setApplySymbolToEverythingExceptRecord(false); |
|
317 |
} |
|
318 |
} |
|
307 | 319 |
} |
308 | 320 |
|
309 | 321 |
private void translate() { |
... | ... | |
322 | 334 |
manager.translate(txtBufferSize); |
323 | 335 |
manager.translate(chkHighlightRecord); |
324 | 336 |
manager.translate(btnSelectSymbol); |
337 |
manager.translate(lblAppySymbolTo); |
|
338 |
manager.translate(cboApplySymbolTo); |
|
325 | 339 |
} |
326 | 340 |
|
327 |
public boolean doConfigureReportFromLayout(ConfigureReportFromLayoutParameters params) {
|
|
328 |
LayoutDocument layout = params.getLayout(); |
|
329 |
FeatureStore source = params.getSource(); |
|
341 |
public boolean doConfigureReportFromLayout(LayoutReportActionParameters params, LayoutDocument layout, FeatureStore source) {
|
|
342 |
// LayoutDocument layout = params.getLayout();
|
|
343 |
// FeatureStore source = params.getSource();
|
|
330 | 344 |
String identifier = params.getIdentifier(); |
331 | 345 |
String label = params.getLabel(); |
332 | 346 |
|
... | ... | |
364 | 378 |
boolean zoomToCurrentRow = params.isZoomToCurrentRow(); |
365 | 379 |
double bufferSize = params.getBufferSize(); |
366 | 380 |
boolean highlightRecord = params.isHighlightRecord(); |
367 |
ISymbol highlightSymbol = params.getHighlightSymbol(); |
|
368 |
boolean useInternalPdfViewer = params.isUseIntervalPdfViewer(); |
|
381 |
ISymbol highlightSymbol = params.getHighlightSymbol(source); |
|
382 |
boolean applySymbolToRecord = params.isApplySymbolToRecord(); |
|
383 |
boolean applySymbolToEverythingExceptRecord = params.isApplySymbolToEverythingExceptRecord(); |
|
384 |
boolean useInternalPdfViewer = params.isUseInternalPdfViewer(); |
|
369 | 385 |
String viewTag = params.getViewTag(); |
370 | 386 |
|
371 | 387 |
return doConfigureReportFromLayout( |
... | ... | |
378 | 394 |
bufferSize, |
379 | 395 |
highlightRecord, |
380 | 396 |
highlightSymbol, |
397 |
applySymbolToRecord, |
|
398 |
applySymbolToEverythingExceptRecord, |
|
381 | 399 |
viewTag, |
382 | 400 |
useInternalPdfViewer); |
383 | 401 |
|
... | ... | |
394 | 412 |
double bufferSize, |
395 | 413 |
boolean highlightRecord, |
396 | 414 |
ISymbol highlightSymbol, |
415 |
boolean applySymbolToRecord, |
|
416 |
boolean applySymbolToEverythingExceptRecord, |
|
397 | 417 |
String viewTag, |
398 | 418 |
boolean useInternalPdfViewer |
399 | 419 |
) { |
400 |
ResourcesStorage.Resource resource = null; |
|
401 |
ResourcesStorage.Resource resourceLayout = null; |
|
402 |
boolean selfContained = layout.isPersistIndependent(); |
|
403 | 420 |
try { |
404 |
ResourcesStorage resources = store.getResourcesStorage(); |
|
405 |
|
|
406 |
String resourceName = getResourceName(resources, name); |
|
407 |
if(resourceName == null){ |
|
408 |
resourceName = getNextResourceName(resources, "report"); |
|
409 |
} |
|
410 |
|
|
411 |
String templateName = LayoutReportActionFactory.LAYOUT_REPORT_ACTION_NAME; |
|
412 |
if(StringUtils.contains(resourceName, resources.getSeparator())){ |
|
413 |
templateName = StringUtils.replaceIgnoreCase(resourceName, resources.getSeparator()+"report", resources.getSeparator()+LayoutReportActionFactory.LAYOUT_REPORT_ACTION_NAME); |
|
414 |
} |
|
415 |
JsonObjectBuilder jsonBuilder = Json.createObjectBuilder(); |
|
416 |
jsonBuilder.add(LayoutReportActionImpl.LAYOUT_REPORT_NAME, name); |
|
417 |
jsonBuilder.add(LayoutReportActionImpl.LAYOUT_REPORT_TYPE, LayoutReportActionFactory.LAYOUT_REPORT_ACTION_NAME); |
|
418 |
jsonBuilder.add(LayoutReportActionImpl.LAYOUT_REPORT_LABEL, label); |
|
419 |
jsonBuilder.add(LayoutReportActionImpl.LAYOUT_REPORT_TEMPLATE_NAME, templateName); |
|
420 |
if(highlightSymbol != null){ |
|
421 |
jsonBuilder.add(LayoutReportActionImpl.LAYOUT_REPORT_HIGHLIGHT_SYMBOL, this.toString(highlightSymbol)); |
|
422 |
} |
|
423 |
jsonBuilder.add(LayoutReportActionImpl.LAYOUT_REPORT_CENTER_TO_CURRENT_ROW, centerToCurrentRow); |
|
424 |
jsonBuilder.add(LayoutReportActionImpl.LAYOUT_REPORT_ZOOM_TO_CURRENT_ROW, zoomToCurrentRow); |
|
425 |
jsonBuilder.add(LayoutReportActionImpl.LAYOUT_REPORT_BUFFER_SIZE, bufferSize); |
|
426 |
jsonBuilder.add(LayoutReportActionImpl.LAYOUT_REPORT_HIGHLIGHT_RECORD, highlightRecord); |
|
427 |
jsonBuilder.add(LayoutReportActionImpl.LAYOUT_REPORT_VIEW_TAG, viewTag); |
|
428 |
jsonBuilder.add(LayoutReportActionImpl.LAYOUT_REPORT_USE_INTERNAL_PDF_VIEWER, useInternalPdfViewer); |
|
429 |
|
|
430 |
resource = resources.getResource(resourceName); |
|
431 |
IOUtils.write(jsonBuilder.toString(), resource.asOutputStream(), StandardCharsets.UTF_8); |
|
432 |
|
|
433 |
resourceLayout = resources.getResource(templateName); |
|
434 |
PersistenceManager persistenceManager = ToolsLocator.getPersistenceManager(); |
|
435 |
layout.setPersistIndependent(true); |
|
436 |
PersistentState persistentState = persistenceManager.getState(layout.getMainWindow()); |
|
437 |
persistenceManager.saveState(persistentState, resourceLayout.asOutputStream()); |
|
421 |
LayoutReportActionParameters reportParameters = LayoutReportActionParameters.create(); |
|
422 |
reportParameters.setIdentifier(name); |
|
423 |
reportParameters.setLabel(label); |
|
424 |
reportParameters.setHighlightSymbol(highlightSymbol); |
|
425 |
reportParameters.setCenterToCurrentRow(centerToCurrentRow); |
|
426 |
reportParameters.setZoomToCurrentRow(zoomToCurrentRow); |
|
427 |
reportParameters.setBufferSize(bufferSize); |
|
428 |
reportParameters.setHighlightRecord(highlightRecord); |
|
429 |
reportParameters.setApplySymbolToRecord(applySymbolToRecord); |
|
430 |
reportParameters.setApplySymbolToEverythingExceptRecord(applySymbolToEverythingExceptRecord); |
|
431 |
reportParameters.setViewTag(viewTag); |
|
432 |
reportParameters.setUseInternalPdfViewer(useInternalPdfViewer); |
|
433 |
|
|
434 |
reportParameters.save(store, layout); |
|
438 | 435 |
((JComponent)dialog).setVisible(false); |
439 | 436 |
return true; |
440 | 437 |
} catch (Exception ex) { |
... | ... | |
446 | 443 |
"_Configure_report_from_layout", |
447 | 444 |
JOptionPane.WARNING_MESSAGE); |
448 | 445 |
return false; |
449 |
} finally { |
|
450 |
layout.setPersistIndependent(selfContained); |
|
451 |
IOUtils.closeQuietly(resource); |
|
452 |
IOUtils.closeQuietly(resourceLayout); |
|
453 | 446 |
} |
454 |
|
|
455 | 447 |
} |
456 | 448 |
|
457 |
private String toString(ISymbol symbol){ |
|
458 |
try { |
|
459 |
if(symbol == null){ |
|
460 |
return null; |
|
461 |
} |
|
462 |
PersistenceManager persistenceManager = ToolsLocator.getPersistenceManager(); |
|
463 |
PersistentState state = persistenceManager.getState(symbol); |
|
464 |
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
|
465 |
persistenceManager.saveState(state, out); |
|
466 |
return Hex.encodeHexString(out.toByteArray()); |
|
467 |
} catch (Exception ex) { |
|
468 |
throw new RuntimeException("Can't persist symbol", ex); |
|
469 |
} |
|
470 |
} |
|
471 |
|
|
472 |
private String getNextResourceName(ResourcesStorage resources, String resourceName){ |
|
473 |
List<ResourcesStorage.Resource> reports = resources.getResources(resourceName); |
|
474 |
if(reports == null || reports.isEmpty()){ |
|
475 |
return resourceName; |
|
476 |
} |
|
477 |
int n = -1; |
|
478 |
for (ResourcesStorage.Resource report : reports) { |
|
479 |
if(StringUtils.contains(report.getName(), resources.getSeparator())){ |
|
480 |
String[] s = StringUtils.split(report.getName(), resources.getSeparator()); |
|
481 |
n = Math.max(n, Integer.parseInt(s[0])); |
|
482 |
} else { |
|
483 |
n=0; |
|
484 |
} |
|
485 |
} |
|
486 |
|
|
487 |
if (n < 0) { |
|
488 |
return resourceName; |
|
489 |
} |
|
490 |
|
|
491 |
n++; |
|
492 |
return String.valueOf(n) + resources.getSeparator() + resourceName; |
|
493 |
|
|
494 |
|
|
495 |
} |
|
496 |
|
|
497 |
private String getResourceName(ResourcesStorage resources, String reportName) { |
|
498 |
try { |
|
499 |
if (resources != null) { |
|
500 |
List<ResourcesStorage.Resource> reportsResources = resources.getResources("report"); |
|
501 |
if (reportsResources != null && !reportsResources.isEmpty()) { |
Also available in: Unified diff