Revision 30 trunk/org.gvsig.app.document.layout.app/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/gui/DefaultLayoutPanel.java
DefaultLayoutPanel.java | ||
---|---|---|
22 | 22 |
package org.gvsig.app.project.documents.layout.gui; |
23 | 23 |
|
24 | 24 |
import java.awt.Component; |
25 |
import java.awt.Graphics2D; |
|
25 | 26 |
import java.awt.GridLayout; |
27 |
import java.awt.geom.AffineTransform; |
|
26 | 28 |
import java.awt.print.PageFormat; |
27 | 29 |
import java.awt.print.Printable; |
28 | 30 |
import java.awt.print.PrinterException; |
... | ... | |
252 | 254 |
}; |
253 | 255 |
|
254 | 256 |
jobNuevo.addPrintJobListener(pjlistener); |
257 |
|
|
258 |
/* |
|
259 |
Class repClass = null; |
|
260 |
try { |
|
261 |
repClass = Class.forName(flavor.getRepresentationClassName()); |
|
262 |
} catch (Throwable e) { |
|
263 |
throw new IllegalArgumentException("unknown representation class"); |
|
264 |
} |
|
265 |
|
|
266 |
if (!repClass.isInstance(printData)) { |
|
267 |
throw new IllegalArgumentException("data is not of declared type"); |
|
268 |
} */ |
|
255 | 269 |
|
256 |
doc = |
|
257 |
new SimpleDoc( |
|
258 |
PluginServices |
|
259 |
.getExtension(org.gvsig.app.extension.Print.class), |
|
260 |
flavor, null); |
|
270 |
Printable pb = null; |
|
271 |
Class repClass = null; |
|
272 |
try { |
|
273 |
repClass = Class.forName(flavor.getRepresentationClassName()); |
|
274 |
} catch (Throwable e) { |
|
275 |
throw new IllegalArgumentException("unknown representation class"); |
|
276 |
} |
|
261 | 277 |
|
278 |
Object printData = PluginServices.getExtension(org.gvsig.app.extension.Print.class); |
|
279 |
|
|
280 |
doc = new SimpleDoc(printData, flavor, null); |
|
281 |
|
|
262 | 282 |
try { |
263 | 283 |
jobNuevo.print(doc, att); |
264 | 284 |
|
... | ... | |
490 | 510 |
public void setLayoutManager(LayoutManager layoutManager) { |
491 | 511 |
this.layoutManager = layoutManager; |
492 | 512 |
} |
513 |
|
|
514 |
|
|
515 |
/** |
|
516 |
* Method to print the Layout without modify the Affinetransform. |
|
517 |
* |
|
518 |
* @param g2 Geaphics2D |
|
519 |
*/ |
|
520 |
public void drawLayoutPrint(Graphics2D g2) { |
|
521 |
layoutControl.setCancelDrawing(false); |
|
493 | 522 |
|
523 |
// setCursor(Cursor.getDefaultCursor()); |
|
524 |
|
|
525 |
double scale = 0; |
|
526 |
scale = layoutControl.getRect().height / layoutContext.getAttributes().m_sizePaper.getAlto() * 1; |
|
527 |
AffineTransform escalado = new AffineTransform(); |
|
528 |
AffineTransform translacion = new AffineTransform(); |
|
529 |
translacion.setToTranslation(layoutControl.getRect().getMinX(), layoutControl.getRect().getMinY()); |
|
530 |
escalado.setToScale(scale, scale); |
|
531 |
layoutControl.getAT().setToIdentity(); |
|
532 |
layoutControl.getAT().concatenate(translacion); |
|
533 |
layoutControl.getAT().concatenate(escalado); |
|
534 |
layoutContext.getAttributes().setDistanceUnitX(layoutControl.getRect()); |
|
535 |
layoutContext.getAttributes().setDistanceUnitY(layoutControl.getRect()); |
|
536 |
IFFrame[] fframes=layoutContext.getFFrames(); |
|
537 |
|
|
538 |
for (int i = 0; i < fframes.length; i++) { |
|
539 |
// fframes[i].setPrintingProperties(this.att); |
|
540 |
fframes[i].print( |
|
541 |
g2, |
|
542 |
layoutControl.getAT(), |
|
543 |
null, |
|
544 |
layoutContext.getAttributes().toPrintAttributes()); |
|
545 |
// fframes[i].setPrintingProperties(null); |
|
546 |
} |
|
547 |
|
|
548 |
// TODO Esto es para ver el rect�ngulo que representa el folio en la |
|
549 |
// impresi�n. |
|
550 |
// g2.drawRect(0, 0, (int) rect.getWidth(), (int) rect.getHeight()); |
|
551 |
} |
|
552 |
|
|
494 | 553 |
} |
Also available in: Unified diff