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.api.SplitContainerI; |
24 |
|
import jalview.datamodel.AlignmentI; |
25 |
|
import jalview.jbgui.GAlignFrame; |
26 |
|
import jalview.jbgui.GSplitFrame; |
27 |
|
import jalview.structure.StructureSelectionManager; |
28 |
|
import jalview.util.Platform; |
29 |
|
import jalview.viewmodel.AlignmentViewport; |
30 |
|
|
31 |
|
import java.awt.Component; |
32 |
|
import java.awt.Toolkit; |
33 |
|
import java.awt.event.ActionEvent; |
34 |
|
import java.awt.event.ActionListener; |
35 |
|
import java.awt.event.KeyAdapter; |
36 |
|
import java.awt.event.KeyEvent; |
37 |
|
import java.awt.event.KeyListener; |
38 |
|
import java.beans.PropertyVetoException; |
39 |
|
import java.util.Arrays; |
40 |
|
import java.util.List; |
41 |
|
import java.util.Map.Entry; |
42 |
|
|
43 |
|
import javax.swing.AbstractAction; |
44 |
|
import javax.swing.InputMap; |
45 |
|
import javax.swing.JComponent; |
46 |
|
import javax.swing.JMenuItem; |
47 |
|
import javax.swing.KeyStroke; |
48 |
|
import javax.swing.event.InternalFrameAdapter; |
49 |
|
import javax.swing.event.InternalFrameEvent; |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
@author |
61 |
|
|
62 |
|
|
|
|
| 0% |
Uncovered Elements: 305 (305) |
Complexity: 80 |
Complexity Density: 0.4 |
|
63 |
|
public class SplitFrame extends GSplitFrame implements SplitContainerI |
64 |
|
{ |
65 |
|
private static final int WINDOWS_INSETS_WIDTH = 28; |
66 |
|
|
67 |
|
private static final int MAC_INSETS_WIDTH = 28; |
68 |
|
|
69 |
|
private static final int WINDOWS_INSETS_HEIGHT = 50; |
70 |
|
|
71 |
|
private static final int MAC_INSETS_HEIGHT = 50; |
72 |
|
|
73 |
|
private static final int DESKTOP_DECORATORS_HEIGHT = 65; |
74 |
|
|
75 |
|
private static final long serialVersionUID = 1L; |
76 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
77 |
0 |
public SplitFrame(GAlignFrame top, GAlignFrame bottom)... |
78 |
|
{ |
79 |
0 |
super(top, bottom); |
80 |
0 |
init(); |
81 |
|
} |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 3 |
Complexity Density: 0.19 |
|
86 |
0 |
protected void init()... |
87 |
|
{ |
88 |
0 |
getTopFrame().setSplitFrame(this); |
89 |
0 |
getBottomFrame().setSplitFrame(this); |
90 |
0 |
getTopFrame().setVisible(true); |
91 |
0 |
getBottomFrame().setVisible(true); |
92 |
|
|
93 |
0 |
((AlignFrame) getTopFrame()).getViewport().setCodingComplement( |
94 |
|
((AlignFrame) getBottomFrame()).getViewport()); |
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
0 |
int widthFudge = Platform.isAMac() ? MAC_INSETS_WIDTH |
101 |
|
: WINDOWS_INSETS_WIDTH; |
102 |
0 |
int heightFudge = Platform.isAMac() ? MAC_INSETS_HEIGHT |
103 |
|
: WINDOWS_INSETS_HEIGHT; |
104 |
0 |
int width = ((AlignFrame) getTopFrame()).getWidth() + widthFudge; |
105 |
0 |
int height = ((AlignFrame) getTopFrame()).getHeight() |
106 |
|
+ ((AlignFrame) getBottomFrame()).getHeight() + DIVIDER_SIZE |
107 |
|
+ heightFudge; |
108 |
0 |
height = fitHeightToDesktop(height); |
109 |
0 |
setSize(width, height); |
110 |
|
|
111 |
0 |
adjustLayout(); |
112 |
|
|
113 |
0 |
addCloseFrameListener(); |
114 |
|
|
115 |
0 |
addKeyListener(); |
116 |
|
|
117 |
0 |
addKeyBindings(); |
118 |
|
|
119 |
0 |
addCommandListeners(); |
120 |
|
} |
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
@param |
127 |
|
|
128 |
|
@return |
129 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
130 |
0 |
public int fitHeightToDesktop(int height)... |
131 |
|
{ |
132 |
|
|
133 |
|
|
134 |
0 |
int newHeight = Math.min(height, |
135 |
|
Desktop.instance.getHeight() - DESKTOP_DECORATORS_HEIGHT); |
136 |
0 |
if (newHeight != height) |
137 |
|
{ |
138 |
0 |
int oldDividerLocation = getDividerLocation(); |
139 |
0 |
setDividerLocation(oldDividerLocation * newHeight / height); |
140 |
|
} |
141 |
0 |
return newHeight; |
142 |
|
} |
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
148 |
0 |
protected void addCommandListeners()... |
149 |
|
{ |
150 |
|
|
151 |
|
|
152 |
0 |
final StructureSelectionManager ssm = StructureSelectionManager |
153 |
|
.getStructureSelectionManager(Desktop.instance); |
154 |
0 |
ssm.addCommandListener(((AlignFrame) getTopFrame()).getViewport()); |
155 |
0 |
ssm.addCommandListener(((AlignFrame) getBottomFrame()).getViewport()); |
156 |
|
} |
157 |
|
|
158 |
|
|
159 |
|
|
160 |
|
|
|
|
| 0% |
Uncovered Elements: 32 (32) |
Complexity: 10 |
Complexity Density: 0.62 |
|
161 |
0 |
public void adjustLayout()... |
162 |
|
{ |
163 |
|
|
164 |
|
|
165 |
|
|
166 |
0 |
int w1 = ((AlignFrame) getTopFrame()).getViewport().getIdWidth(); |
167 |
0 |
int w2 = ((AlignFrame) getBottomFrame()).getViewport().getIdWidth(); |
168 |
0 |
int w3 = Math.max(w1, w2); |
169 |
0 |
if (w1 != w3) |
170 |
|
{ |
171 |
0 |
((AlignFrame) getTopFrame()).getViewport().setIdWidth(w3); |
172 |
|
} |
173 |
0 |
if (w2 != w3) |
174 |
|
{ |
175 |
0 |
((AlignFrame) getBottomFrame()).getViewport().setIdWidth(w3); |
176 |
|
} |
177 |
|
|
178 |
|
|
179 |
|
|
180 |
|
|
181 |
0 |
final AlignViewport topViewport = ((AlignFrame) getTopFrame()).viewport; |
182 |
0 |
final AlignViewport bottomViewport = ((AlignFrame) getBottomFrame()).viewport; |
183 |
0 |
final AlignmentI topAlignment = topViewport.getAlignment(); |
184 |
0 |
final AlignmentI bottomAlignment = bottomViewport.getAlignment(); |
185 |
0 |
AlignmentViewport cdna = topAlignment.isNucleotide() ? topViewport |
186 |
0 |
: (bottomAlignment.isNucleotide() ? bottomViewport : null); |
187 |
0 |
AlignmentViewport protein = !topAlignment.isNucleotide() ? topViewport |
188 |
0 |
: (!bottomAlignment.isNucleotide() ? bottomViewport : null); |
189 |
0 |
if (protein != null && cdna != null) |
190 |
|
{ |
191 |
0 |
int scale = protein.isScaleProteinAsCdna() ? 3 : 1; |
192 |
0 |
protein.setCharWidth(scale * cdna.getViewStyle().getCharWidth()); |
193 |
|
} |
194 |
|
} |
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
|
199 |
|
|
200 |
|
|
201 |
|
|
202 |
|
|
203 |
|
|
204 |
|
|
205 |
|
|
|
|
| 0% |
Uncovered Elements: 36 (36) |
Complexity: 4 |
Complexity Density: 0.13 |
|
206 |
0 |
protected void adjustInitialLayout()... |
207 |
|
{ |
208 |
0 |
AlignFrame topFrame = (AlignFrame) getTopFrame(); |
209 |
0 |
AlignFrame bottomFrame = (AlignFrame) getBottomFrame(); |
210 |
|
|
211 |
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
0 |
topFrame.alignPanel.adjustAnnotationHeight(); |
216 |
0 |
bottomFrame.alignPanel.adjustAnnotationHeight(); |
217 |
|
|
218 |
0 |
final AlignViewport topViewport = topFrame.viewport; |
219 |
0 |
final AlignViewport bottomViewport = bottomFrame.viewport; |
220 |
0 |
final AlignmentI topAlignment = topViewport.getAlignment(); |
221 |
0 |
final AlignmentI bottomAlignment = bottomViewport.getAlignment(); |
222 |
0 |
boolean topAnnotations = topViewport.isShowAnnotation(); |
223 |
0 |
boolean bottomAnnotations = bottomViewport.isShowAnnotation(); |
224 |
|
|
225 |
0 |
int topCount = topAlignment.getHeight(); |
226 |
0 |
int bottomCount = bottomAlignment.getHeight(); |
227 |
0 |
int topCharHeight = topViewport.getViewStyle().getCharHeight(); |
228 |
0 |
int bottomCharHeight = bottomViewport.getViewStyle().getCharHeight(); |
229 |
|
|
230 |
|
|
231 |
|
|
232 |
|
|
233 |
|
|
234 |
0 |
int topPanelHeight = topFrame.getHeight(); |
235 |
0 |
int bottomPanelHeight = bottomFrame.getHeight(); |
236 |
0 |
int topSequencesHeight = topFrame.alignPanel.getSeqPanel().seqCanvas |
237 |
|
.getHeight(); |
238 |
0 |
int topPanelMinHeight = topPanelHeight |
239 |
|
- Math.max(0, topSequencesHeight - 3 * topCharHeight); |
240 |
0 |
double totalHeight = (double) topPanelHeight + bottomPanelHeight; |
241 |
0 |
double minRatio = topPanelMinHeight / totalHeight; |
242 |
|
|
243 |
|
|
244 |
|
|
245 |
|
|
246 |
|
|
247 |
0 |
int bottomSequencesHeight = bottomFrame.alignPanel.getSeqPanel().seqCanvas |
248 |
|
.getHeight(); |
249 |
0 |
int bottomPanelMinHeight = bottomPanelHeight |
250 |
|
- Math.max(0, bottomSequencesHeight - 3 * bottomCharHeight); |
251 |
0 |
double maxRatio = (totalHeight - bottomPanelMinHeight) / totalHeight; |
252 |
|
|
253 |
|
|
254 |
|
|
255 |
|
|
256 |
0 |
int insets = Platform.isAMac() ? MAC_INSETS_HEIGHT |
257 |
|
: WINDOWS_INSETS_HEIGHT; |
258 |
|
|
259 |
0 |
int topHeight = insets + (3 + topCount) * topCharHeight |
260 |
0 |
+ (topAnnotations ? topViewport.calcPanelHeight() : 0); |
261 |
0 |
int bottomHeight = insets + (3 + bottomCount) * bottomCharHeight |
262 |
0 |
+ (bottomAnnotations ? bottomViewport.calcPanelHeight() : 0); |
263 |
0 |
double ratio = ((double) topHeight) |
264 |
|
/ (double) (topHeight + bottomHeight); |
265 |
|
|
266 |
|
|
267 |
|
|
268 |
|
|
269 |
0 |
ratio = Math.min(ratio, maxRatio); |
270 |
0 |
ratio = Math.max(ratio, minRatio); |
271 |
0 |
setRelativeDividerLocation(ratio); |
272 |
|
} |
273 |
|
|
274 |
|
|
275 |
|
|
276 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
277 |
0 |
protected void addCloseFrameListener()... |
278 |
|
{ |
279 |
0 |
addInternalFrameListener(new InternalFrameAdapter() |
280 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
281 |
0 |
@Override... |
282 |
|
public void internalFrameClosed(InternalFrameEvent evt) |
283 |
|
{ |
284 |
0 |
close(); |
285 |
|
}; |
286 |
|
}); |
287 |
|
} |
288 |
|
|
289 |
|
|
290 |
|
|
291 |
|
|
292 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
293 |
0 |
protected void addKeyListener()... |
294 |
|
{ |
295 |
0 |
addKeyListener(new KeyAdapter() |
296 |
|
{ |
297 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
298 |
0 |
@Override... |
299 |
|
public void keyPressed(KeyEvent e) |
300 |
|
{ |
301 |
0 |
AlignFrame af = (AlignFrame) getFrameAtMouse(); |
302 |
|
|
303 |
|
|
304 |
|
|
305 |
|
|
306 |
0 |
if (!overrideKey(e, af)) |
307 |
|
{ |
308 |
0 |
if (af != null) |
309 |
|
{ |
310 |
0 |
for (KeyListener kl : af.getKeyListeners()) |
311 |
|
{ |
312 |
0 |
kl.keyPressed(e); |
313 |
|
} |
314 |
|
} |
315 |
|
} |
316 |
|
} |
317 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
318 |
0 |
@Override... |
319 |
|
public void keyReleased(KeyEvent e) |
320 |
|
{ |
321 |
0 |
Component c = getFrameAtMouse(); |
322 |
0 |
if (c != null) |
323 |
|
{ |
324 |
0 |
for (KeyListener kl : c.getKeyListeners()) |
325 |
|
{ |
326 |
0 |
kl.keyReleased(e); |
327 |
|
} |
328 |
|
} |
329 |
|
} |
330 |
|
|
331 |
|
}); |
332 |
|
} |
333 |
|
|
334 |
|
|
335 |
|
|
336 |
|
|
337 |
|
|
338 |
|
|
339 |
|
|
340 |
|
|
341 |
|
|
342 |
|
@see |
343 |
|
@param |
344 |
|
@param |
345 |
|
@return |
346 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 7 |
Complexity Density: 0.37 |
|
347 |
0 |
protected boolean overrideKey(KeyEvent e, AlignFrame af)... |
348 |
|
{ |
349 |
0 |
boolean actioned = false; |
350 |
0 |
int keyCode = e.getKeyCode(); |
351 |
0 |
switch (keyCode) |
352 |
|
{ |
353 |
0 |
case KeyEvent.VK_DOWN: |
354 |
0 |
if (e.isAltDown() || !af.viewport.cursorMode) |
355 |
|
{ |
356 |
|
|
357 |
|
|
358 |
|
|
359 |
0 |
((AlignFrame) getTopFrame()).moveSelectedSequences(false); |
360 |
0 |
((AlignFrame) getBottomFrame()).moveSelectedSequences(false); |
361 |
0 |
actioned = true; |
362 |
0 |
e.consume(); |
363 |
|
} |
364 |
0 |
break; |
365 |
0 |
case KeyEvent.VK_UP: |
366 |
0 |
if (e.isAltDown() || !af.viewport.cursorMode) |
367 |
|
{ |
368 |
|
|
369 |
|
|
370 |
|
|
371 |
0 |
((AlignFrame) getTopFrame()).moveSelectedSequences(true); |
372 |
0 |
((AlignFrame) getBottomFrame()).moveSelectedSequences(true); |
373 |
0 |
actioned = true; |
374 |
0 |
e.consume(); |
375 |
|
} |
376 |
0 |
break; |
377 |
0 |
default: |
378 |
|
} |
379 |
0 |
return actioned; |
380 |
|
} |
381 |
|
|
382 |
|
|
383 |
|
|
384 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
385 |
0 |
private void addKeyBindings()... |
386 |
|
{ |
387 |
0 |
overrideDelegatedKeyBindings(); |
388 |
|
|
389 |
0 |
overrideImplementedKeyBindings(); |
390 |
|
} |
391 |
|
|
392 |
|
|
393 |
|
|
394 |
|
|
395 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
396 |
0 |
protected void overrideImplementedKeyBindings()... |
397 |
|
{ |
398 |
0 |
overrideFind(); |
399 |
0 |
overrideNewView(); |
400 |
0 |
overrideCloseView(); |
401 |
0 |
overrideExpandViews(); |
402 |
0 |
overrideGatherViews(); |
403 |
|
} |
404 |
|
|
405 |
|
|
406 |
|
|
407 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
408 |
0 |
protected void overrideCloseView()... |
409 |
|
{ |
410 |
0 |
AbstractAction action; |
411 |
|
|
412 |
|
|
413 |
|
|
414 |
0 |
KeyStroke key_cmdW = KeyStroke.getKeyStroke(KeyEvent.VK_W, |
415 |
|
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); |
416 |
0 |
action = new AbstractAction() |
417 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
418 |
0 |
@Override... |
419 |
|
public void actionPerformed(ActionEvent e) |
420 |
|
{ |
421 |
0 |
closeView_actionPerformed(); |
422 |
|
} |
423 |
|
}; |
424 |
0 |
overrideKeyBinding(key_cmdW, action); |
425 |
|
} |
426 |
|
|
427 |
|
|
428 |
|
|
429 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
430 |
0 |
protected void overrideNewView()... |
431 |
|
{ |
432 |
|
|
433 |
|
|
434 |
|
|
435 |
0 |
KeyStroke key_cmdT = KeyStroke.getKeyStroke(KeyEvent.VK_T, |
436 |
|
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); |
437 |
0 |
AbstractAction action = new AbstractAction() |
438 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
439 |
0 |
@Override... |
440 |
|
public void actionPerformed(ActionEvent e) |
441 |
|
{ |
442 |
0 |
newView_actionPerformed(); |
443 |
|
} |
444 |
|
}; |
445 |
0 |
overrideKeyBinding(key_cmdT, action); |
446 |
|
} |
447 |
|
|
448 |
|
|
449 |
|
|
450 |
|
|
451 |
|
|
452 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
453 |
0 |
protected void overrideDelegatedKeyBindings()... |
454 |
|
{ |
455 |
0 |
if (getTopFrame() instanceof AlignFrame) |
456 |
|
{ |
457 |
|
|
458 |
|
|
459 |
|
|
460 |
|
|
461 |
0 |
for (Entry<KeyStroke, JMenuItem> acc : ((AlignFrame) getTopFrame()) |
462 |
|
.getAccelerators().entrySet()) |
463 |
|
{ |
464 |
0 |
overrideKeyBinding(acc); |
465 |
|
} |
466 |
|
} |
467 |
|
} |
468 |
|
|
469 |
|
|
470 |
|
|
471 |
|
|
472 |
|
|
473 |
|
|
474 |
|
@param |
475 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
476 |
0 |
private void overrideKeyBinding(Entry<KeyStroke, JMenuItem> acc)... |
477 |
|
{ |
478 |
0 |
final KeyStroke ks = acc.getKey(); |
479 |
0 |
InputMap inputMap = this.getInputMap(JComponent.WHEN_FOCUSED); |
480 |
0 |
inputMap.put(ks, ks); |
481 |
0 |
this.getActionMap().put(ks, new AbstractAction() |
482 |
|
{ |
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
483 |
0 |
@Override... |
484 |
|
public void actionPerformed(ActionEvent e) |
485 |
|
{ |
486 |
0 |
Component c = getFrameAtMouse(); |
487 |
0 |
if (c != null && c instanceof AlignFrame) |
488 |
|
{ |
489 |
0 |
for (ActionListener a : ((AlignFrame) c).getAccelerators().get(ks) |
490 |
|
.getActionListeners()) |
491 |
|
{ |
492 |
0 |
a.actionPerformed(null); |
493 |
|
} |
494 |
|
} |
495 |
|
} |
496 |
|
}); |
497 |
|
} |
498 |
|
|
499 |
|
|
500 |
|
|
501 |
|
|
502 |
|
@param |
503 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
504 |
0 |
protected void overrideKeyBinding(KeyStroke ks, AbstractAction action)... |
505 |
|
{ |
506 |
0 |
this.getActionMap().put(ks, action); |
507 |
0 |
overrideMenuItem(ks, action); |
508 |
|
} |
509 |
|
|
510 |
|
|
511 |
|
|
512 |
|
|
513 |
|
|
514 |
|
|
515 |
|
|
516 |
|
|
517 |
|
|
518 |
|
|
519 |
|
|
520 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 2 |
Complexity Density: 0.13 |
|
521 |
0 |
protected void newView_actionPerformed()... |
522 |
|
{ |
523 |
0 |
AlignFrame topFrame = (AlignFrame) getTopFrame(); |
524 |
0 |
AlignFrame bottomFrame = (AlignFrame) getBottomFrame(); |
525 |
0 |
final boolean scaleProteinAsCdna = topFrame.viewport |
526 |
|
.isScaleProteinAsCdna(); |
527 |
|
|
528 |
0 |
AlignmentPanel newTopPanel = topFrame.newView(null, true); |
529 |
0 |
AlignmentPanel newBottomPanel = bottomFrame.newView(null, true); |
530 |
|
|
531 |
|
|
532 |
|
|
533 |
|
|
534 |
|
|
535 |
|
|
536 |
|
|
537 |
0 |
if (topFrame.getTabIndex() != bottomFrame.getTabIndex()) |
538 |
|
{ |
539 |
0 |
topFrame.setDisplayedView(newTopPanel); |
540 |
|
} |
541 |
|
|
542 |
0 |
newBottomPanel.av.viewName = newTopPanel.av.viewName; |
543 |
0 |
newTopPanel.av.setCodingComplement(newBottomPanel.av); |
544 |
|
|
545 |
|
|
546 |
|
|
547 |
|
|
548 |
|
|
549 |
|
|
550 |
0 |
newTopPanel.av.setScaleProteinAsCdna(scaleProteinAsCdna); |
551 |
0 |
newBottomPanel.av.setScaleProteinAsCdna(scaleProteinAsCdna); |
552 |
|
|
553 |
|
|
554 |
|
|
555 |
|
|
556 |
0 |
adjustLayout(); |
557 |
|
|
558 |
0 |
final StructureSelectionManager ssm = StructureSelectionManager |
559 |
|
.getStructureSelectionManager(Desktop.instance); |
560 |
0 |
ssm.addCommandListener(newTopPanel.av); |
561 |
0 |
ssm.addCommandListener(newBottomPanel.av); |
562 |
|
} |
563 |
|
|
564 |
|
|
565 |
|
|
566 |
|
|
567 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
568 |
0 |
protected void closeView_actionPerformed()... |
569 |
|
{ |
570 |
0 |
int viewCount = ((AlignFrame) getTopFrame()).getAlignPanels().size(); |
571 |
0 |
if (viewCount < 2) |
572 |
|
{ |
573 |
0 |
close(); |
574 |
0 |
return; |
575 |
|
} |
576 |
|
|
577 |
0 |
AlignmentPanel topPanel = ((AlignFrame) getTopFrame()).alignPanel; |
578 |
0 |
AlignmentPanel bottomPanel = ((AlignFrame) getBottomFrame()).alignPanel; |
579 |
|
|
580 |
0 |
((AlignFrame) getTopFrame()).closeView(topPanel); |
581 |
0 |
((AlignFrame) getBottomFrame()).closeView(bottomPanel); |
582 |
|
|
583 |
|
} |
584 |
|
|
585 |
|
|
586 |
|
|
587 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
588 |
0 |
public void close()... |
589 |
|
{ |
590 |
0 |
((AlignFrame) getTopFrame()).closeMenuItem_actionPerformed(true); |
591 |
0 |
((AlignFrame) getBottomFrame()).closeMenuItem_actionPerformed(true); |
592 |
0 |
try |
593 |
|
{ |
594 |
0 |
this.setClosed(true); |
595 |
|
} catch (PropertyVetoException e) |
596 |
|
{ |
597 |
|
|
598 |
|
} |
599 |
|
} |
600 |
|
|
601 |
|
|
602 |
|
|
603 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
604 |
0 |
protected void overrideExpandViews()... |
605 |
|
{ |
606 |
0 |
KeyStroke key_X = KeyStroke.getKeyStroke(KeyEvent.VK_X, 0, false); |
607 |
0 |
AbstractAction action = new AbstractAction() |
608 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
609 |
0 |
@Override... |
610 |
|
public void actionPerformed(ActionEvent e) |
611 |
|
{ |
612 |
0 |
expandViews_actionPerformed(); |
613 |
|
} |
614 |
|
}; |
615 |
0 |
overrideMenuItem(key_X, action); |
616 |
|
} |
617 |
|
|
618 |
|
|
619 |
|
|
620 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
621 |
0 |
protected void overrideGatherViews()... |
622 |
|
{ |
623 |
0 |
KeyStroke key_G = KeyStroke.getKeyStroke(KeyEvent.VK_G, 0, false); |
624 |
0 |
AbstractAction action = new AbstractAction() |
625 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
626 |
0 |
@Override... |
627 |
|
public void actionPerformed(ActionEvent e) |
628 |
|
{ |
629 |
0 |
gatherViews_actionPerformed(); |
630 |
|
} |
631 |
|
}; |
632 |
0 |
overrideMenuItem(key_G, action); |
633 |
|
} |
634 |
|
|
635 |
|
|
636 |
|
|
637 |
|
|
638 |
|
|
639 |
|
@param |
640 |
|
@param |
641 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
642 |
0 |
private void overrideMenuItem(KeyStroke ks, AbstractAction action)... |
643 |
|
{ |
644 |
0 |
overrideMenuItem(ks, action, getTopFrame()); |
645 |
0 |
overrideMenuItem(ks, action, getBottomFrame()); |
646 |
|
} |
647 |
|
|
648 |
|
|
649 |
|
|
650 |
|
|
651 |
|
|
652 |
|
@param |
653 |
|
@param |
654 |
|
@param |
655 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
656 |
0 |
private void overrideMenuItem(KeyStroke key, final AbstractAction action,... |
657 |
|
JComponent comp) |
658 |
|
{ |
659 |
0 |
if (comp instanceof AlignFrame) |
660 |
|
{ |
661 |
0 |
JMenuItem mi = ((AlignFrame) comp).getAccelerators().get(key); |
662 |
0 |
if (mi != null) |
663 |
|
{ |
664 |
0 |
for (ActionListener al : mi.getActionListeners()) |
665 |
|
{ |
666 |
0 |
mi.removeActionListener(al); |
667 |
|
} |
668 |
0 |
mi.addActionListener(new ActionListener() |
669 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
670 |
0 |
@Override... |
671 |
|
public void actionPerformed(ActionEvent e) |
672 |
|
{ |
673 |
0 |
action.actionPerformed(e); |
674 |
|
} |
675 |
|
}); |
676 |
|
} |
677 |
|
} |
678 |
|
} |
679 |
|
|
680 |
|
|
681 |
|
|
682 |
|
|
683 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
684 |
0 |
protected void expandViews_actionPerformed()... |
685 |
|
{ |
686 |
0 |
Desktop.instance.explodeViews(this); |
687 |
|
} |
688 |
|
|
689 |
|
|
690 |
|
|
691 |
|
|
692 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
693 |
0 |
protected void gatherViews_actionPerformed()... |
694 |
|
{ |
695 |
0 |
Desktop.instance.gatherViews(this); |
696 |
|
} |
697 |
|
|
698 |
|
|
699 |
|
|
700 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
701 |
0 |
@Override... |
702 |
|
public AlignmentI getComplement(Object alignFrame) |
703 |
|
{ |
704 |
0 |
if (alignFrame == this.getTopFrame()) |
705 |
|
{ |
706 |
0 |
return ((AlignFrame) getBottomFrame()).viewport.getAlignment(); |
707 |
|
} |
708 |
0 |
else if (alignFrame == this.getBottomFrame()) |
709 |
|
{ |
710 |
0 |
return ((AlignFrame) getTopFrame()).viewport.getAlignment(); |
711 |
|
} |
712 |
0 |
return null; |
713 |
|
} |
714 |
|
|
715 |
|
|
716 |
|
|
717 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
718 |
0 |
@Override... |
719 |
|
public String getComplementTitle(Object alignFrame) |
720 |
|
{ |
721 |
0 |
if (alignFrame == this.getTopFrame()) |
722 |
|
{ |
723 |
0 |
return ((AlignFrame) getBottomFrame()).getTitle(); |
724 |
|
} |
725 |
0 |
else if (alignFrame == this.getBottomFrame()) |
726 |
|
{ |
727 |
0 |
return ((AlignFrame) getTopFrame()).getTitle(); |
728 |
|
} |
729 |
0 |
return null; |
730 |
|
} |
731 |
|
|
732 |
|
|
733 |
|
|
734 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
735 |
0 |
@Override... |
736 |
|
public void setComplementVisible(Object alignFrame, boolean show) |
737 |
|
{ |
738 |
|
|
739 |
|
|
740 |
|
|
741 |
0 |
if (alignFrame == getTopFrame()) |
742 |
|
{ |
743 |
0 |
((AlignFrame) getBottomFrame()).alignPanel.setVisible(show); |
744 |
|
} |
745 |
0 |
else if (alignFrame == getBottomFrame()) |
746 |
|
{ |
747 |
0 |
((AlignFrame) getTopFrame()).alignPanel.setVisible(show); |
748 |
|
} |
749 |
0 |
super.setComplementVisible(alignFrame, show); |
750 |
|
} |
751 |
|
|
752 |
|
|
753 |
|
|
754 |
|
|
755 |
|
@return |
756 |
|
|
757 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
758 |
0 |
public List<AlignFrame> getAlignFrames()... |
759 |
|
{ |
760 |
0 |
return Arrays |
761 |
|
.asList(new AlignFrame[] |
762 |
|
{ (AlignFrame) getTopFrame(), (AlignFrame) getBottomFrame() }); |
763 |
|
} |
764 |
|
|
765 |
|
|
766 |
|
|
767 |
|
|
768 |
|
|
769 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
770 |
0 |
protected void overrideFind()... |
771 |
|
{ |
772 |
|
|
773 |
|
|
774 |
|
|
775 |
0 |
KeyStroke key_cmdF = KeyStroke.getKeyStroke(KeyEvent.VK_F, |
776 |
|
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); |
777 |
0 |
AbstractAction action = new AbstractAction() |
778 |
|
{ |
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
779 |
0 |
@Override... |
780 |
|
public void actionPerformed(ActionEvent e) |
781 |
|
{ |
782 |
0 |
Component c = getFrameAtMouse(); |
783 |
0 |
if (c != null && c instanceof AlignFrame) |
784 |
|
{ |
785 |
0 |
AlignFrame af = (AlignFrame) c; |
786 |
0 |
new Finder(af.viewport, af.alignPanel); |
787 |
|
} |
788 |
|
} |
789 |
|
}; |
790 |
0 |
overrideKeyBinding(key_cmdF, action); |
791 |
|
} |
792 |
|
} |