1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.gui; |
22 |
|
|
23 |
|
import jalview.analysis.scoremodels.ScoreModels; |
24 |
|
import jalview.api.AlignViewportI; |
25 |
|
import jalview.api.analysis.ScoreModelI; |
26 |
|
import jalview.api.analysis.SimilarityParamsI; |
27 |
|
import jalview.bin.Console; |
28 |
|
import jalview.datamodel.Alignment; |
29 |
|
import jalview.datamodel.AlignmentI; |
30 |
|
import jalview.datamodel.AlignmentView; |
31 |
|
import jalview.datamodel.HiddenColumns; |
32 |
|
import jalview.datamodel.SequenceGroup; |
33 |
|
import jalview.datamodel.SequenceI; |
34 |
|
import jalview.gui.ImageExporter.ImageWriterI; |
35 |
|
import jalview.gui.JalviewColourChooser.ColourChooserListener; |
36 |
|
import jalview.jbgui.GPCAPanel; |
37 |
|
import jalview.math.RotatableMatrix.Axis; |
38 |
|
import jalview.util.ImageMaker; |
39 |
|
import jalview.util.MessageManager; |
40 |
|
import jalview.viewmodel.AlignmentViewport; |
41 |
|
import jalview.viewmodel.PaSiMapModel; |
42 |
|
|
43 |
|
import java.awt.BorderLayout; |
44 |
|
import java.awt.Color; |
45 |
|
import java.awt.Container; |
46 |
|
import java.awt.Dimension; |
47 |
|
import java.awt.Graphics; |
48 |
|
import java.awt.event.ActionEvent; |
49 |
|
import java.awt.event.ActionListener; |
50 |
|
import java.awt.print.PageFormat; |
51 |
|
import java.awt.print.Printable; |
52 |
|
import java.awt.print.PrinterException; |
53 |
|
import java.awt.print.PrinterJob; |
54 |
|
import java.beans.PropertyChangeEvent; |
55 |
|
import java.beans.PropertyChangeListener; |
56 |
|
|
57 |
|
import javax.swing.ButtonGroup; |
58 |
|
import javax.swing.JMenuItem; |
59 |
|
import javax.swing.JProgressBar; |
60 |
|
import javax.swing.JRadioButtonMenuItem; |
61 |
|
import javax.swing.event.InternalFrameAdapter; |
62 |
|
import javax.swing.event.InternalFrameEvent; |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
|
|
| 0% |
Uncovered Elements: 355 (355) |
Complexity: 94 |
Complexity Density: 0.38 |
|
67 |
|
public class PaSiMapPanel extends SpatialPanel |
68 |
|
implements Runnable, IProgressIndicator |
69 |
|
{ |
70 |
|
private static final int MIN_WIDTH = 470; |
71 |
|
|
72 |
|
private static final int MIN_HEIGHT = 250; |
73 |
|
|
74 |
|
private static final int MAX_PASIMAP_SEQ = 20000; |
75 |
|
|
76 |
|
private final int GAP_OPEN_COST = 100; |
77 |
|
|
78 |
|
private final int GAP_EXTEND_COST = 5; |
79 |
|
|
80 |
|
private RotatableCanvas rc; |
81 |
|
|
82 |
|
AlignmentPanel ap; |
83 |
|
|
84 |
|
AlignmentViewport av; |
85 |
|
|
86 |
|
private PaSiMapModel pasimapModel; |
87 |
|
|
88 |
|
private int top = 0; |
89 |
|
|
90 |
|
private IProgressIndicator progressBar; |
91 |
|
|
92 |
|
private long progId; |
93 |
|
|
94 |
|
private boolean working; |
95 |
|
|
96 |
|
private String newPasimapTitle; |
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
@param |
103 |
|
@param |
104 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 2 |
Complexity Density: 0.11 |
|
105 |
0 |
public PaSiMapPanel(AlignmentPanel alignPanel, String modelName)... |
106 |
|
{ |
107 |
0 |
super(8); |
108 |
0 |
this.av = alignPanel.av; |
109 |
0 |
this.ap = alignPanel; |
110 |
0 |
boolean nucleotide = av.getAlignment().isNucleotide(); |
111 |
|
|
112 |
|
|
113 |
|
|
114 |
0 |
addInternalFrameListener(new InternalFrameAdapter() |
115 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
116 |
0 |
@Override... |
117 |
|
public void internalFrameClosed(InternalFrameEvent e) |
118 |
|
{ |
119 |
0 |
close_actionPerformed(); |
120 |
|
} |
121 |
|
}); |
122 |
|
|
123 |
0 |
boolean selected = av.getSelectionGroup() != null |
124 |
|
&& av.getSelectionGroup().getSize() > 0; |
125 |
0 |
SequenceI[] seqs; |
126 |
0 |
if (!selected) |
127 |
|
{ |
128 |
0 |
seqs = av.getAlignment().getSequencesArray(); |
129 |
|
} |
130 |
|
else |
131 |
|
{ |
132 |
0 |
seqs = av.getSelectionGroup().getSequencesInOrder(av.getAlignment()); |
133 |
|
} |
134 |
|
|
135 |
0 |
ScoreModelI scoreModel = ScoreModels.getInstance() |
136 |
|
.getScoreModel(modelName, ap); |
137 |
0 |
setPasimapModel(new PaSiMapModel(av, seqs, nucleotide, scoreModel)); |
138 |
|
|
139 |
0 |
newPasimapTitle = alignPanel.alignFrame.formCalculationTitle( |
140 |
|
MessageManager.formatMessage("label.calc_title", "PaSiMap", |
141 |
|
scoreModel.getName()), |
142 |
|
selected, ap.alignFrame.getTitle()); |
143 |
|
|
144 |
0 |
PaintRefresher.Register(this, av.getSequenceSetId()); |
145 |
|
|
146 |
0 |
setRotatableCanvas(new RotatableCanvas(alignPanel)); |
147 |
0 |
this.getContentPane().add(getRotatableCanvas(), BorderLayout.CENTER); |
148 |
|
|
149 |
0 |
addKeyListener(getRotatableCanvas()); |
150 |
0 |
validate(); |
151 |
|
} |
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
|
156 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
157 |
0 |
protected void close_actionPerformed()... |
158 |
|
{ |
159 |
0 |
setPasimapModel(null); |
160 |
0 |
if (this.rc != null) |
161 |
|
{ |
162 |
0 |
this.rc.sequencePoints = null; |
163 |
0 |
this.rc.setAxisEndPoints(null); |
164 |
0 |
this.rc = null; |
165 |
|
} |
166 |
|
} |
167 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
168 |
0 |
@Override... |
169 |
|
protected void bgcolour_actionPerformed() |
170 |
|
{ |
171 |
0 |
String ttl = MessageManager.getString("label.select_background_colour"); |
172 |
0 |
ColourChooserListener listener = new ColourChooserListener() |
173 |
|
{ |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
174 |
0 |
@Override... |
175 |
|
public void colourSelected(Color c) |
176 |
|
{ |
177 |
0 |
rc.setBgColour(c); |
178 |
0 |
rc.repaint(); |
179 |
|
} |
180 |
|
}; |
181 |
0 |
JalviewColourChooser.showColourChooser(this, ttl, rc.getBgColour(), |
182 |
|
listener); |
183 |
|
} |
184 |
|
|
185 |
|
|
186 |
|
|
187 |
|
|
|
|
| 0% |
Uncovered Elements: 56 (56) |
Complexity: 9 |
Complexity Density: 0.2 |
|
188 |
0 |
@Override... |
189 |
|
public void run() |
190 |
|
{ |
191 |
0 |
working = true; |
192 |
0 |
progId = System.currentTimeMillis(); |
193 |
0 |
progressBar = new jalview.gui.ProgressBar(statusPanel, statusBar); |
194 |
0 |
String message = MessageManager |
195 |
|
.getString("label.pasimap_recalculating"); |
196 |
0 |
if (getParent() == null) |
197 |
|
{ |
198 |
0 |
progressBar = ap.alignFrame; |
199 |
0 |
message = MessageManager.getString("label.pasimap_calculating"); |
200 |
|
} |
201 |
0 |
progressBar.setProgressBar(message, progId); |
202 |
0 |
try |
203 |
|
{ |
204 |
0 |
SequenceGroup selGroup = av.getSelectionGroup(); |
205 |
|
|
206 |
0 |
if (selGroup == null) |
207 |
|
{ |
208 |
0 |
selGroup = new SequenceGroup(av.getAlignment().getSequences()); |
209 |
0 |
selGroup.setStartRes(0); |
210 |
0 |
selGroup.setEndRes(av.getAlignment().getWidth() - 1); |
211 |
|
} |
212 |
|
|
213 |
0 |
if (selGroup.getSize() > MAX_PASIMAP_SEQ) |
214 |
|
{ |
215 |
0 |
int start = selGroup.getStartRes(), end = selGroup.getEndRes(); |
216 |
0 |
selGroup = new SequenceGroup( |
217 |
|
selGroup.getSequences().subList(0, MAX_PASIMAP_SEQ)); |
218 |
0 |
selGroup.setStartRes(start); |
219 |
0 |
selGroup.setEndRes(end); |
220 |
0 |
Console.warn("Truncated input sequences for PASIMAP analysis to " |
221 |
|
+ MAX_PASIMAP_SEQ); |
222 |
|
} |
223 |
|
|
224 |
0 |
final PairwiseAlignPanel pap = new PairwiseAlignPanel(av, selGroup, true, |
225 |
|
GAP_OPEN_COST, GAP_EXTEND_COST, false, null); |
226 |
0 |
pap.setDiscardAlignments(true); |
227 |
0 |
pap.setQuiet(true); |
228 |
|
|
229 |
0 |
System.out.println(pap != null); |
230 |
0 |
addProgressListenerFor(pap); |
231 |
0 |
progressBar.registerHandler(progId, new IProgressIndicatorHandler() |
232 |
|
{ |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
233 |
0 |
@Override... |
234 |
|
public boolean cancelActivity(long id) |
235 |
|
{ |
236 |
0 |
getPasimapModel().cancel(); |
237 |
0 |
return true; |
238 |
|
} |
239 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
240 |
0 |
@Override... |
241 |
|
public boolean canCancel() |
242 |
|
{ |
243 |
0 |
return getPasimapModel().canCancel(); |
244 |
|
} |
245 |
|
}); |
246 |
0 |
getPasimapModel().calculate(pap); |
247 |
0 |
if (!getPasimapModel().isCancelled()) |
248 |
|
{ |
249 |
|
|
250 |
0 |
outputAlignment.setVisible(!pap.isDiscardAlignments() && !pap.isQuiet()); |
251 |
0 |
xCombobox.setSelectedIndex(0); |
252 |
0 |
yCombobox.setSelectedIndex(1); |
253 |
0 |
zCombobox.setSelectedIndex(2); |
254 |
|
|
255 |
0 |
getPasimapModel().updateRc(getRotatableCanvas()); |
256 |
|
|
257 |
0 |
setTop(getPasimapModel().getTop()); |
258 |
|
} |
259 |
|
} catch (OutOfMemoryError er) |
260 |
|
{ |
261 |
0 |
new OOMWarning("calculating PaSiMap", er); |
262 |
0 |
working = false; |
263 |
0 |
return; |
264 |
|
} finally |
265 |
|
{ |
266 |
0 |
if (!getPasimapModel().isCancelled()) { |
267 |
|
|
268 |
0 |
progressBar.setProgressBar("", progId); |
269 |
|
} |
270 |
|
} |
271 |
|
|
272 |
0 |
repaint(); |
273 |
0 |
if (!getPasimapModel().isCancelled() && getParent() == null) |
274 |
|
{ |
275 |
0 |
Desktop.addInternalFrame(this, |
276 |
|
newPasimapTitle, |
277 |
|
475, 450); |
278 |
0 |
this.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); |
279 |
|
} |
280 |
0 |
working = false; |
281 |
|
} |
282 |
|
|
283 |
|
|
284 |
|
|
285 |
|
|
286 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
287 |
0 |
@Override... |
288 |
|
protected void doDimensionChange() |
289 |
|
{ |
290 |
0 |
if (getTop() == 0) |
291 |
|
{ |
292 |
0 |
return; |
293 |
|
} |
294 |
|
|
295 |
0 |
int dim1 = getTop() - xCombobox.getSelectedIndex(); |
296 |
0 |
int dim2 = getTop() - yCombobox.getSelectedIndex(); |
297 |
0 |
int dim3 = getTop() - zCombobox.getSelectedIndex(); |
298 |
0 |
getPasimapModel().updateRcView(dim1, dim2, dim3); |
299 |
0 |
getRotatableCanvas().resetView(); |
300 |
|
} |
301 |
|
|
302 |
|
|
303 |
|
|
304 |
|
|
305 |
|
|
306 |
|
@param |
307 |
|
@param |
308 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 4 |
Complexity Density: 0.36 |
|
309 |
0 |
public void setSelectedDimensionIndex(int index, Axis axis)... |
310 |
|
{ |
311 |
0 |
switch (axis) |
312 |
|
{ |
313 |
0 |
case X: |
314 |
0 |
xCombobox.setSelectedIndex(index); |
315 |
0 |
break; |
316 |
0 |
case Y: |
317 |
0 |
yCombobox.setSelectedIndex(index); |
318 |
0 |
break; |
319 |
0 |
case Z: |
320 |
0 |
zCombobox.setSelectedIndex(index); |
321 |
0 |
break; |
322 |
0 |
default: |
323 |
|
} |
324 |
|
} |
325 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
326 |
0 |
@Override... |
327 |
|
protected void outputValues_actionPerformed() |
328 |
|
{ |
329 |
0 |
CutAndPasteTransfer cap = new CutAndPasteTransfer(); |
330 |
0 |
try |
331 |
|
{ |
332 |
0 |
cap.setText(getPasimapModel().getDetails()); |
333 |
0 |
Desktop.addInternalFrame(cap, |
334 |
|
MessageManager.getString("label.pasimap_details"), 500, 500); |
335 |
|
} catch (OutOfMemoryError oom) |
336 |
|
{ |
337 |
0 |
new OOMWarning("opening PaSiMap details", oom); |
338 |
0 |
cap.dispose(); |
339 |
|
} |
340 |
|
} |
341 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
342 |
0 |
@Override... |
343 |
|
protected void showLabels_actionPerformed() |
344 |
|
{ |
345 |
0 |
getRotatableCanvas().showLabels(showLabels.getState()); |
346 |
|
} |
347 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
348 |
0 |
@Override... |
349 |
|
protected void print_actionPerformed() |
350 |
|
{ |
351 |
0 |
PaSiMapPrinter printer = new PaSiMapPrinter(); |
352 |
0 |
printer.start(); |
353 |
|
} |
354 |
|
|
355 |
|
|
356 |
|
|
357 |
|
|
358 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 8 |
Complexity Density: 0.53 |
|
359 |
0 |
@Override... |
360 |
|
public void originalSeqData_actionPerformed() |
361 |
|
{ |
362 |
|
|
363 |
0 |
if (getPasimapModel().getInputData() == null) |
364 |
|
{ |
365 |
0 |
Console.info( |
366 |
|
"Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action."); |
367 |
0 |
return; |
368 |
|
} |
369 |
|
|
370 |
|
|
371 |
|
|
372 |
|
|
373 |
|
|
374 |
|
|
375 |
0 |
char gc = '-'; |
376 |
0 |
try |
377 |
|
{ |
378 |
|
|
379 |
|
|
380 |
0 |
gc = av.getGapCharacter(); |
381 |
|
} catch (Exception ex) |
382 |
|
{ |
383 |
|
} |
384 |
|
|
385 |
|
|
386 |
0 |
Object[] alAndColsel = getPasimapModel().getInputData().getAlignmentAndHiddenColumns(gc); |
387 |
|
|
388 |
0 |
if (alAndColsel != null && alAndColsel[0] != null) |
389 |
|
{ |
390 |
|
|
391 |
|
|
392 |
0 |
AlignmentI al = new Alignment((SequenceI[]) alAndColsel[0]); |
393 |
0 |
AlignmentI dataset = (av != null && av.getAlignment() != null) |
394 |
|
? av.getAlignment().getDataset() |
395 |
|
: null; |
396 |
0 |
if (dataset != null) |
397 |
|
{ |
398 |
0 |
al.setDataset(dataset); |
399 |
|
} |
400 |
|
|
401 |
0 |
if (true) |
402 |
|
{ |
403 |
|
|
404 |
0 |
AlignFrame af = new AlignFrame(al, (HiddenColumns) alAndColsel[1], |
405 |
|
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); |
406 |
|
|
407 |
|
|
408 |
|
|
409 |
|
|
410 |
|
|
411 |
|
|
412 |
|
|
413 |
|
|
414 |
0 |
Desktop.addInternalFrame(af, MessageManager.formatMessage( |
415 |
|
"label.original_data_for_params", new String[] |
416 |
|
{ this.title }), AlignFrame.DEFAULT_WIDTH, |
417 |
|
AlignFrame.DEFAULT_HEIGHT); |
418 |
|
} |
419 |
|
} |
420 |
|
|
421 |
|
|
422 |
|
|
423 |
|
|
424 |
|
|
425 |
|
|
426 |
|
|
427 |
|
|
428 |
|
} |
429 |
|
|
|
|
| 0% |
Uncovered Elements: 28 (28) |
Complexity: 7 |
Complexity Density: 0.39 |
|
430 |
|
class PaSiMapPrinter extends Thread implements Printable |
431 |
|
{ |
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 4 |
Complexity Density: 0.4 |
|
432 |
0 |
@Override... |
433 |
|
public void run() |
434 |
|
{ |
435 |
0 |
PrinterJob printJob = PrinterJob.getPrinterJob(); |
436 |
0 |
PageFormat defaultPage = printJob.defaultPage(); |
437 |
0 |
PageFormat pf = printJob.pageDialog(defaultPage); |
438 |
|
|
439 |
0 |
if (defaultPage == pf) |
440 |
|
{ |
441 |
|
|
442 |
|
|
443 |
|
|
444 |
0 |
return; |
445 |
|
} |
446 |
|
|
447 |
0 |
printJob.setPrintable(this, pf); |
448 |
|
|
449 |
0 |
if (printJob.printDialog()) |
450 |
|
{ |
451 |
0 |
try |
452 |
|
{ |
453 |
0 |
printJob.print(); |
454 |
|
} catch (Exception PrintException) |
455 |
|
{ |
456 |
0 |
PrintException.printStackTrace(); |
457 |
|
} |
458 |
|
} |
459 |
|
} |
460 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
461 |
0 |
@Override... |
462 |
|
public int print(Graphics pg, PageFormat pf, int pi) |
463 |
|
throws PrinterException |
464 |
|
{ |
465 |
0 |
pg.translate((int) pf.getImageableX(), (int) pf.getImageableY()); |
466 |
|
|
467 |
0 |
getRotatableCanvas().drawBackground(pg); |
468 |
0 |
getRotatableCanvas().drawScene(pg); |
469 |
0 |
if (getRotatableCanvas().drawAxes) |
470 |
|
{ |
471 |
0 |
getRotatableCanvas().drawAxes(pg); |
472 |
|
} |
473 |
|
|
474 |
0 |
if (pi == 0) |
475 |
|
{ |
476 |
0 |
return Printable.PAGE_EXISTS; |
477 |
|
} |
478 |
|
else |
479 |
|
{ |
480 |
0 |
return Printable.NO_SUCH_PAGE; |
481 |
|
} |
482 |
|
} |
483 |
|
} |
484 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
485 |
0 |
public void makePaSiMapImage(ImageMaker.TYPE type) throws Exception... |
486 |
|
{ |
487 |
0 |
int width = getRotatableCanvas().getWidth(); |
488 |
0 |
int height = getRotatableCanvas().getHeight(); |
489 |
0 |
ImageWriterI writer = new ImageWriterI() |
490 |
|
{ |
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
491 |
0 |
@Override... |
492 |
|
public void exportImage(Graphics g) throws Exception |
493 |
|
{ |
494 |
0 |
RotatableCanvas canvas = getRotatableCanvas(); |
495 |
0 |
canvas.drawBackground(g); |
496 |
0 |
canvas.drawScene(g); |
497 |
0 |
if (canvas.drawAxes) |
498 |
|
{ |
499 |
0 |
canvas.drawAxes(g); |
500 |
|
} |
501 |
|
} |
502 |
|
}; |
503 |
0 |
String pasimap = MessageManager.getString("label.pasimap"); |
504 |
0 |
ImageExporter exporter = new ImageExporter(writer, null, type, pasimap); |
505 |
0 |
exporter.doExport(null, this, width, height, pasimap); |
506 |
|
} |
507 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
508 |
0 |
@Override... |
509 |
|
protected void viewMenu_menuSelected() |
510 |
|
{ |
511 |
0 |
buildAssociatedViewMenu(); |
512 |
|
} |
513 |
|
|
514 |
|
|
515 |
|
|
516 |
|
|
517 |
|
|
|
|
| 0% |
Uncovered Elements: 28 (28) |
Complexity: 5 |
Complexity Density: 0.23 |
|
518 |
0 |
void buildAssociatedViewMenu()... |
519 |
|
{ |
520 |
0 |
AlignmentPanel[] aps = PaintRefresher |
521 |
|
.getAssociatedPanels(av.getSequenceSetId()); |
522 |
0 |
if (aps.length == 1 && getRotatableCanvas().av == aps[0].av) |
523 |
|
{ |
524 |
0 |
associateViewsMenu.setVisible(false); |
525 |
0 |
return; |
526 |
|
} |
527 |
|
|
528 |
0 |
associateViewsMenu.setVisible(true); |
529 |
|
|
530 |
0 |
if ((viewMenu |
531 |
|
.getItem(viewMenu.getItemCount() - 2) instanceof JMenuItem)) |
532 |
|
{ |
533 |
0 |
viewMenu.insertSeparator(viewMenu.getItemCount() - 1); |
534 |
|
} |
535 |
|
|
536 |
0 |
associateViewsMenu.removeAll(); |
537 |
|
|
538 |
0 |
JRadioButtonMenuItem item; |
539 |
0 |
ButtonGroup buttonGroup = new ButtonGroup(); |
540 |
0 |
int iSize = aps.length; |
541 |
|
|
542 |
0 |
for (int i = 0; i < iSize; i++) |
543 |
|
{ |
544 |
0 |
final AlignmentPanel panel = aps[i]; |
545 |
0 |
item = new JRadioButtonMenuItem(panel.av.getViewName(), |
546 |
|
panel.av == getRotatableCanvas().av); |
547 |
0 |
buttonGroup.add(item); |
548 |
0 |
item.addActionListener(new ActionListener() |
549 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
550 |
0 |
@Override... |
551 |
|
public void actionPerformed(ActionEvent evt) |
552 |
|
{ |
553 |
0 |
selectAssociatedView(panel); |
554 |
|
} |
555 |
|
}); |
556 |
|
|
557 |
0 |
associateViewsMenu.add(item); |
558 |
|
} |
559 |
|
|
560 |
0 |
final JRadioButtonMenuItem itemf = new JRadioButtonMenuItem( |
561 |
|
"All Views"); |
562 |
|
|
563 |
0 |
buttonGroup.add(itemf); |
564 |
|
|
565 |
0 |
itemf.setSelected(getRotatableCanvas().isApplyToAllViews()); |
566 |
0 |
itemf.addActionListener(new ActionListener() |
567 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
568 |
0 |
@Override... |
569 |
|
public void actionPerformed(ActionEvent evt) |
570 |
|
{ |
571 |
0 |
getRotatableCanvas().setApplyToAllViews(itemf.isSelected()); |
572 |
|
} |
573 |
|
}); |
574 |
0 |
associateViewsMenu.add(itemf); |
575 |
|
|
576 |
|
} |
577 |
|
|
578 |
|
|
579 |
|
|
580 |
|
|
581 |
|
@see |
582 |
|
|
583 |
|
|
584 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
585 |
0 |
@Override... |
586 |
|
protected void outputPoints_actionPerformed() |
587 |
|
{ |
588 |
0 |
CutAndPasteTransfer cap = new CutAndPasteTransfer(); |
589 |
0 |
try |
590 |
|
{ |
591 |
0 |
cap.setText(getPasimapModel().getPointsasCsv(false, |
592 |
|
xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(), |
593 |
|
zCombobox.getSelectedIndex())); |
594 |
0 |
Desktop.addInternalFrame(cap, MessageManager |
595 |
|
.formatMessage("label.points_for_params", new String[] |
596 |
|
{ this.getTitle() }), 500, 500); |
597 |
|
} catch (OutOfMemoryError oom) |
598 |
|
{ |
599 |
0 |
new OOMWarning("exporting PaSiMap points", oom); |
600 |
0 |
cap.dispose(); |
601 |
|
} |
602 |
|
} |
603 |
|
|
604 |
|
|
605 |
|
|
606 |
|
|
607 |
|
@see |
608 |
|
|
609 |
|
|
610 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
611 |
0 |
@Override... |
612 |
|
protected void outputProjPoints_actionPerformed() |
613 |
|
{ |
614 |
0 |
CutAndPasteTransfer cap = new CutAndPasteTransfer(); |
615 |
0 |
try |
616 |
|
{ |
617 |
0 |
cap.setText(getPasimapModel().getPointsasCsv(true, |
618 |
|
xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(), |
619 |
|
zCombobox.getSelectedIndex())); |
620 |
0 |
Desktop.addInternalFrame(cap, MessageManager.formatMessage( |
621 |
|
"label.transformed_points_for_params", new String[] |
622 |
|
{ this.getTitle() }), 500, 500); |
623 |
|
} catch (OutOfMemoryError oom) |
624 |
|
{ |
625 |
0 |
new OOMWarning("exporting transformed PaSiMap points", oom); |
626 |
0 |
cap.dispose(); |
627 |
|
} |
628 |
|
} |
629 |
|
|
630 |
|
|
631 |
|
|
632 |
|
|
633 |
|
@see |
634 |
|
|
635 |
|
|
636 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
637 |
0 |
@Override... |
638 |
|
protected void outputAlignment_actionPerformed() |
639 |
|
{ |
640 |
0 |
CutAndPasteTransfer cap = new CutAndPasteTransfer(); |
641 |
0 |
try |
642 |
|
{ |
643 |
0 |
cap.setText(getPasimapModel().getAlignmentOutput()); |
644 |
0 |
Desktop.addInternalFrame(cap, MessageManager.formatMessage( |
645 |
|
"label.pairwise_alignment_for_params", new String[] |
646 |
|
{ this.getTitle() }), 500, 500); |
647 |
|
} catch (OutOfMemoryError oom) |
648 |
|
{ |
649 |
0 |
new OOMWarning("exporting pairwise alignments", oom); |
650 |
0 |
cap.dispose(); |
651 |
|
} |
652 |
|
} |
653 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
654 |
0 |
public void setProgressBar(String message, long id)... |
655 |
|
{ |
656 |
0 |
progressBar.setProgressBar(message, id); |
657 |
|
} |
658 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
659 |
0 |
public String getMessage(long id)... |
660 |
|
{ |
661 |
0 |
return progressBar.getMessage(id); |
662 |
|
} |
663 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
664 |
0 |
public void setProgressBarMessage(long id, String message)... |
665 |
|
{ |
666 |
0 |
progressBar.setProgressBarMessage(id, message); |
667 |
|
} |
668 |
|
|
669 |
|
|
670 |
|
|
671 |
|
|
672 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 5 |
Complexity Density: 0.42 |
|
673 |
0 |
public void updateProgressBar(int lengthOfTask, int progress)... |
674 |
|
{ |
675 |
0 |
JProgressBar pBar = progressBar.getProgressBar(progId); |
676 |
0 |
if (pBar == null) |
677 |
|
{ |
678 |
0 |
return; |
679 |
|
} |
680 |
0 |
if (pBar.isIndeterminate()) |
681 |
|
{ |
682 |
0 |
pBar.setMaximum(lengthOfTask); |
683 |
0 |
pBar.setValue(0); |
684 |
0 |
pBar.setIndeterminate(false); |
685 |
|
} |
686 |
|
|
687 |
0 |
if (progress<-1 || lengthOfTask<=0) |
688 |
|
{ |
689 |
0 |
pBar.setIndeterminate(true); |
690 |
0 |
pBar.repaint(); |
691 |
0 |
return; |
692 |
|
} |
693 |
0 |
updateProgressBar(progress); |
694 |
|
} |
695 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
696 |
0 |
public void updateProgressBarWithEta(int progress, double minutes)... |
697 |
|
{ |
698 |
0 |
JProgressBar pBar = progressBar.getProgressBar(progId); |
699 |
|
|
700 |
0 |
if (pBar == null) |
701 |
|
{ |
702 |
0 |
return; |
703 |
|
} |
704 |
0 |
int max=pBar.getMaximum(); |
705 |
0 |
updateProgressBarEta(minutes); |
706 |
0 |
pBar.setMaximum(max); |
707 |
0 |
pBar.setValue(progress); |
708 |
|
} |
709 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 1 |
|
710 |
0 |
public void updateProgressBarEta(double minutes)... |
711 |
|
{ |
712 |
0 |
JProgressBar pBar = progressBar.getProgressBar(progId); |
713 |
|
|
714 |
0 |
if (pBar == null) |
715 |
|
{ |
716 |
0 |
return; |
717 |
|
} |
718 |
0 |
progressBar.setProgressBarMessage(progId, |
719 |
|
progressBar.getMessage(progId) + " (" |
720 |
0 |
+ (Double.isNaN(minutes) ? " .. working ..)" |
721 |
0 |
: (minutes < 1.0 ? "Less than a minute)" |
722 |
|
: ((int) Math.ceil(minutes)) |
723 |
|
+ " mins. to go)"))); |
724 |
|
} |
725 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
726 |
0 |
public void updateProgressBar(int progress)... |
727 |
|
{ |
728 |
0 |
JProgressBar pBar = progressBar.getProgressBar(progId); |
729 |
|
|
730 |
0 |
if (pBar == null) |
731 |
|
{ |
732 |
0 |
return; |
733 |
|
} |
734 |
|
|
735 |
0 |
pBar.setValue(progress); |
736 |
0 |
pBar.repaint(); |
737 |
|
} |
738 |
|
|
739 |
|
|
740 |
|
|
741 |
|
|
742 |
|
|
743 |
|
@param |
744 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
745 |
0 |
public void addProgressListenerFor(Container pap)... |
746 |
|
{ |
747 |
0 |
pap.addPropertyChangeListener(new PropertyChangeListener() |
748 |
|
{ |
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 6 |
Complexity Density: 0.6 |
|
749 |
0 |
@Override... |
750 |
|
public void propertyChange(PropertyChangeEvent pcEvent) |
751 |
|
{ |
752 |
0 |
if (PairwiseAlignPanel.PROGRESS.equals(pcEvent.getPropertyName())) |
753 |
|
{ |
754 |
0 |
updateProgressBar((int) pcEvent.getNewValue()); |
755 |
|
} |
756 |
0 |
else if (PairwiseAlignPanel.TOTAL.equals(pcEvent.getPropertyName())) |
757 |
|
{ |
758 |
0 |
updateProgressBar((int) pcEvent.getNewValue(), 0); |
759 |
|
} |
760 |
0 |
else if (PairwiseAlignPanel.ETA.equals(pcEvent.getPropertyName())) |
761 |
|
{ |
762 |
0 |
updateProgressBarEta((double) pcEvent.getNewValue()); |
763 |
|
} |
764 |
0 |
else if (PairwiseAlignPanel.PROGRESSMESSAGE.equals(pcEvent.getPropertyName())) |
765 |
|
{ |
766 |
0 |
setProgressBarMessage(progId, (String) pcEvent.getNewValue()); |
767 |
|
} |
768 |
0 |
else if (PairwiseAlignPanel.PROGRESSCOMPLETE.equals(pcEvent.getPropertyName())) |
769 |
|
{ |
770 |
0 |
setProgressBarMessage(progId, (String) pcEvent.getNewValue()); |
771 |
|
} |
772 |
|
} |
773 |
|
}); |
774 |
|
} |
775 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
776 |
0 |
@Override... |
777 |
|
public void registerHandler(final long id, |
778 |
|
final IProgressIndicatorHandler handler) |
779 |
|
{ |
780 |
0 |
progressBar.registerHandler(id, handler); |
781 |
|
} |
782 |
|
|
783 |
|
|
784 |
|
|
785 |
|
@return |
786 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
787 |
0 |
@Override... |
788 |
|
public boolean operationInProgress() |
789 |
|
{ |
790 |
0 |
return progressBar.operationInProgress(); |
791 |
|
} |
792 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
793 |
0 |
@Override... |
794 |
|
protected void resetButton_actionPerformed() |
795 |
|
{ |
796 |
0 |
int t = getTop(); |
797 |
0 |
setTop(0); |
798 |
0 |
xCombobox.setSelectedIndex(0); |
799 |
0 |
yCombobox.setSelectedIndex(1); |
800 |
0 |
setTop(t); |
801 |
0 |
zCombobox.setSelectedIndex(2); |
802 |
|
} |
803 |
|
|
804 |
|
|
805 |
|
|
806 |
|
|
807 |
|
@return |
808 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
809 |
0 |
public boolean isWorking()... |
810 |
|
{ |
811 |
0 |
return working; |
812 |
|
} |
813 |
|
|
814 |
|
|
815 |
|
|
816 |
|
|
817 |
|
|
818 |
|
@param |
819 |
|
@return |
820 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 3 |
Complexity Density: 0.43 |
|
821 |
0 |
public int getSelectedDimensionIndex(Axis axis)... |
822 |
|
{ |
823 |
0 |
switch (axis) |
824 |
|
{ |
825 |
0 |
case X: |
826 |
0 |
return xCombobox.getSelectedIndex(); |
827 |
0 |
case Y: |
828 |
0 |
return yCombobox.getSelectedIndex(); |
829 |
0 |
default: |
830 |
0 |
return zCombobox.getSelectedIndex(); |
831 |
|
} |
832 |
|
} |
833 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
834 |
0 |
public void setShowLabels(boolean show)... |
835 |
|
{ |
836 |
0 |
showLabels.setSelected(show); |
837 |
|
} |
838 |
|
|
839 |
|
|
840 |
|
|
841 |
|
|
842 |
|
|
843 |
|
|
844 |
|
@param |
845 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
846 |
0 |
public void setInputData(AlignmentViewport data)... |
847 |
|
{ |
848 |
0 |
getPasimapModel().setInputData(data); |
849 |
0 |
originalSeqData.setVisible(data != null); |
850 |
|
} |
851 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
852 |
0 |
public AlignViewportI getAlignViewport()... |
853 |
|
{ |
854 |
0 |
return av; |
855 |
|
} |
856 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
857 |
0 |
public PaSiMapModel getPasimapModel()... |
858 |
|
{ |
859 |
0 |
return pasimapModel; |
860 |
|
} |
861 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
862 |
0 |
public void setPasimapModel(PaSiMapModel pasimapModel)... |
863 |
|
{ |
864 |
0 |
this.pasimapModel = pasimapModel; |
865 |
|
} |
866 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
867 |
0 |
public RotatableCanvas getRotatableCanvas()... |
868 |
|
{ |
869 |
0 |
return rc; |
870 |
|
} |
871 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
872 |
0 |
public void setRotatableCanvas(RotatableCanvas rc)... |
873 |
|
{ |
874 |
0 |
this.rc = rc; |
875 |
|
} |
876 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
877 |
0 |
public int getTop()... |
878 |
|
{ |
879 |
0 |
return top; |
880 |
|
} |
881 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
882 |
0 |
public void setTop(int top)... |
883 |
|
{ |
884 |
0 |
this.top = top; |
885 |
|
} |
886 |
|
|
887 |
|
|
888 |
|
|
889 |
|
|
890 |
|
@param |
891 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
892 |
0 |
public void selectAssociatedView(AlignmentPanel panel)... |
893 |
|
{ |
894 |
0 |
getRotatableCanvas().setApplyToAllViews(false); |
895 |
|
|
896 |
0 |
ap = panel; |
897 |
0 |
av = panel.av; |
898 |
|
|
899 |
0 |
getRotatableCanvas().av = panel.av; |
900 |
0 |
getRotatableCanvas().ap = panel; |
901 |
0 |
PaintRefresher.Register(PaSiMapPanel.this, panel.av.getSequenceSetId()); |
902 |
|
} |
903 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
904 |
0 |
@Override... |
905 |
|
public JProgressBar getProgressBar(long id) |
906 |
|
{ |
907 |
0 |
return progressBar.getProgressBar(id); |
908 |
|
} |
909 |
|
} |