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