diff --git a/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.form b/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.form index a847f700c7..49b86ae014 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.form +++ b/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.form @@ -11,7 +11,7 @@ - + @@ -49,9 +49,9 @@ - + - + @@ -120,7 +120,7 @@ - + @@ -312,6 +312,17 @@ + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.java b/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.java index 8d0743b272..eb33b557e2 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.java +++ b/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.java @@ -44,6 +44,7 @@ import java.awt.Cursor; import java.awt.Dimension; import java.awt.Font; import java.awt.Frame; +import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -57,14 +58,18 @@ import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.concurrent.ExecutionException; -import java.util.Map; import java.util.concurrent.Future; import java.util.function.BiConsumer; import java.util.logging.Level; import java.util.stream.Collectors; import java.util.stream.Stream; +import javafx.application.Platform; +import javafx.embed.swing.JFXPanel; +import javafx.scene.Scene; +import javafx.scene.layout.Pane; import javax.swing.AbstractAction; import javax.swing.ImageIcon; import javax.swing.JButton; @@ -78,6 +83,7 @@ import javax.swing.JToolBar; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; +import org.controlsfx.control.Notifications; import org.jdesktop.layout.GroupLayout; import org.jdesktop.layout.LayoutStyle; import org.openide.explorer.ExplorerManager; @@ -89,7 +95,6 @@ import org.openide.util.lookup.ProxyLookup; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.coreutils.ThreadConfined; import org.sleuthkit.autopsy.progress.ModalDialogProgressIndicator; import org.sleuthkit.datamodel.CommunicationsFilter; @@ -142,12 +147,43 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider private final Map layoutButtons = new HashMap<>(); private NamedGraphLayout currentLayout; + @NbBundle.Messages("VisalizationPanel.paintingError=Problem painting visualization.") public VisualizationPanel() { initComponents(); + //initialize invisible JFXPanel that is used to show JFXNotifications over this window. + notificationsJFXPanel.setScene(new Scene(new Pane())); graph = new CommunicationsGraph(pinnedAccountModel, lockedVertexModel); - graphComponent = new mxGraphComponent(graph); + /* + * custom implementation of mxGraphComponent that uses... a custom + * implementation of mxGraphControl ... that overrides paint so we can + * catch the NPEs we are getting and deal with them. For now that means + * just ignoring them. + */ + graphComponent = new mxGraphComponent(graph) { + @Override + protected mxGraphComponent.mxGraphControl createGraphControl() { + + return new mxGraphControl() { + + @Override + public void paint(Graphics graphics) { + try { + super.paint(graphics); + } catch (NullPointerException ex) { //NOPMD + /* We can't find the underlying cause of the NPE in + * jgraphx, but it doesn't seem to cause any + * noticeable problems, so we are just logging it + * and moving on. + */ + logger.log(Level.WARNING, "There was a NPE while painting the VisualizationPanel", ex); + } + } + + }; + } + }; graphComponent.setAutoExtend(true); graphComponent.setAutoScroll(true); graphComponent.setAutoscrolls(true); @@ -350,6 +386,7 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider zoomLabel = new JLabel(); clearVizButton = new JButton(); jSeparator2 = new JToolBar.Separator(); + notificationsJFXPanel = new JFXPanel(); setLayout(new BorderLayout()); @@ -368,9 +405,9 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider placeHolderPanel.setLayout(placeHolderPanelLayout); placeHolderPanelLayout.setHorizontalGroup(placeHolderPanelLayout.createParallelGroup(GroupLayout.LEADING) .add(placeHolderPanelLayout.createSequentialGroup() - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap(71, Short.MAX_VALUE) .add(jTextArea1, GroupLayout.PREFERRED_SIZE, 424, GroupLayout.PREFERRED_SIZE) - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(248, Short.MAX_VALUE)) ); placeHolderPanelLayout.setVerticalGroup(placeHolderPanelLayout.createParallelGroup(GroupLayout.LEADING) .add(placeHolderPanelLayout.createSequentialGroup() @@ -499,7 +536,7 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider .add(zoomActualButton, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.RELATED) .add(fitZoomButton, GroupLayout.PREFERRED_SIZE, 32, GroupLayout.PREFERRED_SIZE) - .addContainerGap(12, Short.MAX_VALUE)) + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); toolbarLayout.setVerticalGroup(toolbarLayout.createParallelGroup(GroupLayout.LEADING) .add(toolbarLayout.createSequentialGroup() @@ -523,6 +560,7 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider ); borderLayoutPanel.add(toolbar, BorderLayout.PAGE_START); + borderLayoutPanel.add(notificationsJFXPanel, BorderLayout.PAGE_END); splitPane.setLeftComponent(borderLayoutPanel); @@ -584,12 +622,15 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider get(); } catch (InterruptedException | ExecutionException ex) { logger.log(Level.WARNING, "CVT graph layout failed.", ex); - if (lockedVertexModel.isEmpty()) { - MessageNotifyUtil.Message.error(Bundle.VisualizationPanel_layoutFail_text(layout.getDisplayName())); - } else { - MessageNotifyUtil.Message.error(Bundle.VisualizationPanel_layoutFailWithLockedVertices_text(layout.getDisplayName())); - } - undoManager.undo(); + String message = (lockedVertexModel.isEmpty()) + ? Bundle.VisualizationPanel_layoutFail_text(layout.getDisplayName()) + : Bundle.VisualizationPanel_layoutFailWithLockedVertices_text(layout.getDisplayName()); + + Platform.runLater(() + -> Notifications.create().owner(notificationsJFXPanel.getScene().getWindow()) + .text(message) + .showWarning() + ); } } }.execute(); @@ -646,6 +687,7 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider private JToolBar.Separator jSeparator1; private JToolBar.Separator jSeparator2; private JTextArea jTextArea1; + private JFXPanel notificationsJFXPanel; private JButton organicLayoutButton; private JPanel placeHolderPanel; private JSplitPane splitPane; @@ -724,7 +766,7 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider @Override public boolean isVertexIgnored(Object vertex) { return super.isVertexIgnored(vertex) - || lockedVertexModel.isVertexLocked((mxCell) vertex); + || lockedVertexModel.isVertexLocked((mxCell) vertex); } @Override @@ -755,7 +797,7 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider @Override public boolean isVertexIgnored(Object vertex) { return super.isVertexIgnored(vertex) - || lockedVertexModel.isVertexLocked((mxCell) vertex); + || lockedVertexModel.isVertexLocked((mxCell) vertex); } @Override @@ -786,7 +828,7 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider @Override public boolean isVertexIgnored(Object vertex) { return super.isVertexIgnored(vertex) - || lockedVertexModel.isVertexLocked((mxCell) vertex); + || lockedVertexModel.isVertexLocked((mxCell) vertex); } @Override @@ -816,7 +858,7 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider @Override public boolean isVertexIgnored(Object vertex) { return super.isVertexIgnored(vertex) - || lockedVertexModel.isVertexLocked((mxCell) vertex); + || lockedVertexModel.isVertexLocked((mxCell) vertex); } @Override diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalLanguageSettingsPanel.form b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalLanguageSettingsPanel.form index c6f133161b..02b5d3cede 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalLanguageSettingsPanel.form +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalLanguageSettingsPanel.form @@ -48,14 +48,14 @@ - + - + diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalLanguageSettingsPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalLanguageSettingsPanel.java index 513b26ea30..8342587833 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalLanguageSettingsPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchGlobalLanguageSettingsPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2012-2014 Basis Technology Corp. + * Copyright 2012-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,6 +28,7 @@ import java.util.Map; import javax.swing.JCheckBox; import org.netbeans.spi.options.OptionsPanelController; import org.sleuthkit.autopsy.corecomponents.OptionsPanel; +import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.StringExtract; import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT; import org.sleuthkit.autopsy.ingest.IngestManager; @@ -61,6 +62,10 @@ class KeywordSearchGlobalLanguageSettingsPanel extends javax.swing.JPanel implem } } }; + + if (!PlatformUtil.isWindowsOS()) { + enableOcrCheckbox.setVisible(false); + } initScriptsCheckBoxes(); reloadScriptsCheckBoxes(); @@ -234,14 +239,14 @@ class KeywordSearchGlobalLanguageSettingsPanel extends javax.swing.JPanel implem .addComponent(ingestSettingsLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(enableOcrCheckbox) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(enableUTF16Checkbox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(enableUTF8Checkbox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(languagesLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(langPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 380, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(langPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE) .addContainerGap()) ); }// //GEN-END:initComponents diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchSettings.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchSettings.java index 096c6a255a..4350ce3085 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchSettings.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchSettings.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2012-2014 Basis Technology Corp. + * Copyright 2012-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -132,7 +132,8 @@ class KeywordSearchSettings { /** * Save OCR setting to permanent storage - * @param enabled + * + * @param enabled Is OCR enabled? */ static void setOcrOption(boolean enabled) { ModuleSettings.setConfigSetting(PROPERTIES_OPTIONS, OCR_ENABLED, (enabled ? "true" : "false")); //NON-NLS @@ -140,7 +141,8 @@ class KeywordSearchSettings { /** * Get OCR setting from permanent storage - * @return + * + * @return Is OCR enabled? */ static boolean getOcrOption() { if (ModuleSettings.settingExists(PROPERTIES_OPTIONS, OCR_ENABLED)) {