context viewer

This commit is contained in:
Greg DiCristofaro 2021-06-03 16:35:18 -04:00
parent 32dd9fe4e5
commit 3b9a6f6bb2
7 changed files with 118 additions and 196 deletions

View File

@ -2,11 +2,17 @@
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
<Property name="background" type="java.awt.Color" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="ContentViewerDefaults.getPanelBackground()" type="code"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[495, 55]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[300, 55]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[495, 75]"/>
<Dimension value="[495, 55]"/>
</Property>
</Properties>
<AuxValues>
@ -24,15 +30,13 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="50" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jSourceNameLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="36" max="-2" attributes="0"/>
<Component id="jSourceTextLabel" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="260" max="-2" attributes="0"/>
<Component id="jSourceTextLabel" pref="360" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="90" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="40" max="-2" attributes="0"/>
<Component id="jSourceGoToResultButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
@ -41,14 +45,13 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jSourceNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jSourceTextLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jSourceGoToResultButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<EmptySpace min="0" pref="11" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>

View File

@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.contentviewers.contextviewer;
import java.util.ArrayList;
import java.util.List;
import org.sleuthkit.autopsy.contentviewers.contextviewer.ContextViewer.DateTimePanel;
import org.sleuthkit.autopsy.contentviewers.layout.ContentViewerDefaults;
import org.sleuthkit.autopsy.directorytree.DirectoryTreeTopComponent;
import org.sleuthkit.datamodel.BlackboardArtifact;
import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT;
@ -75,8 +76,10 @@ public final class ContextSourcePanel extends javax.swing.JPanel implements Date
jSourceNameLabel = new javax.swing.JLabel();
jSourceTextLabel = new javax.swing.JLabel();
setBackground(new java.awt.Color(255, 255, 255));
setPreferredSize(new java.awt.Dimension(495, 75));
setBackground(ContentViewerDefaults.getPanelBackground());
setMaximumSize(new java.awt.Dimension(495, 55));
setMinimumSize(new java.awt.Dimension(300, 55));
setPreferredSize(new java.awt.Dimension(495, 55));
org.openide.awt.Mnemonics.setLocalizedText(jSourceGoToResultButton, org.openide.util.NbBundle.getMessage(ContextSourcePanel.class, "ContextSourcePanel.jSourceGoToResultButton.text")); // NOI18N
jSourceGoToResultButton.addActionListener(new java.awt.event.ActionListener() {
@ -94,26 +97,23 @@ public final class ContextSourcePanel extends javax.swing.JPanel implements Date
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(50, 50, 50)
.addComponent(jSourceNameLabel)
.addGap(36, 36, 36)
.addComponent(jSourceTextLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(260, 260, 260))
.addComponent(jSourceTextLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 360, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(90, 90, 90)
.addGap(40, 40, 40)
.addComponent(jSourceGoToResultButton)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(2, 2, 2)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jSourceNameLabel)
.addComponent(jSourceTextLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSourceGoToResultButton)
.addGap(0, 0, 0))
.addGap(0, 11, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents

View File

@ -2,11 +2,17 @@
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
<Property name="background" type="java.awt.Color" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="ContentViewerDefaults.getPanelBackground()" type="code"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[32767, 55]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[300, 55]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[495, 75]"/>
<Dimension value="[495, 55]"/>
</Property>
</Properties>
<AuxValues>
@ -24,30 +30,28 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="50" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jUsageNameLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jUsageTextLabel" pref="240" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="36" max="-2" attributes="0"/>
<Component id="jUsageTextLabel" pref="420" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="90" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="40" max="-2" attributes="0"/>
<Component id="jUsageGoToResultButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="275" 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 min="-2" pref="2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jUsageTextLabel" min="-2" max="-2" attributes="0"/>
<Component id="jUsageNameLabel" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jUsageGoToResultButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="11" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>

View File

@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.contentviewers.contextviewer;
import java.util.ArrayList;
import java.util.List;
import org.sleuthkit.autopsy.contentviewers.layout.ContentViewerDefaults;
import org.sleuthkit.autopsy.directorytree.DirectoryTreeTopComponent;
import org.sleuthkit.datamodel.BlackboardArtifact;
import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT;
@ -74,8 +75,10 @@ public final class ContextUsagePanel extends javax.swing.JPanel implements Conte
jUsageNameLabel = new javax.swing.JLabel();
jUsageTextLabel = new javax.swing.JLabel();
setBackground(new java.awt.Color(255, 255, 255));
setPreferredSize(new java.awt.Dimension(495, 75));
setBackground(ContentViewerDefaults.getPanelBackground());
setMaximumSize(new java.awt.Dimension(32767, 55));
setMinimumSize(new java.awt.Dimension(300, 55));
setPreferredSize(new java.awt.Dimension(495, 55));
org.openide.awt.Mnemonics.setLocalizedText(jUsageGoToResultButton, org.openide.util.NbBundle.getMessage(ContextUsagePanel.class, "ContextUsagePanel.jUsageGoToResultButton.text")); // NOI18N
jUsageGoToResultButton.addActionListener(new java.awt.event.ActionListener() {
@ -93,25 +96,23 @@ public final class ContextUsagePanel extends javax.swing.JPanel implements Conte
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(50, 50, 50)
.addComponent(jUsageNameLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jUsageTextLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)
.addGap(36, 36, 36))
.addComponent(jUsageTextLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(90, 90, 90)
.addGap(40, 40, 40)
.addComponent(jUsageGoToResultButton)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(275, javax.swing.GroupLayout.PREFERRED_SIZE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(2, 2, 2)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jUsageTextLabel)
.addComponent(jUsageNameLabel, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jUsageGoToResultButton))
.addComponent(jUsageGoToResultButton)
.addGap(0, 11, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents

View File

@ -4,38 +4,19 @@
<NonVisualComponents>
<Container class="javax.swing.JPanel" name="jSourcePanel">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" id="window" palette="3" red="ff" type="palette"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new EmptyBorder(FIRST_HEADER_INSETS)" type="code"/>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="40" max="-2" attributes="0"/>
<Component id="jSourceLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="304" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
<Component id="jSourceLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
<Property name="axis" type="int" value="3"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jSourceLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="true" component="jSourceLabel" property="font" relativeSize="true" size="1"/>
</FontInfo>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="ContentViewerDefaults.getHeaderFont()" type="code"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/contextviewer/Bundle.properties" key="ContextViewer.jSourceLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
@ -50,38 +31,19 @@
</Container>
<Container class="javax.swing.JPanel" name="jUsagePanel">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" id="window" palette="3" red="ff" type="palette"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new EmptyBorder(HEADER_INSETS)" type="code"/>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="40" max="-2" attributes="0"/>
<Component id="jUsageLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="298" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="jUsageLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
<Property name="axis" type="int" value="3"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jUsageLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="true" component="jUsageLabel" property="font" relativeSize="true" size="1"/>
</FontInfo>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="ContentViewerDefaults.getHeaderFont()&#xd;&#xa;" type="code"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/contextviewer/Bundle.properties" key="ContextViewer.jUsageLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
@ -95,31 +57,9 @@
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jUnknownPanel">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="50" max="-2" attributes="0"/>
<Component id="jUnknownLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="jUnknownLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
<Property name="axis" type="int" value="3"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jUnknownLabel">
@ -127,6 +67,9 @@
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/contextviewer/Bundle.properties" key="ContextViewer.jUnknownLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new EmptyBorder(DATA_ROW_INSETS)" type="code"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
@ -137,9 +80,6 @@
</Container>
</NonVisualComponents>
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[495, 358]"/>
</Property>
@ -170,11 +110,6 @@
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
</Container>

View File

@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.contentviewers.contextviewer;
import java.awt.Component;
import java.awt.Insets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@ -28,12 +29,14 @@ import java.util.Map;
import java.util.logging.Level;
import javax.swing.BoxLayout;
import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
import javax.swing.border.EmptyBorder;
import org.apache.commons.lang.StringUtils;
import org.openide.nodes.Node;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.contentviewers.layout.ContentViewerDefaults;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.AbstractFile;
@ -56,6 +59,10 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte
private static final int ARTIFACT_STR_MAX_LEN = 1024;
private static final int ATTRIBUTE_STR_MAX_LEN = 200;
private final static Insets FIRST_HEADER_INSETS = new Insets(0, 0, 0, 0);
private final static Insets HEADER_INSETS = new Insets(ContentViewerDefaults.getSectionSpacing(), 0, ContentViewerDefaults.getLineSpacing(), 0);
private final static Insets DATA_ROW_INSETS = new Insets(0, ContentViewerDefaults.getSectionIndent(), ContentViewerDefaults.getLineSpacing(), 0);
// defines a list of artifacts that provide context for a file
private static final List<BlackboardArtifact.ARTIFACT_TYPE> CONTEXT_ARTIFACTS = new ArrayList<>();
private final List<ContextSourcePanel> contextSourcePanels = new ArrayList<>();
@ -91,76 +98,29 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte
javax.swing.JLabel jUnknownLabel = new javax.swing.JLabel();
jScrollPane = new javax.swing.JScrollPane();
jSourcePanel.setBackground(javax.swing.UIManager.getDefaults().getColor("window"));
jSourcePanel.setBorder(new EmptyBorder(FIRST_HEADER_INSETS));
jSourcePanel.setLayout(new javax.swing.BoxLayout(jSourcePanel, javax.swing.BoxLayout.PAGE_AXIS));
jSourceLabel.setFont(jSourceLabel.getFont().deriveFont(jSourceLabel.getFont().getStyle() | java.awt.Font.BOLD, jSourceLabel.getFont().getSize()+1));
jSourceLabel.setFont(ContentViewerDefaults.getHeaderFont());
org.openide.awt.Mnemonics.setLocalizedText(jSourceLabel, org.openide.util.NbBundle.getMessage(ContextViewer.class, "ContextViewer.jSourceLabel.text")); // NOI18N
jSourcePanel.add(jSourceLabel);
javax.swing.GroupLayout jSourcePanelLayout = new javax.swing.GroupLayout(jSourcePanel);
jSourcePanel.setLayout(jSourcePanelLayout);
jSourcePanelLayout.setHorizontalGroup(
jSourcePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jSourcePanelLayout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(jSourceLabel)
.addContainerGap(304, Short.MAX_VALUE))
jUsagePanel.setBorder(new EmptyBorder(HEADER_INSETS));
jUsagePanel.setLayout(new javax.swing.BoxLayout(jUsagePanel, javax.swing.BoxLayout.PAGE_AXIS));
jUsageLabel.setFont(ContentViewerDefaults.getHeaderFont()
);
jSourcePanelLayout.setVerticalGroup(
jSourcePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jSourcePanelLayout.createSequentialGroup()
.addGap(5, 5, 5)
.addComponent(jSourceLabel)
.addGap(2, 2, 2))
);
jUsagePanel.setBackground(javax.swing.UIManager.getDefaults().getColor("window"));
jUsageLabel.setFont(jUsageLabel.getFont().deriveFont(jUsageLabel.getFont().getStyle() | java.awt.Font.BOLD, jUsageLabel.getFont().getSize()+1));
org.openide.awt.Mnemonics.setLocalizedText(jUsageLabel, org.openide.util.NbBundle.getMessage(ContextViewer.class, "ContextViewer.jUsageLabel.text")); // NOI18N
jUsagePanel.add(jUsageLabel);
javax.swing.GroupLayout jUsagePanelLayout = new javax.swing.GroupLayout(jUsagePanel);
jUsagePanel.setLayout(jUsagePanelLayout);
jUsagePanelLayout.setHorizontalGroup(
jUsagePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jUsagePanelLayout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(jUsageLabel)
.addContainerGap(298, Short.MAX_VALUE))
);
jUsagePanelLayout.setVerticalGroup(
jUsagePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jUsagePanelLayout.createSequentialGroup()
.addGap(2, 2, 2)
.addComponent(jUsageLabel)
.addGap(2, 2, 2))
);
jUnknownPanel.setBackground(new java.awt.Color(255, 255, 255));
jUnknownPanel.setLayout(new javax.swing.BoxLayout(jUnknownPanel, javax.swing.BoxLayout.PAGE_AXIS));
org.openide.awt.Mnemonics.setLocalizedText(jUnknownLabel, org.openide.util.NbBundle.getMessage(ContextViewer.class, "ContextViewer.jUnknownLabel.text")); // NOI18N
jUnknownLabel.setBorder(new EmptyBorder(DATA_ROW_INSETS));
jUnknownPanel.add(jUnknownLabel);
javax.swing.GroupLayout jUnknownPanelLayout = new javax.swing.GroupLayout(jUnknownPanel);
jUnknownPanel.setLayout(jUnknownPanelLayout);
jUnknownPanelLayout.setHorizontalGroup(
jUnknownPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jUnknownPanelLayout.createSequentialGroup()
.addGap(50, 50, 50)
.addComponent(jUnknownLabel)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jUnknownPanelLayout.setVerticalGroup(
jUnknownPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jUnknownPanelLayout.createSequentialGroup()
.addGap(2, 2, 2)
.addComponent(jUnknownLabel)
.addGap(2, 2, 2))
);
setBackground(new java.awt.Color(255, 255, 255));
setPreferredSize(new java.awt.Dimension(495, 358));
jScrollPane.setBackground(new java.awt.Color(255, 255, 255));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@ -275,6 +235,8 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte
}
}
javax.swing.JPanel contextContainer = new javax.swing.JPanel();
contextContainer.setBorder(new EmptyBorder(ContentViewerDefaults.getPanelInsets()));
contextContainer.add(jSourcePanel);
contextContainer.setLayout(new BoxLayout(contextContainer, BoxLayout.Y_AXIS));
if (contextSourcePanels.isEmpty()) {
@ -282,6 +244,7 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte
} else {
for (javax.swing.JPanel sourcePanel : contextSourcePanels) {
contextContainer.add(sourcePanel);
contextContainer.setAlignmentX(0);
}
}
contextContainer.add(jUsagePanel);
@ -290,10 +253,11 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte
} else {
for (javax.swing.JPanel usagePanel : contextUsagePanels) {
contextContainer.add(usagePanel);
contextContainer.setAlignmentX(0);
}
}
contextContainer.setBackground(javax.swing.UIManager.getDefaults().getColor("window"));
contextContainer.setBackground(ContentViewerDefaults.getPanelBackground());
contextContainer.setEnabled(foundASource);
contextContainer.setVisible(foundASource);
jScrollPane.getViewport().setView(contextContainer);
@ -346,6 +310,8 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte
String sourceName = Bundle.ContextViewer_attachmentSource();
String sourceText = msgArtifactToAbbreviatedString(associatedArtifact);
ContextSourcePanel sourcePanel = new ContextSourcePanel(sourceName, sourceText, associatedArtifact, dateTime);
sourcePanel.setBorder(new EmptyBorder(DATA_ROW_INSETS));
sourcePanel.setAlignmentX(0);
contextSourcePanels.add(sourcePanel);
} else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() == associatedArtifact.getArtifactTypeID()
@ -353,18 +319,24 @@ public final class ContextViewer extends javax.swing.JPanel implements DataConte
String sourceName = Bundle.ContextViewer_downloadSource();
String sourceText = webDownloadArtifactToString(associatedArtifact);
ContextSourcePanel sourcePanel = new ContextSourcePanel(sourceName, sourceText, associatedArtifact, dateTime);
sourcePanel.setBorder(new EmptyBorder(DATA_ROW_INSETS));
sourcePanel.setAlignmentX(0);
contextSourcePanels.add(sourcePanel);
} else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID() == associatedArtifact.getArtifactTypeID()) {
String sourceName = Bundle.ContextViewer_recentDocs();
String sourceText = recentDocArtifactToString(associatedArtifact);
ContextUsagePanel usagePanel = new ContextUsagePanel(sourceName, sourceText, associatedArtifact, dateTime);
usagePanel.setBorder(new EmptyBorder(DATA_ROW_INSETS));
usagePanel.setAlignmentX(0);
contextUsagePanels.add(usagePanel);
} else if (BlackboardArtifact.ARTIFACT_TYPE.TSK_PROG_RUN.getTypeID() == associatedArtifact.getArtifactTypeID()) {
String sourceName = Bundle.ContextViewer_programExecution();
String sourceText = programExecArtifactToString(associatedArtifact);
ContextUsagePanel usagePanel = new ContextUsagePanel(sourceName, sourceText, associatedArtifact, dateTime);
usagePanel.setBorder(new EmptyBorder(DATA_ROW_INSETS));
usagePanel.setAlignmentX(0);
contextUsagePanels.add(usagePanel);
}

