Changed the case list panel on the left hand side

This commit is contained in:
U-BASIS\dsmyda 2019-03-19 09:16:27 -04:00
parent 141df2647c
commit fd688a21c5
4 changed files with 96 additions and 227 deletions

View File

@ -11,13 +11,11 @@ MultiCaseKeywordSearchPanel.keywordTextField.text_1=
MultiCaseKeywordSearchPanel.toolDescriptionTextArea.text=Perform a keyword search on the selected cases. The case can be opened to examine the results more closely. MultiCaseKeywordSearchPanel.toolDescriptionTextArea.text=Perform a keyword search on the selected cases. The case can be opened to examine the results more closely.
MultiCaseKeywordSearchPanel.casesLabel.text_1=Cases MultiCaseKeywordSearchPanel.casesLabel.text_1=Cases
MultiCaseKeywordSearchPanel.resultsLabel.text=Results MultiCaseKeywordSearchPanel.resultsLabel.text=Results
MultiCaseKeywordSearchPanel.uncheckButton.text=Uncheck All
MultiCaseKeywordSearchPanel.checkButton.text=Check All
MultiCaseKeywordSearchPanel.searchButton.text=Search MultiCaseKeywordSearchPanel.searchButton.text=Search
MultiCaseKeywordSearchPanel.viewErrorsButton.text=View Errors MultiCaseKeywordSearchPanel.viewErrorsButton.text=View Errors
MultiCaseKeywordSearchPanel.warningLabel.text= MultiCaseKeywordSearchPanel.warningLabel.text=
MultiCaseKeywordSearchPanel.exportButton.text=Export Results MultiCaseKeywordSearchPanel.exportButton.text=Export Results
MultiCaseKeywordSearchPanel.cancelButton.text=Cancel MultiCaseKeywordSearchPanel.cancelButton.text=Cancel
MultiCaseKeywordSearchPanel.resultsCountLabel.text= MultiCaseKeywordSearchPanel.resultsCountLabel.text=
MultiCaseKeywordSearchPanel.pickCasesButton.text_1=Pick Cases MultiCaseKeywordSearchPanel.pickCasesButton.text_1=Add Cases
SelectMultiUserCasesPanel.refreshButton.text=Refresh SelectMultiUserCasesPanel.refreshButton.text=Refresh

View File

@ -92,13 +92,11 @@ MultiCaseKeywordSearchPanel.keywordTextField.text_1=
MultiCaseKeywordSearchPanel.toolDescriptionTextArea.text=Perform a keyword search on the selected cases. The case can be opened to examine the results more closely. MultiCaseKeywordSearchPanel.toolDescriptionTextArea.text=Perform a keyword search on the selected cases. The case can be opened to examine the results more closely.
MultiCaseKeywordSearchPanel.casesLabel.text_1=Cases MultiCaseKeywordSearchPanel.casesLabel.text_1=Cases
MultiCaseKeywordSearchPanel.resultsLabel.text=Results MultiCaseKeywordSearchPanel.resultsLabel.text=Results
MultiCaseKeywordSearchPanel.uncheckButton.text=Uncheck All
MultiCaseKeywordSearchPanel.checkButton.text=Check All
MultiCaseKeywordSearchPanel.searchButton.text=Search MultiCaseKeywordSearchPanel.searchButton.text=Search
MultiCaseKeywordSearchPanel.viewErrorsButton.text=View Errors MultiCaseKeywordSearchPanel.viewErrorsButton.text=View Errors
MultiCaseKeywordSearchPanel.warningLabel.text= MultiCaseKeywordSearchPanel.warningLabel.text=
MultiCaseKeywordSearchPanel.exportButton.text=Export Results MultiCaseKeywordSearchPanel.exportButton.text=Export Results
MultiCaseKeywordSearchPanel.cancelButton.text=Cancel MultiCaseKeywordSearchPanel.cancelButton.text=Cancel
MultiCaseKeywordSearchPanel.resultsCountLabel.text= MultiCaseKeywordSearchPanel.resultsCountLabel.text=
MultiCaseKeywordSearchPanel.pickCasesButton.text_1=Pick Cases MultiCaseKeywordSearchPanel.pickCasesButton.text_1=Add Cases
SelectMultiUserCasesPanel.refreshButton.text=Refresh SelectMultiUserCasesPanel.refreshButton.text=Refresh

View File

