Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
DropdownListSearchPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2022 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.keywordsearch;
20 
21 import java.awt.Component;
22 import java.awt.Cursor;
23 import java.awt.EventQueue;
24 import java.awt.event.ActionEvent;
25 import java.awt.event.ActionListener;
26 import java.beans.PropertyChangeEvent;
27 import java.beans.PropertyChangeListener;
28 import java.util.ArrayList;
29 import java.util.HashSet;
30 import java.util.Iterator;
31 import java.util.List;
32 import java.util.Set;
33 import javax.swing.JCheckBox;
34 import javax.swing.JTable;
35 import javax.swing.ListSelectionModel;
36 import javax.swing.event.ListSelectionEvent;
37 import javax.swing.event.ListSelectionListener;
38 import javax.swing.table.AbstractTableModel;
39 import javax.swing.table.TableCellRenderer;
40 import javax.swing.table.TableColumn;
41 import org.openide.util.NbBundle;
42 import org.openide.util.actions.SystemAction;
46 
51 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
52 class DropdownListSearchPanel extends AdHocSearchPanel {
53 
54  private static final Logger logger = Logger.getLogger(DropdownListSearchPanel.class.getName());
55  private static DropdownListSearchPanel instance;
56  private XmlKeywordSearchList loader;
57  private final KeywordListsTableModel listsTableModel;
58  private final KeywordsTableModel keywordsTableModel;
59  private ActionListener searchAddListener;
60  private boolean ingestRunning;
61 
65  private DropdownListSearchPanel() {
66  listsTableModel = new KeywordListsTableModel();
67  keywordsTableModel = new KeywordsTableModel();
68  initComponents();
69  customizeComponents();
70  dataSourceList.setModel(getDataSourceListModel());
71 
72  dataSourceList.addListSelectionListener((ListSelectionEvent evt) -> {
73  firePropertyChange(Bundle.DropdownSingleTermSearchPanel_selected(), null, null);
74  });
75  }
76 
77  static synchronized DropdownListSearchPanel getDefault() {
78  if (instance == null) {
79  instance = new DropdownListSearchPanel();
80  }
81  return instance;
82  }
83 
84  private void customizeComponents() {
85  listsTable.setTableHeader(null);
86  listsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
87  //customize column witdhs
88  final int leftWidth = leftPane.getPreferredSize().width;
89  TableColumn column;
90  for (int i = 0; i < listsTable.getColumnCount(); i++) {
91  column = listsTable.getColumnModel().getColumn(i);
92  if (i == 0) {
93  column.setPreferredWidth(((int) (leftWidth * 0.10)));
94  column.setCellRenderer(new LeftCheckBoxRenderer());
95  } else {
96  column.setPreferredWidth(((int) (leftWidth * 0.89)));
97  column.setCellRenderer(new SimpleTableCellRenderer());
98  }
99  }
100  final int rightWidth = rightPane.getPreferredSize().width;
101  for (int i = 0; i < keywordsTable.getColumnCount(); i++) {
102  column = keywordsTable.getColumnModel().getColumn(i);
103  if (i == 0) {
104  column.setPreferredWidth(((int) (rightWidth * 0.60)));
105  } else {
106  column.setPreferredWidth(((int) (rightWidth * 0.38)));
107  }
108  }
109  keywordsTable.setDefaultRenderer(String.class, new SimpleTableCellRenderer());
110 
111  loader = XmlKeywordSearchList.getCurrent();
112  listsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
113  @Override
114  public void valueChanged(ListSelectionEvent e) {
115  ListSelectionModel listSelectionModel = (ListSelectionModel) e.getSource();
116  if (!listSelectionModel.isSelectionEmpty()) {
117  int index = listSelectionModel.getMinSelectionIndex();
118  KeywordList list = listsTableModel.getListAt(index);
119  keywordsTableModel.resync(list);
120  } else {
121  keywordsTableModel.deleteAll();
122  }
123  }
124  });
125 
126  ingestRunning = IngestManager.getInstance().isIngestRunning();
127  updateComponents();
128 
129  IngestManager.getInstance().addIngestJobEventListener(new PropertyChangeListener() {
130  @Override
131  public void propertyChange(PropertyChangeEvent evt) {
132  Object source = evt.getSource();
133  if (source instanceof String && ((String) source).equals("LOCAL")) { //NON-NLS
134  EventQueue.invokeLater(() -> {
135  ingestRunning = IngestManager.getInstance().isIngestRunning();
136  updateComponents();
137  });
138  }
139  }
140  });
141 
142  searchAddListener = new ActionListener() {
143  @Override
144  public void actionPerformed(ActionEvent e) {
145  if (!ingestRunning) {
146  searchAction(e);
147  }
148  }
149  };
150 
151  searchAddButton.addActionListener(searchAddListener);
152  }
153 
154  private void updateComponents() {
155  ingestRunning = IngestManager.getInstance().isIngestRunning();
156  if (ingestRunning) {
157  searchAddButton.setText(NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.addIngestTitle"));
158  searchAddButton.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.addIngestMsg"));
159 
160  } else {
161  searchAddButton.setText(NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.searchIngestTitle"));
162  searchAddButton.setToolTipText(NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.addIdxSearchMsg"));
163  }
164  listsTableModel.resync();
165  updateIngestIndexLabel();
166 
167  jSaveSearchResults.setSelected(true);
168  }
169 
170  private void updateIngestIndexLabel() {
171  if (ingestRunning) {
172  ingestIndexLabel.setText(NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.ongoingIngestMsg", filesIndexed));
173  } else {
174  ingestIndexLabel.setText(NbBundle.getMessage(this.getClass(), "KeywordSearchListsViewerPanel.initIngest.fileIndexCtMsg", filesIndexed));
175  }
176  }
177 
178  @Override
179  protected void postFilesIndexedChange() {
180  updateIngestIndexLabel();
181  }
182 
186  void resync() {
187  listsTableModel.resync();
188  }
189 
195  @SuppressWarnings("unchecked")
196  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
197  private void initComponents() {
198 
199  jSplitPane1 = new javax.swing.JSplitPane();
200  leftPane = new javax.swing.JScrollPane();
201  listsTable = new javax.swing.JTable();
202  rightPane = new javax.swing.JScrollPane();
203  keywordsTable = new javax.swing.JTable();
204  manageListsButton = new javax.swing.JButton();
205  searchAddButton = new javax.swing.JButton();
206  ingestIndexLabel = new javax.swing.JLabel();
207  dataSourceCheckBox = new javax.swing.JCheckBox();
208  jScrollPane1 = new javax.swing.JScrollPane();
209  dataSourceList = new javax.swing.JList<>();
210  jSaveSearchResults = new javax.swing.JCheckBox();
211 
212  leftPane.setMinimumSize(new java.awt.Dimension(150, 23));
213  leftPane.setOpaque(false);
214 
215  listsTable.setBackground(new java.awt.Color(240, 240, 240));
216  listsTable.setModel(listsTableModel);
217  listsTable.setShowHorizontalLines(false);
218  listsTable.setShowVerticalLines(false);
219  listsTable.getTableHeader().setReorderingAllowed(false);
220  leftPane.setViewportView(listsTable);
221 
222  jSplitPane1.setLeftComponent(leftPane);
223 
224  rightPane.setOpaque(false);
225 
226  keywordsTable.setBackground(new java.awt.Color(240, 240, 240));
227  keywordsTable.setModel(keywordsTableModel);
228  keywordsTable.setGridColor(new java.awt.Color(153, 153, 153));
229  rightPane.setViewportView(keywordsTable);
230 
231  jSplitPane1.setRightComponent(rightPane);
232 
233  manageListsButton.setText(org.openide.util.NbBundle.getMessage(DropdownListSearchPanel.class, "KeywordSearchListsViewerPanel.manageListsButton.text")); // NOI18N
234  manageListsButton.setToolTipText(org.openide.util.NbBundle.getMessage(DropdownListSearchPanel.class, "KeywordSearchListsViewerPanel.manageListsButton.toolTipText")); // NOI18N
235  manageListsButton.addActionListener(new java.awt.event.ActionListener() {
236  public void actionPerformed(java.awt.event.ActionEvent evt) {
237  manageListsButtonActionPerformed(evt);
238  }
239  });
240 
241  searchAddButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/search-icon.png"))); // NOI18N
242  searchAddButton.setText(org.openide.util.NbBundle.getMessage(DropdownListSearchPanel.class, "KeywordSearchListsViewerPanel.searchAddButton.text")); // NOI18N
243  searchAddButton.addActionListener(new java.awt.event.ActionListener() {
244  public void actionPerformed(java.awt.event.ActionEvent evt) {
245  searchAddButtonActionPerformed(evt);
246  }
247  });
248 
249  ingestIndexLabel.setFont(ingestIndexLabel.getFont().deriveFont(ingestIndexLabel.getFont().getSize()-1f));
250  ingestIndexLabel.setText(org.openide.util.NbBundle.getMessage(DropdownListSearchPanel.class, "KeywordSearchListsViewerPanel.ingestIndexLabel.text")); // NOI18N
251 
252  dataSourceCheckBox.setText(org.openide.util.NbBundle.getMessage(DropdownListSearchPanel.class, "DropdownListSearchPanel.dataSourceCheckBox.text")); // NOI18N
253  dataSourceCheckBox.addActionListener(new java.awt.event.ActionListener() {
254  public void actionPerformed(java.awt.event.ActionEvent evt) {
255  dataSourceCheckBoxActionPerformed(evt);
256  }
257  });
258 
259  dataSourceList.setMinimumSize(new java.awt.Dimension(0, 200));
260  jScrollPane1.setViewportView(dataSourceList);
261 
262  jSaveSearchResults.setText(org.openide.util.NbBundle.getMessage(DropdownListSearchPanel.class, "DropdownListSearchPanel.jSaveSearchResults.text")); // NOI18N
263  jSaveSearchResults.setToolTipText(org.openide.util.NbBundle.getMessage(DropdownListSearchPanel.class, "DropdownListSearchPanel.jSaveSearchResults.toolTipText")); // NOI18N
264 
265  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
266  this.setLayout(layout);
267  layout.setHorizontalGroup(
268  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
269  .addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
270  .addComponent(jScrollPane1)
271  .addGroup(layout.createSequentialGroup()
272  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
273  .addComponent(dataSourceCheckBox)
274  .addComponent(jSaveSearchResults)
275  .addGroup(layout.createSequentialGroup()
276  .addComponent(searchAddButton)
277  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
278  .addComponent(manageListsButton)
279  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
280  .addComponent(ingestIndexLabel)))
281  .addGap(0, 120, Short.MAX_VALUE))
282  );
283 
284  layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {manageListsButton, searchAddButton});
285 
286  layout.setVerticalGroup(
287  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
288  .addGroup(layout.createSequentialGroup()
289  .addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE)
290  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
291  .addComponent(dataSourceCheckBox)
292  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
293  .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
294  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
295  .addComponent(jSaveSearchResults)
296  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
297  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
298  .addComponent(manageListsButton)
299  .addComponent(searchAddButton)
300  .addComponent(ingestIndexLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE))
301  .addGap(23, 23, 23))
302  );
303  }// </editor-fold>//GEN-END:initComponents
304 
305  private void manageListsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageListsButtonActionPerformed
306  SystemAction.get(KeywordSearchConfigurationAction.class).performAction();
307  }//GEN-LAST:event_manageListsButtonActionPerformed
308 
309  private void dataSourceCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataSourceCheckBoxActionPerformed
310  updateDataSourceListModel();
311  }//GEN-LAST:event_dataSourceCheckBoxActionPerformed
312 
313  private void searchAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchAddButtonActionPerformed
314  // TODO add your handling code here:
315  }//GEN-LAST:event_searchAddButtonActionPerformed
316 
317  // Variables declaration - do not modify//GEN-BEGIN:variables
318  private javax.swing.JCheckBox dataSourceCheckBox;
319  private javax.swing.JList<String> dataSourceList;
320  private javax.swing.JLabel ingestIndexLabel;
321  private javax.swing.JCheckBox jSaveSearchResults;
322  private javax.swing.JScrollPane jScrollPane1;
323  private javax.swing.JSplitPane jSplitPane1;
324  private javax.swing.JTable keywordsTable;
325  private javax.swing.JScrollPane leftPane;
326  private javax.swing.JTable listsTable;
327  private javax.swing.JButton manageListsButton;
328  private javax.swing.JScrollPane rightPane;
329  private javax.swing.JButton searchAddButton;
330  // End of variables declaration//GEN-END:variables
331 
332  private void searchAction(ActionEvent e) {
333  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
334 
335  try {
336  search(jSaveSearchResults.isSelected());
337  } finally {
338  setCursor(null);
339  }
340  }
341 
342  @Override
343  List<KeywordList> getKeywordLists() {
344  return listsTableModel.getSelectedListsL();
345  }
346 
347  void addSearchButtonActionListener(ActionListener al) {
348  searchAddButton.addActionListener(al);
349  }
350 
355  @Override
356  Set<Long> getDataSourcesSelected() {
357  Set<Long> dataSourceObjIdSet = new HashSet<>();
358  for (Long key : getDataSourceMap().keySet()) {
359  String value = getDataSourceMap().get(key);
360  for (String dataSource : this.dataSourceList.getSelectedValuesList()) {
361  if (value.equals(dataSource)) {
362  dataSourceObjIdSet.add(key);
363  }
364  }
365  }
366  return dataSourceObjIdSet;
367  }
368 
369  private class KeywordListsTableModel extends AbstractTableModel {
370  //data
371 
372  private final XmlKeywordSearchList listsHandle = XmlKeywordSearchList.getCurrent();
373  private final List<ListTableEntry> listData = new ArrayList<>();
374 
375  @Override
376  public int getColumnCount() {
377  return 2;
378  }
379 
380  @Override
381  public int getRowCount() {
382  return listData.size();
383  }
384 
385  @Override
386  public String getColumnName(int column) {
387  String ret = null;
388  switch (column) {
389  case 0:
390  ret = NbBundle.getMessage(this.getClass(), "KeywordSearch.selectedColLbl");
391  break;
392  case 1:
393  ret = NbBundle.getMessage(this.getClass(), "KeywordSearch.nameColLbl");
394  break;
395  default:
396  break;
397  }
398  return ret;
399  }
400 
401  @Override
402  public Object getValueAt(int rowIndex, int columnIndex) {
403  Object ret = null;
404  ListTableEntry entry = null;
405  //iterate until row
406  Iterator<ListTableEntry> it = listData.iterator();
407  for (int i = 0; i <= rowIndex; ++i) {
408  entry = it.next();
409  }
410  if (null != entry) {
411  switch (columnIndex) {
412  case 0:
413  ret = (Object) entry.selected;
414  break;
415  case 1:
416  ret = (Object) entry.name;
417  break;
418  default:
419  break;
420  }
421  }
422  return ret;
423  }
424 
425  @Override
426  public boolean isCellEditable(int rowIndex, int columnIndex) {
427  return (columnIndex == 0 && !ingestRunning);
428  }
429 
430  @Override
431  public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
432  if (columnIndex == 0) {
433  ListTableEntry entry = null;
434  Iterator<ListTableEntry> it = listData.iterator();
435  for (int i = 0; i <= rowIndex; i++) {
436  entry = it.next();
437  }
438  if (entry != null) {
439  entry.selected = (Boolean) aValue;
440  if (ingestRunning) {
441  //updateUseForIngest(getListAt(rowIndex), (Boolean) aValue);
442  }
443  }
444 
445  }
446  }
447 
448  @Override
449  public Class<?> getColumnClass(int c) {
450  return getValueAt(0, c).getClass();
451  }
452 
453  List<String> getAllLists() {
454  List<String> ret = new ArrayList<>();
455  for (ListTableEntry e : listData) {
456  ret.add(e.name);
457  }
458  return ret;
459  }
460 
461  KeywordList getListAt(int rowIndex) {
462  return listsHandle.getList((String) getValueAt(rowIndex, 1));
463  }
464 
465  List<String> getSelectedLists() {
466  List<String> ret = new ArrayList<>();
467  for (ListTableEntry e : listData) {
468  if (e.selected) {
469  ret.add(e.name);
470  }
471  }
472  return ret;
473  }
474 
475  List<KeywordList> getSelectedListsL() {
476  List<KeywordList> ret = new ArrayList<>();
477  for (String s : getSelectedLists()) {
478  ret.add(listsHandle.getList(s));
479  }
480  return ret;
481  }
482 
483  boolean listExists(String list) {
484  List<String> all = getAllLists();
485  return all.contains(list);
486  }
487 
488  //resync model from handle, then update table
489  void resync() {
490  listData.clear();
491  addLists(listsHandle.getListsL());
492  fireTableDataChanged();
493  }
494 
495  //add lists to the model
496  private void addLists(List<KeywordList> lists) {
497  for (KeywordList list : lists) {
498  if (!listExists(list.getName())) {
499  listData.add(new ListTableEntry(list, ingestRunning));
500  }
501  }
502  }
503 
504  //single model entry
505  private class ListTableEntry implements Comparable<ListTableEntry> {
506 
507  String name;
508  Boolean selected;
509 
510  ListTableEntry(KeywordList list, boolean ingestRunning) {
511  this.name = list.getName();
512  if (ingestRunning) {
513  this.selected = list.getUseForIngest();
514  } else {
515  this.selected = false;
516  }
517  }
518 
519  @Override
520  public int compareTo(ListTableEntry e) {
521  return this.name.compareTo(e.name);
522  }
523  }
524  }
525 
526  private class KeywordsTableModel extends AbstractTableModel {
527 
528  List<KeywordTableEntry> listData = new ArrayList<>();
529 
530  @Override
531  public int getRowCount() {
532  return listData.size();
533  }
534 
535  @Override
536  public int getColumnCount() {
537  return 2;
538  }
539 
540  @Override
541  public String getColumnName(int column) {
542  String ret = null;
543  switch (column) {
544  case 0:
545  ret = NbBundle.getMessage(this.getClass(), "KeywordSearch.nameColLbl");
546  break;
547  case 1:
548  ret = NbBundle.getMessage(this.getClass(), "KeywordSearch.typeColLbl");
549  break;
550  default:
551  break;
552  }
553  return ret;
554  }
555 
556  @Override
557  public Object getValueAt(int rowIndex, int columnIndex) {
558  Object ret = null;
559  KeywordTableEntry entry = null;
560  //iterate until row
561  Iterator<KeywordTableEntry> it = listData.iterator();
562  for (int i = 0; i <= rowIndex; ++i) {
563  entry = it.next();
564  }
565  if (null != entry) {
566  switch (columnIndex) {
567  case 0:
568  ret = (Object) entry.name;
569  break;
570  case 1:
571  ret = (Object) entry.keywordType;
572  break;
573  default:
574  break;
575  }
576  }
577  return ret;
578  }
579 
580  @Override
581  public boolean isCellEditable(int rowIndex, int columnIndex) {
582  return false;
583  }
584 
585  @Override
586  public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
587  }
588 
589  @Override
590  public Class<?> getColumnClass(int c) {
591  return getValueAt(0, c).getClass();
592  }
593 
594  void resync(KeywordList list) {
595  listData.clear();
596  for (Keyword k : list.getKeywords()) {
597  listData.add(new KeywordTableEntry(k));
598  }
599  fireTableDataChanged();
600  }
601 
602  void deleteAll() {
603  listData.clear();
604  fireTableDataChanged();
605  }
606 
607  //single model entry
608  private class KeywordTableEntry implements Comparable<KeywordTableEntry> {
609 
610  String name;
611  String keywordType;
612 
613  KeywordTableEntry(Keyword keyword) {
614  this.name = keyword.getSearchTerm();
615  this.keywordType = keyword.getSearchTermType();
616  }
617 
618  @Override
619  public int compareTo(KeywordTableEntry e) {
620  return this.name.compareTo(e.name);
621  }
622  }
623  }
624 
625  private class LeftCheckBoxRenderer extends JCheckBox implements TableCellRenderer {
626 
627  @Override
629  JTable table, Object value,
630  boolean isSelected, boolean hasFocus,
631  int row, int column) {
632 
633  this.setHorizontalAlignment(JCheckBox.CENTER);
634  this.setVerticalAlignment(JCheckBox.CENTER);
635 
636  setEnabled(!ingestRunning);
637 
638  boolean selected = (Boolean) table.getModel().getValueAt(row, 0);
639  setSelected(selected);
640 
641  if (isSelected) {
642  setBackground(listsTable.getSelectionBackground());
643  } else {
644  setBackground(listsTable.getBackground());
645  }
646 
647  return this;
648  }
649  }
650 
654  @NbBundle.Messages({"DropdownListSearchPanel.selected=Ad Hoc Search data source filter is selected"})
655  void updateDataSourceListModel() {
656  getDataSourceListModel().removeAllElements();
657  for (String dsName : getDataSourceArray()) {
658  getDataSourceListModel().addElement(dsName);
659  }
660  setComponentsEnabled();
661  firePropertyChange(Bundle.DropdownListSearchPanel_selected(), null, null);
662 
663  }
664 
668  private void setComponentsEnabled() {
669 
670  if (getDataSourceListModel().size() > 1) {
671  this.dataSourceCheckBox.setEnabled(true);
672 
673  boolean enabled = this.dataSourceCheckBox.isSelected();
674  this.dataSourceList.setEnabled(enabled);
675  if (enabled) {
676  this.dataSourceList.setSelectionInterval(0, this.dataSourceList.getModel().getSize()-1);
677  } else {
678  this.dataSourceList.setSelectedIndices(new int[0]);
679  }
680  } else {
681  this.dataSourceCheckBox.setEnabled(false);
682  this.dataSourceCheckBox.setSelected(false);
683  this.dataSourceList.setEnabled(false);
684  this.dataSourceList.setSelectedIndices(new int[0]);
685  }
686  }
687 
688 }
Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)

Copyright © 2012-2022 Basis Technology. Generated on: Wed Oct 5 2022
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.