View File

@ -10,6 +10,7 @@ import java.awt.Font;
import java.awt.Insets;
import java.awt.Toolkit;
import com.google.common.base.Supplier;
import java.awt.Color;
import javax.swing.UIManager;
/**
@ -17,6 +18,7 @@ import javax.swing.UIManager;
* @author gregd
*/
public class ContentViewerDefaults {
private static final Supplier<Font> DEFAULT_FONT = Suppliers.memoize(() -> UIManager.getDefaults().getFont("Label.font"));
private static final Supplier<Integer> DEFAULT_FONT_PX = Suppliers.memoize(() -> {
@ -34,8 +36,10 @@ public class ContentViewerDefaults {
private static final Supplier<Integer> DEFAULT_INDENT = Suppliers.memoize(() -> DEFAULT_FONT_PX.get());
private static final Supplier<Integer> DEFAULT_SECTION_SPACING = Suppliers.memoize(() -> DEFAULT_FONT_PX.get());
private static final Supplier<Integer> DEFAULT_COLUMN_SPACING = Suppliers.memoize(() -> (int)(DEFAULT_FONT_PX.get() / 3));
private static final Supplier<Integer> DEFAULT_LINE_SPACING = Suppliers.memoize(() -> (int)(DEFAULT_FONT_PX.get() / 5));
private static final Supplier<Integer> DEFAULT_COLUMN_SPACING = Suppliers.memoize(() -> (DEFAULT_FONT_PX.get() / 3));
private static final Supplier<Integer> DEFAULT_LINE_SPACING = Suppliers.memoize(() -> (DEFAULT_FONT_PX.get() / 5));
private static final Supplier<Color> DEFAULT_BACKGROUND = Suppliers.memoize(() -> UIManager.getColor("Panel.background"));
public static int getColumnSpacing() {
return DEFAULT_COLUMN_SPACING.get();
@ -65,5 +69,8 @@ public class ContentViewerDefaults {
return DEFAULT_LINE_SPACING.get();
}
public static Color getPanelBackground() {
return DEFAULT_BACKGROUND.get();
}
// line spacing???
}