5369 change info displayed on VideoThumbnailPanel

This commit is contained in:
William Schaefer 2019-08-27 14:10:20 -04:00
parent 62b71db68e
commit ac4895103c
3 changed files with 31 additions and 22 deletions

View File

@ -27,7 +27,11 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="imagePanel" pref="776" max="32767" attributes="0"/>
<Component id="fileInfoLabel" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="fileSizeLabel" min="-2" pref="248" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="countLabel" min="-2" pref="204" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -38,8 +42,11 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="imagePanel" min="-2" pref="220" max="-2" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="fileInfoLabel" min="-2" pref="19" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="fileSizeLabel" pref="19" max="32767" attributes="0"/>
<Component id="countLabel" max="32767" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
@ -50,7 +57,9 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
</Container>
<Component class="javax.swing.JLabel" name="fileInfoLabel">
<Component class="javax.swing.JLabel" name="fileSizeLabel">
</Component>
<Component class="javax.swing.JLabel" name="countLabel">
</Component>
</SubComponents>
</Form>

View File

@ -27,6 +27,7 @@ import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import org.openide.util.NbBundle.Messages;
/**
* Class which displays thumbnails and information for a video file.
@ -93,7 +94,8 @@ public final class VideoThumbnailPanel extends javax.swing.JPanel implements Lis
private void initComponents() {
imagePanel = new javax.swing.JPanel();
fileInfoLabel = new javax.swing.JLabel();
fileSizeLabel = new javax.swing.JLabel();
countLabel = new javax.swing.JLabel();
setBorder(javax.swing.BorderFactory.createEtchedBorder());
@ -107,7 +109,10 @@ public final class VideoThumbnailPanel extends javax.swing.JPanel implements Lis
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(imagePanel, javax.swing.GroupLayout.DEFAULT_SIZE, 776, Short.MAX_VALUE)
.addComponent(fileInfoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(fileSizeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(countLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.setVerticalGroup(
@ -116,20 +121,28 @@ public final class VideoThumbnailPanel extends javax.swing.JPanel implements Lis
.addContainerGap()
.addComponent(imagePanel, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(fileInfoLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(fileSizeLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 19, Short.MAX_VALUE)
.addComponent(countLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel fileInfoLabel;
private javax.swing.JLabel countLabel;
private javax.swing.JLabel fileSizeLabel;
private javax.swing.JPanel imagePanel;
// End of variables declaration//GEN-END:variables
@Messages({"# {0} - fileSize",
"VideoThumbnailPanel.sizeLabel.text=Size: {0} bytes",
"# {0} - numberOfInstances",
"VideoThumbnailPanel.countLabel.text=Numbber of Instances: {0}"})
@Override
public Component getListCellRendererComponent(JList<? extends VideoThumbnailsWrapper> list, VideoThumbnailsWrapper value, int index, boolean isSelected, boolean cellHasFocus) {
fileInfoLabel.setText(value.getFilePath());
fileSizeLabel.setText(Bundle.VideoThumbnailPanel_sizeLabel_text(value.getResultFile().getFirstInstance().getSize()));
countLabel.setText(Bundle.VideoThumbnailPanel_countLabel_text(value.getResultFile().getAllInstances().size()));
addThumbnails(value);
imagePanel.setBackground(isSelected ? SELECTION_COLOR : list.getBackground());
setBackground(isSelected ? SELECTION_COLOR : list.getBackground());

View File

@ -71,19 +71,6 @@ final class VideoThumbnailsWrapper {
return timeStamps.clone();
}
/**
* Get the path to the file including the file name.
*
* @return The path to the file including the file name.
*/
String getFilePath() {
try {
return resultFile.getFirstInstance().getUniquePath();
} catch (TskCoreException ingored) {
return resultFile.getFirstInstance().getParentPath() + "/" + resultFile.getFirstInstance().getName();
}
}
/**
* Get the list of thumbnails for the video.
*