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 java.awt.BorderLayout; |
24 |
|
import java.awt.Component; |
25 |
|
import java.awt.Dimension; |
26 |
|
import java.awt.event.ActionEvent; |
27 |
|
import java.awt.event.ActionListener; |
28 |
|
import java.awt.event.KeyAdapter; |
29 |
|
import java.awt.event.KeyEvent; |
30 |
|
import java.awt.event.KeyListener; |
31 |
|
import java.beans.PropertyVetoException; |
32 |
|
import java.util.Arrays; |
33 |
|
import java.util.List; |
34 |
|
import java.util.Map.Entry; |
35 |
|
|
36 |
|
import javax.swing.AbstractAction; |
37 |
|
import javax.swing.InputMap; |
38 |
|
import javax.swing.JButton; |
39 |
|
import javax.swing.JComponent; |
40 |
|
import javax.swing.JDesktopPane; |
41 |
|
import javax.swing.JInternalFrame; |
42 |
|
import javax.swing.JLayeredPane; |
43 |
|
import javax.swing.JMenuItem; |
44 |
|
import javax.swing.JPanel; |
45 |
|
import javax.swing.JTabbedPane; |
46 |
|
import javax.swing.KeyStroke; |
47 |
|
import javax.swing.event.ChangeEvent; |
48 |
|
import javax.swing.event.ChangeListener; |
49 |
|
import javax.swing.event.InternalFrameAdapter; |
50 |
|
import javax.swing.event.InternalFrameEvent; |
51 |
|
|
52 |
|
import jalview.api.AlignViewControllerGuiI; |
53 |
|
import jalview.api.FeatureSettingsControllerI; |
54 |
|
import jalview.api.SplitContainerI; |
55 |
|
import jalview.controller.FeatureSettingsControllerGuiI; |
56 |
|
import jalview.datamodel.AlignmentI; |
57 |
|
import jalview.jbgui.GAlignFrame; |
58 |
|
import jalview.jbgui.GSplitFrame; |
59 |
|
import jalview.structure.StructureSelectionManager; |
60 |
|
import jalview.util.MessageManager; |
61 |
|
import jalview.util.Platform; |
62 |
|
import jalview.viewmodel.AlignmentViewport; |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
@author |
74 |
|
|
75 |
|
|
|
|
| 35.8% |
Uncovered Elements: 291 (453) |
Complexity: 122 |
Complexity Density: 0.41 |
|
76 |
|
public class SplitFrame extends GSplitFrame implements SplitContainerI |
77 |
|
{ |
78 |
|
private static final int WINDOWS_INSETS_WIDTH = 28; |
79 |
|
|
80 |
|
private static final int MAC_INSETS_WIDTH = 28; |
81 |
|
|
82 |
|
private static final int WINDOWS_INSETS_HEIGHT = 50; |
83 |
|
|
84 |
|
private static final int MAC_INSETS_HEIGHT = 50; |
85 |
|
|
86 |
|
private static final int DESKTOP_DECORATORS_HEIGHT = 65; |
87 |
|
|
88 |
|
private static final long serialVersionUID = 1L; |
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
private static final int FS_MIN_WIDTH = 400; |
94 |
|
|
95 |
|
private static final int FS_MIN_HEIGHT = 400; |
96 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
97 |
3 |
public SplitFrame(GAlignFrame top, GAlignFrame bottom)... |
98 |
|
{ |
99 |
3 |
super(top, bottom); |
100 |
3 |
init(); |
101 |
|
} |
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
|
|
| 90.5% |
Uncovered Elements: 2 (21) |
Complexity: 3 |
Complexity Density: 0.18 |
|
106 |
3 |
protected void init()... |
107 |
|
{ |
108 |
3 |
setFrameIcon(null); |
109 |
3 |
getTopFrame().setSplitFrame(this); |
110 |
3 |
getBottomFrame().setSplitFrame(this); |
111 |
3 |
getTopFrame().setVisible(true); |
112 |
3 |
getBottomFrame().setVisible(true); |
113 |
|
|
114 |
3 |
((AlignFrame) getTopFrame()).getViewport().setCodingComplement( |
115 |
|
((AlignFrame) getBottomFrame()).getViewport()); |
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
3 |
int widthFudge = Platform.isAMacAndNotJS() ? MAC_INSETS_WIDTH |
122 |
|
: WINDOWS_INSETS_WIDTH; |
123 |
3 |
int heightFudge = Platform.isAMacAndNotJS() ? MAC_INSETS_HEIGHT |
124 |
|
: WINDOWS_INSETS_HEIGHT; |
125 |
3 |
int width = ((AlignFrame) getTopFrame()).getWidth() + widthFudge; |
126 |
3 |
int height = ((AlignFrame) getTopFrame()).getHeight() |
127 |
|
+ ((AlignFrame) getBottomFrame()).getHeight() + DIVIDER_SIZE |
128 |
|
+ heightFudge; |
129 |
3 |
height = fitHeightToDesktop(height); |
130 |
3 |
setSize(width, height); |
131 |
|
|
132 |
3 |
adjustLayout(); |
133 |
|
|
134 |
3 |
addCloseFrameListener(); |
135 |
|
|
136 |
3 |
addKeyListener(); |
137 |
|
|
138 |
3 |
addKeyBindings(); |
139 |
|
|
140 |
3 |
addCommandListeners(); |
141 |
|
} |
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
@param |
148 |
|
|
149 |
|
@return |
150 |
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
151 |
3 |
public int fitHeightToDesktop(int height)... |
152 |
|
{ |
153 |
|
|
154 |
|
|
155 |
3 |
int newHeight = Math.min(height, |
156 |
|
Desktop.instance.getHeight() - DESKTOP_DECORATORS_HEIGHT); |
157 |
3 |
if (newHeight != height) |
158 |
|
{ |
159 |
3 |
int oldDividerLocation = getDividerLocation(); |
160 |
3 |
setDividerLocation(oldDividerLocation * newHeight / height); |
161 |
|
} |
162 |
3 |
return newHeight; |
163 |
|
} |
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
|
168 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
169 |
3 |
protected void addCommandListeners()... |
170 |
|
{ |
171 |
|
|
172 |
|
|
173 |
3 |
final StructureSelectionManager ssm = StructureSelectionManager |
174 |
|
.getStructureSelectionManager(Desktop.instance); |
175 |
3 |
ssm.addCommandListener(((AlignFrame) getTopFrame()).getViewport()); |
176 |
3 |
ssm.addCommandListener(((AlignFrame) getBottomFrame()).getViewport()); |
177 |
|
} |
178 |
|
|
179 |
|
|
180 |
|
|
181 |
|
|
|
|
| 73.1% |
Uncovered Elements: 7 (26) |
Complexity: 8 |
Complexity Density: 0.57 |
|
182 |
3 |
public void adjustLayout()... |
183 |
|
{ |
184 |
3 |
final AlignViewport topViewport = ((AlignFrame) getTopFrame()).viewport; |
185 |
3 |
final AlignViewport bottomViewport = ((AlignFrame) getBottomFrame()).viewport; |
186 |
|
|
187 |
|
|
188 |
|
|
189 |
|
|
190 |
3 |
int w1 = topViewport.getIdWidth(); |
191 |
3 |
int w2 = bottomViewport.getIdWidth(); |
192 |
3 |
int w3 = Math.max(w1, w2); |
193 |
3 |
topViewport.setIdWidth(w3); |
194 |
3 |
bottomViewport.setIdWidth(w3); |
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
|
199 |
3 |
final AlignmentI topAlignment = topViewport.getAlignment(); |
200 |
3 |
final AlignmentI bottomAlignment = bottomViewport.getAlignment(); |
201 |
3 |
AlignmentViewport cdna = topAlignment.isNucleotide() ? topViewport |
202 |
0 |
: (bottomAlignment.isNucleotide() ? bottomViewport : null); |
203 |
3 |
AlignmentViewport protein = !topAlignment.isNucleotide() ? topViewport |
204 |
3 |
: (!bottomAlignment.isNucleotide() ? bottomViewport : null); |
205 |
3 |
if (protein != null && cdna != null) |
206 |
|
{ |
207 |
3 |
int scale = protein.isScaleProteinAsCdna() ? 3 : 1; |
208 |
3 |
protein.setCharWidth(scale * cdna.getViewStyle().getCharWidth()); |
209 |
|
} |
210 |
|
} |
211 |
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
|
221 |
|
|
|
|
| 91.7% |
Uncovered Elements: 3 (36) |
Complexity: 4 |
Complexity Density: 0.13 |
|
222 |
2 |
protected void adjustInitialLayout()... |
223 |
|
{ |
224 |
2 |
AlignFrame topFrame = (AlignFrame) getTopFrame(); |
225 |
2 |
AlignFrame bottomFrame = (AlignFrame) getBottomFrame(); |
226 |
|
|
227 |
|
|
228 |
|
|
229 |
|
|
230 |
|
|
231 |
2 |
topFrame.alignPanel.adjustAnnotationHeight(); |
232 |
2 |
bottomFrame.alignPanel.adjustAnnotationHeight(); |
233 |
|
|
234 |
2 |
final AlignViewport topViewport = topFrame.viewport; |
235 |
2 |
final AlignViewport bottomViewport = bottomFrame.viewport; |
236 |
2 |
final AlignmentI topAlignment = topViewport.getAlignment(); |
237 |
2 |
final AlignmentI bottomAlignment = bottomViewport.getAlignment(); |
238 |
2 |
boolean topAnnotations = topViewport.isShowAnnotation(); |
239 |
2 |
boolean bottomAnnotations = bottomViewport.isShowAnnotation(); |
240 |
|
|
241 |
2 |
int topCount = topAlignment.getHeight(); |
242 |
2 |
int bottomCount = bottomAlignment.getHeight(); |
243 |
2 |
int topCharHeight = topViewport.getViewStyle().getCharHeight(); |
244 |
2 |
int bottomCharHeight = bottomViewport.getViewStyle().getCharHeight(); |
245 |
|
|
246 |
|
|
247 |
|
|
248 |
|
|
249 |
|
|
250 |
2 |
int topPanelHeight = topFrame.getHeight(); |
251 |
2 |
int bottomPanelHeight = bottomFrame.getHeight(); |
252 |
2 |
int topSequencesHeight = topFrame.alignPanel.getSeqPanel().seqCanvas |
253 |
|
.getHeight(); |
254 |
2 |
int topPanelMinHeight = topPanelHeight |
255 |
|
- Math.max(0, topSequencesHeight - 3 * topCharHeight); |
256 |
2 |
double totalHeight = (double) topPanelHeight + bottomPanelHeight; |
257 |
2 |
double minRatio = topPanelMinHeight / totalHeight; |
258 |
|
|
259 |
|
|
260 |
|
|
261 |
|
|
262 |
|
|
263 |
2 |
int bottomSequencesHeight = bottomFrame.alignPanel |
264 |
|
.getSeqPanel().seqCanvas.getHeight(); |
265 |
2 |
int bottomPanelMinHeight = bottomPanelHeight |
266 |
|
- Math.max(0, bottomSequencesHeight - 3 * bottomCharHeight); |
267 |
2 |
double maxRatio = (totalHeight - bottomPanelMinHeight) / totalHeight; |
268 |
|
|
269 |
|
|
270 |
|
|
271 |
|
|
272 |
2 |
int insets = Platform.isAMacAndNotJS() ? MAC_INSETS_HEIGHT |
273 |
|
: WINDOWS_INSETS_HEIGHT; |
274 |
|
|
275 |
2 |
int topHeight = insets + (3 + topCount) * topCharHeight |
276 |
2 |
+ (topAnnotations ? topViewport.calcPanelHeight() : 0); |
277 |
2 |
int bottomHeight = insets + (3 + bottomCount) * bottomCharHeight |
278 |
2 |
+ (bottomAnnotations ? bottomViewport.calcPanelHeight() : 0); |
279 |
2 |
double ratio = ((double) topHeight) |
280 |
|
/ (double) (topHeight + bottomHeight); |
281 |
|
|
282 |
|
|
283 |
|
|
284 |
|
|
285 |
2 |
ratio = Math.min(ratio, maxRatio); |
286 |
2 |
ratio = Math.max(ratio, minRatio); |
287 |
2 |
setRelativeDividerLocation(ratio); |
288 |
|
} |
289 |
|
|
290 |
|
|
291 |
|
|
292 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
293 |
3 |
protected void addCloseFrameListener()... |
294 |
|
{ |
295 |
3 |
addInternalFrameListener(new InternalFrameAdapter() |
296 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
297 |
3 |
@Override... |
298 |
|
public void internalFrameClosed(InternalFrameEvent evt) |
299 |
|
{ |
300 |
3 |
close(); |
301 |
|
}; |
302 |
|
}); |
303 |
|
} |
304 |
|
|
305 |
|
|
306 |
|
|
307 |
|
|
308 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
309 |
3 |
protected void addKeyListener()... |
310 |
|
{ |
311 |
3 |
addKeyListener(new KeyAdapter() |
312 |
|
{ |
313 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
314 |
0 |
@Override... |
315 |
|
public void keyPressed(KeyEvent e) |
316 |
|
{ |
317 |
0 |
AlignFrame af = (AlignFrame) getFrameAtMouse(); |
318 |
|
|
319 |
|
|
320 |
|
|
321 |
|
|
322 |
0 |
if (!overrideKey(e, af)) |
323 |
|
{ |
324 |
0 |
if (af != null) |
325 |
|
{ |
326 |
0 |
for (KeyListener kl : af.getKeyListeners()) |
327 |
|
{ |
328 |
0 |
kl.keyPressed(e); |
329 |
|
} |
330 |
|
} |
331 |
|
} |
332 |
|
} |
333 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
334 |
0 |
@Override... |
335 |
|
public void keyReleased(KeyEvent e) |
336 |
|
{ |
337 |
0 |
Component c = getFrameAtMouse(); |
338 |
0 |
if (c != null) |
339 |
|
{ |
340 |
0 |
for (KeyListener kl : c.getKeyListeners()) |
341 |
|
{ |
342 |
0 |
kl.keyReleased(e); |
343 |
|
} |
344 |
|
} |
345 |
|
} |
346 |
|
|
347 |
|
}); |
348 |
|
} |
349 |
|
|
350 |
|
|
351 |
|
|
352 |
|
|
353 |
|
|
354 |
|
|
355 |
|
|
356 |
|
|
357 |
|
|
358 |
|
@see |
359 |
|
@param |
360 |
|
@param |
361 |
|
@return |
362 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 7 |
Complexity Density: 0.37 |
|
363 |
0 |
protected boolean overrideKey(KeyEvent e, AlignFrame af)... |
364 |
|
{ |
365 |
0 |
boolean actioned = false; |
366 |
0 |
int keyCode = e.getKeyCode(); |
367 |
0 |
switch (keyCode) |
368 |
|
{ |
369 |
0 |
case KeyEvent.VK_DOWN: |
370 |
0 |
if (e.isAltDown() || !af.viewport.cursorMode) |
371 |
|
{ |
372 |
|
|
373 |
|
|
374 |
|
|
375 |
0 |
((AlignFrame) getTopFrame()).moveSelectedSequences(false); |
376 |
0 |
((AlignFrame) getBottomFrame()).moveSelectedSequences(false); |
377 |
0 |
actioned = true; |
378 |
0 |
e.consume(); |
379 |
|
} |
380 |
0 |
break; |
381 |
0 |
case KeyEvent.VK_UP: |
382 |
0 |
if (e.isAltDown() || !af.viewport.cursorMode) |
383 |
|
{ |
384 |
|
|
385 |
|
|
386 |
|
|
387 |
0 |
((AlignFrame) getTopFrame()).moveSelectedSequences(true); |
388 |
0 |
((AlignFrame) getBottomFrame()).moveSelectedSequences(true); |
389 |
0 |
actioned = true; |
390 |
0 |
e.consume(); |
391 |
|
} |
392 |
0 |
break; |
393 |
0 |
default: |
394 |
|
} |
395 |
0 |
return actioned; |
396 |
|
} |
397 |
|
|
398 |
|
|
399 |
|
|
400 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
401 |
3 |
private void addKeyBindings()... |
402 |
|
{ |
403 |
3 |
overrideDelegatedKeyBindings(); |
404 |
|
|
405 |
3 |
overrideImplementedKeyBindings(); |
406 |
|
} |
407 |
|
|
408 |
|
|
409 |
|
|
410 |
|
|
411 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
412 |
3 |
protected void overrideImplementedKeyBindings()... |
413 |
|
{ |
414 |
3 |
overrideFind(); |
415 |
3 |
overrideNewView(); |
416 |
3 |
overrideCloseView(); |
417 |
3 |
overrideExpandViews(); |
418 |
3 |
overrideGatherViews(); |
419 |
|
} |
420 |
|
|
421 |
|
|
422 |
|
|
423 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
424 |
3 |
protected void overrideCloseView()... |
425 |
|
{ |
426 |
3 |
AbstractAction action; |
427 |
|
|
428 |
|
|
429 |
|
|
430 |
3 |
KeyStroke key_cmdW = KeyStroke.getKeyStroke(KeyEvent.VK_W, |
431 |
|
jalview.util.ShortcutKeyMaskExWrapper |
432 |
|
.getMenuShortcutKeyMaskEx(), |
433 |
|
false); |
434 |
3 |
action = new AbstractAction() |
435 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
436 |
0 |
@Override... |
437 |
|
public void actionPerformed(ActionEvent e) |
438 |
|
{ |
439 |
0 |
closeView_actionPerformed(); |
440 |
|
} |
441 |
|
}; |
442 |
3 |
overrideKeyBinding(key_cmdW, action); |
443 |
|
} |
444 |
|
|
445 |
|
|
446 |
|
|
447 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
448 |
3 |
protected void overrideNewView()... |
449 |
|
{ |
450 |
|
|
451 |
|
|
452 |
|
|
453 |
3 |
KeyStroke key_cmdT = KeyStroke.getKeyStroke(KeyEvent.VK_T, |
454 |
|
jalview.util.ShortcutKeyMaskExWrapper |
455 |
|
.getMenuShortcutKeyMaskEx(), |
456 |
|
false); |
457 |
3 |
AbstractAction action = new AbstractAction() |
458 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
459 |
0 |
@Override... |
460 |
|
public void actionPerformed(ActionEvent e) |
461 |
|
{ |
462 |
0 |
newView_actionPerformed(); |
463 |
|
} |
464 |
|
}; |
465 |
3 |
overrideKeyBinding(key_cmdT, action); |
466 |
|
} |
467 |
|
|
468 |
|
|
469 |
|
|
470 |
|
|
471 |
|
|
472 |
|
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
473 |
3 |
protected void overrideDelegatedKeyBindings()... |
474 |
|
{ |
475 |
3 |
if (getTopFrame() instanceof AlignFrame) |
476 |
|
{ |
477 |
|
|
478 |
|
|
479 |
|
|
480 |
|
|
481 |
3 |
for (Entry<KeyStroke, JMenuItem> acc : ((AlignFrame) getTopFrame()) |
482 |
|
.getAccelerators().entrySet()) |
483 |
|
{ |
484 |
81 |
overrideKeyBinding(acc); |
485 |
|
} |
486 |
|
} |
487 |
|
} |
488 |
|
|
489 |
|
|
490 |
|
|
491 |
|
|
492 |
|
|
493 |
|
|
494 |
|
@param |
495 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
496 |
81 |
private void overrideKeyBinding(Entry<KeyStroke, JMenuItem> acc)... |
497 |
|
{ |
498 |
81 |
final KeyStroke ks = acc.getKey(); |
499 |
81 |
InputMap inputMap = this.getInputMap(JComponent.WHEN_FOCUSED); |
500 |
81 |
inputMap.put(ks, ks); |
501 |
81 |
this.getActionMap().put(ks, new AbstractAction() |
502 |
|
{ |
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
503 |
0 |
@Override... |
504 |
|
public void actionPerformed(ActionEvent e) |
505 |
|
{ |
506 |
0 |
Component c = getFrameAtMouse(); |
507 |
0 |
if (c != null && c instanceof AlignFrame) |
508 |
|
{ |
509 |
0 |
for (ActionListener a : ((AlignFrame) c).getAccelerators().get(ks) |
510 |
|
.getActionListeners()) |
511 |
|
{ |
512 |
0 |
a.actionPerformed(null); |
513 |
|
} |
514 |
|
} |
515 |
|
} |
516 |
|
}); |
517 |
|
} |
518 |
|
|
519 |
|
|
520 |
|
|
521 |
|
|
522 |
|
@param |
523 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
524 |
9 |
protected void overrideKeyBinding(KeyStroke ks, AbstractAction action)... |
525 |
|
{ |
526 |
9 |
this.getActionMap().put(ks, action); |
527 |
9 |
overrideMenuItem(ks, action); |
528 |
|
} |
529 |
|
|
530 |
|
|
531 |
|
|
532 |
|
|
533 |
|
|
534 |
|
|
535 |
|
|
536 |
|
|
537 |
|
|
538 |
|
|
539 |
|
|
540 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 2 |
Complexity Density: 0.13 |
|
541 |
0 |
protected void newView_actionPerformed()... |
542 |
|
{ |
543 |
0 |
AlignFrame topFrame = (AlignFrame) getTopFrame(); |
544 |
0 |
AlignFrame bottomFrame = (AlignFrame) getBottomFrame(); |
545 |
0 |
final boolean scaleProteinAsCdna = topFrame.viewport |
546 |
|
.isScaleProteinAsCdna(); |
547 |
|
|
548 |
0 |
AlignmentPanel newTopPanel = topFrame.newView(null, true); |
549 |
0 |
AlignmentPanel newBottomPanel = bottomFrame.newView(null, true); |
550 |
|
|
551 |
|
|
552 |
|
|
553 |
|
|
554 |
|
|
555 |
|
|
556 |
|
|
557 |
0 |
if (topFrame.getTabIndex() != bottomFrame.getTabIndex()) |
558 |
|
{ |
559 |
0 |
topFrame.setDisplayedView(newTopPanel); |
560 |
|
} |
561 |
|
|
562 |
0 |
newBottomPanel.av.setViewName(newTopPanel.av.getViewName()); |
563 |
0 |
newTopPanel.av.setCodingComplement(newBottomPanel.av); |
564 |
|
|
565 |
|
|
566 |
|
|
567 |
|
|
568 |
|
|
569 |
|
|
570 |
0 |
newTopPanel.av.setScaleProteinAsCdna(scaleProteinAsCdna); |
571 |
0 |
newBottomPanel.av.setScaleProteinAsCdna(scaleProteinAsCdna); |
572 |
|
|
573 |
|
|
574 |
|
|
575 |
|
|
576 |
0 |
adjustLayout(); |
577 |
|
|
578 |
0 |
final StructureSelectionManager ssm = StructureSelectionManager |
579 |
|
.getStructureSelectionManager(Desktop.instance); |
580 |
0 |
ssm.addCommandListener(newTopPanel.av); |
581 |
0 |
ssm.addCommandListener(newBottomPanel.av); |
582 |
|
} |
583 |
|
|
584 |
|
|
585 |
|
|
586 |
|
|
587 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
588 |
0 |
protected void closeView_actionPerformed()... |
589 |
|
{ |
590 |
0 |
int viewCount = ((AlignFrame) getTopFrame()).getAlignPanels().size(); |
591 |
0 |
if (viewCount < 2) |
592 |
|
{ |
593 |
0 |
close(); |
594 |
0 |
return; |
595 |
|
} |
596 |
|
|
597 |
0 |
AlignmentPanel topPanel = ((AlignFrame) getTopFrame()).alignPanel; |
598 |
0 |
AlignmentPanel bottomPanel = ((AlignFrame) getBottomFrame()).alignPanel; |
599 |
|
|
600 |
0 |
((AlignFrame) getTopFrame()).closeView(topPanel); |
601 |
0 |
((AlignFrame) getBottomFrame()).closeView(bottomPanel); |
602 |
|
|
603 |
|
} |
604 |
|
|
605 |
|
|
606 |
|
|
607 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
608 |
3 |
public void close()... |
609 |
|
{ |
610 |
3 |
((AlignFrame) getTopFrame()).closeMenuItem_actionPerformed(true); |
611 |
3 |
((AlignFrame) getBottomFrame()).closeMenuItem_actionPerformed(true); |
612 |
3 |
try |
613 |
|
{ |
614 |
3 |
this.setClosed(true); |
615 |
|
} catch (PropertyVetoException e) |
616 |
|
{ |
617 |
|
|
618 |
|
} |
619 |
|
} |
620 |
|
|
621 |
|
|
622 |
|
|
623 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
624 |
3 |
protected void overrideExpandViews()... |
625 |
|
{ |
626 |
3 |
KeyStroke key_X = KeyStroke.getKeyStroke(KeyEvent.VK_X, 0, false); |
627 |
3 |
AbstractAction action = new AbstractAction() |
628 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
629 |
0 |
@Override... |
630 |
|
public void actionPerformed(ActionEvent e) |
631 |
|
{ |
632 |
0 |
expandViews_actionPerformed(); |
633 |
|
} |
634 |
|
}; |
635 |
3 |
overrideMenuItem(key_X, action); |
636 |
|
} |
637 |
|
|
638 |
|
|
639 |
|
|
640 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
641 |
3 |
protected void overrideGatherViews()... |
642 |
|
{ |
643 |
3 |
KeyStroke key_G = KeyStroke.getKeyStroke(KeyEvent.VK_G, 0, false); |
644 |
3 |
AbstractAction action = new AbstractAction() |
645 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
646 |
0 |
@Override... |
647 |
|
public void actionPerformed(ActionEvent e) |
648 |
|
{ |
649 |
0 |
gatherViews_actionPerformed(); |
650 |
|
} |
651 |
|
}; |
652 |
3 |
overrideMenuItem(key_G, action); |
653 |
|
} |
654 |
|
|
655 |
|
|
656 |
|
|
657 |
|
|
658 |
|
|
659 |
|
@param |
660 |
|
@param |
661 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
662 |
15 |
private void overrideMenuItem(KeyStroke ks, AbstractAction action)... |
663 |
|
{ |
664 |
15 |
overrideMenuItem(ks, action, getTopFrame()); |
665 |
15 |
overrideMenuItem(ks, action, getBottomFrame()); |
666 |
|
} |
667 |
|
|
668 |
|
|
669 |
|
|
670 |
|
|
671 |
|
|
672 |
|
@param |
673 |
|
@param |
674 |
|
@param |
675 |
|
|
|
|
| 80% |
Uncovered Elements: 2 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
676 |
30 |
private void overrideMenuItem(KeyStroke key, final AbstractAction action,... |
677 |
|
JComponent comp) |
678 |
|
{ |
679 |
30 |
if (comp instanceof AlignFrame) |
680 |
|
{ |
681 |
30 |
JMenuItem mi = ((AlignFrame) comp).getAccelerators().get(key); |
682 |
30 |
if (mi != null) |
683 |
|
{ |
684 |
30 |
for (ActionListener al : mi.getActionListeners()) |
685 |
|
{ |
686 |
30 |
mi.removeActionListener(al); |
687 |
|
} |
688 |
30 |
mi.addActionListener(new ActionListener() |
689 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
690 |
0 |
@Override... |
691 |
|
public void actionPerformed(ActionEvent e) |
692 |
|
{ |
693 |
0 |
action.actionPerformed(e); |
694 |
|
} |
695 |
|
}); |
696 |
|
} |
697 |
|
} |
698 |
|
} |
699 |
|
|
700 |
|
|
701 |
|
|
702 |
|
|
703 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
704 |
0 |
protected void expandViews_actionPerformed()... |
705 |
|
{ |
706 |
0 |
Desktop.instance.explodeViews(this); |
707 |
|
} |
708 |
|
|
709 |
|
|
710 |
|
|
711 |
|
|
712 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
713 |
0 |
protected void gatherViews_actionPerformed()... |
714 |
|
{ |
715 |
0 |
Desktop.instance.gatherViews(this); |
716 |
|
} |
717 |
|
|
718 |
|
|
719 |
|
|
720 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
721 |
0 |
@Override... |
722 |
|
public AlignmentI getComplement(Object alignFrame) |
723 |
|
{ |
724 |
0 |
if (alignFrame == this.getTopFrame()) |
725 |
|
{ |
726 |
0 |
return ((AlignFrame) getBottomFrame()).viewport.getAlignment(); |
727 |
|
} |
728 |
0 |
else if (alignFrame == this.getBottomFrame()) |
729 |
|
{ |
730 |
0 |
return ((AlignFrame) getTopFrame()).viewport.getAlignment(); |
731 |
|
} |
732 |
0 |
return null; |
733 |
|
} |
734 |
|
|
735 |
|
|
736 |
|
|
737 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
738 |
0 |
@Override... |
739 |
|
public String getComplementTitle(Object alignFrame) |
740 |
|
{ |
741 |
0 |
if (alignFrame == this.getTopFrame()) |
742 |
|
{ |
743 |
0 |
return ((AlignFrame) getBottomFrame()).getTitle(); |
744 |
|
} |
745 |
0 |
else if (alignFrame == this.getBottomFrame()) |
746 |
|
{ |
747 |
0 |
return ((AlignFrame) getTopFrame()).getTitle(); |
748 |
|
} |
749 |
0 |
return null; |
750 |
|
} |
751 |
|
|
752 |
|
|
753 |
|
|
754 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
755 |
0 |
@Override... |
756 |
|
public void setComplementVisible(Object alignFrame, boolean show) |
757 |
|
{ |
758 |
|
|
759 |
|
|
760 |
|
|
761 |
0 |
if (alignFrame == getTopFrame()) |
762 |
|
{ |
763 |
0 |
((AlignFrame) getBottomFrame()).alignPanel.setVisible(show); |
764 |
|
} |
765 |
0 |
else if (alignFrame == getBottomFrame()) |
766 |
|
{ |
767 |
0 |
((AlignFrame) getTopFrame()).alignPanel.setVisible(show); |
768 |
|
} |
769 |
0 |
super.setComplementVisible(alignFrame, show); |
770 |
|
} |
771 |
|
|
772 |
|
|
773 |
|
|
774 |
|
|
775 |
|
@return |
776 |
|
|
777 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
778 |
0 |
public List<AlignFrame> getAlignFrames()... |
779 |
|
{ |
780 |
0 |
return Arrays |
781 |
|
.asList(new AlignFrame[] |
782 |
|
{ (AlignFrame) getTopFrame(), (AlignFrame) getBottomFrame() }); |
783 |
|
} |
784 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
785 |
0 |
@Override... |
786 |
|
public AlignFrame getComplementAlignFrame( |
787 |
|
AlignViewControllerGuiI alignFrame) |
788 |
|
{ |
789 |
0 |
if (getTopFrame() == alignFrame) |
790 |
|
{ |
791 |
0 |
return (AlignFrame) getBottomFrame(); |
792 |
|
} |
793 |
0 |
if (getBottomFrame() == alignFrame) |
794 |
|
{ |
795 |
0 |
return (AlignFrame) getTopFrame(); |
796 |
|
} |
797 |
|
|
798 |
0 |
return null; |
799 |
|
} |
800 |
|
|
801 |
|
|
802 |
|
|
803 |
|
|
804 |
|
|
805 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
806 |
3 |
protected void overrideFind()... |
807 |
|
{ |
808 |
|
|
809 |
|
|
810 |
|
|
811 |
3 |
KeyStroke key_cmdF = KeyStroke.getKeyStroke(KeyEvent.VK_F, |
812 |
|
jalview.util.ShortcutKeyMaskExWrapper |
813 |
|
.getMenuShortcutKeyMaskEx(), |
814 |
|
false); |
815 |
3 |
AbstractAction action = new AbstractAction() |
816 |
|
{ |
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
817 |
0 |
@Override... |
818 |
|
public void actionPerformed(ActionEvent e) |
819 |
|
{ |
820 |
0 |
Component c = getFrameAtMouse(); |
821 |
0 |
if (c != null && c instanceof AlignFrame) |
822 |
|
{ |
823 |
0 |
AlignFrame af = (AlignFrame) c; |
824 |
0 |
boolean dna = af.getViewport().getAlignment().isNucleotide(); |
825 |
0 |
String scope = MessageManager.getString("label.in") + " " |
826 |
0 |
+ (dna ? MessageManager.getString("label.nucleotide") |
827 |
|
: MessageManager.getString("label.protein")); |
828 |
0 |
new Finder(af.alignPanel, true, scope); |
829 |
|
} |
830 |
|
} |
831 |
|
}; |
832 |
3 |
overrideKeyBinding(key_cmdF, action); |
833 |
|
} |
834 |
|
|
835 |
|
|
836 |
|
|
837 |
|
|
|
|
| 53.8% |
Uncovered Elements: 6 (13) |
Complexity: 5 |
Complexity Density: 0.71 |
|
838 |
11 |
@Override... |
839 |
|
public void setSelected(boolean selected) throws PropertyVetoException |
840 |
|
{ |
841 |
11 |
JDesktopPane desktopPane = getDesktopPane(); |
842 |
11 |
JInternalFrame fr = desktopPane == null ? null |
843 |
|
: desktopPane.getSelectedFrame(); |
844 |
11 |
if (fr == getTopFrame() || fr == getBottomFrame()) |
845 |
|
{ |
846 |
|
|
847 |
|
|
848 |
|
|
849 |
|
|
850 |
|
|
851 |
0 |
if (selected) |
852 |
|
{ |
853 |
0 |
moveToFront(); |
854 |
|
} |
855 |
0 |
return; |
856 |
|
} |
857 |
11 |
super.setSelected(selected); |
858 |
|
} |
859 |
|
|
860 |
|
|
861 |
|
|
862 |
|
|
863 |
|
|
864 |
|
JInternalFrame featureSettingsUI; |
865 |
|
|
866 |
|
JTabbedPane featureSettingsPanels; |
867 |
|
|
|
|
| 0% |
Uncovered Elements: 52 (52) |
Complexity: 8 |
Complexity Density: 0.2 |
|
868 |
0 |
@Override... |
869 |
|
public void addFeatureSettingsUI( |
870 |
|
FeatureSettingsControllerGuiI featureSettings) |
871 |
|
{ |
872 |
0 |
boolean showInternalFrame = false; |
873 |
0 |
if (featureSettingsUI == null || featureSettingsPanels == null) |
874 |
|
{ |
875 |
0 |
showInternalFrame = true; |
876 |
0 |
featureSettingsPanels = new JTabbedPane(); |
877 |
0 |
featureSettingsPanels.addChangeListener(new ChangeListener() |
878 |
|
{ |
879 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 7 |
Complexity Density: 1.17 |
|
880 |
0 |
@Override... |
881 |
|
public void stateChanged(ChangeEvent e) |
882 |
|
{ |
883 |
0 |
if (e.getSource() != featureSettingsPanels |
884 |
|
|| featureSettingsUI == null |
885 |
|
|| featureSettingsUI.isClosed() |
886 |
|
|| !featureSettingsUI.isVisible()) |
887 |
|
{ |
888 |
|
|
889 |
0 |
return; |
890 |
|
} |
891 |
0 |
int tab = featureSettingsPanels.getSelectedIndex(); |
892 |
0 |
if (tab < 0 || featureSettingsPanels |
893 |
|
.getSelectedComponent() instanceof FeatureSettingsControllerGuiI) |
894 |
|
{ |
895 |
|
|
896 |
0 |
return; |
897 |
|
} |
898 |
0 |
getAlignFrames().get(tab).showFeatureSettingsUI(); |
899 |
|
} |
900 |
|
}); |
901 |
0 |
featureSettingsUI = new JInternalFrame(MessageManager.getString( |
902 |
|
"label.sequence_feature_settings_for_CDS_and_Protein")); |
903 |
0 |
featureSettingsUI.setFrameIcon(null); |
904 |
0 |
featureSettingsPanels.setOpaque(true); |
905 |
|
|
906 |
0 |
JPanel dialog = new JPanel(); |
907 |
0 |
dialog.setOpaque(true); |
908 |
0 |
dialog.setLayout(new BorderLayout()); |
909 |
0 |
dialog.add(featureSettingsPanels, BorderLayout.CENTER); |
910 |
0 |
JPanel buttons = new JPanel(); |
911 |
0 |
JButton ok = new JButton(MessageManager.getString("action.ok")); |
912 |
0 |
ok.addActionListener(new ActionListener() |
913 |
|
{ |
914 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
915 |
0 |
@Override... |
916 |
|
public void actionPerformed(ActionEvent e) |
917 |
|
{ |
918 |
0 |
try |
919 |
|
{ |
920 |
0 |
featureSettingsUI.setClosed(true); |
921 |
|
} catch (PropertyVetoException pv) |
922 |
|
{ |
923 |
0 |
pv.printStackTrace(); |
924 |
|
} |
925 |
|
} |
926 |
|
}); |
927 |
0 |
JButton cancel = new JButton( |
928 |
|
MessageManager.getString("action.cancel")); |
929 |
0 |
cancel.addActionListener(new ActionListener() |
930 |
|
{ |
931 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
932 |
0 |
@Override... |
933 |
|
public void actionPerformed(ActionEvent e) |
934 |
|
{ |
935 |
0 |
try |
936 |
|
{ |
937 |
0 |
for (Component fspanel : featureSettingsPanels.getComponents()) |
938 |
|
{ |
939 |
0 |
if (fspanel instanceof FeatureSettingsControllerGuiI) |
940 |
|
{ |
941 |
0 |
((FeatureSettingsControllerGuiI) fspanel).revert(); |
942 |
|
} |
943 |
|
} |
944 |
0 |
featureSettingsUI.setClosed(true); |
945 |
|
} catch (Exception pv) |
946 |
|
{ |
947 |
0 |
pv.printStackTrace(); |
948 |
|
} |
949 |
|
} |
950 |
|
}); |
951 |
0 |
buttons.add(ok); |
952 |
0 |
buttons.add(cancel); |
953 |
0 |
dialog.add(buttons, BorderLayout.SOUTH); |
954 |
0 |
featureSettingsUI.setContentPane(dialog); |
955 |
0 |
createDummyTabs(); |
956 |
|
} |
957 |
0 |
if (featureSettingsPanels |
958 |
|
.indexOfTabComponent((Component) featureSettings) > -1) |
959 |
|
{ |
960 |
|
|
961 |
0 |
featureSettingsPanels |
962 |
|
.setSelectedComponent((Component) featureSettings); |
963 |
0 |
return; |
964 |
|
} |
965 |
|
|
966 |
0 |
int pos = getAlignFrames().indexOf(featureSettings.getAlignframe()); |
967 |
|
|
968 |
0 |
if (pos == 0) |
969 |
|
{ |
970 |
0 |
featureSettingsPanels.removeTabAt(0); |
971 |
0 |
featureSettingsPanels.insertTab(tabName[0], null, |
972 |
|
(Component) featureSettings, |
973 |
|
MessageManager.formatMessage( |
974 |
|
"label.sequence_feature_settings_for", tabName[0]), |
975 |
|
0); |
976 |
|
} |
977 |
0 |
if (pos == 1) |
978 |
|
{ |
979 |
0 |
featureSettingsPanels.removeTabAt(1); |
980 |
0 |
featureSettingsPanels.insertTab(tabName[1], null, |
981 |
|
(Component) featureSettings, |
982 |
|
MessageManager.formatMessage( |
983 |
|
"label.sequence_feature_settings_for", tabName[1]), |
984 |
|
1); |
985 |
|
} |
986 |
0 |
featureSettingsPanels.setSelectedComponent((Component) featureSettings); |
987 |
|
|
988 |
|
|
989 |
|
|
990 |
|
|
991 |
0 |
if (showInternalFrame) |
992 |
|
{ |
993 |
0 |
if (Platform.isAMacAndNotJS()) |
994 |
|
{ |
995 |
0 |
Desktop.addInternalFrame(featureSettingsUI, |
996 |
|
MessageManager.getString( |
997 |
|
"label.sequence_feature_settings_for_CDS_and_Protein"), |
998 |
|
600, 480); |
999 |
|
} |
1000 |
|
else |
1001 |
|
{ |
1002 |
0 |
Desktop.addInternalFrame(featureSettingsUI, |
1003 |
|
MessageManager.getString( |
1004 |
|
"label.sequence_feature_settings_for_CDS_and_Protein"), |
1005 |
|
600, 450); |
1006 |
|
} |
1007 |
0 |
featureSettingsUI |
1008 |
|
.setMinimumSize(new Dimension(FS_MIN_WIDTH, FS_MIN_HEIGHT)); |
1009 |
|
|
1010 |
0 |
featureSettingsUI.addInternalFrameListener( |
1011 |
|
new javax.swing.event.InternalFrameAdapter() |
1012 |
|
{ |
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
1013 |
0 |
@Override... |
1014 |
|
public void internalFrameClosed( |
1015 |
|
javax.swing.event.InternalFrameEvent evt) |
1016 |
|
{ |
1017 |
0 |
for (int tab = 0; tab < featureSettingsPanels |
1018 |
|
.getTabCount();) |
1019 |
|
{ |
1020 |
0 |
FeatureSettingsControllerGuiI fsettings = (FeatureSettingsControllerGuiI) featureSettingsPanels |
1021 |
|
.getTabComponentAt(tab); |
1022 |
0 |
if (fsettings != null) |
1023 |
|
{ |
1024 |
0 |
featureSettingsPanels.removeTabAt(tab); |
1025 |
0 |
fsettings.featureSettings_isClosed(); |
1026 |
|
} |
1027 |
|
else |
1028 |
|
{ |
1029 |
0 |
tab++; |
1030 |
|
} |
1031 |
|
} |
1032 |
0 |
featureSettingsPanels = null; |
1033 |
0 |
featureSettingsUI = null; |
1034 |
|
}; |
1035 |
|
}); |
1036 |
0 |
featureSettingsUI.setLayer(JLayeredPane.PALETTE_LAYER); |
1037 |
|
} |
1038 |
|
} |
1039 |
|
|
1040 |
|
|
1041 |
|
|
1042 |
|
|
1043 |
|
private String[] tabName = new String[] { |
1044 |
|
MessageManager.getString("label.CDS"), |
1045 |
|
MessageManager.getString("label.protein") }; |
1046 |
|
|
1047 |
|
|
1048 |
|
|
1049 |
|
|
1050 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1051 |
0 |
private void createDummyTabs()... |
1052 |
|
{ |
1053 |
0 |
for (int tabIndex = 0; tabIndex < 2; tabIndex++) |
1054 |
|
{ |
1055 |
0 |
JPanel dummyTab = new JPanel(); |
1056 |
0 |
featureSettingsPanels.addTab(tabName[tabIndex], dummyTab); |
1057 |
|
} |
1058 |
|
} |
1059 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 5 |
Complexity Density: 0.56 |
|
1060 |
0 |
private void replaceWithDummyTab(FeatureSettingsControllerI toClose)... |
1061 |
|
{ |
1062 |
0 |
Component dummyTab = null; |
1063 |
0 |
for (int tabIndex = 0; tabIndex < 2; tabIndex++) |
1064 |
|
{ |
1065 |
0 |
if (featureSettingsPanels.getTabCount() > tabIndex) |
1066 |
|
{ |
1067 |
0 |
dummyTab = featureSettingsPanels.getTabComponentAt(tabIndex); |
1068 |
0 |
if (dummyTab instanceof FeatureSettingsControllerGuiI |
1069 |
|
&& !dummyTab.isVisible()) |
1070 |
|
{ |
1071 |
0 |
featureSettingsPanels.removeTabAt(tabIndex); |
1072 |
|
|
1073 |
0 |
((FeatureSettingsControllerGuiI) dummyTab) |
1074 |
|
.featureSettings_isClosed(); |
1075 |
|
|
1076 |
0 |
dummyTab = new JPanel(); |
1077 |
0 |
featureSettingsPanels.insertTab(tabName[tabIndex], null, dummyTab, |
1078 |
|
MessageManager.formatMessage( |
1079 |
|
"label.sequence_feature_settings_for", |
1080 |
|
tabName[tabIndex]), |
1081 |
|
tabIndex); |
1082 |
|
} |
1083 |
|
} |
1084 |
|
} |
1085 |
|
} |
1086 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
1087 |
0 |
@Override... |
1088 |
|
public void closeFeatureSettings( |
1089 |
|
FeatureSettingsControllerI featureSettings, |
1090 |
|
boolean closeContainingFrame) |
1091 |
|
{ |
1092 |
0 |
if (featureSettingsUI != null) |
1093 |
|
{ |
1094 |
0 |
if (closeContainingFrame) |
1095 |
|
{ |
1096 |
0 |
try |
1097 |
|
{ |
1098 |
0 |
featureSettingsUI.setClosed(true); |
1099 |
|
} catch (Exception x) |
1100 |
|
{ |
1101 |
|
} |
1102 |
0 |
featureSettingsUI = null; |
1103 |
|
} |
1104 |
|
else |
1105 |
|
{ |
1106 |
0 |
replaceWithDummyTab(featureSettings); |
1107 |
|
} |
1108 |
|
} |
1109 |
|
} |
1110 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1111 |
0 |
@Override... |
1112 |
|
public boolean isFeatureSettingsOpen() |
1113 |
|
{ |
1114 |
0 |
return featureSettingsUI != null && !featureSettingsUI.isClosed(); |
1115 |
|
} |
1116 |
|
} |