mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
TSK-392 Improve inbox icon with number of messages
This commit is contained in:
parent
f090ddd722
commit
8db1bf8937
@ -26,7 +26,6 @@ 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
|
||||
IngestMessageDetailsPanel.messageDetailsPane.contentType=text/html
|
||||
IngestMessageDetailsPanel.messageDetailsPane.toolTipText=
|
||||
IngestMessagesToolbar.toolTipText=
|
||||
|
@ -2,11 +2,14 @@
|
||||
|
||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/ingest/Bundle.properties" key="IngestMessagesToolbar.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[32767, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[80, 23]"/>
|
||||
<Dimension value="[80, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
@ -21,56 +24,5 @@
|
||||
<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" alignment="1" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="ingestMessagesButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</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="enabled" type="boolean" value="false"/>
|
||||
<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="[2, 0, 2, 2]"/>
|
||||
</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>
|
||||
<Property name="preferredSize" 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>
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
</Form>
|
||||
|
@ -16,11 +16,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.sleuthkit.autopsy.ingest;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import javax.swing.JButton;
|
||||
import org.openide.windows.Mode;
|
||||
import org.openide.windows.WindowManager;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
@ -31,6 +36,8 @@ import org.sleuthkit.autopsy.casemodule.Case;
|
||||
*/
|
||||
public class IngestMessagesToolbar extends javax.swing.JPanel {
|
||||
|
||||
private IngestMessagesButton ingestMessagesButton = new IngestMessagesButton();
|
||||
|
||||
/** Creates new form IngestMessagesToolbar */
|
||||
public IngestMessagesToolbar() {
|
||||
initComponents();
|
||||
@ -46,72 +53,67 @@ public class IngestMessagesToolbar extends javax.swing.JPanel {
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
ingestMessagesButton = new javax.swing.JButton();
|
||||
|
||||
setToolTipText(org.openide.util.NbBundle.getMessage(IngestMessagesToolbar.class, "IngestMessagesToolbar.toolTipText")); // NOI18N
|
||||
setMaximumSize(new java.awt.Dimension(32767, 25));
|
||||
setPreferredSize(new java.awt.Dimension(80, 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.setEnabled(false);
|
||||
ingestMessagesButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||
ingestMessagesButton.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
ingestMessagesButton.setMargin(new java.awt.Insets(2, 0, 2, 2));
|
||||
ingestMessagesButton.setMaximumSize(new java.awt.Dimension(65, 23));
|
||||
ingestMessagesButton.setMinimumSize(new java.awt.Dimension(65, 23));
|
||||
ingestMessagesButton.setPreferredSize(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)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(ingestMessagesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(10, 10, 10))
|
||||
);
|
||||
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)
|
||||
);
|
||||
setPreferredSize(new java.awt.Dimension(80, 25));
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
}// </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 customizeButton() {
|
||||
ingestMessagesButton = new IngestMessagesButton();
|
||||
|
||||
setMaximumSize(new java.awt.Dimension(32767, 25));
|
||||
setPreferredSize(new java.awt.Dimension(80, 25));
|
||||
|
||||
ingestMessagesButton.setFont(new java.awt.Font("Tahoma", 0, 10));
|
||||
ingestMessagesButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/ingest/eye-icon-25.png")));
|
||||
ingestMessagesButton.setToolTipText("Ingest Messages");
|
||||
ingestMessagesButton.setBorder(null);
|
||||
ingestMessagesButton.setBorderPainted(false);
|
||||
ingestMessagesButton.setEnabled(false);
|
||||
ingestMessagesButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
ingestMessagesButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
|
||||
ingestMessagesButton.setMaximumSize(new java.awt.Dimension(44, 26));
|
||||
ingestMessagesButton.setMinimumSize(new java.awt.Dimension(44, 26));
|
||||
ingestMessagesButton.setPreferredSize(new java.awt.Dimension(44, 26));
|
||||
ingestMessagesButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
showIngestMessages();
|
||||
}
|
||||
});
|
||||
this.add(ingestMessagesButton, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
private void customizeComponents() {
|
||||
|
||||
customizeButton();
|
||||
|
||||
this.setBorder(null);
|
||||
|
||||
IngestMessagePanel.addPropertyChangeSupportListener(new PropertyChangeListener() {
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
final int numberMessages = (Integer)evt.getNewValue();
|
||||
ingestMessagesButton.setText(Integer.toString(numberMessages));
|
||||
final int numberMessages = (Integer) evt.getNewValue();
|
||||
//ingestMessagesButton.setText(Integer.toString(numberMessages));
|
||||
//repaint button
|
||||
ingestMessagesButton.setMessages(numberMessages);
|
||||
ingestMessagesButton.repaint();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Case.addPropertyChangeListener(new PropertyChangeListener() {
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if(evt.getPropertyName().equals(Case.CASE_CURRENT_CASE))
|
||||
if (evt.getPropertyName().equals(Case.CASE_CURRENT_CASE)) {
|
||||
setEnabled(evt.getNewValue() != null);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -132,4 +134,29 @@ public class IngestMessagesToolbar extends javax.swing.JPanel {
|
||||
super.setEnabled(enabled);
|
||||
ingestMessagesButton.setEnabled(enabled);
|
||||
}
|
||||
|
||||
private static class IngestMessagesButton extends JButton {
|
||||
|
||||
private static final Font messagesFont = new java.awt.Font("Tahoma", 0, 9);
|
||||
private int messages = 0;
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
|
||||
//paint text
|
||||
String messageStr = Integer.toString(messages);
|
||||
final int len = messageStr.length();
|
||||
g.setFont(messagesFont);
|
||||
g.setColor(Color.BLUE);
|
||||
int x = getSize().width - len * 5 - 1;
|
||||
if (x<0)
|
||||
x = 0;
|
||||
g.drawString(messageStr, x, 10);
|
||||
}
|
||||
|
||||
void setMessages(int messages) {
|
||||
this.messages = messages;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
Ingest/src/org/sleuthkit/autopsy/ingest/eye-icon-25.png
Normal file
BIN
Ingest/src/org/sleuthkit/autopsy/ingest/eye-icon-25.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
BIN
Ingest/src/org/sleuthkit/autopsy/ingest/eye-icon-32.png
Normal file
BIN
Ingest/src/org/sleuthkit/autopsy/ingest/eye-icon-32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
Loading…
x
Reference in New Issue
Block a user