@@ -57,15 +57,17 @@ public void setRowToModelRow(IntUnaryOperator rowToModel) {
57
57
public void run (TaskMonitor taskMonitor ) throws IOException , DocumentException {
58
58
taskMonitor .setTitle ("Export HeatMap to PDF" );
59
59
60
- FileOutputStream out = new FileOutputStream (file );
61
-
62
60
PdfPTable table = createTable ();
61
+ if (cancelled )
62
+ return ;
63
+
63
64
setColumnWidths (table );
64
65
65
66
float width = table .getTotalWidth () + MARGIN * 2 ;
66
67
float height = table .getTotalHeight () + MARGIN * 2 ;
67
68
Rectangle pageSize = new Rectangle (width , height );
68
69
70
+ FileOutputStream out = new FileOutputStream (file );
69
71
Document document = new Document (pageSize );
70
72
PdfWriter .getInstance (document , out );
71
73
document .setMargins (MARGIN , MARGIN , MARGIN , MARGIN );
@@ -84,6 +86,9 @@ private PdfPTable createTable() {
84
86
PdfPCell descHeaderCell = createDesciptionHeader ();
85
87
PdfPCell scoreHeaderCell = createScoreHeader ();
86
88
89
+ if (cancelled )
90
+ return null ;
91
+
87
92
if (model .getCompress ().isNone ()) {
88
93
geneHeaderCell .setRowspan (2 );
89
94
descHeaderCell .setRowspan (2 );
@@ -103,11 +108,17 @@ private PdfPTable createTable() {
103
108
table .addCell (scoreHeaderCell );
104
109
}
105
110
111
+ if (cancelled )
112
+ return null ;
113
+
106
114
for (int col = HeatMapTableModel .DESC_COL_COUNT ; col < colCount ; col ++) {
107
115
table .addCell (createExpressionHeader (col ));
108
116
}
109
117
110
118
for (int row = 0 ; row < model .getRowCount (); row ++) {
119
+ if (cancelled )
120
+ return null ;
121
+
111
122
int modelRow = rowToModel .applyAsInt (row );
112
123
113
124
table .addCell (createGeneCell (modelRow ));
0 commit comments