Author: kono
Date: 2010-06-28 11:24:13 -0700 (Mon, 28 Jun 2010)
New Revision: 20682
Modified:
cytoscape/trunk/src/cytoscape/util/export/PDFExporter.java
cytoscape/trunk/src/cytoscape/view/InternalFrameComponent.java
Log:
Minor format changes only.
Modified: cytoscape/trunk/src/cytoscape/util/export/PDFExporter.java
===================================================================
--- cytoscape/trunk/src/cytoscape/util/export/PDFExporter.java 2010-06-28
18:15:21 UTC (rev 20681)
+++ cytoscape/trunk/src/cytoscape/util/export/PDFExporter.java 2010-06-28
18:24:13 UTC (rev 20682)
@@ -16,58 +16,59 @@
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.DefaultFontMapper;
import cytoscape.ding.DingNetworkView;
+
/**
* PDF exporter by the iText library.
+ *
* @author Samad Lotia
*/
-public class PDFExporter implements Exporter
-{
+public class PDFExporter implements Exporter {
private boolean exportTextAsFont = true;
-
- public void export(CyNetworkView view, FileOutputStream stream) throws
IOException
- {
- DingNetworkView theView = (DingNetworkView) view;
- theView.setPrintingTextAsShape(!exportTextAsFont);
-
- InternalFrameComponent ifc =
Cytoscape.getDesktop().getNetworkViewManager().getInternalFrameComponent(view);
+ public void export(final CyNetworkView view, final FileOutputStream
stream)
+ throws IOException {
+
+ final DingNetworkView dView = (DingNetworkView) view;
+ dView.setPrintingTextAsShape(!exportTextAsFont);
+
+ final InternalFrameComponent ifc = Cytoscape.getDesktop()
+
.getNetworkViewManager().getInternalFrameComponent(view);
Rectangle pageSize = PageSize.LETTER;
Document document = new Document(pageSize);
- try
- {
+ try {
PdfWriter writer = PdfWriter.getInstance(document,
stream);
- try {
- document.open();
- PdfContentByte cb = writer.getDirectContent();
- Graphics2D g = null;
- if ( exportTextAsFont ) {
- g = cb.createGraphics(pageSize.getWidth(),
pageSize.getHeight(), new DefaultFontMapper());
- } else {
- g = cb.createGraphicsShapes(pageSize.getWidth(),
pageSize.getHeight());
- }
+ try {
+ document.open();
+ PdfContentByte cb = writer.getDirectContent();
+ Graphics2D g = null;
+ if (exportTextAsFont) {
+ g =
cb.createGraphics(pageSize.getWidth(), pageSize
+ .getHeight(), new
DefaultFontMapper());
+ } else {
+ g =
cb.createGraphicsShapes(pageSize.getWidth(), pageSize
+ .getHeight());
+ }
- double imageScale = Math.min(pageSize.getWidth() / ((double)
ifc.getWidth()),
- pageSize.getHeight() / ((double)
ifc.getHeight()));
- g.scale(imageScale, imageScale);
+ double imageScale = Math.min(pageSize.getWidth()
+ / ((double) ifc.getWidth()),
pageSize.getHeight()
+ / ((double) ifc.getHeight()));
+ g.scale(imageScale, imageScale);
- ifc.print(g);
- g.dispose();
- }
- finally {
- if (document != null) {
- document.close();
- }
- if (writer != null) {
- writer.close();
- }
- }
- }
- catch (DocumentException exp)
- {
+ ifc.print(g);
+ g.dispose();
+ } finally {
+ if (document != null) {
+ document.close();
+ }
+ if (writer != null) {
+ writer.close();
+ }
+ }
+ } catch (DocumentException exp) {
throw new IOException(exp.getMessage());
}
}
-
+
public void setExportTextAsFont(boolean pExportTextAsFont) {
exportTextAsFont = pExportTextAsFont;
}
Modified: cytoscape/trunk/src/cytoscape/view/InternalFrameComponent.java
===================================================================
--- cytoscape/trunk/src/cytoscape/view/InternalFrameComponent.java
2010-06-28 18:15:21 UTC (rev 20681)
+++ cytoscape/trunk/src/cytoscape/view/InternalFrameComponent.java
2010-06-28 18:24:13 UTC (rev 20682)
@@ -38,24 +38,19 @@
// imports
-import ding.view.DGraphView;
-import ding.view.DingCanvas;
-
import java.awt.Graphics;
import java.awt.Graphics2D;
-import java.awt.Component;
-import java.awt.Rectangle;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
-import java.awt.image.BufferedImage;
-import javax.swing.JLabel;
import javax.swing.JComponent;
import javax.swing.JLayeredPane;
-import javax.swing.ImageIcon;
+import ding.view.DGraphView;
+import ding.view.DingCanvas;
+
/**
* This class manages the JLayeredPane that resides in
* each internal frame of cytoscape. Its intended to be the
@@ -63,8 +58,15 @@
* by the DGraphView class.
*/
public class InternalFrameComponent extends JComponent implements Printable {
+
+ private static final long serialVersionUID = -6037450600865410121L;
+
/**
* z-order enumeration
+ *
+ * TODO: this breaks resize-handle on Mac OS X.
+ * Need to do some research on this layring order.
+ *
*/
private static enum ZOrder {
BACKGROUND_PANE,
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.