@ -39,29 +39,22 @@
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="regexRadioButton" min="-2" max="-2" attributes="0"/> <Component id="regexRadioButton" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<Component id="keywordTextField" pref="679" max="32767" attributes="0"/> <Component id="keywordTextField" pref="591" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="toolDescriptionScrollPane" min="-2" pref="295" max="-2" attributes="0"/> <Component id="toolDescriptionScrollPane" min="-2" pref="295" max="-2" attributes="0"/>
</Group> </Group>
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="casesLabel" min="-2" max="-2" attributes="0"/> <Component id="casesLabel" min="-2" max="-2" attributes="0"/>
<Component id="casesScrollPane" min="-2" max="-2" attributes="0"/> <Component id="jScrollPane1" min="-2" pref="174" max="-2" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Component id="pickCasesButton" min="-2" pref="84" max="-2" attributes="0"/>
<Component id="searchButton" min="-2" max="-2" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <Component id="searchButton" min="-2" max="-2" attributes="0"/>
<Component id="pickCasesButton" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="uncheckButton" linkSize="5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="checkButton" linkSize="5" max="32767" attributes="0"/>
</Group>
</Group> </Group>
</Group> </Group>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Component id="resultsLabel" min="-2" pref="154" max="-2" attributes="0"/> <Component id="resultsLabel" min="-2" pref="154" max="-2" attributes="0"/>
@ -72,7 +65,7 @@
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="viewErrorsButton" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="viewErrorsButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="warningLabel" alignment="0" pref="695" max="32767" attributes="0"/> <Component id="warningLabel" alignment="0" pref="607" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/> <EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0"> <Group type="103" groupAlignment="0" max="-2" attributes="0">
@ -88,7 +81,7 @@
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0"> <Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="196" max="-2" attributes="0"/> <EmptySpace min="-2" pref="196" max="-2" attributes="0"/>
<Component id="searchProgressBar" pref="769" max="32767" attributes="0"/> <Component id="searchProgressBar" pref="608" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="108" max="-2" attributes="0"/> <EmptySpace min="-2" pref="108" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
@ -122,25 +115,21 @@
</Group> </Group>
<EmptySpace min="-2" max="-2" attributes="0"/> <EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="resultsScrollPane" max="32767" attributes="0"/> <Component id="resultsScrollPane" pref="281" max="32767" attributes="0"/>
<Component id="casesScrollPane" max="32767" attributes="0"/> <Component id="jScrollPane1" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="uncheckButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="checkButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="warningLabel" min="-2" pref="15" max="-2" attributes="0"/> <Component id="warningLabel" min="-2" pref="15" max="-2" attributes="0"/>
<Component id="exportButton" min="-2" max="-2" attributes="0"/> <Component id="exportButton" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="pickCasesButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="searchButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0"> <Component id="viewErrorsButton" min="-2" max="-2" attributes="0"/>
<Component id="searchButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="viewErrorsButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="pickCasesButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="cancelButton" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="cancelButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
@ -232,31 +221,6 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Container class="javax.swing.JScrollPane" name="casesScrollPane">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[174, 281]"/>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="casesPanel">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[152, 197]"/>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
<Property name="axis" type="int" value="1"/>
</Layout>
</Container>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="casesLabel"> <Component class="javax.swing.JLabel" name="casesLabel">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@ -271,47 +235,6 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JButton" name="uncheckButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/multicase/Bundle.properties" key="MultiCaseKeywordSearchPanel.uncheckButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[2, 6, 2, 6]"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[84, 23]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[84, 23]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[84, 23]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="uncheckButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="checkButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/multicase/Bundle.properties" key="MultiCaseKeywordSearchPanel.checkButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[84, 23]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[84, 23]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[84, 23]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="checkButtonActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JScrollPane" name="toolDescriptionScrollPane"> <Container class="javax.swing.JScrollPane" name="toolDescriptionScrollPane">
<AuxValues> <AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
@ -428,5 +351,24 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="pickCasesButtonActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="pickCasesButtonActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="caseSelectionList">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="0"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
</SubComponents> </SubComponents>
</Form> </Form>

View File

