diff --git a/Core/src/org/sleuthkit/autopsy/discovery/DiscoveryTopComponent.java b/Core/src/org/sleuthkit/autopsy/discovery/DiscoveryTopComponent.java index 526207981c..56954a2be3 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/DiscoveryTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/DiscoveryTopComponent.java @@ -22,6 +22,8 @@ import com.google.common.eventbus.Subscribe; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.util.List; import java.util.stream.Collectors; import javax.swing.JSplitPane; @@ -53,7 +55,8 @@ public final class DiscoveryTopComponent extends TopComponent { private int dividerLocation = -1; private static final int ANIMATION_INCREMENT = 10; - private static final int RESULTS_AREA_SMALL_SIZE = 250; + private volatile static int resultsAreaSize = 250; + private volatile static int previousResultsAreaSize = -1; private SwingAnimator animator = null; @@ -78,6 +81,23 @@ public final class DiscoveryTopComponent extends TopComponent { } }); + rightSplitPane.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getPropertyName().equalsIgnoreCase(JSplitPane.DIVIDER_LOCATION_PROPERTY)) { + //Only change the saved location when it was a manual change by the user and not the animation or the window opening initially + if ((animator == null || !animator.isRunning()) && evt.getNewValue() instanceof Integer + && ((int) evt.getNewValue() + 5) < (rightSplitPane.getHeight() - rightSplitPane.getDividerSize()) && (int) evt.getNewValue() != previousResultsAreaSize) { + System.out.println("setting small size" + (int) evt.getNewValue()); + System.out.println("HEIGHT: " + rightSplitPane.getHeight()); + System.out.println("DIVIDER LOC: " + rightSplitPane.getDividerLocation()); + previousResultsAreaSize = (int) evt.getOldValue(); + resultsAreaSize = (int) evt.getNewValue(); + + } + } + } + }); } /** @@ -245,6 +265,7 @@ public final class DiscoveryTopComponent extends TopComponent { void handleDetailsVisibleEvent(DiscoveryEventUtils.DetailsVisibleEvent detailsVisibleEvent) { if (animator != null && animator.isRunning()) { animator.stop(); + animator = null; } dividerLocation = rightSplitPane.getDividerLocation(); if (detailsVisibleEvent.isShowDetailsArea()) { @@ -316,8 +337,9 @@ public final class DiscoveryTopComponent extends TopComponent { @Override public boolean hasTerminated() { - if (dividerLocation != JSplitPane.UNDEFINED_CONDITION && dividerLocation < RESULTS_AREA_SMALL_SIZE) { - dividerLocation = RESULTS_AREA_SMALL_SIZE; + if (dividerLocation != JSplitPane.UNDEFINED_CONDITION && dividerLocation < resultsAreaSize) { + dividerLocation = resultsAreaSize; + animator = null; return true; } return false; @@ -340,6 +362,7 @@ public final class DiscoveryTopComponent extends TopComponent { public boolean hasTerminated() { if (dividerLocation > rightSplitPane.getHeight() || dividerLocation == JSplitPane.UNDEFINED_CONDITION) { dividerLocation = rightSplitPane.getHeight(); + animator = null; return true; } return false; @@ -362,8 +385,9 @@ public final class DiscoveryTopComponent extends TopComponent { @Override public void paintComponent(Graphics g) { - if ((dividerLocation == JSplitPane.UNDEFINED_CONDITION) || (dividerLocation <= rightSplitPane.getHeight() && dividerLocation >= RESULTS_AREA_SMALL_SIZE)) { - rightSplitPane.setDividerLocation(dividerLocation); + if (animator != null && animator.isRunning() && (dividerLocation == JSplitPane.UNDEFINED_CONDITION + || (dividerLocation <= getHeight() && dividerLocation >= resultsAreaSize))) { + setDividerLocation(dividerLocation); } super.paintComponent(g); } diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ResultsPanel.form b/Core/src/org/sleuthkit/autopsy/discovery/ResultsPanel.form index d35521df46..cad2e006cd 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ResultsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/discovery/ResultsPanel.form @@ -3,7 +3,7 @@
- + @@ -315,7 +315,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ResultsPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ResultsPanel.java index 7082b0d835..fc86f7a963 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ResultsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ResultsPanel.java @@ -376,7 +376,7 @@ final class ResultsPanel extends javax.swing.JPanel { javax.swing.Box.Filler filler4 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0)); resultsViewerPanel = new javax.swing.JPanel(); - setMinimumSize(new java.awt.Dimension(700, 200)); + setMinimumSize(new java.awt.Dimension(300, 60)); setPreferredSize(new java.awt.Dimension(700, 700)); setLayout(new java.awt.BorderLayout()); @@ -533,7 +533,7 @@ final class ResultsPanel extends javax.swing.JPanel { add(pagingPanel, java.awt.BorderLayout.PAGE_START); - resultsViewerPanel.setMinimumSize(new java.awt.Dimension(0, 160)); + resultsViewerPanel.setMinimumSize(new java.awt.Dimension(0, 60)); resultsViewerPanel.setPreferredSize(new java.awt.Dimension(700, 700)); resultsViewerPanel.setLayout(new java.awt.BorderLayout()); add(resultsViewerPanel, java.awt.BorderLayout.CENTER);