From c13e518d6a512abbba5c009a1a870e1d1fad42ab Mon Sep 17 00:00:00 2001 From: millmanorama Date: Thu, 11 Jan 2018 11:46:31 +0100 Subject: [PATCH] reduce public surface of the API --- .../autopsy/communications/AccountDetailsNode.java | 2 +- .../communications/AccountDeviceInstanceNode.java | 10 +++++----- .../autopsy/communications/AccountsBrowser.java | 2 +- .../sleuthkit/autopsy/communications/CVTEvents.java | 7 +++++-- .../autopsy/communications/MessageBrowser.java | 2 +- .../autopsy/communications/MessageDataContent.java | 2 +- .../autopsy/communications/PinAccountEvent.java | 4 ++-- .../autopsy/communications/RelationshipNode.java | 4 ++-- .../autopsy/communications/VisualizationPanel.java | 11 +++++++++-- 9 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java b/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java index 88470e87e0..7bc1a0faae 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java @@ -38,7 +38,7 @@ import org.sleuthkit.datamodel.TskCoreException; * relationships of all the accounts in this node. * */ -class AccountDetailsNode extends AbstractNode { +final class AccountDetailsNode extends AbstractNode { private final static Logger logger = Logger.getLogger(AccountDetailsNode.class.getName()); diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java b/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java index aa34a65e8e..5b88b01999 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java @@ -54,23 +54,23 @@ final class AccountDeviceInstanceNode extends AbstractNode { setIconBaseWithExtension("org/sleuthkit/autopsy/communications/images/" + Utils.getIconFileName(account.getAccountType())); } - public AccountDeviceInstance getAccountDeviceInstance() { + AccountDeviceInstance getAccountDeviceInstance() { return accountDeviceInstanceKey.getAccountDeviceInstance(); } - public AccountDeviceInstanceKey getAccountDeviceInstanceKey() { + AccountDeviceInstanceKey getAccountDeviceInstanceKey() { return accountDeviceInstanceKey; } - public CommunicationsManager getCommsManager() { + CommunicationsManager getCommsManager() { return commsManager; } - public long getMessageCount() { + long getMessageCount() { return accountDeviceInstanceKey.getMessageCount(); } - public CommunicationsFilter getFilter() { + CommunicationsFilter getFilter() { return accountDeviceInstanceKey.getCommunicationsFilter(); } diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountsBrowser.java b/Core/src/org/sleuthkit/autopsy/communications/AccountsBrowser.java index 8d6407fe02..828d654298 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountsBrowser.java +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountsBrowser.java @@ -70,7 +70,7 @@ public final class AccountsBrowser extends JPanel implements ExplorerManager.Pro } - protected void init(ExplorerManager tableExplorerManager) { + void init(ExplorerManager tableExplorerManager) { this.accountsTableEM = tableExplorerManager; tableExplorerManager.addPropertyChangeListener(evt -> { if (ExplorerManager.PROP_ROOT_CONTEXT.equals(evt.getPropertyName())) { diff --git a/Core/src/org/sleuthkit/autopsy/communications/CVTEvents.java b/Core/src/org/sleuthkit/autopsy/communications/CVTEvents.java index a8e75fffe9..663b711c99 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/CVTEvents.java +++ b/Core/src/org/sleuthkit/autopsy/communications/CVTEvents.java @@ -21,14 +21,17 @@ package org.sleuthkit.autopsy.communications; import com.google.common.eventbus.EventBus; /** - * Provide he singleton EventBus. + * Provide the singleton EventBus. */ final class CVTEvents { private final static EventBus cvtEventBus = new EventBus(); - public static EventBus getCVTEventBus() { + static EventBus getCVTEventBus() { return cvtEventBus; } + private CVTEvents() { + } + } diff --git a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java index 8fe4873f54..7d0146715b 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java +++ b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java @@ -57,7 +57,7 @@ public final class MessageBrowser extends JPanel implements ExplorerManager.Prov * context-sensitive actions. */ @NbBundle.Messages({"MessageBrowser.DataResultViewerTable.title=Messages"}) - public MessageBrowser(ExplorerManager tableEM, ExplorerManager gacExplorerManager) { + MessageBrowser(ExplorerManager tableEM, ExplorerManager gacExplorerManager) { this.tableEM = tableEM; this.gacExplorerManager = gacExplorerManager; initComponents(); diff --git a/Core/src/org/sleuthkit/autopsy/communications/MessageDataContent.java b/Core/src/org/sleuthkit/autopsy/communications/MessageDataContent.java index 1c4ea0f7b4..ac54faa6ad 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/MessageDataContent.java +++ b/Core/src/org/sleuthkit/autopsy/communications/MessageDataContent.java @@ -26,7 +26,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataContent; * Extends MessageContentViewer so that it implements DataContent and can be set * as the only ContentViewer for a DataResultPanel */ -public class MessageDataContent extends MessageContentViewer implements DataContent { +final class MessageDataContent extends MessageContentViewer implements DataContent { private static final long serialVersionUID = 1L; diff --git a/Core/src/org/sleuthkit/autopsy/communications/PinAccountEvent.java b/Core/src/org/sleuthkit/autopsy/communications/PinAccountEvent.java index e77ab3f35d..c8ba063adb 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/PinAccountEvent.java +++ b/Core/src/org/sleuthkit/autopsy/communications/PinAccountEvent.java @@ -11,11 +11,11 @@ import java.util.Collection; /** * */ -class PinAccountEvent { +final class PinAccountEvent { private final ImmutableSet accountDeviceInstances; - public ImmutableSet getAccountDeviceInstances() { + ImmutableSet getAccountDeviceInstances() { return accountDeviceInstances; } diff --git a/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java b/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java index 31f5871b81..fff7dfa9ad 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java @@ -43,11 +43,11 @@ import org.sleuthkit.datamodel.TskCoreException; /** * Node for a relationship, as represented by a BlackboardArtifact. */ -public class RelationshipNode extends BlackboardArtifactNode { +final class RelationshipNode extends BlackboardArtifactNode { private static final Logger logger = Logger.getLogger(RelationshipNode.class.getName()); - public RelationshipNode(BlackboardArtifact artifact) { + RelationshipNode(BlackboardArtifact artifact) { super(artifact); final String stripEnd = StringUtils.stripEnd(artifact.getDisplayName(), "s"); String removeEndIgnoreCase = StringUtils.removeEndIgnoreCase(stripEnd, "message"); diff --git a/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.java b/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.java index 320e7d493b..678b6eabac 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.java +++ b/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.java @@ -24,6 +24,7 @@ import com.mxgraph.model.mxCell; import com.mxgraph.swing.mxGraphComponent; import com.mxgraph.util.mxConstants; import com.mxgraph.view.mxGraph; +import com.mxgraph.view.mxGraphView; import com.mxgraph.view.mxStylesheet; import java.awt.BorderLayout; import java.awt.Color; @@ -86,7 +87,7 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider private CommunicationsManager commsManager; - protected void setFilterProvider(FilterProvider filterProvider) { + void setFilterProvider(FilterProvider filterProvider) { this.filterProvider = filterProvider; } private FilterProvider filterProvider; @@ -102,8 +103,10 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider graph.setDisconnectOnMove(false); graph.setEdgeLabelsMovable(false); graph.setVertexLabelsMovable(false); + graph.setAutoOrigin(true); graphComponent = new mxGraphComponent(graph); graphComponent.setAutoScroll(true); + graphComponent.setOpaque(true); graphComponent.setBackground(Color.WHITE); jPanel1.add(graphComponent, BorderLayout.CENTER); @@ -249,7 +252,6 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider } @Override - public void removeNotify() { super.removeNotify(); // IngestManager.getInstance().removeIngestModuleEventListener(ingestListener); @@ -316,6 +318,11 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider private void applyOrganicLayout() { new mxOrganicLayout(graph).execute(graph.getDefaultParent()); + + mxGraphView view = graphComponent.getGraph().getView(); + int compLen = graphComponent.getWidth(); + int viewLen = (int) view.getGraphBounds().getWidth(); + view.setScale((double) compLen / viewLen * view.getScale()); graphComponent.zoomAndCenter(); }