| 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.util.Locale; |
| 24 |
|
|
| 25 |
|
import jalview.util.MessageManager; |
| 26 |
|
import jalview.ws.seqfetcher.DbSourceProxy; |
| 27 |
|
|
| 28 |
|
import java.awt.BorderLayout; |
| 29 |
|
import java.awt.Component; |
| 30 |
|
import java.awt.Dimension; |
| 31 |
|
import java.awt.FlowLayout; |
| 32 |
|
import java.awt.GridLayout; |
| 33 |
|
import java.awt.event.ActionEvent; |
| 34 |
|
import java.awt.event.ActionListener; |
| 35 |
|
import java.awt.event.KeyEvent; |
| 36 |
|
import java.awt.event.KeyListener; |
| 37 |
|
import java.awt.event.MouseAdapter; |
| 38 |
|
import java.awt.event.MouseEvent; |
| 39 |
|
import java.util.ArrayList; |
| 40 |
|
import java.util.HashSet; |
| 41 |
|
import java.util.Hashtable; |
| 42 |
|
import java.util.List; |
| 43 |
|
import java.util.Vector; |
| 44 |
|
|
| 45 |
|
import javax.swing.JButton; |
| 46 |
|
import javax.swing.JLabel; |
| 47 |
|
import javax.swing.JPanel; |
| 48 |
|
import javax.swing.JScrollPane; |
| 49 |
|
import javax.swing.JTree; |
| 50 |
|
import javax.swing.ToolTipManager; |
| 51 |
|
import javax.swing.event.TreeSelectionEvent; |
| 52 |
|
import javax.swing.event.TreeSelectionListener; |
| 53 |
|
import javax.swing.tree.DefaultMutableTreeNode; |
| 54 |
|
import javax.swing.tree.DefaultTreeCellRenderer; |
| 55 |
|
import javax.swing.tree.DefaultTreeModel; |
| 56 |
|
import javax.swing.tree.TreeCellRenderer; |
| 57 |
|
import javax.swing.tree.TreeNode; |
| 58 |
|
import javax.swing.tree.TreePath; |
| 59 |
|
import javax.swing.tree.TreeSelectionModel; |
| 60 |
|
|
| |
|
| 0% |
Uncovered Elements: 264 (264) |
Complexity: 62 |
Complexity Density: 0.36 |
|
| 61 |
|
public class JDatabaseTree extends JalviewDialog implements KeyListener |
| 62 |
|
{ |
| 63 |
|
boolean allowMultiSelections = false; |
| 64 |
|
|
| 65 |
|
public int action; |
| 66 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 67 |
0 |
JButton getDatabaseSelectorButton()... |
| 68 |
|
{ |
| 69 |
0 |
final JButton viewdbs = new JButton( |
| 70 |
|
MessageManager.getString("action.select_ddbb")); |
| 71 |
0 |
viewdbs.addActionListener(new ActionListener() |
| 72 |
|
{ |
| 73 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 74 |
0 |
@Override... |
| 75 |
|
public void actionPerformed(ActionEvent arg0) |
| 76 |
|
{ |
| 77 |
0 |
showDialog(); |
| 78 |
|
} |
| 79 |
|
}); |
| 80 |
0 |
return viewdbs; |
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
JScrollPane svp; |
| 84 |
|
|
| 85 |
|
JTree dbviews; |
| 86 |
|
|
| 87 |
|
private jalview.ws.SequenceFetcher sfetcher; |
| 88 |
|
|
| 89 |
|
private JLabel dbstatus, dbstatex; |
| 90 |
|
|
| 91 |
|
private JPanel mainPanel = new JPanel(new BorderLayout()); |
| 92 |
|
|
| |
|
| 0% |
Uncovered Elements: 75 (75) |
Complexity: 7 |
Complexity Density: 0.11 |
|
| 93 |
0 |
public JDatabaseTree(jalview.ws.SequenceFetcher sfetch)... |
| 94 |
|
{ |
| 95 |
0 |
mainPanel.add(this); |
| 96 |
0 |
initDialogFrame(mainPanel, true, false, MessageManager |
| 97 |
|
.getString("label.select_database_retrieval_source"), 650, 490); |
| 98 |
|
|
| 99 |
|
|
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
0 |
DefaultMutableTreeNode tn = null, root = new DefaultMutableTreeNode(); |
| 104 |
0 |
Hashtable<String, DefaultMutableTreeNode> source = new Hashtable<>(); |
| 105 |
0 |
sfetcher = sfetch; |
| 106 |
0 |
String dbs[] = sfetch.getSupportedDb(); |
| 107 |
0 |
Hashtable<String, String> ht = new Hashtable<>(); |
| 108 |
0 |
for (int i = 0; i < dbs.length; i++) |
| 109 |
|
{ |
| 110 |
0 |
tn = source.get(dbs[i]); |
| 111 |
0 |
List<DbSourceProxy> srcs = sfetch.getSourceProxy(dbs[i]); |
| 112 |
0 |
if (tn == null) |
| 113 |
|
{ |
| 114 |
0 |
source.put(dbs[i], tn = new DefaultMutableTreeNode(dbs[i], true)); |
| 115 |
|
} |
| 116 |
0 |
for (DbSourceProxy dbp : srcs) |
| 117 |
|
{ |
| 118 |
0 |
if (ht.get(dbp.getDbName()) == null) |
| 119 |
|
{ |
| 120 |
0 |
tn.add(new DefaultMutableTreeNode(dbp, false)); |
| 121 |
0 |
ht.put(dbp.getDbName(), dbp.getDbName()); |
| 122 |
|
} |
| 123 |
|
else |
| 124 |
|
{ |
| 125 |
0 |
jalview.bin.Console.errPrintln("dupe ig for : " + dbs[i] + " \t" |
| 126 |
|
+ dbp.getDbName() + " (" + dbp.getDbSource() + ")"); |
| 127 |
0 |
source.remove(tn); |
| 128 |
|
} |
| 129 |
|
} |
| 130 |
|
} |
| 131 |
0 |
for (int i = 0; i < dbs.length; i++) |
| 132 |
|
{ |
| 133 |
0 |
tn = source.get(dbs[i]); |
| 134 |
0 |
if (tn == null) |
| 135 |
|
{ |
| 136 |
0 |
continue; |
| 137 |
|
} |
| 138 |
0 |
if (tn.getChildCount() == 1) |
| 139 |
|
{ |
| 140 |
0 |
DefaultMutableTreeNode ttn = (DefaultMutableTreeNode) tn |
| 141 |
|
.getChildAt(0); |
| 142 |
|
|
| 143 |
0 |
tn.setUserObject(ttn.getUserObject()); |
| 144 |
0 |
tn.removeAllChildren(); |
| 145 |
0 |
source.put(dbs[i], tn); |
| 146 |
0 |
tn.setAllowsChildren(false); |
| 147 |
|
} |
| 148 |
0 |
root.add(tn); |
| 149 |
|
} |
| 150 |
|
|
| 151 |
0 |
sortTreeNodes(root); |
| 152 |
0 |
dbviews = new JTree(new DefaultTreeModel(root, false)); |
| 153 |
0 |
dbviews.setCellRenderer(new DbTreeRenderer(this)); |
| 154 |
|
|
| 155 |
0 |
dbviews.getSelectionModel() |
| 156 |
|
.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); |
| 157 |
0 |
svp = new JScrollPane(dbviews); |
| 158 |
0 |
svp.setMinimumSize(new Dimension(100, 200)); |
| 159 |
0 |
svp.setPreferredSize(new Dimension(200, 400)); |
| 160 |
0 |
svp.setMaximumSize(new Dimension(300, 600)); |
| 161 |
|
|
| 162 |
0 |
JPanel panel = new JPanel(new BorderLayout()); |
| 163 |
0 |
panel.setSize(new Dimension(350, 220)); |
| 164 |
0 |
panel.add(svp); |
| 165 |
0 |
dbviews.addTreeSelectionListener(new TreeSelectionListener() |
| 166 |
|
{ |
| 167 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 168 |
0 |
@Override... |
| 169 |
|
public void valueChanged(TreeSelectionEvent arg0) |
| 170 |
|
{ |
| 171 |
0 |
_setSelectionState(); |
| 172 |
|
} |
| 173 |
|
}); |
| 174 |
0 |
dbviews.addMouseListener(new MouseAdapter() |
| 175 |
|
{ |
| 176 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 177 |
0 |
@Override... |
| 178 |
|
public void mousePressed(MouseEvent e) |
| 179 |
|
{ |
| 180 |
0 |
if (e.getClickCount() == 2) |
| 181 |
|
{ |
| 182 |
0 |
okPressed(); |
| 183 |
0 |
closeDialog(); |
| 184 |
|
} |
| 185 |
|
} |
| 186 |
|
}); |
| 187 |
0 |
JPanel jc = new JPanel(new BorderLayout()), |
| 188 |
|
j = new JPanel(new FlowLayout()); |
| 189 |
0 |
jc.add(svp, BorderLayout.CENTER); |
| 190 |
|
|
| 191 |
0 |
java.awt.Font f; |
| 192 |
|
|
| 193 |
0 |
JPanel dbstat = new JPanel(new GridLayout(2, 1)); |
| 194 |
0 |
dbstatus = new JLabel(" "); |
| 195 |
0 |
dbstatus.setFont(f = JvSwingUtils.getLabelFont(false, true)); |
| 196 |
0 |
dbstatus.setSize(new Dimension(290, 50)); |
| 197 |
0 |
dbstatex = new JLabel(" "); |
| 198 |
0 |
dbstatex.setFont(f); |
| 199 |
0 |
dbstatex.setSize(new Dimension(290, 50)); |
| 200 |
0 |
dbstat.add(dbstatus); |
| 201 |
0 |
dbstat.add(dbstatex); |
| 202 |
0 |
jc.add(dbstat, BorderLayout.SOUTH); |
| 203 |
0 |
jc.validate(); |
| 204 |
0 |
add(jc, BorderLayout.CENTER); |
| 205 |
0 |
ok.setEnabled(false); |
| 206 |
0 |
j.add(ok); |
| 207 |
0 |
j.add(cancel); |
| 208 |
0 |
add(j, BorderLayout.SOUTH); |
| 209 |
0 |
dbviews.addKeyListener(this); |
| 210 |
0 |
validate(); |
| 211 |
|
} |
| 212 |
|
|
| |
|
| 0% |
Uncovered Elements: 29 (29) |
Complexity: 6 |
Complexity Density: 0.32 |
|
| 213 |
0 |
private void sortTreeNodes(DefaultMutableTreeNode root)... |
| 214 |
|
{ |
| 215 |
0 |
if (root.getChildCount() == 0) |
| 216 |
|
{ |
| 217 |
0 |
return; |
| 218 |
|
} |
| 219 |
0 |
int count = root.getChildCount(); |
| 220 |
0 |
String[] names = new String[count]; |
| 221 |
0 |
DefaultMutableTreeNode[] nodes = new DefaultMutableTreeNode[count]; |
| 222 |
0 |
for (int i = 0; i < count; i++) |
| 223 |
|
{ |
| 224 |
0 |
TreeNode node = root.getChildAt(i); |
| 225 |
0 |
if (node instanceof DefaultMutableTreeNode) |
| 226 |
|
{ |
| 227 |
0 |
DefaultMutableTreeNode child = (DefaultMutableTreeNode) node; |
| 228 |
0 |
nodes[i] = child; |
| 229 |
0 |
if (child.getUserObject() instanceof DbSourceProxy) |
| 230 |
|
{ |
| 231 |
0 |
names[i] = ((DbSourceProxy) child.getUserObject()).getDbName() |
| 232 |
|
.toLowerCase(Locale.ROOT); |
| 233 |
|
} |
| 234 |
|
else |
| 235 |
|
{ |
| 236 |
0 |
names[i] = ((String) child.getUserObject()) |
| 237 |
|
.toLowerCase(Locale.ROOT); |
| 238 |
0 |
sortTreeNodes(child); |
| 239 |
|
} |
| 240 |
|
} |
| 241 |
|
else |
| 242 |
|
{ |
| 243 |
0 |
throw new Error(MessageManager |
| 244 |
|
.getString("error.implementation_error_cant_reorder_tree")); |
| 245 |
|
} |
| 246 |
|
} |
| 247 |
0 |
jalview.util.QuickSort.sort(names, nodes); |
| 248 |
0 |
root.removeAllChildren(); |
| 249 |
0 |
for (int i = count - 1; i >= 0; i--) |
| 250 |
|
{ |
| 251 |
0 |
root.add(nodes[i]); |
| 252 |
|
} |
| 253 |
|
} |
| 254 |
|
|
| |
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 9 |
Complexity Density: 0.5 |
|
| 255 |
|
private class DbTreeRenderer extends DefaultTreeCellRenderer |
| 256 |
|
implements TreeCellRenderer |
| 257 |
|
{ |
| 258 |
|
JDatabaseTree us; |
| 259 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 260 |
0 |
public DbTreeRenderer(JDatabaseTree me)... |
| 261 |
|
{ |
| 262 |
0 |
us = me; |
| 263 |
0 |
ToolTipManager.sharedInstance().registerComponent(dbviews); |
| 264 |
|
} |
| 265 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 266 |
0 |
private Component returnLabel(String txt)... |
| 267 |
|
{ |
| 268 |
0 |
JLabel jl = new JLabel(txt); |
| 269 |
0 |
jl.setFont(JvSwingUtils.getLabelFont()); |
| 270 |
0 |
return jl; |
| 271 |
|
} |
| 272 |
|
|
| |
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 7 |
Complexity Density: 0.54 |
|
| 273 |
0 |
@Override... |
| 274 |
|
public Component getTreeCellRendererComponent(JTree tree, Object value, |
| 275 |
|
boolean selected, boolean expanded, boolean leaf, int row, |
| 276 |
|
boolean hasFocus) |
| 277 |
|
{ |
| 278 |
0 |
String val = ""; |
| 279 |
0 |
if (value != null && value instanceof DefaultMutableTreeNode) |
| 280 |
|
{ |
| 281 |
0 |
DefaultMutableTreeNode vl = (DefaultMutableTreeNode) value; |
| 282 |
0 |
value = vl.getUserObject(); |
| 283 |
0 |
if (value instanceof DbSourceProxy) |
| 284 |
|
{ |
| 285 |
0 |
val = ((DbSourceProxy) value).getDbName(); |
| 286 |
0 |
if (((DbSourceProxy) value).getDescription() != null) |
| 287 |
|
{ |
| 288 |
0 |
this.setToolTipText(((DbSourceProxy) value).getDescription()); |
| 289 |
|
} |
| 290 |
|
} |
| 291 |
|
else |
| 292 |
|
{ |
| 293 |
0 |
if (value instanceof String) |
| 294 |
|
{ |
| 295 |
0 |
val = (String) value; |
| 296 |
|
} |
| 297 |
|
} |
| 298 |
|
} |
| 299 |
0 |
if (value == null) |
| 300 |
|
{ |
| 301 |
0 |
val = ""; |
| 302 |
|
} |
| 303 |
0 |
return super.getTreeCellRendererComponent(tree, val, selected, |
| 304 |
|
expanded, leaf, row, hasFocus); |
| 305 |
|
|
| 306 |
|
} |
| 307 |
|
} |
| 308 |
|
|
| 309 |
|
List<DbSourceProxy> oldselection, selection = null; |
| 310 |
|
|
| 311 |
|
TreePath[] tsel = null, oldtsel = null; |
| 312 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 313 |
0 |
@Override... |
| 314 |
|
protected void raiseClosed() |
| 315 |
|
{ |
| 316 |
0 |
for (ActionListener al : lstners) |
| 317 |
|
{ |
| 318 |
0 |
al.actionPerformed(null); |
| 319 |
|
} |
| 320 |
|
} |
| 321 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 322 |
0 |
@Override... |
| 323 |
|
protected void okPressed() |
| 324 |
|
{ |
| 325 |
0 |
_setSelectionState(); |
| 326 |
|
} |
| 327 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 328 |
0 |
@Override... |
| 329 |
|
protected void cancelPressed() |
| 330 |
|
{ |
| 331 |
0 |
selection = oldselection; |
| 332 |
0 |
tsel = oldtsel; |
| 333 |
0 |
_revertSelectionState(); |
| 334 |
0 |
closeDialog(); |
| 335 |
|
} |
| 336 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 337 |
0 |
void showDialog()... |
| 338 |
|
{ |
| 339 |
0 |
oldselection = selection; |
| 340 |
0 |
oldtsel = tsel; |
| 341 |
0 |
validate(); |
| 342 |
0 |
waitForInput(); |
| 343 |
|
} |
| 344 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 3 |
|
| 345 |
0 |
public boolean hasSelection()... |
| 346 |
|
{ |
| 347 |
0 |
return selection == null ? false : selection.size() == 0 ? false : true; |
| 348 |
|
} |
| 349 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 350 |
0 |
public List<DbSourceProxy> getSelectedSources()... |
| 351 |
|
{ |
| 352 |
0 |
return selection; |
| 353 |
|
} |
| 354 |
|
|
| 355 |
|
|
| 356 |
|
|
| 357 |
|
|
| 358 |
|
boolean handleSelections = true; |
| 359 |
|
|
| |
|
| 0% |
Uncovered Elements: 33 (33) |
Complexity: 7 |
Complexity Density: 0.33 |
|
| 360 |
0 |
private void _setSelectionState()... |
| 361 |
|
{ |
| 362 |
0 |
if (!handleSelections) |
| 363 |
|
{ |
| 364 |
0 |
return; |
| 365 |
|
} |
| 366 |
0 |
ok.setEnabled(false); |
| 367 |
0 |
if (dbviews.getSelectionCount() == 0) |
| 368 |
|
{ |
| 369 |
0 |
selection = null; |
| 370 |
|
} |
| 371 |
|
|
| 372 |
0 |
tsel = dbviews.getSelectionPaths(); |
| 373 |
0 |
boolean forcedFirstChild = false; |
| 374 |
0 |
List<DbSourceProxy> srcs = new ArrayList<>(); |
| 375 |
0 |
if (tsel != null) |
| 376 |
|
{ |
| 377 |
0 |
for (TreePath tp : tsel) |
| 378 |
|
{ |
| 379 |
0 |
DefaultMutableTreeNode admt, |
| 380 |
|
dmt = (DefaultMutableTreeNode) tp.getLastPathComponent(); |
| 381 |
0 |
if (dmt.getUserObject() != null) |
| 382 |
|
{ |
| 383 |
|
|
| 384 |
|
|
| 385 |
|
|
| 386 |
0 |
ok.setEnabled(true); |
| 387 |
0 |
if (dmt.getUserObject() instanceof DbSourceProxy) |
| 388 |
|
{ |
| 389 |
0 |
srcs.add((DbSourceProxy) dmt.getUserObject()); |
| 390 |
|
} |
| 391 |
|
else |
| 392 |
|
{ |
| 393 |
0 |
if (allowMultiSelections) |
| 394 |
|
{ |
| 395 |
0 |
srcs.addAll(sfetcher |
| 396 |
|
.getSourceProxy((String) dmt.getUserObject())); |
| 397 |
|
} |
| 398 |
|
else |
| 399 |
|
{ |
| 400 |
0 |
srcs.add(sfetcher.getSourceProxy((String) dmt.getUserObject()) |
| 401 |
|
.get(0)); |
| 402 |
0 |
forcedFirstChild = true; |
| 403 |
|
} |
| 404 |
|
} |
| 405 |
|
} |
| 406 |
|
} |
| 407 |
|
} |
| 408 |
0 |
updateDbStatus(srcs, forcedFirstChild); |
| 409 |
0 |
selection = srcs; |
| 410 |
|
} |
| 411 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
| 412 |
0 |
private void _revertSelectionState()... |
| 413 |
|
{ |
| 414 |
0 |
handleSelections = false; |
| 415 |
0 |
if (selection == null || selection.size() == 0) |
| 416 |
|
{ |
| 417 |
0 |
dbviews.clearSelection(); |
| 418 |
|
} |
| 419 |
|
else |
| 420 |
|
{ |
| 421 |
0 |
dbviews.setSelectionPaths(tsel); |
| 422 |
|
} |
| 423 |
0 |
handleSelections = true; |
| 424 |
|
} |
| 425 |
|
|
| |
|
| 0% |
Uncovered Elements: 32 (32) |
Complexity: 10 |
Complexity Density: 0.56 |
|
| 426 |
0 |
private void updateDbStatus(List<DbSourceProxy> srcs,... |
| 427 |
|
boolean forcedFirstChild) |
| 428 |
|
{ |
| 429 |
0 |
int x = 0; |
| 430 |
0 |
String nm = "", qr = ""; |
| 431 |
0 |
for (DbSourceProxy dbs : srcs) |
| 432 |
|
{ |
| 433 |
0 |
String tq = dbs.getTestQuery(); |
| 434 |
0 |
nm = dbs.getDbName(); |
| 435 |
0 |
if (tq != null && tq.trim().length() > 0 && dbs.isValidReference(tq)) |
| 436 |
|
{ |
| 437 |
0 |
qr = tq; |
| 438 |
0 |
x++; |
| 439 |
|
} |
| 440 |
|
} |
| 441 |
|
|
| 442 |
0 |
dbstatex.setText(" "); |
| 443 |
0 |
if (allowMultiSelections) |
| 444 |
|
{ |
| 445 |
0 |
dbstatus.setText(MessageManager.formatMessage( |
| 446 |
|
"label.selected_database_to_fetch_from", new String[] |
| 447 |
|
{ Integer.valueOf(srcs.size()).toString(), |
| 448 |
0 |
(srcs.size() == 1 ? "" : "s"), |
| 449 |
0 |
(srcs.size() > 0 |
| 450 |
|
? " with " + x + " test quer" |
| 451 |
0 |
+ (x == 1 ? "y" : "ies") |
| 452 |
|
: ".") })); |
| 453 |
|
} |
| 454 |
|
else |
| 455 |
|
{ |
| 456 |
0 |
if (nm.length() > 0) |
| 457 |
|
{ |
| 458 |
0 |
dbstatus.setText(MessageManager |
| 459 |
|
.formatMessage("label.database_param", new String[] |
| 460 |
|
{ nm })); |
| 461 |
0 |
if (qr.length() > 0) |
| 462 |
|
{ |
| 463 |
0 |
dbstatex.setText(MessageManager |
| 464 |
|
.formatMessage("label.example_param", new String[] |
| 465 |
|
{ qr })); |
| 466 |
|
} |
| 467 |
|
} |
| 468 |
|
else |
| 469 |
|
{ |
| 470 |
0 |
dbstatus.setText(" "); |
| 471 |
|
} |
| 472 |
|
} |
| 473 |
0 |
dbstatus.invalidate(); |
| 474 |
0 |
dbstatex.invalidate(); |
| 475 |
|
} |
| 476 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 477 |
0 |
public String getSelectedItem()... |
| 478 |
|
{ |
| 479 |
0 |
if (hasSelection()) |
| 480 |
|
{ |
| 481 |
0 |
return getSelectedSources().get(0).getDbName(); |
| 482 |
|
} |
| 483 |
0 |
return null; |
| 484 |
|
} |
| 485 |
|
|
| |
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.33 |
|
| 486 |
0 |
public String getExampleQueries()... |
| 487 |
|
{ |
| 488 |
0 |
if (!hasSelection()) |
| 489 |
|
{ |
| 490 |
0 |
return null; |
| 491 |
|
} |
| 492 |
0 |
StringBuffer sb = new StringBuffer(); |
| 493 |
0 |
HashSet<String> hs = new HashSet<>(); |
| 494 |
0 |
for (DbSourceProxy dbs : getSelectedSources()) |
| 495 |
|
{ |
| 496 |
0 |
String tq = dbs.getTestQuery(); |
| 497 |
0 |
; |
| 498 |
0 |
if (hs.add(tq)) |
| 499 |
|
{ |
| 500 |
0 |
if (sb.length() > 0) |
| 501 |
|
{ |
| 502 |
0 |
sb.append(";"); |
| 503 |
|
} |
| 504 |
0 |
sb.append(tq); |
| 505 |
|
} |
| 506 |
|
} |
| 507 |
0 |
return sb.toString(); |
| 508 |
|
} |
| 509 |
|
|
| 510 |
|
List<ActionListener> lstners = new Vector<>(); |
| 511 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 512 |
0 |
public void addActionListener(ActionListener actionListener)... |
| 513 |
|
{ |
| 514 |
0 |
lstners.add(actionListener); |
| 515 |
|
} |
| 516 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 517 |
0 |
public void removeActionListener(ActionListener actionListener)... |
| 518 |
|
{ |
| 519 |
0 |
lstners.remove(actionListener); |
| 520 |
|
} |
| 521 |
|
|
| |
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 5 |
Complexity Density: 0.71 |
|
| 522 |
0 |
@Override... |
| 523 |
|
public void keyPressed(KeyEvent arg0) |
| 524 |
|
{ |
| 525 |
0 |
if (!arg0.isConsumed() && arg0.getKeyCode() == KeyEvent.VK_ENTER) |
| 526 |
|
{ |
| 527 |
0 |
action = arg0.getKeyCode(); |
| 528 |
0 |
okPressed(); |
| 529 |
0 |
closeDialog(); |
| 530 |
|
} |
| 531 |
0 |
if (!arg0.isConsumed() && arg0.getKeyChar() == KeyEvent.VK_ESCAPE) |
| 532 |
|
{ |
| 533 |
0 |
action = arg0.getKeyCode(); |
| 534 |
0 |
cancelPressed(); |
| 535 |
|
} |
| 536 |
|
} |
| 537 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 538 |
0 |
@Override... |
| 539 |
|
public void keyReleased(KeyEvent arg0) |
| 540 |
|
{ |
| 541 |
|
|
| 542 |
|
|
| 543 |
|
} |
| 544 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 545 |
0 |
@Override... |
| 546 |
|
public void keyTyped(KeyEvent arg0) |
| 547 |
|
{ |
| 548 |
|
|
| 549 |
|
|
| 550 |
|
} |
| 551 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 552 |
0 |
@Override... |
| 553 |
|
public void setVisible(boolean arg0) |
| 554 |
|
{ |
| 555 |
0 |
jalview.bin.Console.outPrintln("setVisible: " + arg0); |
| 556 |
0 |
super.setVisible(arg0); |
| 557 |
|
} |
| 558 |
|
} |