From b7c1209951dad3d833355c801cfb6a03e3fd8056 Mon Sep 17 00:00:00 2001 From: gfd2020 <59742865+gfd2020@users.noreply.github.com> Date: Thu, 27 Jul 2023 16:21:33 -0300 Subject: [PATCH 1/5] Export Case module. All logic to copy files to destination --- .../src/main/java/iped/app/ui/ExportCase.java | 455 ++++++++++++++++++ 1 file changed, 455 insertions(+) create mode 100644 iped-app/src/main/java/iped/app/ui/ExportCase.java diff --git a/iped-app/src/main/java/iped/app/ui/ExportCase.java b/iped-app/src/main/java/iped/app/ui/ExportCase.java new file mode 100644 index 0000000000..614a10f673 --- /dev/null +++ b/iped-app/src/main/java/iped/app/ui/ExportCase.java @@ -0,0 +1,455 @@ +package iped.app.ui; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.attribute.BasicFileAttributes; +import java.text.DecimalFormat; +import java.util.concurrent.atomic.AtomicLong; +import javax.swing.JOptionPane; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import iped.engine.data.IPEDSource; +import iped.utils.UTF8Properties; +import iped.viewers.api.CancelableWorker; +import iped.viewers.util.ProgressDialog; + +import java.util.*; + +import java.nio.file.*; +import javax.swing.JDialog; + +public class ExportCase extends CancelableWorker { + + ArrayList srcPaths; + ArrayList otherPaths; + String dstPath; + boolean copyImages; + boolean estimateSizeOnly; + Map> imgPaths; + + private static Logger LOGGER = LoggerFactory.getLogger(ExportCase.class); + + protected ProgressDialog progressMonitor; + + boolean success = false; + + Values values = new Values(); + + long free = 0; + + DecimalFormat decimal; + + JDialog dialog; + + public ExportCase(JDialog dialog, ArrayList srcPaths, String dstPath, Map> imgPaths, ArrayList otherPaths,boolean copyImages, boolean estimateSizeOnly){ + + this.srcPaths = srcPaths; + this.otherPaths = otherPaths; + this.dstPath = dstPath; + this.copyImages = copyImages; + this.imgPaths = imgPaths; + this.estimateSizeOnly = estimateSizeOnly; + this.dialog = dialog; + + decimal = new DecimalFormat( "###.##"); + + progressMonitor = new ProgressDialog(this.dialog, this,2); + progressMonitor.setIndeterminate(true); + + free = (new File(dstPath)).getUsableSpace(); + + + } + + @Override + public void done() { + if(progressMonitor != null){ + progressMonitor.close(); + + if (estimateSizeOnly){ + if(success){ + JOptionPane.showMessageDialog(this.dialog, "Estimated Size: "+getEstimateSize(), "Export Case", JOptionPane.INFORMATION_MESSAGE); + dialog.setVisible(true); + } + } + else{ + if(success){ + String msg = copyImages?"with":"without"; + LOGGER.info("Exported Case {} evidences on folder '{}' - Size: {}",msg, dstPath, getEstimateSize()); + JOptionPane.showMessageDialog(this.dialog, "Case successfully exported to:\n"+dstPath, "Export Case", JOptionPane.INFORMATION_MESSAGE); + } + } + } + } + + public long size(Path path) { + + final AtomicLong size = new AtomicLong(0); + + try { + Files.walkFileTree(path, new SimpleFileVisitor() { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { + + size.addAndGet(attrs.size()); + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult visitFileFailed(Path file, IOException exc) { + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) { + return FileVisitResult.CONTINUE; + } + }); + } catch (IOException e) { + throw new AssertionError("walkFileTree will not throw IOException if the FileVisitor does not"); + } + + return size.get(); + } + + protected void copyFiles(File src, File target) throws IOException { + + InputStream in = null; + BufferedOutputStream out = null; + + if (progressMonitor.isCanceled()) { + return; + } + + if (src.isDirectory()){ + + if (!target.exists()){ + target.mkdirs(); + } + + String files[] = src.list(); + + for (String file : files){ + File srcFile = new File(src, file); + File destFile = new File(target, file); + + if (progressMonitor.isCanceled()) { + return; + } + copyFiles(srcFile, destFile); + } + } else{ + + try { + + in = new FileInputStream(src); + out = null; + + if(target.isDirectory()) + out = new BufferedOutputStream(new FileOutputStream(new File(target, src.getName()))); + else + out = new BufferedOutputStream(new FileOutputStream(target)); + + byte[] buf = new byte[8*1024]; + int len; + + while ((len = in.read(buf)) >= 0 && !Thread.currentThread().isInterrupted()) { + out.write(buf, 0, len); + values.megas += len; + } + + + in.close(); + out.close(); + + } catch (Exception e1) { + System.out.println("Error on export:"+src); + e1.printStackTrace(); + } finally { + if (in != null) + in.close(); + if (out != null) + out.close(); + } + + } + } + + + protected String getEstimateSize(){ + return formatBytes(values.totalMega); + } + + protected boolean estimateSize(){ + + long size = 0; + + try{ + + for (String path : this.srcPaths) { + size += size(Paths.get(path)); + } + if (copyImages){ + + for (String path2 : this.otherPaths) { + size += size(Paths.get(path2)); + } + + } + + Thread.sleep(1000); + + } catch (Exception e) { + e.printStackTrace(); + } + + values.totalMega = size; + + return true; + + } + + + + + @Override + protected String doInBackground() { + + progressMonitor.setNote("Estimating total size"); + File target = null; + File src = null; + String folderName = "evidences"; + String root = "."+File.separator+folderName+File.separator; + + + + try { + + if (estimateSize()){ + + if (estimateSizeOnly){ + success = true; + return null; + } + + progressMonitor.setIndeterminate(false); + progressMonitor.reset(); + progressMonitor.setMaximum(values.totalMega); + + + ArrayList dstPaths = new ArrayList(); + + Timer timer = new Timer(); + timer.schedule(new RefreshProgress(progressMonitor, values), 0, 1000); + + target = new File(dstPath); + if (target != null){ + for (String path : this.srcPaths) { + + src = new File (path); + + if (src != null && src.exists()){ + copyFiles(src, target); + } + + } + } + + if(copyImages){ + + target = new File(dstPath,folderName); + if (!target.exists()){ + target.mkdirs(); + } + + IPEDSource iCase = new IPEDSource(new File(dstPath)); + for (Long idSleuthCase : imgPaths.keySet()) { + List pathsImage = imgPaths.get(idSleuthCase); + dstPaths.clear(); + for(String path : pathsImage){ + File temp = new File(path); + dstPaths.add(root+temp.getName()); + } + if (iCase!=null){ + iCase.getSleuthCase().setImagePaths(idSleuthCase,dstPaths); + } + } + + for (String path : this.otherPaths) { + + src = new File (path); + + if (src != null && src.exists()){ + if (src.isDirectory()){ + target = new File(dstPath,root+src.getName()); + }else{ + target = new File(dstPath,root); + } + + copyFiles(src, target); + } + + + File newPath = new File(folderName,src.getName()); + File oldPath; + + if (src.isAbsolute()) + oldPath = src; + else + oldPath = new File(dstPath,src.getPath()); + + saveDataSourcePath(new File(dstPath,"iped"),oldPath, newPath); + + } + + + } + + + + timer.cancel(); + + + success = true; + } + }catch (Exception ex) { + ex.printStackTrace(); + System.out.println(ex.getMessage()); + if (progressMonitor != null) + JOptionPane.showMessageDialog(this.dialog, "Export Error! Verify aplication logs.", "Export Case", JOptionPane.ERROR_MESSAGE); + } + + return null; + } + + private static void saveDataSourcePath(File caseModuleDir, File oldPath, File newPath) throws IOException { + String NEW_DATASOURCE_PATH_FILE = "data/newDataSourceLocations.txt"; + File file = new File(caseModuleDir, NEW_DATASOURCE_PATH_FILE); + UTF8Properties props = new UTF8Properties(); + if (file.exists()) + props.load(file); + props.setProperty(oldPath.getPath(), newPath.getPath()); + try { + props.store(file); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public String formatBytes(long soma){ + + String resultado = "0 Bytes"; + + try { + + if (soma >= 1125899906842624.0){ + resultado = decimal.format((soma/1125899906842624.0)) + " PB"; + } else if (soma >= 1099511627776.0){ + resultado = decimal.format((soma/1099511627776.0)) + " TB"; + } else if (soma >= 1073741824.0){ + resultado = decimal.format((soma/1073741824.0)) + " GB"; + } else if (soma >= 1048576.0) { + resultado = decimal.format((soma/1048576.0)) + " MB"; + } else if (soma >= 1024.0) { + resultado = decimal.format((soma/1024.0)) + " KB"; + } else if (soma >= 0.0) { + resultado = decimal.format((soma)) + " B"; + } + } + catch (Exception ex){ + ; + } + + return resultado; + + } + + +} + +class Values { + + public long megas = 0; + public long totalMega = 0; + +} + + +class RefreshProgress extends TimerTask { + + DecimalFormat decimal; + long num = 0; + Values valores = null; + ProgressDialog progressMonitor = null; + + public RefreshProgress(ProgressDialog progressMonitor, Values valores){ + super(); + this.progressMonitor = progressMonitor; + this.valores = valores; + decimal = new DecimalFormat( "###.##"); + } + + public void run() { + + long timeLeft = 0; + this.num++; + + if (progressMonitor.isCanceled()) { + this.cancel(); + return; + } + + if (this.valores.megas <= 0) + timeLeft = 359999; + else + timeLeft = (long)(((double)this.valores.totalMega - (double)this.valores.megas)/((double)this.valores.megas/(double)this.num)); + + String timeLeftString = "Time left: "+formatTime(timeLeft); + + progressMonitor.setProgress(this.valores.megas); + progressMonitor.setNote(""+"Copying " + formatBytes(this.valores.megas) + " of " + formatBytes(this.valores.totalMega)+"
"+timeLeftString+""); + } + public String formatTime(long tempo){ + + long t1 = tempo/3600; + long t2 = ((tempo % 3600) / 60); + long t3 = tempo%60; + String s1 = (t1<10)?("0"+t1):t1+""; + String s2 = (t2<10)?("0"+t2):t2+""; + String s3 = (t3<10)?("0"+t3):t3+""; + return s1+":"+s2+":"+s3; + + } + public String formatBytes(long soma){ + + String resultado = "0 Bytes"; + + try { + + if (soma >= 1125899906842624.0){ + resultado = decimal.format((soma/1125899906842624.0)) + " PB"; + } else if (soma >= 1099511627776.0){ + resultado = decimal.format((soma/1099511627776.0)) + " TB"; + } else if (soma >= 1073741824.0){ + resultado = decimal.format((soma/1073741824.0)) + " GB"; + } else if (soma >= 1048576.0) { + resultado = decimal.format((soma/1048576.0)) + " MB"; + } else if (soma >= 1024.0) { + resultado = decimal.format((soma/1024.0)) + " KB"; + } else if (soma >= 0.0) { + resultado = decimal.format((soma)) + " B"; + } + } + catch (Exception ex){ + ; + } + + return resultado; + + } + +} From e3f5a91710e6f84f0a3442fc0d6905d0b673e733 Mon Sep 17 00:00:00 2001 From: gfd2020 <59742865+gfd2020@users.noreply.github.com> Date: Thu, 27 Jul 2023 16:21:57 -0300 Subject: [PATCH 2/5] Export case dialog. Create java file. User interface --- .../java/iped/app/ui/ExportCaseDialog.java | 308 ++++++++++++++++++ 1 file changed, 308 insertions(+) create mode 100644 iped-app/src/main/java/iped/app/ui/ExportCaseDialog.java diff --git a/iped-app/src/main/java/iped/app/ui/ExportCaseDialog.java b/iped-app/src/main/java/iped/app/ui/ExportCaseDialog.java new file mode 100644 index 0000000000..4fa73a4dd6 --- /dev/null +++ b/iped-app/src/main/java/iped/app/ui/ExportCaseDialog.java @@ -0,0 +1,308 @@ +package iped.app.ui; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.IOException; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JDialog; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import iped.properties.BasicProps; +import iped.engine.data.IPEDSource; +import iped.engine.search.IPEDSearcher; +import iped.engine.search.LuceneSearchResult; +import iped.engine.search.MultiSearchResult; +import iped.engine.sleuthkit.SleuthkitInputStreamFactory; +import iped.engine.task.index.IndexItem; + +import org.apache.lucene.document.Document; + +import org.sleuthkit.datamodel.SleuthkitCase; + +import iped.data.IItem; +import iped.data.IItemId; + +import java.util.*; +import iped.engine.task.ExportFileTask.SQLiteInputStreamFactory; + +import java.nio.file.DirectoryStream; +import java.nio.file.Paths; +import java.nio.file.Path; +import java.nio.file.Files; + +public class ExportCaseDialog implements ActionListener { + + private static Logger logger = LoggerFactory.getLogger(ReportDialog.class); + + JDialog dialog = new JDialog(App.get()); + + JTextField newPath = null; + JCheckBox chkCopyImages = new JCheckBox("Export Evidences",true); + JButton btnExport = new JButton("Export"); + JButton btnClose = new JButton("Close"); + JButton btnOpen = new JButton("Open"); + JButton btnSize = new JButton("Estimate Size"); + + + + File casePath = App.get().casesPathFile; + String srcPath = casePath.getAbsolutePath(); + String caseName = casePath.getName(); + ArrayList srcPaths = new ArrayList(); + Map> imgPaths = new HashMap>(); + ArrayList otherPaths = new ArrayList(); + + + HashSet noContent = new HashSet<>(); + + public ExportCaseDialog() { + + + + dialog.setTitle("Export Case"); + dialog.setBounds(0, 0, 800, 250); + dialog.setModal(true); + dialog.setLocationRelativeTo(null); + + + JLabel msg = new JLabel("Export Folder:"); + newPath = new JTextField(); + newPath.setText(""); + + + msg.setBounds(15, 20, 600, 30); + newPath.setBounds(15, 60, 600, 30); + chkCopyImages.setBounds(15, 110, 150, 30); + btnOpen.setBounds(650, 60, 80, 30); + btnExport.setBounds(150, 150, 80, 30); + btnSize.setBounds(270, 150, 130, 30); + btnClose.setBounds(440, 150, 80, 30); + + dialog.getContentPane().add(msg); + dialog.getContentPane().add(newPath); + dialog.getContentPane().add(chkCopyImages); + dialog.getContentPane().add(btnOpen); + dialog.getContentPane().add(btnExport); + dialog.getContentPane().add(btnSize); + dialog.getContentPane().add(btnClose); + dialog.getContentPane().add(new JLabel()); + + btnOpen.addActionListener(this); + btnExport.addActionListener(this); + btnClose.addActionListener(this); + btnSize.addActionListener(this); + + initPaths(); + + } + + public void setVisible() { + dialog.setVisible(true); + } + + public void initPaths(){ + + try{ + + ArrayList doNotIncludeInOthers = new ArrayList(); + doNotIncludeInOthers.add(SleuthkitInputStreamFactory.class.getName()); + doNotIncludeInOthers.add(SQLiteInputStreamFactory.class.getName()); + + srcPaths.add(srcPath); + + for(IPEDSource iCase: App.get().appCase.getAtomicSources()){ + SleuthkitCase sleuthCase = iCase.getSleuthCase(); + if (sleuthCase != null){ + Map> tmp = sleuthCase.getImagePaths(); + tmp.forEach(imgPaths::putIfAbsent); + for (List listPaths : tmp.values()){ + for(String paths: listPaths){ + if (!otherPaths.contains(paths)){ + otherPaths.add(paths); + } + } + } + } + } + + IPEDSearcher task = new IPEDSearcher(App.get().appCase, IndexItem.ISROOT + ":true"); + task.setTreeQuery(true); + LuceneSearchResult rs = MultiSearchResult.get(task.multiSearch(), App.get().appCase); + + boolean shouldAdd = true; + + for (int docID : rs.getLuceneIds()) { + + + Document doc = App.get().appCase.getReader().document(docID); + String dtPath = doc.get(IndexItem.SOURCE_PATH); + String dtDecoder = doc.get(IndexItem.SOURCE_DECODER); + + //workaround for empty datasource path + if (dtPath == null || dtPath.isEmpty()){ + + IItemId item = App.get().appCase.getItemId(docID); + IItem e = App.get().appCase.getItemByItemId(item); + + String query = BasicProps.EVIDENCE_UUID + ":" + e.getDataSource().getUUID(); + IPEDSearcher task2 = new IPEDSearcher(App.get().appCase, query); + LuceneSearchResult rs2 = MultiSearchResult.get(task2.multiSearch(), App.get().appCase); + + for (int docID2 : rs2.getLuceneIds()) { + + Document doc2 = App.get().appCase.getReader().document(docID2); + String dtPath2 = doc2.get(IndexItem.SOURCE_PATH); + String dtDecorder2 = doc2.get(IndexItem.SOURCE_DECODER); + + if (dtPath2 != null && !dtPath2.isEmpty() && dtDecorder2 != null && !dtDecorder2.isEmpty()){ + + + shouldAdd = true; + for (String decoder: doNotIncludeInOthers){ + if(decoder.contains(dtDecorder2)){ + shouldAdd = false; + break; + } + } + + if (shouldAdd){ + dtPath = dtPath2; + dtDecoder = dtDecorder2; + break; + } + } + + } + + } + + shouldAdd = true; + for (String decoder: doNotIncludeInOthers){ + if(decoder.contains(dtDecoder)){ + shouldAdd = false; + break; + } + } + if (dtPath != null && !dtPath.isEmpty()){ + if (shouldAdd){ + otherPaths.add(dtPath); + } + } + + } + + + }catch (Exception ex){ + ex.printStackTrace(); + } + + + } + + @Override + public void actionPerformed(ActionEvent e) { + + + if (e.getSource() == btnClose) { + dialog.setVisible(false); + } + if (e.getSource() == btnOpen) { + JFileChooser c = new JFileChooser(); + c.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + c.setMultiSelectionEnabled(false); + c.setDialogTitle("Open Export Folder"); + int rVal = c.showOpenDialog(dialog); + if (rVal == JFileChooser.APPROVE_OPTION) { + String arquivoAberto = c.getSelectedFile().getAbsolutePath(); + newPath.setText(arquivoAberto); + } + if (rVal == JFileChooser.CANCEL_OPTION) { + ; + } + c = null; + } + if (e.getSource() == btnSize) { + dialog.setVisible(false); + (new ExportCase(this.dialog, srcPaths, "", imgPaths, otherPaths,chkCopyImages.isSelected(), true)).execute(); + } + if (e.getSource() == btnExport) { + + try{ + + String dstPath = newPath.getText(); + + File file = new File(dstPath); + if(!file.exists()){ + JOptionPane.showMessageDialog(dialog, "Invalid Export Folder!","Export Case",JOptionPane.ERROR_MESSAGE); + return; + } + + //dstPath cannot be in same folder as srcPath, consequence -> infinite loop + if(isSubDirectory(casePath,file)){ + JOptionPane.showMessageDialog(dialog, "Export directory cannot be inside case folder!","Export Case",JOptionPane.ERROR_MESSAGE); + return; + } + + + if (dstPath.substring(dstPath.length() - 1).compareTo(File.separator)==0 ) + dstPath += caseName; + else + dstPath += File.separator+caseName; + + File tmpDst = new File (dstPath); + if (tmpDst.exists()){ + if (!isDirEmpty(Paths.get(dstPath))){ + JOptionPane.showMessageDialog(dialog, "Export Folder is not empty!\n"+dstPath,"Export Case",JOptionPane.ERROR_MESSAGE); + return; + } + } + + + dialog.setVisible(false); + (new ExportCase(this.dialog, srcPaths, dstPath, imgPaths, otherPaths,chkCopyImages.isSelected(), false)).execute(); + + }catch (Exception ex){ + ex.printStackTrace(); + } + + } + + + } + + private boolean isDirEmpty(final Path directory){ + try(DirectoryStream dirStream = Files.newDirectoryStream(directory)) { + return !dirStream.iterator().hasNext(); + } + catch (Exception ex){ + return false; + } + } + + + private boolean isSubDirectory(File base, File child) throws IOException { + base = base.getCanonicalFile(); + child = child.getCanonicalFile(); + + File parentFile = child; + while (parentFile != null) { + if (base.equals(parentFile)) { + return true; + } + parentFile = parentFile.getParentFile(); + } + return false; + } + + + + +} From fd422aacdc69ba6dd0807dadf43297382a9ccbd3 Mon Sep 17 00:00:00 2001 From: gfd2020 <59742865+gfd2020@users.noreply.github.com> Date: Thu, 27 Jul 2023 16:22:56 -0300 Subject: [PATCH 3/5] Create Menu Item 'Export Case' Report ou Multicase is not supported --- .../src/main/java/iped/app/ui/MenuClass.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/iped-app/src/main/java/iped/app/ui/MenuClass.java b/iped-app/src/main/java/iped/app/ui/MenuClass.java index 6c0b993633..ed532fe01a 100644 --- a/iped-app/src/main/java/iped/app/ui/MenuClass.java +++ b/iped-app/src/main/java/iped/app/ui/MenuClass.java @@ -35,6 +35,7 @@ import iped.data.IItem; import iped.engine.config.ConfigurationManager; import iped.engine.config.IndexTaskConfig; +import iped.engine.data.IPEDSource; import iped.engine.search.SimilarFacesSearch; import iped.engine.task.similarity.ImageSimilarityTask; import iped.parsers.vcard.VCardParser; @@ -53,7 +54,7 @@ public class MenuClass extends JPopupMenu { exportCheckedTreeToZip, exportTree, exportTreeChecked, similarDocs, openViewfile, createReport, resetColLayout, lastColLayout, saveColLayout, addToGraph, navigateToParentChat, pinFirstColumns, similarImagesCurrent, similarImagesExternal, similarFacesCurrent, similarFacesExternal, toggleTimelineView, - uiZoom, catIconSize, savePanelsLayout, loadPanelsLayout; + uiZoom, catIconSize, savePanelsLayout, loadPanelsLayout, exportCase; MenuListener menuListener = new MenuListener(this); boolean isTreeMenu; @@ -317,6 +318,22 @@ public void actionPerformed(ActionEvent e) { createReport.addActionListener(menuListener); this.add(createReport); + + boolean isReport = false; + for (IPEDSource source : App.get().appCase.getAtomicSources()) { + if (source.isReport()){ + isReport = true; + break; + } + } + + if (!isReport && !App.get().isMultiCase){ + this.addSeparator(); + exportCase = new JMenuItem("Export Case"); //$NON-NLS-1$ + exportCase.addActionListener(menuListener); + this.add(exportCase); + } + } public void addExportTreeMenuItems(JComponent menu) { From e1cea92d164aabef8ecefbb18fba13a58d82959b Mon Sep 17 00:00:00 2001 From: gfd2020 <59742865+gfd2020@users.noreply.github.com> Date: Thu, 27 Jul 2023 16:23:32 -0300 Subject: [PATCH 4/5] Update menuListner actionperformed calling ExportCase --- iped-app/src/main/java/iped/app/ui/MenuListener.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iped-app/src/main/java/iped/app/ui/MenuListener.java b/iped-app/src/main/java/iped/app/ui/MenuListener.java index ea81deac70..5f3659e9c7 100644 --- a/iped-app/src/main/java/iped/app/ui/MenuListener.java +++ b/iped-app/src/main/java/iped/app/ui/MenuListener.java @@ -371,6 +371,8 @@ public void actionPerformed(ActionEvent e) { } else if (e.getSource() == menu.createReport) { new ReportDialog().setVisible(); + } else if (e.getSource() == menu.exportCase) { + new ExportCaseDialog().setVisible(); } else if (e.getSource() == menu.lastColLayout) { ColumnsManager.getInstance().resetToLastLayout(); From 861d3636528d59cc433b9398c54c2e742c8e0d71 Mon Sep 17 00:00:00 2001 From: gfd2020 <59742865+gfd2020@users.noreply.github.com> Date: Thu, 27 Jul 2023 16:24:11 -0300 Subject: [PATCH 5/5] Create a way to reset progressDialog initial value --- .../src/main/java/iped/viewers/util/ProgressDialog.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/iped-viewers/iped-viewers-impl/src/main/java/iped/viewers/util/ProgressDialog.java b/iped-viewers/iped-viewers-impl/src/main/java/iped/viewers/util/ProgressDialog.java index 1274ce9d6e..32ed7809fb 100644 --- a/iped-viewers/iped-viewers-impl/src/main/java/iped/viewers/util/ProgressDialog.java +++ b/iped-viewers/iped-viewers-impl/src/main/java/iped/viewers/util/ProgressDialog.java @@ -169,6 +169,10 @@ public void run() { }); } + public void reset(){ + progressBar.setValue(0); + } + public void setMaximum(final long max) { scale = 100f / max; }