mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-20 03:24:55 +00:00
locked nodes are not moved by SOME layouts.
This commit is contained in:
parent
168cc8bea6
commit
b6ea00af8c
@ -140,27 +140,25 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider
|
|||||||
//install rubber band selection handler
|
//install rubber band selection handler
|
||||||
rubberband = new mxRubberband(graphComponent);
|
rubberband = new mxRubberband(graphComponent);
|
||||||
|
|
||||||
graph.getView().addListener(mxEvent.SCALE, (Object sender, mxEventObject evt) -> {
|
final mxEventSource.mxIEventListener scaleListener = (Object sender, mxEventObject evt) ->
|
||||||
zoomLabel.setText(DecimalFormat.getPercentInstance().format(graph.getScale()));
|
zoomLabel.setText(DecimalFormat.getPercentInstance().format(graph.getScale()));
|
||||||
});
|
graph.getView().addListener(mxEvent.SCALE, scaleListener);
|
||||||
|
graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE, scaleListener);
|
||||||
|
|
||||||
graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE, (Object sender, mxEventObject evt) -> {
|
//right click handler
|
||||||
zoomLabel.setText(DecimalFormat.getPercentInstance().format(graph.getScale()));
|
graphComponent.getGraphControl().addMouseWheelListener(new MouseAdapter() {
|
||||||
});
|
|
||||||
final MouseAdapter mouseAdapter = new MouseAdapter() {
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseWheelMoved(MouseWheelEvent e) {
|
public void mouseWheelMoved(final MouseWheelEvent e) {
|
||||||
super.mouseWheelMoved(e);
|
super.mouseWheelMoved(e);
|
||||||
if (e.getPreciseWheelRotation() > 0) {
|
if (e.getPreciseWheelRotation() > 0) {
|
||||||
graphComponent.zoomTo(graph.getScale() / graphComponent.getZoomFactor(), true);
|
graphComponent.zoomTo(graph.getScale() / graphComponent.getZoomFactor(), true);
|
||||||
// graphComponent.zoomIn();
|
|
||||||
} else if (e.getPreciseWheelRotation() < 0) {
|
} else if (e.getPreciseWheelRotation() < 0) {
|
||||||
graphComponent.zoomTo(graph.getScale() * graphComponent.getZoomFactor(), true);
|
graphComponent.zoomTo(graph.getScale() * graphComponent.getZoomFactor(), true);
|
||||||
// graphComponent.zoomOut();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
graphComponent.getGraphControl().addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
super.mouseClicked(e);
|
super.mouseClicked(e);
|
||||||
@ -168,8 +166,27 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider
|
|||||||
mxICell cellAt = (mxICell) graphComponent.getCellAt(e.getX(), e.getY());
|
mxICell cellAt = (mxICell) graphComponent.getCellAt(e.getX(), e.getY());
|
||||||
if (cellAt != null && cellAt.isVertex()) {
|
if (cellAt != null && cellAt.isVertex()) {
|
||||||
JPopupMenu jPopupMenu = new JPopupMenu();
|
JPopupMenu jPopupMenu = new JPopupMenu();
|
||||||
if (graph.isAccountPinned((AccountDeviceInstanceKey) cellAt.getValue())) {
|
AccountDeviceInstanceKey adiKey = (AccountDeviceInstanceKey) cellAt.getValue();
|
||||||
jPopupMenu.add(new JMenuItem(new AbstractAction("Unpin Account " + cellAt.getId(), unpinIcon) {
|
|
||||||
|
if (graph.isAccountLocked(adiKey)) {
|
||||||
|
jPopupMenu.add(new JMenuItem(new AbstractAction("UnLock " + cellAt.getId(), unlockIcon) {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
graph.unlockAccount((AccountDeviceInstanceKey) cellAt.getValue());
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
}else {
|
||||||
|
jPopupMenu.add(new JMenuItem(new AbstractAction("Lock " + cellAt.getId(), lockIcon) {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
graph.lockAccount((AccountDeviceInstanceKey) cellAt.getValue());
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
}
|
||||||
|
if (graph.isAccountPinned(adiKey)) {
|
||||||
|
jPopupMenu.add(new JMenuItem(new AbstractAction("Unpin " + cellAt.getId(), unpinIcon) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
handleUnPinEvent(new CVTEvents.UnpinAccountsEvent(singleton((AccountDeviceInstanceKey) cellAt.getValue())));
|
handleUnPinEvent(new CVTEvents.UnpinAccountsEvent(singleton((AccountDeviceInstanceKey) cellAt.getValue())));
|
||||||
@ -177,26 +194,13 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider
|
|||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
jPopupMenu.add(new JMenuItem(new AbstractAction("Lock Account " + cellAt.getId(), lockIcon) {
|
jPopupMenu.add(new JMenuItem(new AbstractAction("Pin " + cellAt.getId(), addPinIcon) {
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
graph.lockAccount((AccountDeviceInstanceKey) cellAt.getValue());
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
jPopupMenu.add(new JMenuItem(new AbstractAction("UnLock Account " + cellAt.getId(), unlockIcon) {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
graph.unlockAccount((AccountDeviceInstanceKey) cellAt.getValue());
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
jPopupMenu.add(new JMenuItem(new AbstractAction("Pin Account " + cellAt.getId(), addPinIcon) {
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
handlePinEvent(new CVTEvents.PinAccountsEvent(singleton((AccountDeviceInstanceKey) cellAt.getValue()), false));
|
handlePinEvent(new CVTEvents.PinAccountsEvent(singleton((AccountDeviceInstanceKey) cellAt.getValue()), false));
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
jPopupMenu.add(new JMenuItem(new AbstractAction("Reset and Pin Account " + cellAt.getId(), pinIcon) {
|
jPopupMenu.add(new JMenuItem(new AbstractAction("Pin only " + cellAt.getId(), pinIcon) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
handlePinEvent(new CVTEvents.PinAccountsEvent(singleton((AccountDeviceInstanceKey) cellAt.getValue()), true));
|
handlePinEvent(new CVTEvents.PinAccountsEvent(singleton((AccountDeviceInstanceKey) cellAt.getValue()), true));
|
||||||
@ -208,10 +212,7 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
//right click handler
|
|
||||||
graphComponent.getGraphControl().addMouseWheelListener(mouseAdapter);
|
|
||||||
graphComponent.getGraphControl().addMouseListener(mouseAdapter);
|
|
||||||
|
|
||||||
splitPane.setRightComponent(new MessageBrowser(vizEM, gacEM));
|
splitPane.setRightComponent(new MessageBrowser(vizEM, gacEM));
|
||||||
|
|
||||||
@ -582,7 +583,9 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider
|
|||||||
}//GEN-LAST:event_zoomOutButtonActionPerformed
|
}//GEN-LAST:event_zoomOutButtonActionPerformed
|
||||||
|
|
||||||
private void circleLayoutButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_circleLayoutButtonActionPerformed
|
private void circleLayoutButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_circleLayoutButtonActionPerformed
|
||||||
morph(new mxCircleLayout(graph));
|
final mxCircleLayout mxCircleLayout = new mxCircleLayout(graph);
|
||||||
|
mxCircleLayout.setResetEdges(true);
|
||||||
|
morph(mxCircleLayout);
|
||||||
}//GEN-LAST:event_circleLayoutButtonActionPerformed
|
}//GEN-LAST:event_circleLayoutButtonActionPerformed
|
||||||
|
|
||||||
private void OrganicLayoutButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_OrganicLayoutButtonActionPerformed
|
private void OrganicLayoutButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_OrganicLayoutButtonActionPerformed
|
||||||
@ -590,11 +593,14 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider
|
|||||||
}//GEN-LAST:event_OrganicLayoutButtonActionPerformed
|
}//GEN-LAST:event_OrganicLayoutButtonActionPerformed
|
||||||
|
|
||||||
private void fastOrganicLayoutButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_fastOrganicLayoutButtonActionPerformed
|
private void fastOrganicLayoutButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_fastOrganicLayoutButtonActionPerformed
|
||||||
morph(new mxFastOrganicLayout(graph));
|
final mxFastOrganicLayout mxFastOrganicLayout = new mxFastOrganicLayout(graph);
|
||||||
|
|
||||||
|
morph(mxFastOrganicLayout);
|
||||||
}//GEN-LAST:event_fastOrganicLayoutButtonActionPerformed
|
}//GEN-LAST:event_fastOrganicLayoutButtonActionPerformed
|
||||||
|
|
||||||
private void hierarchyLayoutButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_hierarchyLayoutButtonActionPerformed
|
private void hierarchyLayoutButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_hierarchyLayoutButtonActionPerformed
|
||||||
morph(new mxHierarchicalLayout(graph));
|
final mxHierarchicalLayout mxHierarchicalLayout = new mxHierarchicalLayout(graph);
|
||||||
|
morph(mxHierarchicalLayout);
|
||||||
}//GEN-LAST:event_hierarchyLayoutButtonActionPerformed
|
}//GEN-LAST:event_hierarchyLayoutButtonActionPerformed
|
||||||
|
|
||||||
private void applyOrganicLayout(int iterations) {
|
private void applyOrganicLayout(int iterations) {
|
||||||
@ -605,6 +611,7 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
mxOrganicLayout.setResetEdges(true);
|
||||||
mxOrganicLayout.setMaxIterations(iterations);
|
mxOrganicLayout.setMaxIterations(iterations);
|
||||||
morph(mxOrganicLayout);
|
morph(mxOrganicLayout);
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,8 @@ import org.sleuthkit.datamodel.TskCoreException;
|
|||||||
final class mxGraphImpl extends mxGraph {
|
final class mxGraphImpl extends mxGraph {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(mxGraphImpl.class.getName());
|
private static final Logger logger = Logger.getLogger(mxGraphImpl.class.getName());
|
||||||
private static final URL MARKER_PIN_URL = VisualizationPanel.class.getResource("/org/sleuthkit/autopsy/communications/images/marker--pin.png");
|
private static final URL MARKER_PIN_URL = mxGraphImpl.class.getResource("/org/sleuthkit/autopsy/communications/images/marker--pin.png");
|
||||||
|
private static final URL LOCK_URL = mxGraphImpl.class.getResource("/org/sleuthkit/autopsy/communications/images/lock_large_locked.png");
|
||||||
|
|
||||||
static final private mxStylesheet mxStylesheet = new mxStylesheet();
|
static final private mxStylesheet mxStylesheet = new mxStylesheet();
|
||||||
private final HashSet<AccountDeviceInstanceKey> pinnedAccountDevices = new HashSet<>();
|
private final HashSet<AccountDeviceInstanceKey> pinnedAccountDevices = new HashSet<>();
|
||||||
@ -128,8 +129,14 @@ final class mxGraphImpl extends mxGraph {
|
|||||||
if (mxCell.isEdge()) {
|
if (mxCell.isEdge()) {
|
||||||
return super.isCellMovable(cell);
|
return super.isCellMovable(cell);
|
||||||
} else {
|
} else {
|
||||||
return super.isCellMovable(cell)
|
final boolean cellMovable = super.isCellMovable(cell);
|
||||||
&& false == lockedAccountDevices.contains((AccountDeviceInstanceKey) mxCell.getValue());
|
final boolean unlocked = false == lockedAccountDevices.contains((AccountDeviceInstanceKey) mxCell.getValue());
|
||||||
|
|
||||||
|
if (cellMovable && unlocked) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,12 +158,15 @@ final class mxGraphImpl extends mxGraph {
|
|||||||
final String accountName = adiKey.getAccountDeviceInstance().getAccount().getTypeSpecificID();
|
final String accountName = adiKey.getAccountDeviceInstance().getAccount().getTypeSpecificID();
|
||||||
String iconFileName = Utils.getIconFileName(adiKey.getAccountDeviceInstance().getAccount().getAccountType());
|
String iconFileName = Utils.getIconFileName(adiKey.getAccountDeviceInstance().getAccount().getAccountType());
|
||||||
String label = "<img src=\""
|
String label = "<img src=\""
|
||||||
+ VisualizationPanel.class.getResource("/org/sleuthkit/autopsy/communications/images/" + iconFileName)
|
+ mxGraphImpl.class.getResource("/org/sleuthkit/autopsy/communications/images/" + iconFileName)
|
||||||
+ "\">" + accountName;
|
+ "\">" + accountName;
|
||||||
if (pinnedAccountDevices.contains(adiKey)) {
|
if (pinnedAccountDevices.contains(adiKey)) {
|
||||||
label += "<img src=\"" + MARKER_PIN_URL + "\">";
|
label += "<img src=\"" + MARKER_PIN_URL + "\">";
|
||||||
}
|
}
|
||||||
return "<span>" + label + "</span>";
|
if (lockedAccountDevices.contains(adiKey)) {
|
||||||
|
label += "<img src=\"" + LOCK_URL + "\">";
|
||||||
|
}
|
||||||
|
return "<div width=\"" + (Math.sqrt(adiKey.getMessageCount()) + 10) + "\">" + label + "</div>";
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -231,11 +241,11 @@ final class mxGraphImpl extends mxGraph {
|
|||||||
final HashSet<Content> hashSet = new HashSet<>(relSources);
|
final HashSet<Content> hashSet = new HashSet<>(relSources);
|
||||||
// edgeMap.put(relSource, edge);
|
// edgeMap.put(relSource, edge);
|
||||||
edge = (mxCell) insertEdge(getDefaultParent(), edgeName, hashSet, vertex1, vertex2,
|
edge = (mxCell) insertEdge(getDefaultParent(), edgeName, hashSet, vertex1, vertex2,
|
||||||
"strokeWidth=" + Math.sqrt(hashSet.size()));
|
"strokeWidth=" + (Math.log(hashSet.size())+1));
|
||||||
} else {
|
} else {
|
||||||
edge = (mxCell) edgesBetween[0];
|
edge = (mxCell) edgesBetween[0];
|
||||||
((Collection<Content>) edge.getValue()).addAll(relSources);
|
((Collection<Content>) edge.getValue()).addAll(relSources);
|
||||||
edge.setStyle("strokeWidth=" + Math.sqrt(((Collection) edge.getValue()).size()));
|
edge.setStyle("strokeWidth=" +( Math.log(((Collection) edge.getValue()).size())+1));
|
||||||
}
|
}
|
||||||
return edge;
|
return edge;
|
||||||
}
|
}
|
||||||
@ -248,7 +258,11 @@ final class mxGraphImpl extends mxGraph {
|
|||||||
return getView().getScale();
|
return getView().getScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
class SwingWorkerImpl extends SwingWorker<Void, Void> {
|
boolean isAccountLocked(AccountDeviceInstanceKey adiKey) {
|
||||||
|
return lockedAccountDevices.contains(adiKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SwingWorkerImpl extends SwingWorker<Void, Void> {
|
||||||
|
|
||||||
private final ProgressIndicator progress;
|
private final ProgressIndicator progress;
|
||||||
private final CommunicationsManager commsManager;
|
private final CommunicationsManager commsManager;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user