Revision 10626 trunk/examples/exaTemplateLayout/src/com/iver/templateLayout/PrintingManager.java
PrintingManager.java | ||
---|---|---|
1 | 1 |
package com.iver.templateLayout; |
2 | 2 |
|
3 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
4 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
3 | 5 |
import com.hardcode.gdbms.engine.values.ValueWriter; |
4 | 6 |
import com.iver.andami.PluginServices; |
5 | 7 |
import com.iver.cit.gvsig.ProjectExtension; |
6 |
import com.iver.cit.gvsig.fmap.DriverException;
|
|
8 |
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
|
|
7 | 9 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
8 | 10 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
9 | 11 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
... | ... | |
28 | 30 |
Project theProject = aux.getProject(); |
29 | 31 |
layout = ((ProjectMap) theProject.getProjectDocumentByName( |
30 | 32 |
"FichaCurso", ProjectMapFactory.registerName)).getModel(); |
31 |
|
|
33 |
|
|
32 | 34 |
} |
33 | 35 |
|
34 |
public void startPrinting() throws DriverException { |
|
36 |
public void startPrinting() throws ReadDriverException {
|
|
35 | 37 |
Selectable select = (Selectable) layer; |
36 | 38 |
FBitSet bs = select.getSelection(); |
37 | 39 |
SelectableDataSource rs = layer.getRecordset(); |
38 |
|
|
40 |
|
|
39 | 41 |
for(int i=bs.nextSetBit(0); i>=0; i=bs.nextSetBit(i+1)) { |
40 | 42 |
// operate on index i here } |
41 |
IFeature feat = layer.getSource().getFeature(i); |
|
42 |
|
|
43 |
IFeature feat; |
|
44 |
try { |
|
45 |
feat = layer.getSource().getFeature(i); |
|
46 |
} catch (ExpansionFileReadException e) { |
|
47 |
throw new ReadDriverException(layer.getName(),e); |
|
48 |
} |
|
49 |
|
|
43 | 50 |
IFFrame[] theFrames = layout.getLayoutContext().getFFrames(); |
44 | 51 |
for (int j=0; j < theFrames.length; j++) |
45 | 52 |
{ |
46 | 53 |
if (theFrames[j].getTag() != null) |
47 | 54 |
{ |
48 |
try { |
|
49 |
processFrame(theFrames[j], feat, rs ); |
|
50 |
} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) { |
|
51 |
e.printStackTrace(); |
|
52 |
throw new DriverException(e); |
|
53 |
} |
|
55 |
processFrame(theFrames[j], feat, rs ); |
|
54 | 56 |
} |
55 | 57 |
} |
56 | 58 |
layout.getLayoutControl().refresh(); |
57 | 59 |
layout.showPrintDialog(null); |
58 | 60 |
} |
59 |
|
|
61 |
|
|
60 | 62 |
} |
61 | 63 |
|
62 |
private void processFrame(IFFrame frame, IFeature feat, SelectableDataSource rs) throws com.hardcode.gdbms.engine.data.driver.DriverException {
|
|
64 |
private void processFrame(IFFrame frame, IFeature feat, SelectableDataSource rs) throws ReadDriverException {
|
|
63 | 65 |
String tag = frame.getTag(); |
64 | 66 |
if (tag.compareTo("VISTA1")==0) |
65 | 67 |
{ |
... | ... | |
78 | 80 |
// FFrameView fv = (FFrameView) frame; |
79 | 81 |
// fv.getFMap().getViewPort().setExtent(feat.getGeometry().getBounds2D()); |
80 | 82 |
// } |
81 |
|
|
83 |
|
|
82 | 84 |
} |
83 | 85 |
|
84 | 86 |
} |
Also available in: Unified diff