19 package org.sleuthkit.autopsy.corecomponents;
21 import java.awt.CardLayout;
22 import java.awt.Component;
23 import java.awt.Dimension;
24 import java.util.List;
25 import java.util.logging.Level;
26 import org.openide.nodes.Node;
27 import org.openide.util.NbBundle;
28 import org.openide.util.lookup.ServiceProvider;
29 import org.openide.util.lookup.ServiceProviders;
38 @ServiceProviders(value = {
39 @ServiceProvider(service = DataContentViewer.class, position = 5)
51 private static final String IMAGE_VIEWER_LAYER =
"IMAGE";
52 private static final String VIDEO_VIEWER_LAYER =
"VIDEO";
63 videoPanelInited = videoPanel.
isInited();
66 imagePanelInited = imagePanel.
isInited();
68 customizeComponents();
69 logger.log(Level.INFO,
"Created MediaView instance: {0}",
this);
73 add(imagePanel, IMAGE_VIEWER_LAYER);
74 add(videoPanel, VIDEO_VIEWER_LAYER);
76 showVideoPanel(
false);
84 @SuppressWarnings(
"unchecked")
86 private
void initComponents() {
88 setLayout(
new java.awt.CardLayout());
89 getAccessibleContext().setAccessibleDescription(
org.openide.util.NbBundle.getMessage(
DataContentViewerMedia.class,
"DataContentViewerMedia.AccessibleContext.accessibleDescription"));
97 if (selectedNode == null) {
108 if (file.
equals(lastFile)) {
116 if (videoPanelInited && videoPanel.
isSupported(file)) {
117 videoPanel.setupVideo(file, dims);
118 this.showVideoPanel(
true);
119 }
else if (imagePanelInited && imagePanel.
isSupported(file)) {
120 imagePanel.showImageFx(file, dims);
121 this.showVideoPanel(
false);
123 }
catch (Exception e) {
124 logger.log(Level.SEVERE,
"Exception while setting node", e);
134 CardLayout layout = (CardLayout) this.getLayout();
136 layout.show(
this, VIDEO_VIEWER_LAYER);
138 layout.show(
this, IMAGE_VIEWER_LAYER);
144 return NbBundle.getMessage(this.getClass(),
"DataContentViewerMedia.title");
149 return NbBundle.getMessage(this.getClass(),
"DataContentViewerMedia.toolTip");
177 if (null == file || file.
getSize() == 0) {
191 if (null == file || file.
getSize() == 0) {
213 if (imagePanelInited && isImageSupported(file)) {
217 return videoPanelInited && isVideoSupported(file);
236 interface MediaViewPanel {
241 List<String> getMimeTypes();
248 List<String> getExtensionsList();
boolean isVideoSupported(AbstractFile file)
final MediaViewVideoPanel videoPanel
void showVideoPanel(boolean showVideo)
boolean isDirNameFlagSet(TSK_FS_NAME_FLAG_ENUM flag)
boolean isImageSupported(AbstractFile file)
final boolean videoPanelInited
DataContentViewer createInstance()
void customizeComponents()
boolean isSupported(Node node)
final boolean imagePanelInited
int isPreferred(Node node)
boolean equals(Object obj)
final MediaViewImagePanel imagePanel
void setNode(Node selectedNode)
synchronized static Logger getLogger(String name)