diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties b/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties index 229d26af58..0dd66e8c59 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties @@ -1,13 +1,11 @@ OptionsCategory_Name_TagNamesOptions=Tags OptionsCategory_TagNames=TagNames Blackboard.unableToIndexArtifact.error.msg=Unable to index blackboard artifact {0} -NewUserTagNameDialog.title.text=New Tag Name -NewUserTagNameDialog.JOptionPane.tagNameIllegalCharacters.message=Tag name may not contain any of the following symbols\: \\ \: * ? " < > | , ; -NewUserTagNameDialog.JOptionPane.tagNameIllegalCharacters.title=Invalid character in tag name -TagNamesSettingsPanel.JOptionPane.tagNameAlreadyExists.message=The tag name already exists in your settings -TagNamesSettingsPanel.JOptionPane.tagNameAlreadyExists.title=Tag name already exists -NewUserTagNameDialog.JOptionPane.tagNameEmpty.message=The tag name cannot be empty -NewUserTagNameDialog.JOptionPane.tagNameEmpty.title=Empty tag name +NewTagNameDialog.title.text=New Tag Name +NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.message=Tag name may not contain any of the following symbols\: \\ \: * ? " < > | , ; +NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.title=Invalid character in tag name +NewTagNameDialog.JOptionPane.tagNameEmpty.message=The tag name cannot be empty +NewTagNameDialog.JOptionPane.tagNameEmpty.title=Empty tag name TagOptionsPanel.tagTypesListLabel.text=Tag Names: TagOptionsPanel.panelDescriptionLabel.text=Autopsy keeps a list of the tag names you have created in the past. Add more or delete them here. NewTagNameDialog.okButton.text=OK diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.java index fbb7594c44..ff21ac283b 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.java @@ -43,8 +43,8 @@ final class NewTagNameDialog extends javax.swing.JDialog { * Creates a new NewUserTagNameDialog dialog. */ NewTagNameDialog() { - super(new JFrame(NbBundle.getMessage(NewTagNameDialog.class, "NewUserTagNameDialog.title.text")), - NbBundle.getMessage(NewTagNameDialog.class, "NewUserTagNameDialog.title.text"), true); + super(new JFrame(NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.title.text")), + NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.title.text"), true); initComponents(); this.display(); } @@ -112,15 +112,15 @@ final class NewTagNameDialog extends javax.swing.JDialog { String newTagDisplayName = tagNameTextField.getText().trim(); if (newTagDisplayName.isEmpty()) { JOptionPane.showMessageDialog(null, - NbBundle.getMessage(NewTagNameDialog.class, "NewUserTagNameDialog.JOptionPane.tagNameEmpty.message"), - NbBundle.getMessage(NewTagNameDialog.class, "NewUserTagNameDialog.JOptionPane.tagNameEmpty.title"), + NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameEmpty.message"), + NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameEmpty.title"), JOptionPane.ERROR_MESSAGE); return; } if (TagsManager.containsIllegalCharacters(newTagDisplayName)) { JOptionPane.showMessageDialog(null, - NbBundle.getMessage(NewTagNameDialog.class, "NewUserTagNameDialog.JOptionPane.tagNameIllegalCharacters.message"), - NbBundle.getMessage(NewTagNameDialog.class, "NewUserTagNameDialog.JOptionPane.tagNameIllegalCharacters.title"), + NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.message"), + NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.title"), JOptionPane.ERROR_MESSAGE); return; } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/NewUserTagNameDialog.form b/Core/src/org/sleuthkit/autopsy/casemodule/services/NewUserTagNameDialog.form deleted file mode 100755 index 26ab153c27..0000000000 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/NewUserTagNameDialog.form +++ /dev/null @@ -1,98 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/NewUserTagNameDialog.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/NewUserTagNameDialog.java deleted file mode 100755 index bd04678ba9..0000000000 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/NewUserTagNameDialog.java +++ /dev/null @@ -1,246 +0,0 @@ -/* -* Autopsy Forensic Browser -* -* Copyright 2011-2016 Basis Technology Corp. -* Contact: carrier sleuthkit org -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. - */ -package org.sleuthkit.autopsy.casemodule.services; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import org.openide.util.NbBundle; - -class NewUserTagNameDialog extends javax.swing.JDialog { - - private String userTagDisplayName; - private BUTTON_PRESSED result; - - enum BUTTON_PRESSED { - OK, CANCEL; - } - - /** - * Creates a new NewUserTagNameDialog dialog. - */ - NewUserTagNameDialog() { - super(new JFrame(NbBundle.getMessage(NewUserTagNameDialog.class, "NewUserTagNameDialog.title.text")), - NbBundle.getMessage(NewUserTagNameDialog.class, "NewUserTagNameDialog.title.text"), true); - initComponents(); - this.display(); - } - - /** - * Sets display settings for the dialog and adds appropriate listeners. - */ - private void display() { - setLayout(new BorderLayout()); - - /* - * Center the dialog - */ - Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); - int width = this.getSize().width; - int height = this.getSize().height; - setLocation((screenDimension.width - width) / 2, (screenDimension.height - height) / 2); - - /* - * Add a handler for when the dialog window is closed directly. - */ - this.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - doButtonAction(false); - } - }); - - /* - * Add a listener to enable the OK button when the text field changes. - */ - tagNameTextField.getDocument().addDocumentListener(new DocumentListener() { - @Override - public void changedUpdate(DocumentEvent e) { - fire(); - } - @Override - public void removeUpdate(DocumentEvent e) { - fire(); - } - @Override - public void insertUpdate(DocumentEvent e) { - fire(); - } - private void fire() { - enableOkButton(); - } - }); - - enableOkButton(); - - /* - * Used to show the dialog. - */ - setResizable(false); - setVisible(true); - } - - /** - * Called when a button is pressed or when the dialog is closed. - * @param okPressed whether the OK button was pressed. - */ - private void doButtonAction(boolean okPressed) { - if (okPressed) { - String newTagDisplayName = tagNameTextField.getText().trim(); - if (newTagDisplayName.isEmpty()) { - JOptionPane.showMessageDialog(null, - NbBundle.getMessage(NewUserTagNameDialog.class, "NewUserTagNameDialog.JOptionPane.tagNameEmpty.message"), - NbBundle.getMessage(NewUserTagNameDialog.class, "NewUserTagNameDialog.JOptionPane.tagNameEmpty.title"), - JOptionPane.ERROR_MESSAGE); - return; - } - if (TagsManager.containsIllegalCharacters(newTagDisplayName)) { - JOptionPane.showMessageDialog(null, - NbBundle.getMessage(NewUserTagNameDialog.class, "NewUserTagNameDialog.JOptionPane.tagNameIllegalCharacters.message"), - NbBundle.getMessage(NewUserTagNameDialog.class, "NewUserTagNameDialog.JOptionPane.tagNameIllegalCharacters.title"), - JOptionPane.ERROR_MESSAGE); - return; - } - userTagDisplayName = newTagDisplayName; - result = BUTTON_PRESSED.OK; - } else { - result = BUTTON_PRESSED.CANCEL; - } - setVisible(false); - } - - /** - * Returns the tag name entered by the user. - * - * @return a new user tag name - */ - String getTagName() { - return userTagDisplayName; - } - - /** - * Returns information about which button was pressed. - * - * @return BUTTON_PRESSED (OK, CANCEL) - */ - BUTTON_PRESSED getResult() { - return result; - } - - /** - * Enable the OK button if the tag name text field is not empty. - * Sets the enter button as default, so user can press enter to activate - * an okButton press and add the tag name. - */ - private void enableOkButton() { - okButton.setEnabled(!tagNameTextField.getText().isEmpty()); - getRootPane().setDefaultButton(okButton); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - newTagNameLabel = new javax.swing.JLabel(); - tagNameTextField = new javax.swing.JTextField(); - cancelButton = new javax.swing.JButton(); - okButton = new javax.swing.JButton(); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - - org.openide.awt.Mnemonics.setLocalizedText(newTagNameLabel, org.openide.util.NbBundle.getMessage(NewUserTagNameDialog.class, "NewUserTagNameDialog.newTagNameLabel.text")); // NOI18N - - tagNameTextField.setText(org.openide.util.NbBundle.getMessage(NewUserTagNameDialog.class, "NewUserTagNameDialog.tagNameTextField.text")); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(NewUserTagNameDialog.class, "NewUserTagNameDialog.cancelButton.text")); // NOI18N - cancelButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cancelButtonActionPerformed(evt); - } - }); - - org.openide.awt.Mnemonics.setLocalizedText(okButton, org.openide.util.NbBundle.getMessage(NewUserTagNameDialog.class, "NewUserTagNameDialog.okButton.text")); // NOI18N - okButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - okButtonActionPerformed(evt); - } - }); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(tagNameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE) - .addGroup(layout.createSequentialGroup() - .addGap(0, 0, Short.MAX_VALUE) - .addComponent(okButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cancelButton)) - .addComponent(newTagNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(newTagNameLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(tagNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(50, Short.MAX_VALUE)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(cancelButton) - .addComponent(okButton)) - .addContainerGap()) - ); - - pack(); - }// //GEN-END:initComponents - - private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed - doButtonAction(true); - }//GEN-LAST:event_okButtonActionPerformed - - private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed - doButtonAction(false); - }//GEN-LAST:event_cancelButtonActionPerformed - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton cancelButton; - private javax.swing.JLabel newTagNameLabel; - private javax.swing.JButton okButton; - private javax.swing.JTextField tagNameTextField; - // End of variables declaration//GEN-END:variables -} diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNamesOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNamesOptionsPanelController.java deleted file mode 100755 index 20c478d966..0000000000 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNamesOptionsPanelController.java +++ /dev/null @@ -1,131 +0,0 @@ -/* -* Autopsy Forensic Browser -* -* Copyright 2011-2016 Basis Technology Corp. -* Contact: carrier sleuthkit org -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package org.sleuthkit.autopsy.casemodule.services; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import javax.swing.JComponent; -import org.netbeans.spi.options.OptionsPanelController; -import org.openide.util.HelpCtx; -import org.openide.util.Lookup; - -@OptionsPanelController.TopLevelRegistration( - categoryName = "#OptionsCategory_Name_TagNamesOptions", - iconBase = "org/sleuthkit/autopsy/casemodule/services/tags-manager.png", - keywords = "#OptionsCategory_TagNames", - keywordsCategory = "CustomTagNames", - position = 8 -) -public final class TagNamesOptionsPanelController extends OptionsPanelController { - - private TagNamesSettingsPanel panel; - private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); - private boolean changed; - - /** - * Component should load its data here. - */ - @Override - public void update() { - getPanel().load(); - changed = false; - } - - /** - * This method is called when both the Ok and Apply buttons are pressed. It - * applies to any of the panels that have been opened in the process of - * using the options pane. - */ - @Override - public void applyChanges() { - if (changed) { - getPanel().store(); - changed = false; - } - } - - /** - * This method is called when the Cancel button is pressed. It applies to - * any of the panels that have been opened in the process of using the - * options pane. - */ - @Override - public void cancel() { - } - - @Override - public boolean isValid() { - return true; - } - - /** - * Used to determine whether any changes have been made to this controller's - * panel. - * - * @return Whether or not a change has been made. - */ - @Override - public boolean isChanged() { - return changed; - } - - @Override - public JComponent getComponent(Lookup lkp) { - return getPanel(); - } - - @Override - public HelpCtx getHelpCtx() { - return null; - } - - @Override - public void addPropertyChangeListener(PropertyChangeListener l) { - pcs.addPropertyChangeListener(l); - } - - @Override - public void removePropertyChangeListener(PropertyChangeListener l) { - pcs.removePropertyChangeListener(l); - } - - private TagNamesSettingsPanel getPanel() { - if (panel == null) { - panel = new TagNamesSettingsPanel(); - panel.addPropertyChangeListener(new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getPropertyName().equals(OptionsPanelController.PROP_CHANGED)) { - changed(); - } - } - }); - } - return panel; - } - - void changed() { - if (!changed) { - changed = true; - pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true); - } - pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null); - } -} diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNamesSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNamesSettingsPanel.form deleted file mode 100755 index 4412f20274..0000000000 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNamesSettingsPanel.form +++ /dev/null @@ -1,203 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNamesSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNamesSettingsPanel.java deleted file mode 100755 index 91a24e7ad2..0000000000 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNamesSettingsPanel.java +++ /dev/null @@ -1,316 +0,0 @@ -/* -* Autopsy Forensic Browser -* -* Copyright 2011-2016 Basis Technology Corp. -* Contact: carrier sleuthkit org -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package org.sleuthkit.autopsy.casemodule.services; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import javax.swing.DefaultListModel; -import javax.swing.JOptionPane; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import org.netbeans.spi.options.OptionsPanelController; -import org.openide.util.NbBundle; -import org.sleuthkit.autopsy.casemodule.Case; -import org.sleuthkit.autopsy.corecomponents.OptionsPanel; -import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.coreutils.ModuleSettings; - -/** - * A panel to allow the user to create new tag names or to delete tag names that - * user has created in the past. List of user tag names is maintained in a - * properties file, able to be used across cases. Potentially room to add other - * tag name options in the future. - */ -final class TagNamesSettingsPanel extends javax.swing.JPanel implements OptionsPanel { - - private static final Logger logger = Logger.getLogger(TagNamesSettingsPanel.class.getName()); - - private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS - private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS - - private static final String DEFAULT_DESCRIPTION = ""; - private static final String DEFAULT_COLOR_STRING = "NONE"; - - private DefaultListModel tagNamesListModel; - private List tagNames; - - /** - * Creates new form TagsManagerOptionsPanel - */ - TagNamesSettingsPanel() { - initComponents(); - customizeComponents(); - } - - private void customizeComponents() { - tagNamesListModel = new DefaultListModel<>(); - tagNamesList.setModel(tagNamesListModel); - tagNames = new ArrayList<>(); - tagNamesList.addListSelectionListener(new ListSelectionListener() { - @Override - public void valueChanged(ListSelectionEvent e) { - enableButtons(); - } - }); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - jPanel1 = new javax.swing.JPanel(); - panelDescriptionLabel = new javax.swing.JLabel(); - jSplitPane1 = new javax.swing.JSplitPane(); - modifyTagNameListPanel = new javax.swing.JPanel(); - tagNamesListLabel = new javax.swing.JLabel(); - jScrollPane1 = new javax.swing.JScrollPane(); - tagNamesList = new javax.swing.JList<>(); - newTagNameButton = new javax.swing.JButton(); - deleteTagNameButton = new javax.swing.JButton(); - tagNameAdditionalPanel = new javax.swing.JPanel(); - - jPanel1.setPreferredSize(new java.awt.Dimension(750, 500)); - - org.openide.awt.Mnemonics.setLocalizedText(panelDescriptionLabel, org.openide.util.NbBundle.getMessage(TagNamesSettingsPanel.class, "TagNamesSettingsPanel.panelDescriptionLabel.text")); // NOI18N - - jSplitPane1.setDividerLocation(400); - jSplitPane1.setDividerSize(1); - - org.openide.awt.Mnemonics.setLocalizedText(tagNamesListLabel, org.openide.util.NbBundle.getMessage(TagNamesSettingsPanel.class, "TagNamesSettingsPanel.tagNamesListLabel.text")); // NOI18N - - jScrollPane1.setViewportView(tagNamesList); - - newTagNameButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add-tag.png"))); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(newTagNameButton, org.openide.util.NbBundle.getMessage(TagNamesSettingsPanel.class, "TagNamesSettingsPanel.newTagNameButton.text")); // NOI18N - newTagNameButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - newTagNameButtonActionPerformed(evt); - } - }); - - deleteTagNameButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete-tag.png"))); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(deleteTagNameButton, org.openide.util.NbBundle.getMessage(TagNamesSettingsPanel.class, "TagNamesSettingsPanel.deleteTagNameButton.text")); // NOI18N - deleteTagNameButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - deleteTagNameButtonActionPerformed(evt); - } - }); - - javax.swing.GroupLayout modifyTagNameListPanelLayout = new javax.swing.GroupLayout(modifyTagNameListPanel); - modifyTagNameListPanel.setLayout(modifyTagNameListPanelLayout); - modifyTagNameListPanelLayout.setHorizontalGroup( - modifyTagNameListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(modifyTagNameListPanelLayout.createSequentialGroup() - .addContainerGap() - .addGroup(modifyTagNameListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(tagNamesListLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(modifyTagNameListPanelLayout.createSequentialGroup() - .addComponent(newTagNameButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(deleteTagNameButton) - .addGap(0, 113, Short.MAX_VALUE)) - .addComponent(jScrollPane1)) - .addContainerGap()) - ); - modifyTagNameListPanelLayout.setVerticalGroup( - modifyTagNameListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(modifyTagNameListPanelLayout.createSequentialGroup() - .addContainerGap() - .addComponent(tagNamesListLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(modifyTagNameListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(newTagNameButton) - .addComponent(deleteTagNameButton)) - .addContainerGap()) - ); - - jSplitPane1.setLeftComponent(modifyTagNameListPanel); - - javax.swing.GroupLayout tagNameAdditionalPanelLayout = new javax.swing.GroupLayout(tagNameAdditionalPanel); - tagNameAdditionalPanel.setLayout(tagNameAdditionalPanelLayout); - tagNameAdditionalPanelLayout.setHorizontalGroup( - tagNameAdditionalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 356, Short.MAX_VALUE) - ); - tagNameAdditionalPanelLayout.setVerticalGroup( - tagNameAdditionalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 456, Short.MAX_VALUE) - ); - - jSplitPane1.setRightComponent(tagNameAdditionalPanel); - - javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jSplitPane1) - .addComponent(panelDescriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap()) - ); - jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addComponent(panelDescriptionLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jSplitPane1) - .addContainerGap()) - ); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 778, Short.MAX_VALUE) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, Short.MAX_VALUE)) - ); - }// //GEN-END:initComponents - - private void newTagNameButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newTagNameButtonActionPerformed - NewUserTagNameDialog dialog = new NewUserTagNameDialog(); - NewUserTagNameDialog.BUTTON_PRESSED result = dialog.getResult(); - if (result == NewUserTagNameDialog.BUTTON_PRESSED.OK) { - String newTagDisplayName = dialog.getTagName(); - UserTagName newTagName = new UserTagName(newTagDisplayName, DEFAULT_DESCRIPTION, DEFAULT_COLOR_STRING); - /* - * If tag name already exists, don't add the tag name. - */ - if (tagNames.contains(newTagName)) { - JOptionPane.showMessageDialog(null, - NbBundle.getMessage(TagNamesSettingsPanel.class, "TagNamesSettingsPanel.JOptionPane.tagNameAlreadyExists.message"), - NbBundle.getMessage(TagNamesSettingsPanel.class, "TagNamesSettingsPanel.JOptionPane.tagNameAlreadyExists.title"), - JOptionPane.INFORMATION_MESSAGE); - } else { - tagNames.add(newTagName); - updateTagNamesListModel(); - /* - * Set the selection to the tag name that was just added. - */ - int index = tagNames.indexOf(newTagName); - tagNamesList.setSelectedIndex(index); - enableButtons(); - firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); - } - } - }//GEN-LAST:event_newTagNameButtonActionPerformed - - private void deleteTagNameButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteTagNameButtonActionPerformed - UserTagName tagName = tagNamesList.getSelectedValue(); - tagNames.remove(tagName); - updateTagNamesListModel(); - enableButtons(); - firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); - }//GEN-LAST:event_deleteTagNameButtonActionPerformed - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton deleteTagNameButton; - private javax.swing.JPanel jPanel1; - private javax.swing.JScrollPane jScrollPane1; - private javax.swing.JSplitPane jSplitPane1; - private javax.swing.JPanel modifyTagNameListPanel; - private javax.swing.JButton newTagNameButton; - private javax.swing.JLabel panelDescriptionLabel; - private javax.swing.JPanel tagNameAdditionalPanel; - private javax.swing.JList tagNamesList; - private javax.swing.JLabel tagNamesListLabel; - // End of variables declaration//GEN-END:variables - - /** - * Updates the tag names model for the tag names list component. - */ - private void updateTagNamesListModel() { - tagNamesListModel.clear(); - Set tagNameSet = new HashSet<>(); - tagNameSet.addAll(tagNames); - tagNames.clear(); - tagNames.addAll(tagNameSet); - Collections.sort(tagNames); - for (UserTagName tagName : tagNames) { - tagNamesListModel.addElement(tagName); - } - } - - /** - * Stores tag name changes in the properties file, called when OK or Apply - * is selected in the options panel. - * - * Adds all new tag names to the case database for displaying usable tag - * names when tagging. - */ - @Override - public void store() { - StringBuilder setting = new StringBuilder(); - for (UserTagName tagName : tagNames) { - if (setting.length() != 0) { - setting.append(";"); - } - setting.append(tagName.toSettingsFormat()); - } - ModuleSettings.setConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY, setting.toString()); - if (Case.isCaseOpen()) { - Case.getCurrentCase().getServices().getTagsManager().storeNewUserTagNames(tagNames); - } - } - - /** - * Updates the tag names list component with tag names from the properties - * file. - */ - @Override - public void load() { - String setting = ModuleSettings.getConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY); - tagNames.clear(); - if (null != setting && !setting.isEmpty()) { - List tagNameTuples = Arrays.asList(setting.split(";")); - for (String tagNameTuple : tagNameTuples) { - String[] tagNameAttributes = tagNameTuple.split(","); - tagNames.add(new UserTagName(tagNameAttributes[0], tagNameAttributes[1], tagNameAttributes[2])); - } - } - updateTagNamesListModel(); - enableButtons(); - } - - /** - * Only enable delete button when there is a tag name selected in the list. - */ - private void enableButtons() { - boolean ruleIsSelected = tagNamesList.getSelectedIndex() != -1; - deleteTagNameButton.setEnabled(ruleIsSelected); - } -} diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/UserTagName.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/UserTagName.java deleted file mode 100755 index c761665c08..0000000000 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/UserTagName.java +++ /dev/null @@ -1,86 +0,0 @@ -/* -* Autopsy Forensic Browser -* -* Copyright 2011-2016 Basis Technology Corp. -* Contact: carrier sleuthkit org -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package org.sleuthkit.autopsy.casemodule.services; - -import java.util.Objects; - -/** - * Because the DTO TagName constructor can not be called outside of its class - * package, UserTagName is used to keep track of user tag names while - * preserving properties that will potentially be implemented in the future - * (tag name description and tag name color). - */ -class UserTagName implements Comparable { - - private final String displayName; - private final String description; - private final String colorName; - - UserTagName(String displayName, String description, String colorName) { - this.displayName = displayName; - this.description = description; - this.colorName = colorName; - } - - String getDisplayName() { - return displayName; - } - - String getDescription() { - return description; - } - - String getColorName() { - return colorName; - } - - @Override - public int compareTo(UserTagName other) { - return this.getDisplayName().toLowerCase().compareTo(other.getDisplayName().toLowerCase()); - } - - @Override - public int hashCode() { - int hash = 7; - hash = 83 * hash + Objects.hashCode(this.displayName); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof UserTagName)) { - return false; - } - UserTagName thatTagName = (UserTagName) obj; - return this.getDisplayName().equals(thatTagName.getDisplayName()); - } - - @Override - public String toString() { - return displayName; - } - - /** - * @return A string representation of the tag name in the format that is - * used by the properties file. - */ - public String toSettingsFormat() { - return displayName + "," + description + "," + colorName; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/tags-manager.png b/Core/src/org/sleuthkit/autopsy/casemodule/services/tags-manager.png deleted file mode 100755 index b782cfe010..0000000000 Binary files a/Core/src/org/sleuthkit/autopsy/casemodule/services/tags-manager.png and /dev/null differ