@ -30,6 +30,7 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -38,11 +39,14 @@ import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.swing.AbstractButton; import javax.swing.AbstractButton;
import javax.swing.DefaultListModel;
import javax.swing.DefaultListSelectionModel;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
import javax.swing.table.TableColumn; import javax.swing.table.TableColumn;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.ListModel;
import javax.swing.ListSelectionModel; import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
@ -117,6 +121,14 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
outline.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); outline.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
caseNameToCaseDataMap = new HashMap<>(); caseNameToCaseDataMap = new HashMap<>();
setColumnWidths(); setColumnWidths();
//Disable selection in JList
caseSelectionList.setSelectionModel(new DefaultListSelectionModel() {
@Override
public void setSelectionInterval(int index0, int index1) {
super.setSelectionInterval(-1, -1);
}
});
} }
/** /**
@ -237,30 +249,27 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
* Get the list of cases from the Multi user case browser * Get the list of cases from the Multi user case browser
*/ */
private void populateCasesList(List<CaseNodeData> selectedNodes) { private void populateCasesList(List<CaseNodeData> selectedNodes) {
Collection<String> disabledCases = getCases(false); caseSelectionList.removeAll();
casesPanel.removeAll(); caseSelectionList.revalidate();
casesPanel.revalidate(); caseSelectionList.repaint();
casesPanel.repaint();
caseNameToCaseDataMap.clear(); caseNameToCaseDataMap.clear();
int casePanelWidth = casesPanel.getPreferredSize().width; DefaultListModel<String> listModel = new DefaultListModel<>();
int heightOfAllRows = 0; Collections.sort(selectedNodes, (CaseNodeData o1, CaseNodeData o2) -> {
for (CaseNodeData data : selectedNodes) { return o1.getName().toLowerCase()
//select all new cases and cases which were previously selected .compareTo(o2.getName().toLowerCase());
});
for (int i = 0; i < selectedNodes.size(); i++) {
CaseNodeData data = selectedNodes.get(i);
String multiUserCaseName = data.getName(); String multiUserCaseName = data.getName();
listModel.addElement(multiUserCaseName);
/**
* Map out the name to CaseNodeData so we can retrieve it later for
* search.
*/
caseNameToCaseDataMap.put(multiUserCaseName, data); caseNameToCaseDataMap.put(multiUserCaseName, data);
boolean isSelected = true;
if (disabledCases.contains(multiUserCaseName)) {
isSelected = false;
}
JCheckBox caseCheckBox = new JCheckBox(multiUserCaseName, isSelected);
caseCheckBox.setBackground(Color.white);
if (casePanelWidth < caseCheckBox.getPreferredSize().width) {
casePanelWidth = caseCheckBox.getPreferredSize().width;
}
heightOfAllRows += caseCheckBox.getPreferredSize().height;
casesPanel.add(caseCheckBox);
} }
casesPanel.setPreferredSize(new Dimension(casePanelWidth, heightOfAllRows)); caseSelectionList.setModel(listModel);
} }
@Override @Override
@ -283,12 +292,8 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
keywordTextField = new javax.swing.JTextField(); keywordTextField = new javax.swing.JTextField();
exactRadioButton = new javax.swing.JRadioButton(); exactRadioButton = new javax.swing.JRadioButton();
regexRadioButton = new javax.swing.JRadioButton(); regexRadioButton = new javax.swing.JRadioButton();
casesScrollPane = new javax.swing.JScrollPane();
casesPanel = new javax.swing.JPanel();
casesLabel = new javax.swing.JLabel(); casesLabel = new javax.swing.JLabel();
resultsLabel = new javax.swing.JLabel(); resultsLabel = new javax.swing.JLabel();
uncheckButton = new javax.swing.JButton();
checkButton = new javax.swing.JButton();
toolDescriptionScrollPane = new javax.swing.JScrollPane(); toolDescriptionScrollPane = new javax.swing.JScrollPane();
toolDescriptionTextArea = new javax.swing.JTextArea(); toolDescriptionTextArea = new javax.swing.JTextArea();
resultsScrollPane = new javax.swing.JScrollPane(); resultsScrollPane = new javax.swing.JScrollPane();
@ -299,6 +304,8 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
resultsCountLabel = new javax.swing.JLabel(); resultsCountLabel = new javax.swing.JLabel();
viewErrorsButton = new javax.swing.JButton(); viewErrorsButton = new javax.swing.JButton();
pickCasesButton = new javax.swing.JButton(); pickCasesButton = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
caseSelectionList = new javax.swing.JList<>();
setName(""); // NOI18N setName(""); // NOI18N
setOpaque(false); setOpaque(false);
@ -335,38 +342,10 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
searchTypeGroup.add(regexRadioButton); searchTypeGroup.add(regexRadioButton);
org.openide.awt.Mnemonics.setLocalizedText(regexRadioButton, org.openide.util.NbBundle.getMessage(MultiCaseKeywordSearchPanel.class, "MultiCaseKeywordSearchPanel.regexRadioButton.text_1")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(regexRadioButton, org.openide.util.NbBundle.getMessage(MultiCaseKeywordSearchPanel.class, "MultiCaseKeywordSearchPanel.regexRadioButton.text_1")); // NOI18N
casesScrollPane.setPreferredSize(new java.awt.Dimension(174, 281));
casesPanel.setBackground(new java.awt.Color(255, 255, 255));
casesPanel.setPreferredSize(new java.awt.Dimension(152, 197));
casesPanel.setLayout(new javax.swing.BoxLayout(casesPanel, javax.swing.BoxLayout.Y_AXIS));
casesScrollPane.setViewportView(casesPanel);
org.openide.awt.Mnemonics.setLocalizedText(casesLabel, org.openide.util.NbBundle.getMessage(MultiCaseKeywordSearchPanel.class, "MultiCaseKeywordSearchPanel.casesLabel.text_1")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(casesLabel, org.openide.util.NbBundle.getMessage(MultiCaseKeywordSearchPanel.class, "MultiCaseKeywordSearchPanel.casesLabel.text_1")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(resultsLabel, org.openide.util.NbBundle.getMessage(MultiCaseKeywordSearchPanel.class, "MultiCaseKeywordSearchPanel.resultsLabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(resultsLabel, org.openide.util.NbBundle.getMessage(MultiCaseKeywordSearchPanel.class, "MultiCaseKeywordSearchPanel.resultsLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(uncheckButton, org.openide.util.NbBundle.getMessage(MultiCaseKeywordSearchPanel.class, "MultiCaseKeywordSearchPanel.uncheckButton.text")); // NOI18N
uncheckButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
uncheckButton.setMaximumSize(new java.awt.Dimension(84, 23));
uncheckButton.setMinimumSize(new java.awt.Dimension(84, 23));
uncheckButton.setPreferredSize(new java.awt.Dimension(84, 23));
uncheckButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
uncheckButtonActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(checkButton, org.openide.util.NbBundle.getMessage(MultiCaseKeywordSearchPanel.class, "MultiCaseKeywordSearchPanel.checkButton.text")); // NOI18N
checkButton.setMaximumSize(new java.awt.Dimension(84, 23));
checkButton.setMinimumSize(new java.awt.Dimension(84, 23));
checkButton.setPreferredSize(new java.awt.Dimension(84, 23));
checkButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
checkButtonActionPerformed(evt);
}
});
toolDescriptionTextArea.setEditable(false); toolDescriptionTextArea.setEditable(false);
toolDescriptionTextArea.setBackground(new java.awt.Color(240, 240, 240)); toolDescriptionTextArea.setBackground(new java.awt.Color(240, 240, 240));
toolDescriptionTextArea.setColumns(20); toolDescriptionTextArea.setColumns(20);
@ -423,6 +402,8 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
} }
}); });
jScrollPane1.setViewportView(caseSelectionList);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
@ -438,22 +419,17 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
.addComponent(substringRadioButton) .addComponent(substringRadioButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(regexRadioButton)) .addComponent(regexRadioButton))
.addComponent(keywordTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 679, Short.MAX_VALUE)) .addComponent(keywordTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 591, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(toolDescriptionScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(toolDescriptionScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(casesLabel) .addComponent(casesLabel)
.addComponent(casesScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(layout.createSequentialGroup()
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(pickCasesButton, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(searchButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(searchButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(pickCasesButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(uncheckButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(checkButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
@ -464,7 +440,7 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(viewErrorsButton) .addComponent(viewErrorsButton)
.addComponent(warningLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 695, Short.MAX_VALUE)) .addComponent(warningLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 607, Short.MAX_VALUE))
.addGap(14, 14, 14) .addGap(14, 14, 14)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(exportButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(exportButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
@ -473,12 +449,9 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGap(196, 196, 196) .addGap(196, 196, 196)
.addComponent(searchProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE, 769, Short.MAX_VALUE) .addComponent(searchProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE, 608, Short.MAX_VALUE)
.addGap(108, 108, 108))) .addGap(108, 108, 108)))
); );
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {checkButton, uncheckButton});
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
@ -501,21 +474,18 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
.addComponent(resultsCountLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(resultsCountLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(resultsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(resultsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 281, Short.MAX_VALUE)
.addComponent(casesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(jScrollPane1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(uncheckButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(checkButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(warningLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(warningLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(exportButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(exportButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(pickCasesButton)
.addComponent(searchButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(viewErrorsButton)
.addComponent(searchButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(viewErrorsButton)
.addComponent(pickCasesButton))
.addComponent(cancelButton)) .addComponent(cancelButton))
.addContainerGap()) .addContainerGap())
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -536,7 +506,7 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
*/ */
private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchButtonActionPerformed private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchButtonActionPerformed
if (null == searchThread) { if (null == searchThread) {
Collection<String> cases = getCases(true); Collection<String> cases = getCases();
String searchString = keywordTextField.getText(); String searchString = keywordTextField.getText();
if (cases.isEmpty()) { if (cases.isEmpty()) {
warningLabel.setText(Bundle.MultiCaseKeywordSearchPanel_warningText_noCases()); warningLabel.setText(Bundle.MultiCaseKeywordSearchPanel_warningText_noCases());
@ -566,21 +536,16 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
}//GEN-LAST:event_searchButtonActionPerformed }//GEN-LAST:event_searchButtonActionPerformed
/** /**
* Get the cases which match the selected status specified by isSelected. * Get the case names from the Case List
*
* @param isSelected true to get selected cases false to get unselected
* cases
* *
* @return cases the cases that match the selected status of isSelected * @return cases the cases that match the selected status of isSelected
*/ */
private Collection<String> getCases(boolean isSelected) { private Collection<String> getCases() {
Collection<String> cases = new HashSet<>(); Collection<String> cases = new HashSet<>();
for (Component comp : casesPanel.getComponents()) { ListModel listModel = caseSelectionList.getModel();
if (comp instanceof JCheckBox) { for(int i = 0; i < listModel.getSize(); i++) {
if (((AbstractButton) comp).isSelected() == isSelected) { String caseName = (String) listModel.getElementAt(i);
cases.add(((AbstractButton) comp).getText()); cases.add(caseName);
}
}
} }
return cases; return cases;
} }
@ -637,24 +602,6 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
resultsScrollPane.setPreferredSize(new Dimension(outline.getPreferredSize().width, resultsScrollPane.getPreferredSize().height)); resultsScrollPane.setPreferredSize(new Dimension(outline.getPreferredSize().width, resultsScrollPane.getPreferredSize().height));
} }
/**
* Un-select all check boxes in the cases list
*
* @param evt ignored
*/
private void uncheckButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uncheckButtonActionPerformed
allCheckboxesSetSelected(false);
}//GEN-LAST:event_uncheckButtonActionPerformed
/**
* Select all check boxes in the cases list
*
* @param evt ignored
*/
private void checkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkButtonActionPerformed
allCheckboxesSetSelected(true);
}//GEN-LAST:event_checkButtonActionPerformed
/** /**
* Cancel the current multi-case search which is being performed. * Cancel the current multi-case search which is being performed.
* *
@ -811,20 +758,6 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
} }
} }
/**
* Set the selected status of all checkboxes.
*
* @param selected true if all checkboxes should be selected, false if no
* check boxes should be selected.
*/
private void allCheckboxesSetSelected(boolean selected) {
for (Component comp : casesPanel.getComponents()) {
if (comp instanceof JCheckBox) {
((AbstractButton) comp).setSelected(selected);
}
}
}
/** /**
* Ask the user if they want to continue their search while this window is * Ask the user if they want to continue their search while this window is
* closed. Cancels the current search if they select no. * closed. Cancels the current search if they select no.
@ -849,12 +782,11 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton cancelButton; private javax.swing.JButton cancelButton;
private javax.swing.JList<String> caseSelectionList;
private javax.swing.JLabel casesLabel; private javax.swing.JLabel casesLabel;
private javax.swing.JPanel casesPanel;
private javax.swing.JScrollPane casesScrollPane;
private javax.swing.JButton checkButton;
private javax.swing.JRadioButton exactRadioButton; private javax.swing.JRadioButton exactRadioButton;
private javax.swing.JButton exportButton; private javax.swing.JButton exportButton;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField keywordTextField; private javax.swing.JTextField keywordTextField;
private javax.swing.JButton pickCasesButton; private javax.swing.JButton pickCasesButton;
private javax.swing.JRadioButton regexRadioButton; private javax.swing.JRadioButton regexRadioButton;
@ -867,7 +799,6 @@ final class MultiCaseKeywordSearchPanel extends javax.swing.JPanel implements Ex
private javax.swing.JRadioButton substringRadioButton; private javax.swing.JRadioButton substringRadioButton;
private javax.swing.JScrollPane toolDescriptionScrollPane; private javax.swing.JScrollPane toolDescriptionScrollPane;
private javax.swing.JTextArea toolDescriptionTextArea; private javax.swing.JTextArea toolDescriptionTextArea;
private javax.swing.JButton uncheckButton;
private javax.swing.JButton viewErrorsButton; private javax.swing.JButton viewErrorsButton;
private javax.swing.JLabel warningLabel; private javax.swing.JLabel warningLabel;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables