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 |
|
|
24 |
|
import java.awt.Color; |
25 |
|
import java.awt.Container; |
26 |
|
import java.awt.Graphics; |
27 |
|
import java.awt.event.ActionEvent; |
28 |
|
import java.awt.event.ActionListener; |
29 |
|
import java.awt.print.PageFormat; |
30 |
|
import java.awt.print.Printable; |
31 |
|
import java.awt.print.PrinterException; |
32 |
|
import java.awt.print.PrinterJob; |
33 |
|
import java.beans.PropertyChangeEvent; |
34 |
|
import java.beans.PropertyChangeListener; |
35 |
|
import java.util.List; |
36 |
|
|
37 |
|
import javax.swing.ButtonGroup; |
38 |
|
import javax.swing.JMenuItem; |
39 |
|
import javax.swing.JProgressBar; |
40 |
|
import javax.swing.JRadioButtonMenuItem; |
41 |
|
import javax.swing.event.InternalFrameAdapter; |
42 |
|
import javax.swing.event.InternalFrameEvent; |
43 |
|
import javax.swing.event.MenuEvent; |
44 |
|
import javax.swing.event.MenuListener; |
45 |
|
|
46 |
|
import jalview.api.AlignViewportI; |
47 |
|
import jalview.bin.Console; |
48 |
|
import jalview.datamodel.Alignment; |
49 |
|
import jalview.datamodel.AlignmentI; |
50 |
|
import jalview.datamodel.AlignmentView; |
51 |
|
import jalview.datamodel.HiddenColumns; |
52 |
|
import jalview.datamodel.SequenceI; |
53 |
|
import jalview.gui.ImageExporter.ImageWriterI; |
54 |
|
import jalview.gui.JalviewColourChooser.ColourChooserListener; |
55 |
|
import jalview.io.exceptions.ImageOutputException; |
56 |
|
import jalview.jbgui.GPCAPanel; |
57 |
|
import jalview.math.RotatableMatrix.Axis; |
58 |
|
import jalview.util.ImageMaker; |
59 |
|
import jalview.util.MessageManager; |
60 |
|
import jalview.viewmodel.AlignmentViewport; |
61 |
|
import jalview.viewmodel.SpatialModel; |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
|
|
| 25.4% |
Uncovered Elements: 217 (291) |
Complexity: 87 |
Complexity Density: 0.45 |
|
67 |
|
public abstract class SpatialPanel<T extends SpatialModel> extends GPCAPanel |
68 |
|
implements IProgressIndicator |
69 |
|
{ |
70 |
|
protected static final int MIN_WIDTH = 470; |
71 |
|
protected static final int MIN_HEIGHT = 250; |
72 |
|
T spatialModel; |
73 |
|
protected RotatableCanvas rc; |
74 |
|
protected AlignmentPanel ap; |
75 |
|
protected AlignmentViewport av; |
76 |
|
private int top = 0; |
77 |
|
protected IProgressIndicator progressBar; |
78 |
|
protected long progId; |
79 |
|
protected boolean working; |
80 |
|
|
81 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
82 |
2 |
public SpatialPanel()... |
83 |
|
{ |
84 |
2 |
this(8); |
85 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
86 |
2 |
public SpatialPanel(int dim)... |
87 |
|
{ |
88 |
2 |
super(dim); |
89 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
90 |
2 |
protected void init(AlignmentPanel alignPanel)... |
91 |
|
{ |
92 |
2 |
this.setFrameIcon(null); |
93 |
2 |
this.av = alignPanel.av; |
94 |
2 |
this.ap = alignPanel; |
95 |
2 |
progressBar = new ProgressBar(statusPanel, statusBar); |
96 |
|
|
97 |
2 |
addInternalFrameListener(new InternalFrameAdapter() |
98 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
99 |
2 |
@Override... |
100 |
|
public void internalFrameClosed(InternalFrameEvent e) |
101 |
|
{ |
102 |
2 |
close_actionPerformed(); |
103 |
|
} |
104 |
|
}); |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
} |
109 |
|
|
110 |
|
|
111 |
|
@return |
112 |
|
|
113 |
|
public abstract String getSpatialName(); |
114 |
|
|
115 |
|
|
116 |
|
@return |
117 |
|
|
118 |
|
public abstract String getSpatialNameDetails(); |
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
124 |
2 |
protected void close_actionPerformed()... |
125 |
|
{ |
126 |
2 |
setSpatialModel(null); |
127 |
2 |
if (this.rc != null) |
128 |
|
{ |
129 |
2 |
this.rc.sequencePoints = null; |
130 |
2 |
this.rc.setAxisEndPoints(null); |
131 |
2 |
this.rc = null; |
132 |
|
} |
133 |
|
} |
134 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
135 |
0 |
@Override... |
136 |
|
protected void outputValues_actionPerformed() |
137 |
|
{ |
138 |
0 |
CutAndPasteTransfer cap = new CutAndPasteTransfer(); |
139 |
0 |
try |
140 |
|
{ |
141 |
0 |
cap.setText(getSpatialModel().getDetails()); |
142 |
0 |
Desktop.addInternalFrame(cap, |
143 |
|
getSpatialNameDetails(), 500, 500); |
144 |
|
} catch (OutOfMemoryError oom) |
145 |
|
{ |
146 |
0 |
new OOMWarning("opening "+getSpatialNameDetails(), oom); |
147 |
0 |
cap.dispose(); |
148 |
|
} |
149 |
|
} |
150 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
151 |
0 |
@Override... |
152 |
|
protected void print_actionPerformed() |
153 |
|
{ |
154 |
0 |
PCAPrinter printer = new PCAPrinter(); |
155 |
0 |
printer.start(); |
156 |
|
} |
157 |
|
|
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 8 |
Complexity Density: 0.53 |
|
162 |
0 |
@Override... |
163 |
|
public void originalSeqData_actionPerformed() |
164 |
|
{ |
165 |
|
|
166 |
0 |
if (getSpatialModel().getInputData() == null) |
167 |
|
{ |
168 |
0 |
Console.info( |
169 |
|
"Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action."); |
170 |
0 |
return; |
171 |
|
} |
172 |
|
|
173 |
|
|
174 |
|
|
175 |
|
|
176 |
|
|
177 |
|
|
178 |
0 |
char gc = '-'; |
179 |
0 |
try |
180 |
|
{ |
181 |
|
|
182 |
|
|
183 |
0 |
gc = av.getGapCharacter(); |
184 |
|
} catch (Exception ex) |
185 |
|
{ |
186 |
|
} |
187 |
|
|
188 |
0 |
Object[] alAndColsel = getSpatialModel().getInputData() |
189 |
|
.getAlignmentAndHiddenColumns(gc); |
190 |
|
|
191 |
0 |
if (alAndColsel != null && alAndColsel[0] != null) |
192 |
|
{ |
193 |
|
|
194 |
|
|
195 |
0 |
AlignmentI al = new Alignment((SequenceI[]) alAndColsel[0]); |
196 |
0 |
AlignmentI dataset = (av != null && av.getAlignment() != null) |
197 |
|
? av.getAlignment().getDataset() |
198 |
|
: null; |
199 |
0 |
if (dataset != null) |
200 |
|
{ |
201 |
0 |
al.setDataset(dataset); |
202 |
|
} |
203 |
|
|
204 |
0 |
if (true) |
205 |
|
{ |
206 |
|
|
207 |
0 |
AlignFrame af = new AlignFrame(al, (HiddenColumns) alAndColsel[1], |
208 |
|
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); |
209 |
|
|
210 |
|
|
211 |
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
|
|
216 |
|
|
217 |
0 |
Desktop.addInternalFrame(af, MessageManager.formatMessage( |
218 |
|
"label.original_data_for_params", new String[] |
219 |
|
{ this.title }), AlignFrame.DEFAULT_WIDTH, |
220 |
|
AlignFrame.DEFAULT_HEIGHT); |
221 |
|
} |
222 |
|
} |
223 |
|
|
224 |
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
|
|
229 |
|
|
230 |
|
|
231 |
|
} |
232 |
|
|
|
|
| 0% |
Uncovered Elements: 28 (28) |
Complexity: 7 |
Complexity Density: 0.39 |
|
233 |
|
class PCAPrinter extends Thread implements Printable |
234 |
|
{ |
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 4 |
Complexity Density: 0.4 |
|
235 |
0 |
@Override... |
236 |
|
public void run() |
237 |
|
{ |
238 |
0 |
PrinterJob printJob = PrinterJob.getPrinterJob(); |
239 |
0 |
PageFormat defaultPage = printJob.defaultPage(); |
240 |
0 |
PageFormat pf = printJob.pageDialog(defaultPage); |
241 |
|
|
242 |
0 |
if (defaultPage == pf) |
243 |
|
{ |
244 |
|
|
245 |
|
|
246 |
|
|
247 |
0 |
return; |
248 |
|
} |
249 |
|
|
250 |
0 |
printJob.setPrintable(this, pf); |
251 |
|
|
252 |
0 |
if (printJob.printDialog()) |
253 |
|
{ |
254 |
0 |
try |
255 |
|
{ |
256 |
0 |
printJob.print(); |
257 |
|
} catch (Exception PrintException) |
258 |
|
{ |
259 |
0 |
PrintException.printStackTrace(); |
260 |
|
} |
261 |
|
} |
262 |
|
} |
263 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
264 |
0 |
@Override... |
265 |
|
public int print(Graphics pg, PageFormat pf, int pi) |
266 |
|
throws PrinterException |
267 |
|
{ |
268 |
0 |
pg.translate((int) pf.getImageableX(), (int) pf.getImageableY()); |
269 |
|
|
270 |
0 |
getRotatableCanvas().drawBackground(pg); |
271 |
0 |
getRotatableCanvas().drawScene(pg); |
272 |
0 |
if (getRotatableCanvas().drawAxes) |
273 |
|
{ |
274 |
0 |
getRotatableCanvas().drawAxes(pg); |
275 |
|
} |
276 |
|
|
277 |
0 |
if (pi == 0) |
278 |
|
{ |
279 |
0 |
return Printable.PAGE_EXISTS; |
280 |
|
} |
281 |
|
else |
282 |
|
{ |
283 |
0 |
return Printable.NO_SUCH_PAGE; |
284 |
|
} |
285 |
|
} |
286 |
|
} |
287 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.25 |
|
288 |
0 |
public void makePCAImage(ImageMaker.TYPE type)... |
289 |
|
{ |
290 |
0 |
int width = getRotatableCanvas().getWidth(); |
291 |
0 |
int height = getRotatableCanvas().getHeight(); |
292 |
0 |
ImageWriterI writer = new ImageWriterI() |
293 |
|
{ |
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
294 |
0 |
@Override... |
295 |
|
public void exportImage(Graphics g) throws Exception |
296 |
|
{ |
297 |
0 |
RotatableCanvas canvas = getRotatableCanvas(); |
298 |
0 |
canvas.drawBackground(g); |
299 |
0 |
canvas.drawScene(g); |
300 |
0 |
if (canvas.drawAxes) |
301 |
|
{ |
302 |
0 |
canvas.drawAxes(g); |
303 |
|
} |
304 |
|
} |
305 |
|
}; |
306 |
0 |
String pca = MessageManager.getString(getSpatialName()); |
307 |
0 |
ImageExporter exporter = new ImageExporter(writer, null, type, pca); |
308 |
0 |
try |
309 |
|
{ |
310 |
0 |
exporter.doExport(null, this, width, height, pca); |
311 |
|
} catch (ImageOutputException ioex) |
312 |
|
{ |
313 |
0 |
Console.error("Unexpected error whilst writing " + type.toString(), |
314 |
|
ioex); |
315 |
|
} |
316 |
|
} |
317 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
318 |
1 |
void initClusterMenu() {... |
319 |
1 |
List<String> clusterMethods = spatialModel.getClusterOptions(); |
320 |
1 |
for (String method:clusterMethods) |
321 |
|
{ |
322 |
1 |
JMenuItem doCluster = new JMenuItem("Cluster with "+method); |
323 |
1 |
doCluster.addActionListener(new ActionListener() |
324 |
|
{ |
325 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
326 |
0 |
@Override... |
327 |
|
public void actionPerformed(ActionEvent e) |
328 |
|
{ |
329 |
0 |
doClustering_actionPerformed(method); |
330 |
|
} |
331 |
|
}); |
332 |
1 |
doClustering.add(doCluster); |
333 |
|
} |
334 |
1 |
doClustering.setEnabled(doClustering.getItemCount()>0); |
335 |
|
} |
336 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
337 |
0 |
@Override... |
338 |
|
protected void viewMenu_menuSelected() |
339 |
|
{ |
340 |
0 |
buildAssociatedViewMenu(); |
341 |
|
} |
342 |
|
|
343 |
|
|
344 |
|
|
345 |
|
|
346 |
|
|
|
|
| 0% |
Uncovered Elements: 28 (28) |
Complexity: 5 |
Complexity Density: 0.23 |
|
347 |
0 |
void buildAssociatedViewMenu()... |
348 |
|
{ |
349 |
0 |
AlignmentPanel[] aps = PaintRefresher |
350 |
|
.getAssociatedPanels(av.getSequenceSetId()); |
351 |
0 |
if (aps.length == 1 && getRotatableCanvas().av == aps[0].av) |
352 |
|
{ |
353 |
0 |
associateViewsMenu.setVisible(false); |
354 |
0 |
return; |
355 |
|
} |
356 |
|
|
357 |
0 |
associateViewsMenu.setVisible(true); |
358 |
|
|
359 |
0 |
if ((viewMenu |
360 |
|
.getItem(viewMenu.getItemCount() - 2) instanceof JMenuItem)) |
361 |
|
{ |
362 |
0 |
viewMenu.insertSeparator(viewMenu.getItemCount() - 1); |
363 |
|
} |
364 |
|
|
365 |
0 |
associateViewsMenu.removeAll(); |
366 |
|
|
367 |
0 |
JRadioButtonMenuItem item; |
368 |
0 |
ButtonGroup buttonGroup = new ButtonGroup(); |
369 |
0 |
int iSize = aps.length; |
370 |
|
|
371 |
0 |
for (int i = 0; i < iSize; i++) |
372 |
|
{ |
373 |
0 |
final AlignmentPanel panel = aps[i]; |
374 |
0 |
item = new JRadioButtonMenuItem(panel.av.getViewName(), |
375 |
|
panel.av == getRotatableCanvas().av); |
376 |
0 |
buttonGroup.add(item); |
377 |
0 |
item.addActionListener(new ActionListener() |
378 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
379 |
0 |
@Override... |
380 |
|
public void actionPerformed(ActionEvent evt) |
381 |
|
{ |
382 |
0 |
selectAssociatedView(panel); |
383 |
|
} |
384 |
|
}); |
385 |
|
|
386 |
0 |
associateViewsMenu.add(item); |
387 |
|
} |
388 |
|
|
389 |
0 |
final JRadioButtonMenuItem itemf = new JRadioButtonMenuItem( |
390 |
|
"All Views"); |
391 |
|
|
392 |
0 |
buttonGroup.add(itemf); |
393 |
|
|
394 |
0 |
itemf.setSelected(getRotatableCanvas().isApplyToAllViews()); |
395 |
0 |
itemf.addActionListener(new ActionListener() |
396 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
397 |
0 |
@Override... |
398 |
|
public void actionPerformed(ActionEvent evt) |
399 |
|
{ |
400 |
0 |
getRotatableCanvas().setApplyToAllViews(itemf.isSelected()); |
401 |
|
} |
402 |
|
}); |
403 |
0 |
associateViewsMenu.add(itemf); |
404 |
|
|
405 |
|
} |
406 |
|
|
407 |
|
|
408 |
|
|
409 |
|
|
410 |
|
@see |
411 |
|
|
412 |
|
|
413 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
414 |
0 |
@Override... |
415 |
|
protected void outputPoints_actionPerformed() |
416 |
|
{ |
417 |
0 |
CutAndPasteTransfer cap = new CutAndPasteTransfer(); |
418 |
0 |
try |
419 |
|
{ |
420 |
0 |
cap.setText(getSpatialModel().getPointsasCsv(false, |
421 |
|
xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(), |
422 |
|
zCombobox.getSelectedIndex())); |
423 |
0 |
Desktop.addInternalFrame(cap, MessageManager |
424 |
|
.formatMessage("label.points_for_params", new String[] |
425 |
|
{ this.getTitle() }), 500, 500); |
426 |
|
} catch (OutOfMemoryError oom) |
427 |
|
{ |
428 |
0 |
new OOMWarning("exporting PCA points", oom); |
429 |
0 |
cap.dispose(); |
430 |
|
} |
431 |
|
} |
432 |
|
|
433 |
|
|
434 |
|
|
435 |
|
|
436 |
|
@see |
437 |
|
|
438 |
|
|
439 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
440 |
0 |
@Override... |
441 |
|
protected void outputProjPoints_actionPerformed() |
442 |
|
{ |
443 |
0 |
CutAndPasteTransfer cap = new CutAndPasteTransfer(); |
444 |
0 |
try |
445 |
|
{ |
446 |
0 |
cap.setText(getSpatialModel().getPointsasCsv(true, |
447 |
|
xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(), |
448 |
|
zCombobox.getSelectedIndex())); |
449 |
0 |
Desktop.addInternalFrame(cap, MessageManager.formatMessage( |
450 |
|
"label.transformed_points_for_params", new String[] |
451 |
|
{ this.getTitle() }), 500, 500); |
452 |
|
} catch (OutOfMemoryError oom) |
453 |
|
{ |
454 |
0 |
new OOMWarning("exporting transformed PCA points", oom); |
455 |
0 |
cap.dispose(); |
456 |
|
} |
457 |
|
} |
458 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
459 |
0 |
@Override... |
460 |
|
protected void resetButton_actionPerformed() |
461 |
|
{ |
462 |
0 |
int t = getTop(); |
463 |
0 |
setTop(0); |
464 |
0 |
xCombobox.setSelectedIndex(0); |
465 |
0 |
yCombobox.setSelectedIndex(1); |
466 |
0 |
setTop(t); |
467 |
0 |
zCombobox.setSelectedIndex(2); |
468 |
|
} |
469 |
|
|
470 |
|
|
471 |
|
|
472 |
|
|
473 |
|
|
474 |
|
|
475 |
|
@param |
476 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
477 |
1 |
public void setInputData(AlignmentView data)... |
478 |
|
{ |
479 |
|
|
480 |
|
|
481 |
1 |
originalSeqData.setVisible(data != null); |
482 |
|
} |
483 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
484 |
9 |
public T getSpatialModel()... |
485 |
|
{ |
486 |
9 |
return spatialModel; |
487 |
|
} |
488 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
489 |
2 |
public void setSpatialModel(T SpatialModel)... |
490 |
|
{ |
491 |
2 |
this.spatialModel = SpatialModel; |
492 |
|
} |
493 |
|
|
494 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
495 |
0 |
protected List<String> getAvailableClusteringMethods()... |
496 |
|
{ |
497 |
0 |
return spatialModel.getClusterOptions(); |
498 |
|
} |
499 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
500 |
0 |
protected void doClustering_actionPerformed(String method)... |
501 |
|
{ |
502 |
|
|
503 |
0 |
spatialModel.doClustering(method); |
504 |
0 |
spatialModel.markGroups(); |
505 |
0 |
ap.updateAnnotation(); |
506 |
|
|
507 |
|
} |
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
508 |
0 |
@Override... |
509 |
|
protected void bgcolour_actionPerformed() |
510 |
|
{ |
511 |
0 |
String ttl = MessageManager.getString("label.select_background_colour"); |
512 |
0 |
ColourChooserListener listener = new ColourChooserListener() |
513 |
|
{ |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
514 |
0 |
@Override... |
515 |
|
public void colourSelected(Color c) |
516 |
|
{ |
517 |
0 |
rc.setBgColour(c); |
518 |
0 |
rc.repaint(); |
519 |
|
} |
520 |
|
}; |
521 |
0 |
JalviewColourChooser.showColourChooser(this, ttl, rc.getBgColour(), |
522 |
|
listener); |
523 |
|
} |
524 |
|
|
525 |
|
|
526 |
|
|
527 |
|
|
|
|
| 33.3% |
Uncovered Elements: 6 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
528 |
12 |
@Override... |
529 |
|
protected void doDimensionChange() |
530 |
|
{ |
531 |
12 |
if (getTop() == 0) |
532 |
|
{ |
533 |
12 |
return; |
534 |
|
} |
535 |
|
|
536 |
0 |
int dim1 = getTop() - xCombobox.getSelectedIndex(); |
537 |
0 |
int dim2 = getTop() - yCombobox.getSelectedIndex(); |
538 |
0 |
int dim3 = getTop() - zCombobox.getSelectedIndex(); |
539 |
0 |
spatialModel.updateRcView(dim1, dim2, dim3); |
540 |
0 |
getRotatableCanvas().resetView(); |
541 |
|
} |
542 |
|
|
543 |
|
|
544 |
|
|
545 |
|
|
546 |
|
@param |
547 |
|
@param |
548 |
|
|
|
|
| 90.9% |
Uncovered Elements: 1 (11) |
Complexity: 4 |
Complexity Density: 0.36 |
|
549 |
3 |
public void setSelectedDimensionIndex(int index, Axis axis)... |
550 |
|
{ |
551 |
3 |
switch (axis) |
552 |
|
{ |
553 |
1 |
case X: |
554 |
1 |
xCombobox.setSelectedIndex(index); |
555 |
1 |
break; |
556 |
1 |
case Y: |
557 |
1 |
yCombobox.setSelectedIndex(index); |
558 |
1 |
break; |
559 |
1 |
case Z: |
560 |
1 |
zCombobox.setSelectedIndex(index); |
561 |
1 |
break; |
562 |
0 |
default: |
563 |
|
} |
564 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
565 |
0 |
@Override... |
566 |
|
protected void showLabels_actionPerformed() |
567 |
|
{ |
568 |
0 |
getRotatableCanvas().showLabels(showLabels.getState()); |
569 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
570 |
0 |
public void setProgressBar(String message, long id)... |
571 |
|
{ |
572 |
0 |
progressBar.setProgressBar(message, id); |
573 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
574 |
0 |
public String getMessage(long id)... |
575 |
|
{ |
576 |
0 |
return progressBar.getMessage(id); |
577 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
578 |
0 |
public void setProgressBarMessage(long id, String message)... |
579 |
|
{ |
580 |
0 |
progressBar.setProgressBarMessage(id, message); |
581 |
|
} |
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 5 |
Complexity Density: 0.42 |
|
582 |
0 |
public void updateProgressBar(int lengthOfTask, int progress)... |
583 |
|
{ |
584 |
0 |
JProgressBar pBar = progressBar.getProgressBar(progId); |
585 |
0 |
if (pBar == null) |
586 |
|
{ |
587 |
0 |
return; |
588 |
|
} |
589 |
0 |
if (pBar.isIndeterminate()) |
590 |
|
{ |
591 |
0 |
pBar.setMaximum(lengthOfTask); |
592 |
0 |
pBar.setValue(0); |
593 |
0 |
pBar.setIndeterminate(false); |
594 |
|
} |
595 |
|
|
596 |
0 |
if (progress<-1 || lengthOfTask<=0) |
597 |
|
{ |
598 |
0 |
pBar.setIndeterminate(true); |
599 |
0 |
pBar.repaint(); |
600 |
0 |
return; |
601 |
|
} |
602 |
0 |
updateProgressBar(progress); |
603 |
|
} |
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
604 |
0 |
public void updateProgressBarWithEta(int progress, double minutes)... |
605 |
|
{ |
606 |
0 |
JProgressBar pBar = progressBar.getProgressBar(progId); |
607 |
|
|
608 |
0 |
if (pBar == null) |
609 |
|
{ |
610 |
0 |
return; |
611 |
|
} |
612 |
0 |
int max=pBar.getMaximum(); |
613 |
0 |
updateProgressBarEta(minutes); |
614 |
0 |
pBar.setMaximum(max); |
615 |
0 |
pBar.setValue(progress); |
616 |
|
} |
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 1 |
|
617 |
0 |
public void updateProgressBarEta(double minutes)... |
618 |
|
{ |
619 |
0 |
JProgressBar pBar = progressBar.getProgressBar(progId); |
620 |
|
|
621 |
0 |
if (pBar == null) |
622 |
|
{ |
623 |
0 |
return; |
624 |
|
} |
625 |
0 |
progressBar.setProgressBarMessage(progId, |
626 |
|
progressBar.getMessage(progId) + " (" |
627 |
0 |
+ (Double.isNaN(minutes) ? " .. working ..)" |
628 |
0 |
: (minutes < 1.0 ? "Less than a minute)" |
629 |
|
: ((int) Math.ceil(minutes)) |
630 |
|
+ " mins. to go)"))); |
631 |
|
} |
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
632 |
0 |
public void updateProgressBar(int progress)... |
633 |
|
{ |
634 |
0 |
JProgressBar pBar = progressBar.getProgressBar(progId); |
635 |
|
|
636 |
0 |
if (pBar == null) |
637 |
|
{ |
638 |
0 |
return; |
639 |
|
} |
640 |
|
|
641 |
0 |
pBar.setValue(progress); |
642 |
0 |
pBar.repaint(); |
643 |
|
} |
644 |
|
|
645 |
|
|
646 |
|
|
647 |
|
|
648 |
|
@param |
649 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
650 |
0 |
public void addProgressListenerFor(Container pap)... |
651 |
|
{ |
652 |
0 |
pap.addPropertyChangeListener(new PropertyChangeListener() |
653 |
|
{ |
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 6 |
Complexity Density: 0.6 |
|
654 |
0 |
@Override... |
655 |
|
public void propertyChange(PropertyChangeEvent pcEvent) |
656 |
|
{ |
657 |
0 |
if (PairwiseAlignPanel.PROGRESS.equals(pcEvent.getPropertyName())) |
658 |
|
{ |
659 |
0 |
updateProgressBar((int) pcEvent.getNewValue()); |
660 |
|
} |
661 |
0 |
else if (PairwiseAlignPanel.TOTAL.equals(pcEvent.getPropertyName())) |
662 |
|
{ |
663 |
0 |
updateProgressBar((int) pcEvent.getNewValue(), 0); |
664 |
|
} |
665 |
0 |
else if (PairwiseAlignPanel.ETA.equals(pcEvent.getPropertyName())) |
666 |
|
{ |
667 |
0 |
updateProgressBarEta((double) pcEvent.getNewValue()); |
668 |
|
} |
669 |
0 |
else if (PairwiseAlignPanel.PROGRESSMESSAGE.equals(pcEvent.getPropertyName())) |
670 |
|
{ |
671 |
0 |
setProgressBarMessage(progId, (String) pcEvent.getNewValue()); |
672 |
|
} |
673 |
0 |
else if (PairwiseAlignPanel.PROGRESSCOMPLETE.equals(pcEvent.getPropertyName())) |
674 |
|
{ |
675 |
0 |
setProgressBarMessage(progId, (String) pcEvent.getNewValue()); |
676 |
|
} |
677 |
|
} |
678 |
|
}); |
679 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
680 |
0 |
@Override... |
681 |
|
public void registerHandler(final long id, final IProgressIndicatorHandler handler) |
682 |
|
{ |
683 |
0 |
progressBar.registerHandler(id, handler); |
684 |
|
} |
685 |
|
|
686 |
|
|
687 |
|
@return |
688 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
689 |
0 |
@Override... |
690 |
|
public boolean operationInProgress() |
691 |
|
{ |
692 |
0 |
return progressBar.operationInProgress(); |
693 |
|
} |
694 |
|
|
695 |
|
|
696 |
|
|
697 |
|
@return |
698 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
699 |
0 |
public boolean isWorking()... |
700 |
|
{ |
701 |
0 |
return working; |
702 |
|
} |
703 |
|
|
704 |
|
|
705 |
|
|
706 |
|
|
707 |
|
@param |
708 |
|
@return |
709 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 3 |
Complexity Density: 0.43 |
|
710 |
3 |
public int getSelectedDimensionIndex(Axis axis)... |
711 |
|
{ |
712 |
3 |
switch (axis) |
713 |
|
{ |
714 |
1 |
case X: |
715 |
1 |
return xCombobox.getSelectedIndex(); |
716 |
1 |
case Y: |
717 |
1 |
return yCombobox.getSelectedIndex(); |
718 |
1 |
default: |
719 |
1 |
return zCombobox.getSelectedIndex(); |
720 |
|
} |
721 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
722 |
1 |
public void setShowLabels(boolean show)... |
723 |
|
{ |
724 |
1 |
showLabels.setSelected(show); |
725 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
726 |
10 |
public AlignViewportI getAlignViewport()... |
727 |
|
{ |
728 |
10 |
return av; |
729 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
730 |
24 |
public RotatableCanvas getRotatableCanvas()... |
731 |
|
{ |
732 |
24 |
return rc; |
733 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
734 |
2 |
public void setRotatableCanvas(RotatableCanvas rc)... |
735 |
|
{ |
736 |
2 |
this.rc = rc; |
737 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
738 |
12 |
public int getTop()... |
739 |
|
{ |
740 |
12 |
return top; |
741 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
742 |
2 |
public void setTop(int top)... |
743 |
|
{ |
744 |
2 |
this.top = top; |
745 |
|
} |
746 |
|
|
747 |
|
|
748 |
|
|
749 |
|
@param |
750 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
751 |
1 |
public void selectAssociatedView(AlignmentPanel panel)... |
752 |
|
{ |
753 |
1 |
getRotatableCanvas().setApplyToAllViews(false); |
754 |
|
|
755 |
1 |
ap = panel; |
756 |
1 |
av = panel.av; |
757 |
|
|
758 |
1 |
getRotatableCanvas().av = panel.av; |
759 |
1 |
getRotatableCanvas().ap = panel; |
760 |
1 |
PaintRefresher.Register(SpatialPanel.this, panel.av.getSequenceSetId()); |
761 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
762 |
0 |
@Override... |
763 |
|
public JProgressBar getProgressBar(long id) |
764 |
|
{ |
765 |
0 |
return progressBar.getProgressBar(id); |
766 |
|
} |
767 |
|
} |