1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
package jalview.fts.core; |
23 |
|
|
24 |
|
import java.awt.BorderLayout; |
25 |
|
import java.awt.CardLayout; |
26 |
|
import java.awt.Dimension; |
27 |
|
import java.awt.Font; |
28 |
|
import java.awt.event.ActionEvent; |
29 |
|
import java.awt.event.ActionListener; |
30 |
|
import java.awt.event.FocusAdapter; |
31 |
|
import java.awt.event.FocusEvent; |
32 |
|
import java.awt.event.FocusListener; |
33 |
|
import java.awt.event.ItemEvent; |
34 |
|
import java.awt.event.ItemListener; |
35 |
|
import java.awt.event.KeyAdapter; |
36 |
|
import java.awt.event.KeyEvent; |
37 |
|
import java.awt.event.MouseAdapter; |
38 |
|
import java.awt.event.MouseEvent; |
39 |
|
import java.text.DecimalFormat; |
40 |
|
import java.util.ArrayList; |
41 |
|
import java.util.Arrays; |
42 |
|
import java.util.Collection; |
43 |
|
import java.util.Collections; |
44 |
|
import java.util.Comparator; |
45 |
|
import java.util.HashSet; |
46 |
|
import java.util.List; |
47 |
|
|
48 |
|
import javax.swing.ImageIcon; |
49 |
|
import javax.swing.JButton; |
50 |
|
import javax.swing.JCheckBox; |
51 |
|
import javax.swing.JComboBox; |
52 |
|
import javax.swing.JFrame; |
53 |
|
import javax.swing.JInternalFrame; |
54 |
|
import javax.swing.JLabel; |
55 |
|
import javax.swing.JPanel; |
56 |
|
import javax.swing.JScrollPane; |
57 |
|
import javax.swing.JTabbedPane; |
58 |
|
import javax.swing.JTable; |
59 |
|
import javax.swing.Timer; |
60 |
|
import javax.swing.event.ChangeEvent; |
61 |
|
import javax.swing.event.ChangeListener; |
62 |
|
import javax.swing.event.DocumentEvent; |
63 |
|
import javax.swing.event.DocumentListener; |
64 |
|
import javax.swing.event.InternalFrameEvent; |
65 |
|
import javax.swing.table.DefaultTableModel; |
66 |
|
import javax.swing.table.TableColumn; |
67 |
|
|
68 |
|
import jalview.bin.Cache; |
69 |
|
import jalview.fts.api.FTSDataColumnI; |
70 |
|
import jalview.fts.api.GFTSPanelI; |
71 |
|
import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource; |
72 |
|
import jalview.gui.Desktop; |
73 |
|
import jalview.gui.IProgressIndicator; |
74 |
|
import jalview.gui.JvSwingUtils; |
75 |
|
import jalview.gui.SequenceFetcher; |
76 |
|
import jalview.io.cache.JvCacheableInputBox; |
77 |
|
import jalview.util.MessageManager; |
78 |
|
import jalview.util.Platform; |
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
@author |
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
@SuppressWarnings("serial") |
|
|
| 0% |
Uncovered Elements: 510 (510) |
Complexity: 128 |
Complexity Density: 0.36 |
|
89 |
|
public abstract class GFTSPanel extends JPanel implements GFTSPanelI |
90 |
|
{ |
91 |
|
private static final Font VERDANA_12 = new Font("Verdana", 0, 12); |
92 |
|
|
93 |
|
protected JInternalFrame mainFrame = new JInternalFrame( |
94 |
|
getFTSFrameTitle()); |
95 |
|
|
96 |
|
protected JTabbedPane tabs = new JTabbedPane(); |
97 |
|
|
98 |
|
protected IProgressIndicator progressIndicator; |
99 |
|
|
100 |
|
protected JComboBox<FTSDataColumnI> cmb_searchTarget = new JComboBox<>(); |
101 |
|
|
102 |
|
protected JButton btn_ok = new JButton(); |
103 |
|
|
104 |
|
protected JButton btn_back = new JButton(); |
105 |
|
|
106 |
|
protected JButton btn_cancel = new JButton(); |
107 |
|
|
108 |
|
protected JCheckBox btn_autosearch = new JCheckBox(); |
109 |
|
|
110 |
|
protected JvCacheableInputBox<String> txt_search; |
111 |
|
|
112 |
|
protected SequenceFetcher seqFetcher; |
113 |
|
|
114 |
|
protected Collection<FTSDataColumnI> wantedFields; |
115 |
|
|
116 |
|
private String lastSearchTerm = ""; |
117 |
|
|
118 |
|
protected JButton btn_next_page = new JButton(); |
119 |
|
|
120 |
|
protected JButton btn_prev_page = new JButton(); |
121 |
|
|
122 |
|
protected StringBuilder errorWarning = new StringBuilder(); |
123 |
|
|
124 |
|
protected ImageIcon warningImage = new ImageIcon( |
125 |
|
getClass().getResource("/images/warning.gif")); |
126 |
|
|
127 |
|
protected ImageIcon loadingImage = new ImageIcon( |
128 |
|
getClass().getResource("/images/loading.gif")); |
129 |
|
|
130 |
|
protected ImageIcon balnkPlaceholderImage = new ImageIcon( |
131 |
|
getClass().getResource("/images/blank_16x16_placeholder.png")); |
132 |
|
|
133 |
|
protected JLabel lbl_warning = new JLabel(warningImage); |
134 |
|
|
135 |
|
protected JLabel lbl_loading = new JLabel(loadingImage); |
136 |
|
|
137 |
|
protected JLabel lbl_blank = new JLabel(balnkPlaceholderImage); |
138 |
|
|
139 |
|
JTabbedPane tabbedPane = new JTabbedPane(); |
140 |
|
|
141 |
|
private JPanel pnl_actions = new JPanel(); |
142 |
|
|
143 |
|
private JPanel pnl_results = new JPanel(new CardLayout()); |
144 |
|
|
145 |
|
private JPanel pnl_inputs = new JPanel(); |
146 |
|
|
147 |
|
private BorderLayout mainLayout = new BorderLayout(); |
148 |
|
|
149 |
|
protected Object[] previousWantedFields; |
150 |
|
|
151 |
|
protected int resultSetCount; |
152 |
|
|
153 |
|
protected int totalResultSetCount; |
154 |
|
|
155 |
|
protected int offSet; |
156 |
|
|
157 |
|
protected int pageLimit; |
158 |
|
|
159 |
|
protected HashSet<String> paginatorCart = new HashSet<>(); |
160 |
|
|
161 |
|
private static final int MIN_WIDTH = 670; |
162 |
|
|
163 |
|
private static final int MIN_HEIGHT = 300; |
164 |
|
|
165 |
|
protected static final DecimalFormat totalNumberformatter = new DecimalFormat( |
166 |
|
"###,###"); |
167 |
|
|
168 |
|
private JTable tbl_summary = new JTable() |
169 |
|
{ |
170 |
|
private boolean inLayout; |
171 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
172 |
0 |
@Override... |
173 |
|
public boolean getScrollableTracksViewportWidth() |
174 |
|
{ |
175 |
0 |
return hasExcessWidth(); |
176 |
|
|
177 |
|
} |
178 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
179 |
0 |
@Override... |
180 |
|
public void doLayout() |
181 |
|
{ |
182 |
0 |
if (hasExcessWidth()) |
183 |
|
{ |
184 |
0 |
autoResizeMode = AUTO_RESIZE_SUBSEQUENT_COLUMNS; |
185 |
|
} |
186 |
0 |
inLayout = true; |
187 |
0 |
super.doLayout(); |
188 |
0 |
inLayout = false; |
189 |
0 |
autoResizeMode = AUTO_RESIZE_OFF; |
190 |
|
} |
191 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
192 |
0 |
protected boolean hasExcessWidth()... |
193 |
|
{ |
194 |
0 |
return getPreferredSize().width < getParent().getWidth(); |
195 |
|
} |
196 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 5 |
Complexity Density: 0.62 |
|
197 |
0 |
@Override... |
198 |
|
public void columnMarginChanged(ChangeEvent e) |
199 |
|
{ |
200 |
0 |
if (isEditing()) |
201 |
|
{ |
202 |
0 |
removeEditor(); |
203 |
|
} |
204 |
0 |
TableColumn resizingColumn = getTableHeader().getResizingColumn(); |
205 |
|
|
206 |
|
|
207 |
0 |
if (resizingColumn != null && autoResizeMode == AUTO_RESIZE_OFF |
208 |
|
&& !inLayout) |
209 |
|
{ |
210 |
0 |
resizingColumn.setPreferredWidth(resizingColumn.getWidth()); |
211 |
0 |
String colHeader = resizingColumn.getHeaderValue().toString(); |
212 |
0 |
getTempUserPrefs().put(colHeader, resizingColumn.getWidth()); |
213 |
|
} |
214 |
0 |
resizeAndRepaint(); |
215 |
|
} |
216 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 5 |
Complexity Density: 0.45 |
|
217 |
0 |
@Override... |
218 |
|
public String getToolTipText(MouseEvent evt) |
219 |
|
{ |
220 |
0 |
String toolTipText = null; |
221 |
0 |
java.awt.Point pnt = evt.getPoint(); |
222 |
0 |
int rowIndex = rowAtPoint(pnt); |
223 |
0 |
int colIndex = columnAtPoint(pnt); |
224 |
|
|
225 |
0 |
try |
226 |
|
{ |
227 |
0 |
if (getValueAt(rowIndex, colIndex) == null) |
228 |
|
{ |
229 |
0 |
return null; |
230 |
|
} |
231 |
0 |
toolTipText = getValueAt(rowIndex, colIndex).toString(); |
232 |
|
|
233 |
|
} catch (Exception e) |
234 |
|
{ |
235 |
0 |
e.printStackTrace(); |
236 |
|
} |
237 |
0 |
toolTipText = (toolTipText == null ? null |
238 |
0 |
: (toolTipText.length() > 500 |
239 |
|
? JvSwingUtils.wrapTooltip(true, |
240 |
|
toolTipText.subSequence(0, 500) + "...") |
241 |
|
: JvSwingUtils.wrapTooltip(true, toolTipText))); |
242 |
|
|
243 |
0 |
return toolTipText; |
244 |
|
} |
245 |
|
}; |
246 |
|
|
247 |
|
protected JScrollPane scrl_searchResult = new JScrollPane(tbl_summary); |
248 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
249 |
0 |
public GFTSPanel()... |
250 |
|
{ |
251 |
0 |
this(null); |
252 |
|
} |
253 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 4 |
Complexity Density: 0.31 |
|
254 |
0 |
public GFTSPanel(SequenceFetcher fetcher)... |
255 |
|
{ |
256 |
0 |
try |
257 |
|
{ |
258 |
0 |
if (fetcher == null) |
259 |
|
{ |
260 |
0 |
tabs = null; |
261 |
|
} |
262 |
0 |
jbInit(); |
263 |
0 |
if (fetcher != null) |
264 |
|
{ |
265 |
0 |
tabs.addTab(MessageManager.getString("label.retrieve_ids"), |
266 |
|
fetcher); |
267 |
0 |
fetcher.embedIn(this); |
268 |
|
} |
269 |
0 |
mainFrame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); |
270 |
0 |
final JPanel ftsPanel = this; |
271 |
0 |
mainFrame.addFocusListener(new FocusAdapter() |
272 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 3 |
Complexity Density: 1.5 |
|
273 |
0 |
@Override... |
274 |
|
public void focusGained(FocusEvent e) |
275 |
|
{ |
276 |
|
|
277 |
0 |
if (tabs != null && tabs.getSelectedComponent() == ftsPanel) |
278 |
|
{ |
279 |
0 |
txt_search.getComponent().requestFocusInWindow(); |
280 |
|
} |
281 |
|
} |
282 |
|
}); |
283 |
0 |
mainFrame.invalidate(); |
284 |
0 |
mainFrame.pack(); |
285 |
|
} catch (Exception e) |
286 |
|
{ |
287 |
0 |
e.printStackTrace(); |
288 |
|
} |
289 |
|
} |
290 |
|
|
291 |
|
|
292 |
|
|
293 |
|
|
294 |
|
@throws |
295 |
|
|
|
|
| 0% |
Uncovered Elements: 113 (113) |
Complexity: 7 |
Complexity Density: 0.07 |
|
296 |
0 |
private void jbInit() throws Exception... |
297 |
|
{ |
298 |
|
|
299 |
0 |
txt_search = new JvCacheableInputBox<>(getCacheKey(), 45); |
300 |
0 |
populateCmbSearchTargetOptions(); |
301 |
0 |
Integer width = getTempUserPrefs().get("FTSPanel.width") == null ? 800 |
302 |
|
: getTempUserPrefs().get("FTSPanel.width"); |
303 |
0 |
Integer height = getTempUserPrefs().get("FTSPanel.height") == null ? 400 |
304 |
|
: getTempUserPrefs().get("FTSPanel.height"); |
305 |
0 |
lbl_warning.setVisible(false); |
306 |
0 |
lbl_warning.setFont(VERDANA_12); |
307 |
0 |
lbl_loading.setVisible(false); |
308 |
0 |
lbl_loading.setFont(VERDANA_12); |
309 |
0 |
lbl_blank.setVisible(true); |
310 |
0 |
lbl_blank.setFont(VERDANA_12); |
311 |
|
|
312 |
0 |
tbl_summary.setAutoCreateRowSorter(true); |
313 |
0 |
tbl_summary.getTableHeader().setReorderingAllowed(false); |
314 |
0 |
tbl_summary.addMouseListener(new MouseAdapter() |
315 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
316 |
0 |
@Override... |
317 |
|
public void mouseClicked(MouseEvent e) |
318 |
|
{ |
319 |
0 |
validateSelection(); |
320 |
|
} |
321 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
322 |
0 |
@Override... |
323 |
|
public void mouseReleased(MouseEvent e) |
324 |
|
{ |
325 |
0 |
validateSelection(); |
326 |
|
} |
327 |
|
}); |
328 |
0 |
tbl_summary.addKeyListener(new KeyAdapter() |
329 |
|
{ |
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 6 |
Complexity Density: 0.33 |
|
330 |
0 |
@Override... |
331 |
|
public void keyPressed(KeyEvent evt) |
332 |
|
{ |
333 |
0 |
validateSelection(); |
334 |
0 |
switch (evt.getKeyCode()) |
335 |
|
{ |
336 |
0 |
case KeyEvent.VK_ESCAPE: |
337 |
0 |
btn_back_ActionPerformed(); |
338 |
0 |
break; |
339 |
0 |
case KeyEvent.VK_ENTER: |
340 |
0 |
if (btn_ok.isEnabled()) |
341 |
|
{ |
342 |
0 |
okAction(); |
343 |
|
} |
344 |
0 |
evt.consume(); |
345 |
0 |
break; |
346 |
0 |
case KeyEvent.VK_TAB: |
347 |
0 |
if (evt.isShiftDown()) |
348 |
|
{ |
349 |
0 |
tabbedPane.requestFocus(); |
350 |
|
} |
351 |
|
else |
352 |
|
{ |
353 |
0 |
btn_back.requestFocus(); |
354 |
|
} |
355 |
0 |
evt.consume(); |
356 |
0 |
break; |
357 |
0 |
default: |
358 |
0 |
return; |
359 |
|
} |
360 |
|
} |
361 |
|
}); |
362 |
|
|
363 |
0 |
JButton txt_help = new JButton("?"); |
364 |
0 |
txt_help.setFont(VERDANA_12); |
365 |
0 |
txt_help.setPreferredSize(new Dimension(15, 15)); |
366 |
0 |
txt_help.setToolTipText(MessageManager.getString("action.help")); |
367 |
0 |
txt_help.addActionListener(new ActionListener() |
368 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
369 |
0 |
@Override... |
370 |
|
public void actionPerformed(ActionEvent e) |
371 |
|
{ |
372 |
0 |
showHelp(); |
373 |
|
} |
374 |
|
}); |
375 |
|
|
376 |
0 |
btn_autosearch.setText(MessageManager.getString("option.autosearch")); |
377 |
0 |
btn_autosearch.setToolTipText( |
378 |
|
MessageManager.getString("option.enable_disable_autosearch")); |
379 |
|
|
380 |
0 |
btn_autosearch.setSelected(!Platform.isJS() |
381 |
|
&& Cache.getDefault(getAutosearchPreference(), false)); |
382 |
0 |
btn_autosearch.addActionListener(new java.awt.event.ActionListener() |
383 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
384 |
0 |
@Override... |
385 |
|
public void actionPerformed(ActionEvent e) |
386 |
|
{ |
387 |
0 |
Cache.setProperty(getAutosearchPreference(), |
388 |
|
Boolean.toString(btn_autosearch.isSelected())); |
389 |
|
} |
390 |
|
}); |
391 |
0 |
btn_back.setFont(VERDANA_12); |
392 |
0 |
btn_back.setText(MessageManager.getString("action.back")); |
393 |
0 |
btn_back.addActionListener(new java.awt.event.ActionListener() |
394 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
395 |
0 |
@Override... |
396 |
|
public void actionPerformed(ActionEvent e) |
397 |
|
{ |
398 |
0 |
btn_back_ActionPerformed(); |
399 |
|
} |
400 |
|
}); |
401 |
0 |
btn_back.addKeyListener(new KeyAdapter() |
402 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
403 |
0 |
@Override... |
404 |
|
public void keyPressed(KeyEvent evt) |
405 |
|
{ |
406 |
0 |
if (evt.getKeyCode() == KeyEvent.VK_ENTER) |
407 |
|
{ |
408 |
0 |
btn_back_ActionPerformed(); |
409 |
|
} |
410 |
|
} |
411 |
|
}); |
412 |
|
|
413 |
0 |
btn_ok.setEnabled(false); |
414 |
0 |
btn_ok.setFont(VERDANA_12); |
415 |
0 |
btn_ok.setText(MessageManager.getString("action.ok")); |
416 |
0 |
btn_ok.addActionListener(new java.awt.event.ActionListener() |
417 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
418 |
0 |
@Override... |
419 |
|
public void actionPerformed(ActionEvent e) |
420 |
|
{ |
421 |
0 |
okAction(); |
422 |
|
} |
423 |
|
}); |
424 |
0 |
btn_ok.addKeyListener(new KeyAdapter() |
425 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
426 |
0 |
@Override... |
427 |
|
public void keyPressed(KeyEvent evt) |
428 |
|
{ |
429 |
0 |
if (evt.getKeyCode() == KeyEvent.VK_ENTER) |
430 |
|
{ |
431 |
0 |
okAction(); |
432 |
|
} |
433 |
|
} |
434 |
|
}); |
435 |
0 |
btn_next_page.setEnabled(false); |
436 |
0 |
btn_next_page.setToolTipText( |
437 |
|
MessageManager.getString("label.next_page_tooltip")); |
438 |
0 |
btn_next_page.setFont(VERDANA_12); |
439 |
0 |
btn_next_page.setText(MessageManager.getString("action.next_page")); |
440 |
0 |
btn_next_page.addActionListener(new java.awt.event.ActionListener() |
441 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
442 |
0 |
@Override... |
443 |
|
public void actionPerformed(ActionEvent e) |
444 |
|
{ |
445 |
0 |
nextPageAction(); |
446 |
|
} |
447 |
|
}); |
448 |
0 |
btn_next_page.addKeyListener(new KeyAdapter() |
449 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
450 |
0 |
@Override... |
451 |
|
public void keyPressed(KeyEvent evt) |
452 |
|
{ |
453 |
0 |
if (evt.getKeyCode() == KeyEvent.VK_ENTER) |
454 |
|
{ |
455 |
0 |
nextPageAction(); |
456 |
|
} |
457 |
|
} |
458 |
|
}); |
459 |
|
|
460 |
0 |
btn_prev_page.setEnabled(false); |
461 |
0 |
btn_prev_page.setToolTipText( |
462 |
|
MessageManager.getString("label.prev_page_tooltip")); |
463 |
0 |
btn_prev_page.setFont(VERDANA_12); |
464 |
0 |
btn_prev_page.setText(MessageManager.getString("action.prev_page")); |
465 |
0 |
btn_prev_page.addActionListener(new java.awt.event.ActionListener() |
466 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
467 |
0 |
@Override... |
468 |
|
public void actionPerformed(ActionEvent e) |
469 |
|
{ |
470 |
0 |
prevPageAction(); |
471 |
|
} |
472 |
|
}); |
473 |
0 |
btn_prev_page.addKeyListener(new KeyAdapter() |
474 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
475 |
0 |
@Override... |
476 |
|
public void keyPressed(KeyEvent evt) |
477 |
|
{ |
478 |
0 |
if (evt.getKeyCode() == KeyEvent.VK_ENTER) |
479 |
|
{ |
480 |
0 |
prevPageAction(); |
481 |
|
} |
482 |
|
} |
483 |
|
}); |
484 |
|
|
485 |
0 |
if (isPaginationEnabled()) |
486 |
|
{ |
487 |
0 |
btn_prev_page.setVisible(true); |
488 |
0 |
btn_next_page.setVisible(true); |
489 |
|
} |
490 |
|
else |
491 |
|
{ |
492 |
0 |
btn_prev_page.setVisible(false); |
493 |
0 |
btn_next_page.setVisible(false); |
494 |
|
} |
495 |
|
|
496 |
0 |
btn_cancel.setFont(VERDANA_12); |
497 |
0 |
btn_cancel.setText(MessageManager.getString("action.cancel")); |
498 |
0 |
btn_cancel.addActionListener(new java.awt.event.ActionListener() |
499 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
500 |
0 |
@Override... |
501 |
|
public void actionPerformed(ActionEvent e) |
502 |
|
{ |
503 |
0 |
btn_cancel_ActionPerformed(); |
504 |
|
} |
505 |
|
}); |
506 |
0 |
btn_cancel.addKeyListener(new KeyAdapter() |
507 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
508 |
0 |
@Override... |
509 |
|
public void keyPressed(KeyEvent evt) |
510 |
|
{ |
511 |
0 |
if (evt.getKeyCode() == KeyEvent.VK_ENTER) |
512 |
|
{ |
513 |
0 |
btn_cancel_ActionPerformed(); |
514 |
|
} |
515 |
|
} |
516 |
|
}); |
517 |
0 |
scrl_searchResult.setPreferredSize(new Dimension(width, height)); |
518 |
|
|
519 |
0 |
cmb_searchTarget.setFont(VERDANA_12); |
520 |
0 |
cmb_searchTarget.addItemListener(new ItemListener() |
521 |
|
{ |
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 4 |
Complexity Density: 0.4 |
|
522 |
0 |
@Override... |
523 |
|
public void itemStateChanged(ItemEvent e) |
524 |
|
{ |
525 |
0 |
if (e.getStateChange() == ItemEvent.SELECTED) |
526 |
|
{ |
527 |
0 |
String tooltipText; |
528 |
0 |
if ("all".equalsIgnoreCase( |
529 |
|
getCmbSearchTarget().getSelectedItem().toString())) |
530 |
|
{ |
531 |
0 |
tooltipText = MessageManager.getString("label.search_all"); |
532 |
|
} |
533 |
0 |
else if ("pdb id".equalsIgnoreCase( |
534 |
|
getCmbSearchTarget().getSelectedItem().toString())) |
535 |
|
{ |
536 |
0 |
tooltipText = MessageManager |
537 |
|
.getString("label.separate_multiple_accession_ids"); |
538 |
|
} |
539 |
|
else |
540 |
|
{ |
541 |
0 |
tooltipText = MessageManager.formatMessage( |
542 |
|
"label.separate_multiple_query_values", new Object[] |
543 |
|
{ getCmbSearchTarget().getSelectedItem().toString() }); |
544 |
|
} |
545 |
0 |
txt_search.getComponent().setToolTipText( |
546 |
|
JvSwingUtils.wrapTooltip(true, tooltipText)); |
547 |
|
|
548 |
0 |
searchAction(true); |
549 |
|
|
550 |
0 |
setCmbSearchTargetTooltip(); |
551 |
|
} |
552 |
|
} |
553 |
|
}); |
554 |
|
|
555 |
0 |
txt_search.getComponent().setFont(VERDANA_12); |
556 |
|
|
557 |
0 |
txt_search.addKeyListener(new KeyAdapter() |
558 |
|
{ |
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 5 |
Complexity Density: 0.71 |
|
559 |
0 |
@Override... |
560 |
|
public void keyPressed(KeyEvent e) |
561 |
|
{ |
562 |
0 |
if (e.getKeyCode() == KeyEvent.VK_ENTER) |
563 |
|
{ |
564 |
0 |
if (getTypedText() == null || getTypedText().isEmpty()) |
565 |
|
{ |
566 |
0 |
return; |
567 |
|
} |
568 |
0 |
String primaryKeyName = getFTSRestClient().getPrimaryKeyColumn() |
569 |
|
.getName(); |
570 |
0 |
if (primaryKeyName.equalsIgnoreCase( |
571 |
|
getCmbSearchTarget().getSelectedItem().toString())) |
572 |
|
{ |
573 |
|
|
574 |
|
|
575 |
0 |
transferToSequenceFetcher(getTypedText()); |
576 |
|
} |
577 |
|
else |
578 |
|
{ |
579 |
0 |
performSearchAction(); |
580 |
|
} |
581 |
|
} |
582 |
|
} |
583 |
|
}); |
584 |
0 |
final DeferredTextInputListener listener = new DeferredTextInputListener( |
585 |
|
1500, new ActionListener() |
586 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 3 |
Complexity Density: 1.5 |
|
587 |
0 |
@Override... |
588 |
|
public void actionPerformed(ActionEvent e) |
589 |
|
{ |
590 |
0 |
if (btn_autosearch.isSelected() |
591 |
|
|| txt_search.wasEnterPressed()) |
592 |
|
{ |
593 |
0 |
performSearchAction(); |
594 |
|
} |
595 |
|
} |
596 |
|
}, false); |
597 |
0 |
txt_search.addDocumentListener(listener); |
598 |
|
|
599 |
0 |
txt_search.addFocusListener(new FocusListener() |
600 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
601 |
0 |
@Override... |
602 |
|
public void focusGained(FocusEvent e) |
603 |
|
{ |
604 |
0 |
listener.start(); |
605 |
|
} |
606 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
607 |
0 |
@Override... |
608 |
|
public void focusLost(FocusEvent e) |
609 |
|
{ |
610 |
|
|
611 |
|
} |
612 |
|
}); |
613 |
|
|
614 |
0 |
txt_search.addActionListener(new ActionListener() |
615 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
616 |
0 |
@Override... |
617 |
|
public void actionPerformed(ActionEvent e) |
618 |
|
{ |
619 |
0 |
performSearchAction(); |
620 |
|
} |
621 |
|
}); |
622 |
0 |
final String searchTabTitle = MessageManager |
623 |
|
.getString("label.search_result"); |
624 |
0 |
final String configureCols = MessageManager |
625 |
|
.getString("label.configure_displayed_columns"); |
626 |
0 |
ChangeListener changeListener = new ChangeListener() |
627 |
|
{ |
|
|
| 0% |
Uncovered Elements: 33 (33) |
Complexity: 4 |
Complexity Density: 0.15 |
|
628 |
0 |
@Override... |
629 |
|
public void stateChanged(ChangeEvent changeEvent) |
630 |
|
{ |
631 |
0 |
JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent |
632 |
|
.getSource(); |
633 |
0 |
int index = sourceTabbedPane.getSelectedIndex(); |
634 |
|
|
635 |
0 |
btn_back.setVisible(true); |
636 |
0 |
btn_cancel.setVisible(true); |
637 |
0 |
btn_ok.setVisible(true); |
638 |
0 |
if (sourceTabbedPane.getTitleAt(index).equals(configureCols)) |
639 |
|
{ |
640 |
0 |
btn_back.setVisible(false); |
641 |
0 |
btn_cancel.setVisible(false); |
642 |
0 |
btn_ok.setVisible(false); |
643 |
0 |
btn_back.setEnabled(false); |
644 |
0 |
btn_cancel.setEnabled(false); |
645 |
0 |
btn_ok.setEnabled(false); |
646 |
0 |
btn_next_page.setEnabled(false); |
647 |
0 |
btn_prev_page.setEnabled(false); |
648 |
0 |
txt_search.getComponent().setEnabled(false); |
649 |
0 |
cmb_searchTarget.setEnabled(false); |
650 |
0 |
previousWantedFields = getFTSRestClient() |
651 |
|
.getAllDefaultDisplayedFTSDataColumns() |
652 |
|
.toArray(new Object[0]); |
653 |
|
} |
654 |
0 |
if (sourceTabbedPane.getTitleAt(index).equals(searchTabTitle)) |
655 |
|
{ |
656 |
0 |
btn_back.setEnabled(true); |
657 |
0 |
btn_cancel.setEnabled(true); |
658 |
0 |
refreshPaginatorState(); |
659 |
0 |
txt_search.getComponent().setEnabled(true); |
660 |
0 |
cmb_searchTarget.setEnabled(true); |
661 |
0 |
if (wantedFieldsUpdated()) |
662 |
|
{ |
663 |
0 |
searchAction(true); |
664 |
0 |
paginatorCart.clear(); |
665 |
|
} |
666 |
|
else |
667 |
|
{ |
668 |
0 |
validateSelection(); |
669 |
|
} |
670 |
|
} |
671 |
|
} |
672 |
|
}; |
673 |
0 |
tabbedPane.addChangeListener(changeListener); |
674 |
0 |
tabbedPane.setPreferredSize(new Dimension(width, height)); |
675 |
0 |
tabbedPane.add(searchTabTitle, scrl_searchResult); |
676 |
0 |
tabbedPane.add(configureCols, new FTSDataColumnPreferences( |
677 |
|
PreferenceSource.SEARCH_SUMMARY, getFTSRestClient())); |
678 |
|
|
679 |
0 |
pnl_actions.add(btn_back); |
680 |
0 |
pnl_actions.add(btn_ok); |
681 |
0 |
pnl_actions.add(btn_cancel); |
682 |
|
|
683 |
0 |
pnl_results.add(tabbedPane); |
684 |
0 |
setCmbSearchTargetTooltip(); |
685 |
0 |
pnl_inputs.add(cmb_searchTarget); |
686 |
0 |
pnl_inputs.add(txt_search.getComponent()); |
687 |
0 |
pnl_inputs.add(txt_help); |
688 |
0 |
pnl_inputs.add(btn_autosearch); |
689 |
0 |
pnl_inputs.add(lbl_loading); |
690 |
0 |
pnl_inputs.add(lbl_warning); |
691 |
0 |
pnl_inputs.add(lbl_blank); |
692 |
0 |
pnl_inputs.add(btn_prev_page); |
693 |
0 |
pnl_inputs.add(btn_next_page); |
694 |
|
|
695 |
0 |
this.setLayout(mainLayout); |
696 |
0 |
this.add(pnl_inputs, java.awt.BorderLayout.NORTH); |
697 |
0 |
this.add(pnl_results, java.awt.BorderLayout.CENTER); |
698 |
0 |
this.add(pnl_actions, java.awt.BorderLayout.SOUTH); |
699 |
0 |
mainFrame.setFrameIcon(null); |
700 |
0 |
mainFrame.setVisible(true); |
701 |
0 |
if (tabs != null) |
702 |
|
{ |
703 |
0 |
tabs.setOpaque(true); |
704 |
0 |
tabs.insertTab(MessageManager.getString("label.free_text_search"), |
705 |
|
null, this, "", 0); |
706 |
0 |
mainFrame.setContentPane(tabs); |
707 |
0 |
tabs.setVisible(true); |
708 |
|
} |
709 |
|
else |
710 |
|
{ |
711 |
0 |
mainFrame.setContentPane(this); |
712 |
|
} |
713 |
0 |
mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); |
714 |
0 |
mainFrame.addInternalFrameListener( |
715 |
|
new javax.swing.event.InternalFrameAdapter() |
716 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
717 |
0 |
@Override... |
718 |
|
public void internalFrameClosing(InternalFrameEvent e) |
719 |
|
{ |
720 |
0 |
closeAction(); |
721 |
|
} |
722 |
|
}); |
723 |
0 |
mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); |
724 |
0 |
Integer x = getTempUserPrefs().get("FTSPanel.x"); |
725 |
0 |
Integer y = getTempUserPrefs().get("FTSPanel.y"); |
726 |
0 |
if (x != null && y != null) |
727 |
|
{ |
728 |
0 |
mainFrame.setLocation(x, y); |
729 |
|
} |
730 |
0 |
Desktop.addInternalFrame(mainFrame, getFTSFrameTitle(), width, height); |
731 |
|
} |
732 |
|
|
733 |
|
abstract protected void showHelp(); |
734 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
735 |
0 |
protected void closeAction()... |
736 |
|
{ |
737 |
0 |
getTempUserPrefs().put("FTSPanel.width", this.getWidth()); |
738 |
0 |
getTempUserPrefs().put("FTSPanel.height", pnl_results.getHeight()); |
739 |
0 |
getTempUserPrefs().put("FTSPanel.x", mainFrame.getX()); |
740 |
0 |
getTempUserPrefs().put("FTSPanel.y", mainFrame.getY()); |
741 |
0 |
mainFrame.dispose(); |
742 |
0 |
txt_search.persistCache(); |
743 |
|
} |
744 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 6 |
Complexity Density: 0.86 |
|
745 |
|
public class DeferredTextInputListener implements DocumentListener |
746 |
|
{ |
747 |
|
private final Timer swingTimer; |
748 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
749 |
0 |
public DeferredTextInputListener(int timeOut, ActionListener listener,... |
750 |
|
boolean repeats) |
751 |
|
{ |
752 |
0 |
swingTimer = new Timer(timeOut, listener); |
753 |
0 |
swingTimer.setRepeats(repeats); |
754 |
|
} |
755 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
756 |
0 |
public void start()... |
757 |
|
{ |
758 |
0 |
swingTimer.start(); |
759 |
|
} |
760 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
761 |
0 |
public void stop()... |
762 |
|
{ |
763 |
0 |
swingTimer.stop(); |
764 |
|
} |
765 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
766 |
0 |
@Override... |
767 |
|
public void insertUpdate(DocumentEvent e) |
768 |
|
{ |
769 |
0 |
swingTimer.restart(); |
770 |
|
} |
771 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
772 |
0 |
@Override... |
773 |
|
public void removeUpdate(DocumentEvent e) |
774 |
|
{ |
775 |
0 |
swingTimer.restart(); |
776 |
|
} |
777 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
778 |
0 |
@Override... |
779 |
|
public void changedUpdate(DocumentEvent e) |
780 |
|
{ |
781 |
0 |
swingTimer.restart(); |
782 |
|
} |
783 |
|
|
784 |
|
} |
785 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 4 |
Complexity Density: 0.8 |
|
786 |
0 |
void performSearchAction()... |
787 |
|
{ |
788 |
0 |
String typed = getTypedText(); |
789 |
0 |
if (typed != null && typed.length() > 0 |
790 |
|
&& !typed.equalsIgnoreCase(lastSearchTerm)) |
791 |
|
{ |
792 |
0 |
searchAction(true); |
793 |
0 |
paginatorCart.clear(); |
794 |
0 |
lastSearchTerm = typed; |
795 |
|
} |
796 |
|
} |
797 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 3 |
Complexity Density: 1 |
|
798 |
0 |
public boolean wantedFieldsUpdated()... |
799 |
|
{ |
800 |
0 |
if (previousWantedFields == null) |
801 |
|
{ |
802 |
0 |
return false; |
803 |
|
} |
804 |
|
|
805 |
0 |
return Arrays.equals(getFTSRestClient() |
806 |
|
.getAllDefaultDisplayedFTSDataColumns().toArray(new Object[0]), |
807 |
|
previousWantedFields) ? false : true; |
808 |
|
|
809 |
|
} |
810 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
811 |
0 |
public void validateSelection()... |
812 |
|
{ |
813 |
0 |
if (tbl_summary.getSelectedRows().length > 0 |
814 |
|
|| !paginatorCart.isEmpty()) |
815 |
|
{ |
816 |
0 |
btn_ok.setEnabled(true); |
817 |
|
} |
818 |
|
else |
819 |
|
{ |
820 |
0 |
btn_ok.setEnabled(false); |
821 |
|
} |
822 |
|
} |
823 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
824 |
0 |
public JComboBox<FTSDataColumnI> getCmbSearchTarget()... |
825 |
|
{ |
826 |
0 |
return cmb_searchTarget; |
827 |
|
} |
828 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
829 |
0 |
public JInternalFrame getMainFrame()... |
830 |
|
{ |
831 |
0 |
return mainFrame; |
832 |
|
} |
833 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
834 |
0 |
protected void delayAndEnableActionButtons()... |
835 |
|
{ |
836 |
0 |
new Thread() |
837 |
|
{ |
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
838 |
0 |
@Override... |
839 |
|
public void run() |
840 |
|
{ |
841 |
0 |
try |
842 |
|
{ |
843 |
0 |
Thread.sleep(1500); |
844 |
|
} catch (InterruptedException e) |
845 |
|
{ |
846 |
0 |
e.printStackTrace(); |
847 |
|
} |
848 |
0 |
btn_ok.setEnabled(true); |
849 |
0 |
btn_back.setEnabled(true); |
850 |
0 |
btn_cancel.setEnabled(true); |
851 |
|
} |
852 |
|
}.start(); |
853 |
|
} |
854 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
855 |
0 |
protected void checkForErrors()... |
856 |
|
{ |
857 |
0 |
lbl_warning.setVisible(false); |
858 |
0 |
lbl_blank.setVisible(true); |
859 |
0 |
if (errorWarning.length() > 0) |
860 |
|
{ |
861 |
0 |
lbl_loading.setVisible(false); |
862 |
0 |
lbl_blank.setVisible(false); |
863 |
0 |
lbl_warning.setToolTipText( |
864 |
|
JvSwingUtils.wrapTooltip(true, errorWarning.toString())); |
865 |
0 |
lbl_warning.setVisible(true); |
866 |
|
} |
867 |
|
} |
868 |
|
|
869 |
|
|
870 |
|
|
871 |
|
|
872 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
873 |
0 |
public void btn_back_ActionPerformed()... |
874 |
|
{ |
875 |
0 |
closeAction(); |
876 |
0 |
new SequenceFetcher(progressIndicator); |
877 |
|
} |
878 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
879 |
0 |
protected void disableActionButtons()... |
880 |
|
{ |
881 |
0 |
btn_ok.setEnabled(false); |
882 |
0 |
btn_back.setEnabled(false); |
883 |
0 |
btn_cancel.setEnabled(false); |
884 |
|
} |
885 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
886 |
0 |
public void btn_cancel_ActionPerformed()... |
887 |
|
{ |
888 |
0 |
closeAction(); |
889 |
|
} |
890 |
|
|
891 |
|
|
892 |
|
|
893 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.25 |
|
894 |
0 |
public void populateCmbSearchTargetOptions()... |
895 |
|
{ |
896 |
0 |
List<FTSDataColumnI> searchableTargets = new ArrayList<>(); |
897 |
0 |
try |
898 |
|
{ |
899 |
0 |
Collection<FTSDataColumnI> foundFTSTargets = getFTSRestClient() |
900 |
|
.getSearchableDataColumns(); |
901 |
0 |
searchableTargets.addAll(foundFTSTargets); |
902 |
|
} catch (Exception e) |
903 |
|
{ |
904 |
0 |
e.printStackTrace(); |
905 |
|
} |
906 |
|
|
907 |
0 |
Collections.sort(searchableTargets, new Comparator<FTSDataColumnI>() |
908 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
909 |
0 |
@Override... |
910 |
|
public int compare(FTSDataColumnI o1, FTSDataColumnI o2) |
911 |
|
{ |
912 |
0 |
return o1.getName().compareTo(o2.getName()); |
913 |
|
} |
914 |
|
}); |
915 |
|
|
916 |
0 |
for (FTSDataColumnI searchTarget : searchableTargets) |
917 |
|
{ |
918 |
0 |
cmb_searchTarget.addItem(searchTarget); |
919 |
|
} |
920 |
|
} |
921 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
922 |
0 |
public void transferToSequenceFetcher(String ids)... |
923 |
|
{ |
924 |
0 |
seqFetcher.setQuery(ids); |
925 |
0 |
Thread worker = new Thread(seqFetcher); |
926 |
0 |
worker.start(); |
927 |
|
} |
928 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
929 |
0 |
@Override... |
930 |
|
public String getTypedText() |
931 |
|
{ |
932 |
0 |
return txt_search.getUserInput(); |
933 |
|
} |
934 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
935 |
0 |
@Override... |
936 |
|
public JTable getResultTable() |
937 |
|
{ |
938 |
0 |
return tbl_summary; |
939 |
|
} |
940 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
|
941 |
0 |
public void reset()... |
942 |
|
{ |
943 |
0 |
lbl_loading.setVisible(false); |
944 |
0 |
errorWarning.setLength(0); |
945 |
0 |
lbl_warning.setVisible(false); |
946 |
0 |
lbl_blank.setVisible(true); |
947 |
0 |
btn_ok.setEnabled(false); |
948 |
0 |
mainFrame.setTitle(getFTSFrameTitle()); |
949 |
0 |
refresh(); |
950 |
0 |
tbl_summary.setModel(new DefaultTableModel()); |
951 |
0 |
tbl_summary.setVisible(false); |
952 |
|
} |
953 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
954 |
0 |
@Override... |
955 |
|
public void setPrevPageButtonEnabled(boolean isEnabled) |
956 |
|
{ |
957 |
0 |
btn_prev_page.setEnabled(isEnabled); |
958 |
|
} |
959 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
960 |
0 |
@Override... |
961 |
|
public void setNextPageButtonEnabled(boolean isEnabled) |
962 |
|
{ |
963 |
0 |
btn_next_page.setEnabled(isEnabled); |
964 |
|
} |
965 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
966 |
0 |
@Override... |
967 |
|
public void setErrorMessage(String message) |
968 |
|
{ |
969 |
0 |
errorWarning.append(message); |
970 |
|
} |
971 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
972 |
0 |
@Override... |
973 |
|
public void updateSearchFrameTitle(String title) |
974 |
|
{ |
975 |
0 |
mainFrame.setTitle(title); |
976 |
|
} |
977 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
978 |
0 |
@Override... |
979 |
|
public void setSearchInProgress(Boolean isSearchInProgress) |
980 |
|
{ |
981 |
0 |
lbl_blank.setVisible(!isSearchInProgress); |
982 |
0 |
lbl_loading.setVisible(isSearchInProgress); |
983 |
0 |
txt_search.setEditable(!isSearchInProgress); |
984 |
|
} |
985 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
986 |
0 |
@Override... |
987 |
|
public void prevPageAction() |
988 |
|
{ |
989 |
0 |
updatePaginatorCart(); |
990 |
0 |
if (offSet >= pageLimit) |
991 |
|
{ |
992 |
0 |
offSet = offSet - pageLimit; |
993 |
0 |
searchAction(false); |
994 |
|
} |
995 |
|
else |
996 |
|
{ |
997 |
0 |
refreshPaginatorState(); |
998 |
|
} |
999 |
|
} |
1000 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
1001 |
0 |
@Override... |
1002 |
|
public void nextPageAction() |
1003 |
|
{ |
1004 |
0 |
updatePaginatorCart(); |
1005 |
0 |
offSet = offSet + pageLimit; |
1006 |
0 |
searchAction(false); |
1007 |
|
} |
1008 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.29 |
|
1009 |
0 |
public void updatePaginatorCart()... |
1010 |
|
{ |
1011 |
0 |
int primaryKeyColIndex = 0; |
1012 |
0 |
JTable resultTable = getResultTable(); |
1013 |
0 |
int totalRows = resultTable.getRowCount(); |
1014 |
0 |
try |
1015 |
|
{ |
1016 |
0 |
primaryKeyColIndex = getFTSRestClient() |
1017 |
|
.getPrimaryKeyColumIndex(wantedFields, false); |
1018 |
|
} catch (Exception e) |
1019 |
|
{ |
1020 |
0 |
e.printStackTrace(); |
1021 |
|
} |
1022 |
|
|
1023 |
0 |
for (int row = 0; row < totalRows; row++) |
1024 |
|
{ |
1025 |
0 |
String id = (String) resultTable.getValueAt(row, primaryKeyColIndex); |
1026 |
0 |
if (paginatorCart.contains(id)) |
1027 |
|
{ |
1028 |
0 |
paginatorCart.remove(id); |
1029 |
|
} |
1030 |
|
} |
1031 |
0 |
int[] selectedRows = resultTable.getSelectedRows(); |
1032 |
0 |
for (int summaryRow : selectedRows) |
1033 |
|
{ |
1034 |
0 |
String idStr = resultTable.getValueAt(summaryRow, primaryKeyColIndex) |
1035 |
|
.toString(); |
1036 |
0 |
paginatorCart.add(idStr); |
1037 |
|
} |
1038 |
|
} |
1039 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 5 |
Complexity Density: 0.38 |
|
1040 |
0 |
public void updateSummaryTableSelections()... |
1041 |
|
{ |
1042 |
0 |
JTable resultTable = getResultTable(); |
1043 |
0 |
if (paginatorCart.isEmpty()) |
1044 |
|
{ |
1045 |
0 |
return; |
1046 |
|
} |
1047 |
0 |
int primaryKeyColIndex = 0; |
1048 |
0 |
try |
1049 |
|
{ |
1050 |
0 |
primaryKeyColIndex = getFTSRestClient() |
1051 |
|
.getPrimaryKeyColumIndex(wantedFields, false); |
1052 |
|
} catch (Exception e) |
1053 |
|
{ |
1054 |
0 |
e.printStackTrace(); |
1055 |
|
} |
1056 |
0 |
int totalRows = resultTable.getRowCount(); |
1057 |
0 |
for (int row = 0; row < totalRows; row++) |
1058 |
|
{ |
1059 |
0 |
String id = (String) resultTable.getValueAt(row, primaryKeyColIndex); |
1060 |
0 |
if (paginatorCart.contains(id)) |
1061 |
|
{ |
1062 |
0 |
resultTable.addRowSelectionInterval(row, row); |
1063 |
|
} |
1064 |
|
} |
1065 |
0 |
validateSelection(); |
1066 |
|
} |
1067 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 5 |
Complexity Density: 0.62 |
|
1068 |
0 |
public void refreshPaginatorState()... |
1069 |
|
{ |
1070 |
0 |
setPrevPageButtonEnabled(false); |
1071 |
0 |
setNextPageButtonEnabled(false); |
1072 |
0 |
if (resultSetCount == 0 && pageLimit == 0) |
1073 |
|
{ |
1074 |
0 |
return; |
1075 |
|
} |
1076 |
0 |
if (resultSetCount >= pageLimit) |
1077 |
|
{ |
1078 |
0 |
setNextPageButtonEnabled(true); |
1079 |
|
} |
1080 |
0 |
if (offSet >= pageLimit) |
1081 |
|
{ |
1082 |
0 |
setPrevPageButtonEnabled(true); |
1083 |
|
} |
1084 |
|
} |
1085 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1086 |
0 |
public void refresh()... |
1087 |
|
{ |
1088 |
0 |
mainFrame.setTitle(getFTSFrameTitle()); |
1089 |
|
} |
1090 |
|
|
1091 |
|
@Override |
1092 |
|
public abstract void okAction(); |
1093 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
1094 |
0 |
private void setCmbSearchTargetTooltip()... |
1095 |
|
{ |
1096 |
0 |
JComboBox<FTSDataColumnI> cmb = getCmbSearchTarget(); |
1097 |
0 |
if (cmb.isEnabled()) |
1098 |
|
{ |
1099 |
0 |
boolean isAll = "all" |
1100 |
|
.equalsIgnoreCase(cmb.getSelectedItem().toString()); |
1101 |
0 |
FTSDataColumnI index = (FTSDataColumnI) cmb.getSelectedItem(); |
1102 |
0 |
String indexCode = index.getAltCode(); |
1103 |
0 |
String dbName = getDbName(); |
1104 |
0 |
String message = isAll ? MessageManager |
1105 |
|
.formatMessage("label.search_db_all", new Object[] |
1106 |
|
{ dbName }) |
1107 |
|
: MessageManager.formatMessage("label.search_db_index", |
1108 |
|
new Object[] |
1109 |
|
{ dbName, indexCode }); |
1110 |
0 |
cmb.setToolTipText(message); |
1111 |
|
} |
1112 |
|
else |
1113 |
|
{ |
1114 |
0 |
cmb.setToolTipText(""); |
1115 |
|
} |
1116 |
|
} |
1117 |
|
} |