mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 02:07:42 +00:00
add image number range to thumbnail viewer toolbar
This commit is contained in:
parent
cb965256f1
commit
24df97031b
@ -95,3 +95,5 @@ DataResultViewerThumbnail.totalPagesLabel.text=-
|
||||
DataResultViewerThumbnail.pagesLabel.text=Pages:
|
||||
DataResultViewerThumbnail.pagePrevButton.text=
|
||||
DataResultViewerThumbnail.pageNextButton.text=
|
||||
DataResultViewerThumbnail.imagesLabel.text=Images:
|
||||
DataResultViewerThumbnail.imagesRangeLabel.text=-
|
||||
|
@ -16,7 +16,7 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="thumbnailScrollPanel" pref="675" max="32767" attributes="0"/>
|
||||
<Component id="thumbnailScrollPanel" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="pageLabel" min="-2" max="-2" attributes="0"/>
|
||||
@ -32,7 +32,11 @@
|
||||
<Component id="pagePrevButton" min="-2" pref="23" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="pageNextButton" min="-2" pref="23" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="33" max="-2" attributes="0"/>
|
||||
<Component id="imagesLabel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="imagesRangeLabel" min="-2" pref="91" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="145" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -49,6 +53,10 @@
|
||||
<Component id="pagePrevButton" alignment="3" min="-2" pref="23" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="pageNextButton" alignment="0" min="-2" pref="23" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="imagesLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="imagesRangeLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="thumbnailScrollPanel" min="-2" pref="325" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
@ -157,5 +165,19 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="pageNextButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="imagesLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="DataResultViewerThumbnail.imagesLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="imagesRangeLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="DataResultViewerThumbnail.imagesRangeLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -56,6 +56,7 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
|
||||
//flag to keep track if images are being loaded
|
||||
private int curPage;
|
||||
private int totalPages;
|
||||
private int curPageImages;
|
||||
private final PageUpdater pageUpdater = new PageUpdater();
|
||||
|
||||
/**
|
||||
@ -71,6 +72,7 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
|
||||
|
||||
curPage = -1;
|
||||
totalPages = 0;
|
||||
curPageImages = 0;
|
||||
|
||||
}
|
||||
|
||||
@ -91,6 +93,8 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
|
||||
pagesLabel = new javax.swing.JLabel();
|
||||
pagePrevButton = new javax.swing.JButton();
|
||||
pageNextButton = new javax.swing.JButton();
|
||||
imagesLabel = new javax.swing.JLabel();
|
||||
imagesRangeLabel = new javax.swing.JLabel();
|
||||
|
||||
thumbnailScrollPanel.setPreferredSize(null);
|
||||
|
||||
@ -108,8 +112,6 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
|
||||
pagePrevButton.setText(org.openide.util.NbBundle.getMessage(DataResultViewerThumbnail.class, "DataResultViewerThumbnail.pagePrevButton.text")); // NOI18N
|
||||
pagePrevButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back_disabled.png"))); // NOI18N
|
||||
pagePrevButton.setMargin(new java.awt.Insets(2, 0, 2, 0));
|
||||
pagePrevButton.setMaximumSize(new java.awt.Dimension(27, 31));
|
||||
pagePrevButton.setMinimumSize(new java.awt.Dimension(27, 31));
|
||||
pagePrevButton.setPreferredSize(new java.awt.Dimension(55, 23));
|
||||
pagePrevButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back_hover.png"))); // NOI18N
|
||||
pagePrevButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
@ -131,11 +133,15 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
|
||||
}
|
||||
});
|
||||
|
||||
imagesLabel.setText(org.openide.util.NbBundle.getMessage(DataResultViewerThumbnail.class, "DataResultViewerThumbnail.imagesLabel.text")); // NOI18N
|
||||
|
||||
imagesRangeLabel.setText(org.openide.util.NbBundle.getMessage(DataResultViewerThumbnail.class, "DataResultViewerThumbnail.imagesRangeLabel.text")); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(thumbnailScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 675, Short.MAX_VALUE)
|
||||
.addComponent(thumbnailScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(pageLabel)
|
||||
@ -151,7 +157,11 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
|
||||
.addComponent(pagePrevButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(pageNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGap(33, 33, 33)
|
||||
.addComponent(imagesLabel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(imagesRangeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(145, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@ -164,9 +174,10 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
|
||||
.addComponent(totalPagesLabel)
|
||||
.addComponent(pagesLabel)
|
||||
.addComponent(pagePrevButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(pageNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)))
|
||||
.addComponent(pageNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(imagesLabel)
|
||||
.addComponent(imagesRangeLabel)))
|
||||
.addComponent(thumbnailScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 325, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
);
|
||||
@ -181,6 +192,8 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
|
||||
}//GEN-LAST:event_pageNextButtonActionPerformed
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel curPageLabel;
|
||||
private javax.swing.JLabel imagesLabel;
|
||||
private javax.swing.JLabel imagesRangeLabel;
|
||||
private javax.swing.JLabel ofLabel;
|
||||
private javax.swing.JLabel pageLabel;
|
||||
private javax.swing.JButton pageNextButton;
|
||||
@ -246,6 +259,7 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
|
||||
super.resetComponent();
|
||||
this.totalPages = 0;
|
||||
this.curPage = -1;
|
||||
curPageImages = 0;
|
||||
updateControls();
|
||||
|
||||
}
|
||||
@ -298,6 +312,7 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
|
||||
Node root = em.getRootContext();
|
||||
Node pageNode = root.getChildren().getNodeAt(curPage - 1);
|
||||
em.setExploredContext(pageNode);
|
||||
curPageImages = pageNode.getChildren().getNodesCount();
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -318,9 +333,13 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
|
||||
pageNextButton.setEnabled(false);
|
||||
curPageLabel.setText("");
|
||||
totalPagesLabel.setText("");
|
||||
imagesRangeLabel.setText("");
|
||||
} else {
|
||||
curPageLabel.setText(Integer.toString(curPage));
|
||||
totalPagesLabel.setText(Integer.toString(totalPages));
|
||||
final int imagesFrom = (curPage - 1) * ThumbnailViewChildren.IMAGES_PER_PAGE + 1;
|
||||
final int imagesTo = curPageImages + (curPage - 1) * ThumbnailViewChildren.IMAGES_PER_PAGE;
|
||||
imagesRangeLabel.setText(imagesFrom + "-" + imagesTo);
|
||||
|
||||
|
||||
pageNextButton.setEnabled(!(curPage == totalPages));
|
||||
@ -359,17 +378,43 @@ public final class DataResultViewerThumbnail extends AbstractDataResultViewer {
|
||||
curPage = 1;
|
||||
}
|
||||
|
||||
updateControls();
|
||||
|
||||
|
||||
//force load the curPage node
|
||||
final Node pageNode = root.getChildren().getNodeAt(curPage - 1);
|
||||
|
||||
//em.setSelectedNodes(new Node[]{pageNode});
|
||||
if (pageNode != null) {
|
||||
pageNode.addNodeListener(new NodeListener() {
|
||||
@Override
|
||||
public void childrenAdded(NodeMemberEvent nme) {
|
||||
curPageImages = pageNode.getChildren().getNodesCount();
|
||||
updateControls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void childrenRemoved(NodeMemberEvent nme) {
|
||||
curPageImages = 0;
|
||||
updateControls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void childrenReordered(NodeReorderEvent nre) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void nodeDestroyed(NodeEvent ne) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
}
|
||||
});
|
||||
|
||||
em.setExploredContext(pageNode);
|
||||
}
|
||||
|
||||
|
||||
updateControls();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,7 +50,7 @@ import org.sleuthkit.datamodel.File;
|
||||
class ThumbnailViewChildren extends Children.Keys<Integer> {
|
||||
|
||||
private static final IsSupportedContentVisitor isSupportedVisitor = new IsSupportedContentVisitor();
|
||||
private static final int IMAGES_PER_PAGE = 1000;
|
||||
static final int IMAGES_PER_PAGE = 1000;
|
||||
private Node parent;
|
||||
private final HashMap<Integer, List<Node>> pages = new HashMap<Integer, List<Node>>();
|
||||
private int totalImages = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user