mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Removed previous files accidentally committed from merge
This commit is contained in:
parent
aaf4b61f30
commit
83afd06486
@ -1,13 +1,11 @@
|
|||||||
OptionsCategory_Name_TagNamesOptions=Tags
|
OptionsCategory_Name_TagNamesOptions=Tags
|
||||||
OptionsCategory_TagNames=TagNames
|
OptionsCategory_TagNames=TagNames
|
||||||
Blackboard.unableToIndexArtifact.error.msg=Unable to index blackboard artifact {0}
|
Blackboard.unableToIndexArtifact.error.msg=Unable to index blackboard artifact {0}
|
||||||
NewUserTagNameDialog.title.text=New Tag Name
|
NewTagNameDialog.title.text=New Tag Name
|
||||||
NewUserTagNameDialog.JOptionPane.tagNameIllegalCharacters.message=Tag name may not contain any of the following symbols\: \\ \: * ? " < > | , ;
|
NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.message=Tag name may not contain any of the following symbols\: \\ \: * ? " < > | , ;
|
||||||
NewUserTagNameDialog.JOptionPane.tagNameIllegalCharacters.title=Invalid character in tag name
|
NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.title=Invalid character in tag name
|
||||||
TagNamesSettingsPanel.JOptionPane.tagNameAlreadyExists.message=The tag name already exists in your settings
|
NewTagNameDialog.JOptionPane.tagNameEmpty.message=The tag name cannot be empty
|
||||||
TagNamesSettingsPanel.JOptionPane.tagNameAlreadyExists.title=Tag name already exists
|
NewTagNameDialog.JOptionPane.tagNameEmpty.title=Empty tag name
|
||||||
NewUserTagNameDialog.JOptionPane.tagNameEmpty.message=The tag name cannot be empty
|
|
||||||
NewUserTagNameDialog.JOptionPane.tagNameEmpty.title=Empty tag name
|
|
||||||
TagOptionsPanel.tagTypesListLabel.text=Tag Names:
|
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.
|
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
|
NewTagNameDialog.okButton.text=OK
|
||||||
|
@ -43,8 +43,8 @@ final class NewTagNameDialog extends javax.swing.JDialog {
|
|||||||
* Creates a new NewUserTagNameDialog dialog.
|
* Creates a new NewUserTagNameDialog dialog.
|
||||||
*/
|
*/
|
||||||
NewTagNameDialog() {
|
NewTagNameDialog() {
|
||||||
super(new JFrame(NbBundle.getMessage(NewTagNameDialog.class, "NewUserTagNameDialog.title.text")),
|
super(new JFrame(NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.title.text")),
|
||||||
NbBundle.getMessage(NewTagNameDialog.class, "NewUserTagNameDialog.title.text"), true);
|
NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.title.text"), true);
|
||||||
initComponents();
|
initComponents();
|
||||||
this.display();
|
this.display();
|
||||||
}
|
}
|
||||||
@ -112,15 +112,15 @@ final class NewTagNameDialog extends javax.swing.JDialog {
|
|||||||
String newTagDisplayName = tagNameTextField.getText().trim();
|
String newTagDisplayName = tagNameTextField.getText().trim();
|
||||||
if (newTagDisplayName.isEmpty()) {
|
if (newTagDisplayName.isEmpty()) {
|
||||||
JOptionPane.showMessageDialog(null,
|
JOptionPane.showMessageDialog(null,
|
||||||
NbBundle.getMessage(NewTagNameDialog.class, "NewUserTagNameDialog.JOptionPane.tagNameEmpty.message"),
|
NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameEmpty.message"),
|
||||||
NbBundle.getMessage(NewTagNameDialog.class, "NewUserTagNameDialog.JOptionPane.tagNameEmpty.title"),
|
NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameEmpty.title"),
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (TagsManager.containsIllegalCharacters(newTagDisplayName)) {
|
if (TagsManager.containsIllegalCharacters(newTagDisplayName)) {
|
||||||
JOptionPane.showMessageDialog(null,
|
JOptionPane.showMessageDialog(null,
|
||||||
NbBundle.getMessage(NewTagNameDialog.class, "NewUserTagNameDialog.JOptionPane.tagNameIllegalCharacters.message"),
|
NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.message"),
|
||||||
NbBundle.getMessage(NewTagNameDialog.class, "NewUserTagNameDialog.JOptionPane.tagNameIllegalCharacters.title"),
|
NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.title"),
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,98 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
|
|
||||||
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
|
||||||
<Properties>
|
|
||||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
|
||||||
</Properties>
|
|
||||||
<SyntheticProperties>
|
|
||||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
|
||||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
|
||||||
</SyntheticProperties>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
|
||||||
</AuxValues>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="tagNameTextField" pref="220" max="32767" attributes="0"/>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
|
||||||
<Component id="okButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="newTagNameLabel" alignment="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="newTagNameLabel" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="tagNameTextField" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace pref="50" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<EmptySpace max="32767" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="okButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JLabel" name="newTagNameLabel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/services/Bundle.properties" key="NewUserTagNameDialog.newTagNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JTextField" name="tagNameTextField">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/services/Bundle.properties" key="NewUserTagNameDialog.tagNameTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="cancelButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/services/Bundle.properties" key="NewUserTagNameDialog.cancelButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="okButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/services/Bundle.properties" key="NewUserTagNameDialog.okButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="okButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Form>
|
|
@ -1,246 +0,0 @@
|
|||||||
/*
|
|
||||||
* Autopsy Forensic Browser
|
|
||||||
*
|
|
||||||
* Copyright 2011-2016 Basis Technology Corp.
|
|
||||||
* Contact: carrier <at> sleuthkit <dot> 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")
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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();
|
|
||||||
}// </editor-fold>//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
|
|
||||||
}
|
|
@ -1,131 +0,0 @@
|
|||||||
/*
|
|
||||||
* Autopsy Forensic Browser
|
|
||||||
*
|
|
||||||
* Copyright 2011-2016 Basis Technology Corp.
|
|
||||||
* Contact: carrier <at> sleuthkit <dot> 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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,203 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
|
|
||||||
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
|
||||||
</AuxValues>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="jPanel1" alignment="0" pref="778" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
|
||||||
<Properties>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[750, 500]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="1" attributes="0">
|
|
||||||
<Component id="jSplitPane1" max="32767" attributes="0"/>
|
|
||||||
<Component id="panelDescriptionLabel" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="panelDescriptionLabel" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jSplitPane1" max="32767" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JLabel" name="panelDescriptionLabel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/services/Bundle.properties" key="TagNamesSettingsPanel.panelDescriptionLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
|
|
||||||
<Properties>
|
|
||||||
<Property name="dividerLocation" type="int" value="400"/>
|
|
||||||
<Property name="dividerSize" type="int" value="1"/>
|
|
||||||
</Properties>
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
|
||||||
<SubComponents>
|
|
||||||
<Container class="javax.swing.JPanel" name="modifyTagNameListPanel">
|
|
||||||
<Constraints>
|
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
|
||||||
<JSplitPaneConstraints position="left"/>
|
|
||||||
</Constraint>
|
|
||||||
</Constraints>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="tagNamesListLabel" alignment="0" max="32767" attributes="0"/>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="newTagNameButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="deleteTagNameButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="0" pref="113" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="jScrollPane1" alignment="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="tagNamesListLabel" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jScrollPane1" pref="383" max="32767" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="newTagNameButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="deleteTagNameButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JLabel" name="tagNamesListLabel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/services/Bundle.properties" key="TagNamesSettingsPanel.tagNamesListLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</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="tagNamesList">
|
|
||||||
<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="<UserTagName>"/>
|
|
||||||
</AuxValues>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
<Component class="javax.swing.JButton" name="newTagNameButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/org/sleuthkit/autopsy/images/add-tag.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/services/Bundle.properties" key="TagNamesSettingsPanel.newTagNameButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="newTagNameButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="deleteTagNameButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/org/sleuthkit/autopsy/images/delete-tag.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/services/Bundle.properties" key="TagNamesSettingsPanel.deleteTagNameButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteTagNameButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
<Container class="javax.swing.JPanel" name="tagNameAdditionalPanel">
|
|
||||||
<Constraints>
|
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
|
||||||
<JSplitPaneConstraints position="right"/>
|
|
||||||
</Constraint>
|
|
||||||
</Constraints>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="356" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="456" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
</SubComponents>
|
|
||||||
</Form>
|
|
@ -1,316 +0,0 @@
|
|||||||
/*
|
|
||||||
* Autopsy Forensic Browser
|
|
||||||
*
|
|
||||||
* Copyright 2011-2016 Basis Technology Corp.
|
|
||||||
* Contact: carrier <at> sleuthkit <dot> 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<UserTagName> tagNamesListModel;
|
|
||||||
private List<UserTagName> 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")
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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))
|
|
||||||
);
|
|
||||||
}// </editor-fold>//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<UserTagName> 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<UserTagName> 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<String> 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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* Autopsy Forensic Browser
|
|
||||||
*
|
|
||||||
* Copyright 2011-2016 Basis Technology Corp.
|
|
||||||
* Contact: carrier <at> sleuthkit <dot> 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<UserTagName> {
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
Loading…
x
Reference in New Issue
Block a user