mirror of
https://github.com/elisspace/autopsy.git
synced 2026-10-05 16:56:16 +00:00
Add count of ingest messages (groups) to the ingest toolbar button
This commit is contained in:
@@ -27,3 +27,5 @@ IngestMessagePanel.sortByLabel.text=Sort by:
|
||||
IngestMessagePanel.sortByComboBox.toolTipText=Sort messages by time (chronological order) or message priority
|
||||
IngestDialogPanel.advancedButton.text=Advanced
|
||||
AdvancedConfigurationDialog.applyButton.text=Apply
|
||||
IngestMessagesToolbar.ingestMessagesButton.text=0
|
||||
IngestMessagesToolbar.ingestMessagesButton.toolTipText=Ingest Messages
|
||||
|
||||
@@ -21,6 +21,8 @@ package org.sleuthkit.autopsy.ingest;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
@@ -51,6 +53,9 @@ class IngestMessagePanel extends javax.swing.JPanel {
|
||||
private static Font notVisitedFont = new Font("Arial", Font.BOLD, 11);
|
||||
private static Color ERROR_COLOR = new Color(255, 90, 90);
|
||||
private int lastRowSelected = -1;
|
||||
|
||||
private static PropertyChangeSupport messagePcs = new PropertyChangeSupport(IngestMessagePanel.class);
|
||||
static final String MESSAGE_CHANGE_EVT = "MESSAGE_CHANGE_EVT"; //number of unread messages changed
|
||||
|
||||
/** Creates new form IngestMessagePanel */
|
||||
public IngestMessagePanel(IngestMessageMainPanel mainPanel) {
|
||||
@@ -75,6 +80,10 @@ class IngestMessagePanel extends javax.swing.JPanel {
|
||||
IngestMessageGroup getMessageGroup(int rowNumber) {
|
||||
return tableModel.getMessageGroup(rowNumber);
|
||||
}
|
||||
|
||||
synchronized static void addPropertyChangeSupportListener(PropertyChangeListener l) {
|
||||
messagePcs.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
@@ -215,18 +224,25 @@ class IngestMessagePanel extends javax.swing.JPanel {
|
||||
}
|
||||
|
||||
public void addMessage(IngestMessage m) {
|
||||
final int origMsgGroups = tableModel.getNumberUnreadGroups();
|
||||
tableModel.addMessage(m);
|
||||
messagePcs.firePropertyChange(TOOL_TIP_TEXT_KEY, origMsgGroups, tableModel.getNumberUnreadGroups());
|
||||
|
||||
//autoscroll
|
||||
//messageTable.scrollRectToVisible(messageTable.getCellRect(messageTable.getRowCount() - 1, messageTable.getColumnCount(), true));
|
||||
}
|
||||
|
||||
public void clearMessages() {
|
||||
final int origMsgGroups = tableModel.getNumberUnreadGroups();
|
||||
tableModel.clearMessages();
|
||||
messagePcs.firePropertyChange(TOOL_TIP_TEXT_KEY, origMsgGroups, 0);
|
||||
}
|
||||
|
||||
private void setVisited(int rowNumber) {
|
||||
final int origMsgGroups = tableModel.getNumberUnreadGroups();
|
||||
tableModel.setVisited(rowNumber);
|
||||
lastRowSelected = rowNumber;
|
||||
messagePcs.firePropertyChange(TOOL_TIP_TEXT_KEY, origMsgGroups, tableModel.getNumberUnreadGroups());
|
||||
}
|
||||
|
||||
private class MessageTableModel extends AbstractTableModel {
|
||||
@@ -257,8 +273,38 @@ class IngestMessagePanel extends javax.swing.JPanel {
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return getNumberGroups();
|
||||
}
|
||||
|
||||
int getNumberGroups() {
|
||||
return messageData.size();
|
||||
}
|
||||
|
||||
int getNumberMessages() {
|
||||
int total = 0;
|
||||
for (TableEntry e : messageData) {
|
||||
total += e.messageGroup.count;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
int getNumberUnreadMessages() {
|
||||
int total = 0;
|
||||
for (TableEntry e : messageData) {
|
||||
if (e.visited == false)
|
||||
total += e.messageGroup.count;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
int getNumberUnreadGroups() {
|
||||
int total = 0;
|
||||
for (TableEntry e : messageData) {
|
||||
if (e.visited == false)
|
||||
++total;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(int column) {
|
||||
@@ -715,4 +761,5 @@ class IngestMessagePanel extends javax.swing.JPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,14 +20,10 @@
|
||||
|
||||
package org.sleuthkit.autopsy.ingest;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.logging.Logger;
|
||||
import org.openide.awt.ActionID;
|
||||
import org.openide.awt.ActionReference;
|
||||
import org.openide.awt.ActionReferences;
|
||||
import org.openide.awt.ActionRegistration;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import javax.swing.AbstractAction;
|
||||
import org.openide.util.actions.Presenter;
|
||||
import org.openide.windows.Mode;
|
||||
import org.openide.windows.WindowManager;
|
||||
|
||||
@@ -40,18 +36,15 @@ import org.openide.windows.WindowManager;
|
||||
// @ActionReference(path = "Toolbars/File", position = 575)
|
||||
//})
|
||||
//@Messages("CTL_IngestMessagesAction=Messages")
|
||||
public final class IngestMessagesAction implements ActionListener {
|
||||
public final class IngestMessagesAction extends AbstractAction implements Presenter.Toolbar {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
IngestMessageTopComponent tc = IngestMessageTopComponent.findInstance();
|
||||
|
||||
Mode mode = WindowManager.getDefault().findMode("floatingLeftBottom");
|
||||
if (mode != null) {
|
||||
//TopComponent[] tcs = mode.getTopComponents();
|
||||
mode.dockInto(tc);
|
||||
tc.open();
|
||||
//tc.requestActive();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getToolbarPresenter() {
|
||||
return new IngestMessagesToolbar();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[93, 23]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<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="false"/>
|
||||
<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="ingestMessagesButton" alignment="0" pref="93" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="ingestMessagesButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="ingestMessagesButton">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Tahoma" size="10" style="0"/>
|
||||
</Property>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/org/sleuthkit/autopsy/ingest/eye-icon-16.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/ingest/Bundle.properties" key="IngestMessagesToolbar.ingestMessagesButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/ingest/Bundle.properties" key="IngestMessagesToolbar.ingestMessagesButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="alignmentX" type="float" value="0.5"/>
|
||||
<Property name="horizontalAlignment" type="int" value="2"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
|
||||
<Insets value="[1, 0, 1, 14]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[65, 23]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[65, 23]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ingestMessagesButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011 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.ingest;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import org.openide.windows.Mode;
|
||||
import org.openide.windows.WindowManager;
|
||||
|
||||
/**
|
||||
* Toolbar for Ingest
|
||||
*
|
||||
*/
|
||||
public class IngestMessagesToolbar extends javax.swing.JPanel {
|
||||
|
||||
/** Creates new form IngestMessagesToolbar */
|
||||
public IngestMessagesToolbar() {
|
||||
initComponents();
|
||||
customizeComponents();
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
|
||||
ingestMessagesButton = new javax.swing.JButton();
|
||||
|
||||
setPreferredSize(new java.awt.Dimension(93, 23));
|
||||
|
||||
ingestMessagesButton.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
|
||||
ingestMessagesButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/ingest/eye-icon-16.png"))); // NOI18N
|
||||
ingestMessagesButton.setText(org.openide.util.NbBundle.getMessage(IngestMessagesToolbar.class, "IngestMessagesToolbar.ingestMessagesButton.text")); // NOI18N
|
||||
ingestMessagesButton.setToolTipText(org.openide.util.NbBundle.getMessage(IngestMessagesToolbar.class, "IngestMessagesToolbar.ingestMessagesButton.toolTipText")); // NOI18N
|
||||
ingestMessagesButton.setAlignmentX(0.5F);
|
||||
ingestMessagesButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||
ingestMessagesButton.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
ingestMessagesButton.setMargin(new java.awt.Insets(1, 0, 1, 14));
|
||||
ingestMessagesButton.setMaximumSize(new java.awt.Dimension(65, 23));
|
||||
ingestMessagesButton.setMinimumSize(new java.awt.Dimension(65, 23));
|
||||
ingestMessagesButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
ingestMessagesButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(ingestMessagesButton, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(ingestMessagesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void ingestMessagesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ingestMessagesButtonActionPerformed
|
||||
showIngestMessages();
|
||||
}//GEN-LAST:event_ingestMessagesButtonActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton ingestMessagesButton;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
|
||||
private void customizeComponents() {
|
||||
|
||||
IngestMessagePanel.addPropertyChangeSupportListener(new PropertyChangeListener() {
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
final int numberMessages = (Integer)evt.getNewValue();
|
||||
ingestMessagesButton.setText(Integer.toString(numberMessages));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void showIngestMessages() {
|
||||
IngestMessageTopComponent tc = IngestMessageTopComponent.findInstance();
|
||||
|
||||
Mode mode = WindowManager.getDefault().findMode("floatingLeftBottom");
|
||||
if (mode != null) {
|
||||
//TopComponent[] tcs = mode.getTopComponents();
|
||||
mode.dockInto(tc);
|
||||
tc.open();
|
||||
//tc.requestActive();
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 660 B |
@@ -59,16 +59,16 @@
|
||||
-->
|
||||
|
||||
<folder name="Actions">
|
||||
<folder name="File">
|
||||
<folder name="Tools">
|
||||
<file name="org-sleuthkit-autopsy-ingest-IngestMessagesAction.instance">
|
||||
<!--org.sleuthkit.autopsy.ingest.IngestMessagesAction-->
|
||||
<attr
|
||||
bundlevalue="org.sleuthkit.autopsy.ingest.Bundle#CTL_IngestMessagesAction" name="displayName"/>
|
||||
<attr
|
||||
methodvalue="org.openide.awt.Actions.alwaysEnabled" name="instanceCreate"/>
|
||||
<!-- <attr
|
||||
bundlevalue="org.sleuthkit.autopsy.ingest.Bundle#CTL_IngestMessagesAction" name="displayName"/> -->
|
||||
<!-- <attr
|
||||
methodvalue="org.openide.awt.Actions.alwaysEnabled" name="instanceCreate"/> -->
|
||||
<attr name="delegate" newvalue="org.sleuthkit.autopsy.ingest.IngestMessagesAction"/>
|
||||
<attr name="iconBase" stringvalue="org/sleuthkit/autopsy/ingest/eye-icon.png"/>
|
||||
<attr boolvalue="false" name="noIconInMenu"/>
|
||||
<!-- <attr name="iconBase" stringvalue="org/sleuthkit/autopsy/ingest/eye-icon.png"/> -->
|
||||
<!-- <attr boolvalue="false" name="noIconInMenu"/> -->
|
||||
</file>
|
||||
</folder>
|
||||
</folder>
|
||||
@@ -77,7 +77,7 @@
|
||||
<attr intvalue="500" name="position"/>
|
||||
<file name="org-sleuthkit-autopsy-ingest-IngestMessagesAction.shadow">
|
||||
<!--org.sleuthkit.autopsy.ingest.IngestMessagesAction-->
|
||||
<attr name="originalFile" stringvalue="Actions/File/org-sleuthkit-autopsy-ingest-IngestMessagesAction.instance"/>
|
||||
<attr name="originalFile" stringvalue="Actions/Tools/org-sleuthkit-autopsy-ingest-IngestMessagesAction.instance"/>
|
||||
</file>
|
||||
</folder>
|
||||
</folder>
|
||||
|
||||
Reference in New Issue
Block a user