From cb85d76aeaccfcdd1016daf6967c89cfcb733f4f Mon Sep 17 00:00:00 2001 From: tc-wleite Date: Wed, 6 Sep 2023 09:56:19 -0300 Subject: [PATCH] '#1866: Use a base class in related items TableModels to simplify code. --- .../main/java/iped/app/ui/BaseTableModel.java | 113 +++++++++++++++ .../iped/app/ui/DuplicatesTableModel.java | 108 +-------------- .../java/iped/app/ui/ParentTableModel.java | 118 +--------------- .../iped/app/ui/ReferencedByTableModel.java | 129 ++---------------- .../iped/app/ui/ReferencingTableModel.java | 128 ++--------------- .../java/iped/app/ui/SubitemTableModel.java | 114 +--------------- 6 files changed, 144 insertions(+), 566 deletions(-) create mode 100644 iped-app/src/main/java/iped/app/ui/BaseTableModel.java diff --git a/iped-app/src/main/java/iped/app/ui/BaseTableModel.java b/iped-app/src/main/java/iped/app/ui/BaseTableModel.java new file mode 100644 index 0000000000..3716dc1e90 --- /dev/null +++ b/iped-app/src/main/java/iped/app/ui/BaseTableModel.java @@ -0,0 +1,113 @@ +package iped.app.ui; + +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import javax.swing.event.ListSelectionListener; +import javax.swing.table.AbstractTableModel; + +import org.apache.lucene.document.Document; + +import iped.engine.search.LuceneSearchResult; +import iped.engine.search.MultiSearchResult; +import iped.engine.task.index.IndexItem; +import iped.search.IMultiSearchResult; + +public abstract class BaseTableModel extends AbstractTableModel + implements MouseListener, ListSelectionListener, SearchResultTableModel { + + private static final long serialVersionUID = 1L; + + protected LuceneSearchResult results = new LuceneSearchResult(0); + protected int selectedIndex = -1; + protected Document refDoc; + + public void clear() { + results = new LuceneSearchResult(0); + fireTableDataChanged(); + } + + @Override + public int getColumnCount() { + return 3; + } + + @Override + public int getRowCount() { + return results.getLength(); + } + + @Override + public String getColumnName(int col) { + if (col == 2) + return IndexItem.NAME; + + return ""; + } + + @Override + public boolean isCellEditable(int row, int col) { + return col == 1; + } + + @Override + public Class getColumnClass(int c) { + return c == 1 ? Boolean.class : String.class; + } + + @Override + public void setValueAt(Object value, int row, int col) { + App.get().appCase.getMultiBookmarks().setChecked((Boolean) value, + App.get().appCase.getItemId(results.getLuceneIds()[row])); + BookmarksController.get().updateUISelection(); + } + + @Override + public Object getValueAt(int row, int col) { + switch (col) { + case 0: + return row + 1; + + case 1: + return App.get().appCase.getMultiBookmarks() + .isChecked(App.get().appCase.getItemId(results.getLuceneIds()[row])); + + case 2: + try { + Document doc = App.get().appCase.getSearcher().doc(results.getLuceneIds()[row]); + return doc.get(IndexItem.NAME); + } catch (Exception e) { + } + } + return ""; + } + + @Override + public void mouseClicked(MouseEvent arg0) { + } + + @Override + public void mouseEntered(MouseEvent arg0) { + } + + @Override + public void mouseExited(MouseEvent arg0) { + } + + @Override + public void mousePressed(MouseEvent arg0) { + } + + @Override + public void mouseReleased(MouseEvent evt) { + if (evt.getClickCount() == 2 && selectedIndex != -1) { + int docId = results.getLuceneIds()[selectedIndex]; + ExternalFileOpen.open(docId); + } + } + + @Override + public IMultiSearchResult getSearchResult() { + return MultiSearchResult.get(App.get().appCase, results); + } +} diff --git a/iped-app/src/main/java/iped/app/ui/DuplicatesTableModel.java b/iped-app/src/main/java/iped/app/ui/DuplicatesTableModel.java index 71ae167896..bb6e60f1d6 100644 --- a/iped-app/src/main/java/iped/app/ui/DuplicatesTableModel.java +++ b/iped-app/src/main/java/iped/app/ui/DuplicatesTableModel.java @@ -19,14 +19,10 @@ package iped.app.ui; import java.awt.Rectangle; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.table.AbstractTableModel; import org.apache.lucene.document.Document; @@ -36,105 +32,22 @@ import iped.engine.task.index.IndexItem; import iped.properties.BasicProps; import iped.search.IIPEDSearcher; -import iped.search.IMultiSearchResult; -public class DuplicatesTableModel extends AbstractTableModel - implements MouseListener, ListSelectionListener, SearchResultTableModel { +public class DuplicatesTableModel extends BaseTableModel { - /** - * - */ private static final long serialVersionUID = 1L; - LuceneSearchResult results = new LuceneSearchResult(0); - int selectedIndex = -1; - - @Override - public int getColumnCount() { - return 3; - } - - @Override - public int getRowCount() { - return results.getLength(); - } - - @Override - public String getColumnName(int col) { - if (col == 2) - return IndexItem.PATH; - - return ""; //$NON-NLS-1$ - } - - @Override - public boolean isCellEditable(int row, int col) { - if (col == 1) { - return true; - } else { - return false; - } - } - - @Override - public Class getColumnClass(int c) { - if (c == 1) { - return Boolean.class; - } else { - return String.class; - } - } - - @Override - public void setValueAt(Object value, int row, int col) { - App.get().appCase.getMultiBookmarks().setChecked((Boolean) value, - App.get().appCase.getItemId(results.getLuceneIds()[row])); - BookmarksController.get().updateUISelection(); - } - @Override public Object getValueAt(int row, int col) { - if (col == 0) { - return row + 1; - - } else if (col == 1) { - return App.get().appCase.getMultiBookmarks() - .isChecked(App.get().appCase.getItemId(results.getLuceneIds()[row])); - - } else { + if (col == 2) { try { Document doc = App.get().appCase.getSearcher().doc(results.getLuceneIds()[row]); return doc.get(IndexItem.PATH); - } catch (Exception e) { - // e.printStackTrace(); } - return ""; //$NON-NLS-1$ - } - } - - @Override - public void mouseClicked(MouseEvent arg0) { - } - - @Override - public void mouseEntered(MouseEvent arg0) { - } - - @Override - public void mouseExited(MouseEvent arg0) { - } - - @Override - public void mousePressed(MouseEvent arg0) { - } - - @Override - public void mouseReleased(MouseEvent evt) { - if (evt.getClickCount() == 2 && selectedIndex != -1) { - int docId = results.getLuceneIds()[selectedIndex]; - ExternalFileOpen.open(docId); + return ""; } + return super.getValueAt(row, col); } @Override @@ -166,8 +79,8 @@ public void listDuplicates(Document doc) { String id = doc.get(IndexItem.ID); String sourceUUID = doc.get(IndexItem.EVIDENCE_UUID); - textQuery += " && NOT (" + IndexItem.ID + ":" + id; //$NON-NLS-1$ //$NON-NLS-2$ - textQuery += " && " + IndexItem.EVIDENCE_UUID + ":" + sourceUUID + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + textQuery += " && NOT (" + IndexItem.ID + ":" + id; + textQuery += " && " + IndexItem.EVIDENCE_UUID + ":" + sourceUUID + ")"; try { IIPEDSearcher task = new IPEDSearcher(App.get().appCase, textQuery, BasicProps.PATH); @@ -180,7 +93,7 @@ public void listDuplicates(Document doc) { @Override public void run() { App.get().duplicateDock - .setTitleText(duplicates + Messages.getString("DuplicatesTableModel.Duplicates")); //$NON-NLS-1$ + .setTitleText(duplicates + Messages.getString("DuplicatesTableModel.Duplicates")); } }); } @@ -191,12 +104,5 @@ public void run() { } fireTableDataChanged(); - } - - @Override - public IMultiSearchResult getSearchResult() { - return MultiSearchResult.get(App.get().appCase, results); - } - } diff --git a/iped-app/src/main/java/iped/app/ui/ParentTableModel.java b/iped-app/src/main/java/iped/app/ui/ParentTableModel.java index db72f771c2..41f327d949 100644 --- a/iped-app/src/main/java/iped/app/ui/ParentTableModel.java +++ b/iped-app/src/main/java/iped/app/ui/ParentTableModel.java @@ -19,14 +19,10 @@ package iped.app.ui; import java.awt.Rectangle; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.table.AbstractTableModel; import org.apache.lucene.document.Document; @@ -34,113 +30,11 @@ import iped.engine.search.LuceneSearchResult; import iped.engine.search.MultiSearchResult; import iped.engine.task.index.IndexItem; -import iped.search.IMultiSearchResult; -public class ParentTableModel extends AbstractTableModel - implements MouseListener, ListSelectionListener, SearchResultTableModel { +public class ParentTableModel extends BaseTableModel { - /** - * - */ private static final long serialVersionUID = 1L; - // public ScoreDoc[] results = new ScoreDoc[0]; - LuceneSearchResult results = new LuceneSearchResult(0); - int selectedIndex = -1; - - @Override - public int getColumnCount() { - return 3; - } - - @Override - public int getRowCount() { - return results.getLength(); - } - - @Override - public String getColumnName(int col) { - if (col == 2) - return IndexItem.NAME; - - return ""; //$NON-NLS-1$ - } - - @Override - public boolean isCellEditable(int row, int col) { - if (col == 1) { - return true; - } else { - return false; - } - } - - @Override - public Class getColumnClass(int c) { - if (c == 1) { - return Boolean.class; - } else { - return String.class; - } - } - - @Override - public void setValueAt(Object value, int row, int col) { - App.get().appCase.getMultiBookmarks().setChecked((Boolean) value, - App.get().appCase.getItemId(results.getLuceneIds()[row])); - BookmarksController.get().updateUISelection(); - } - - @Override - public Object getValueAt(int row, int col) { - if (col == 0) { - return row + 1; - - } else if (col == 1) { - return App.get().appCase.getMultiBookmarks() - .isChecked(App.get().appCase.getItemId(results.getLuceneIds()[row])); - - } else { - try { - Document doc = App.get().appCase.getSearcher().doc(results.getLuceneIds()[row]); - return doc.get(IndexItem.NAME); - } catch (Exception e) { - // e.printStackTrace(); - } - return ""; //$NON-NLS-1$ - } - } - - @Override - public IMultiSearchResult getSearchResult() { - return (IMultiSearchResult) MultiSearchResult.get(App.get().appCase, results); - } - - @Override - public void mouseClicked(MouseEvent arg0) { - } - - @Override - public void mouseEntered(MouseEvent arg0) { - } - - @Override - public void mouseExited(MouseEvent arg0) { - } - - @Override - public void mousePressed(MouseEvent arg0) { - } - - @Override - public void mouseReleased(MouseEvent evt) { - if (evt.getClickCount() == 2 && selectedIndex != -1) { - int docId = results.getLuceneIds()[selectedIndex]; - ExternalFileOpen.open(docId); - } - - } - @Override public void valueChanged(ListSelectionEvent evt) { ListSelectionModel lsm = (ListSelectionModel) evt.getSource(); @@ -159,18 +53,16 @@ public void valueChanged(ListSelectionEvent evt) { App.get().subItemModel.fireTableDataChanged(); } - Thread thread; - public void listParents(final Document doc) { String textQuery = null; String parentId = doc.get(IndexItem.PARENTID); if (parentId != null) { - textQuery = IndexItem.ID + ":" + parentId; //$NON-NLS-1$ + textQuery = IndexItem.ID + ":" + parentId; } String sourceUUID = doc.get(IndexItem.EVIDENCE_UUID); - textQuery += " && " + IndexItem.EVIDENCE_UUID + ":" + sourceUUID; //$NON-NLS-1$ //$NON-NLS-2$ + textQuery += " && " + IndexItem.EVIDENCE_UUID + ":" + sourceUUID; results = new LuceneSearchResult(0); @@ -188,13 +80,11 @@ public void listParents(final Document doc) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - App.get().parentDock.setTitleText(Messages.getString("ParentTableModel.ParentCount")); //$NON-NLS-1$ + App.get().parentDock.setTitleText(Messages.getString("ParentTableModel.ParentCount")); } }); } fireTableDataChanged(); - } - } diff --git a/iped-app/src/main/java/iped/app/ui/ReferencedByTableModel.java b/iped-app/src/main/java/iped/app/ui/ReferencedByTableModel.java index 700933aa57..b8418b705c 100644 --- a/iped-app/src/main/java/iped/app/ui/ReferencedByTableModel.java +++ b/iped-app/src/main/java/iped/app/ui/ReferencedByTableModel.java @@ -18,16 +18,12 @@ */ package iped.app.ui; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; import java.util.Arrays; import java.util.stream.Collectors; import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.table.AbstractTableModel; import org.apache.lucene.document.Document; @@ -36,118 +32,16 @@ import iped.engine.search.LuceneSearchResult; import iped.engine.search.MultiSearchResult; import iped.engine.task.HashTask; -import iped.engine.task.index.IndexItem; import iped.parsers.ares.AresParser; import iped.parsers.emule.KnownMetParser; import iped.parsers.shareaza.ShareazaLibraryDatParser; import iped.properties.BasicProps; import iped.properties.ExtraProperties; -public class ReferencedByTableModel extends AbstractTableModel - implements MouseListener, ListSelectionListener, SearchResultTableModel { +public class ReferencedByTableModel extends BaseTableModel { - /** - * - */ private static final long serialVersionUID = 1L; - private LuceneSearchResult results = new LuceneSearchResult(0); - private int selectedIndex = -1; - private Document refDoc; - - public void clear() { - results = new LuceneSearchResult(0); - fireTableDataChanged(); - } - - @Override - public int getColumnCount() { - return 3; - } - - @Override - public int getRowCount() { - return results.getLength(); - } - - @Override - public String getColumnName(int col) { - if (col == 2) - return IndexItem.NAME; - - return ""; //$NON-NLS-1$ - } - - @Override - public boolean isCellEditable(int row, int col) { - if (col == 1) { - return true; - } else { - return false; - } - } - - @Override - public Class getColumnClass(int c) { - if (c == 1) { - return Boolean.class; - } else { - return String.class; - } - } - - @Override - public void setValueAt(Object value, int row, int col) { - App.get().appCase.getMultiBookmarks().setChecked((Boolean) value, - App.get().appCase.getItemId(results.getLuceneIds()[row])); - BookmarksController.get().updateUISelection(); - } - - @Override - public Object getValueAt(int row, int col) { - if (col == 0) { - return row + 1; - - } else if (col == 1) { - return App.get().appCase.getMultiBookmarks() - .isChecked(App.get().appCase.getItemId(results.getLuceneIds()[row])); - - } else { - try { - Document doc = App.get().appCase.getSearcher().doc(results.getLuceneIds()[row]); - return doc.get(IndexItem.NAME); - } catch (Exception e) { - // e.printStackTrace(); - } - return ""; //$NON-NLS-1$ - } - } - - @Override - public void mouseClicked(MouseEvent arg0) { - } - - @Override - public void mouseEntered(MouseEvent arg0) { - } - - @Override - public void mouseExited(MouseEvent arg0) { - } - - @Override - public void mousePressed(MouseEvent arg0) { - } - - @Override - public void mouseReleased(MouseEvent evt) { - if (evt.getClickCount() == 2 && selectedIndex != -1) { - int docId = results.getLuceneIds()[selectedIndex]; - ExternalFileOpen.open(docId); - } - - } - @Override public void valueChanged(ListSelectionEvent evt) { ListSelectionModel lsm = (ListSelectionModel) evt.getSource(); @@ -181,7 +75,6 @@ public void valueChanged(ListSelectionEvent evt) { FileProcessor parsingTask = new FileProcessor(id, false); parsingTask.execute(); - } public void listReferencingItems(Document doc) { @@ -192,32 +85,33 @@ public void listReferencingItems(Document doc) { String edonkey = doc.get(HashTask.HASH.EDONKEY.toString()); String hashes = Arrays.asList(md5, sha1, sha256, edonkey).stream().filter(a -> a != null) .collect(Collectors.joining(" ")); - + if (hashes.isEmpty()) { results = new LuceneSearchResult(0); refDoc = null; } else { String textQuery = ExtraProperties.LINKED_ITEMS + ":(" + hashes + ") "; textQuery += ExtraProperties.SHARED_HASHES + ":(" + hashes + ")"; - + try { IPEDSearcher task = new IPEDSearcher(App.get().appCase, textQuery, BasicProps.NAME); results = MultiSearchResult.get(task.multiSearch(), App.get().appCase); - + final int length = results.getLength(); - + if (length > 0) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - App.get().referencedByDock.setTitleText(Messages.getString("ReferencedByTab.Title") + " " + length); + App.get().referencedByDock + .setTitleText(Messages.getString("ReferencedByTab.Title") + " " + length); } }); refDoc = doc; } else { refDoc = null; } - + } catch (Exception e) { results = new LuceneSearchResult(0); refDoc = null; @@ -226,12 +120,5 @@ public void run() { } fireTableDataChanged(); - } - - @Override - public MultiSearchResult getSearchResult() { - return MultiSearchResult.get(App.get().appCase, results); - } - } diff --git a/iped-app/src/main/java/iped/app/ui/ReferencingTableModel.java b/iped-app/src/main/java/iped/app/ui/ReferencingTableModel.java index b98f3e1620..0707c4d6ff 100644 --- a/iped-app/src/main/java/iped/app/ui/ReferencingTableModel.java +++ b/iped-app/src/main/java/iped/app/ui/ReferencingTableModel.java @@ -18,14 +18,9 @@ */ package iped.app.ui; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; - import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.table.AbstractTableModel; import org.apache.lucene.document.Document; import org.apache.lucene.index.Term; @@ -38,117 +33,16 @@ import iped.engine.search.LuceneSearchResult; import iped.engine.search.MultiSearchResult; import iped.engine.task.HashTask; -import iped.engine.task.index.IndexItem; import iped.parsers.ares.AresParser; import iped.parsers.emule.KnownMetParser; import iped.parsers.shareaza.ShareazaLibraryDatParser; import iped.properties.BasicProps; import iped.properties.ExtraProperties; -public class ReferencingTableModel extends AbstractTableModel - implements MouseListener, ListSelectionListener, SearchResultTableModel { +public class ReferencingTableModel extends BaseTableModel { - /** - * - */ private static final long serialVersionUID = 1L; - private LuceneSearchResult results = new LuceneSearchResult(0); - private int selectedIndex = -1; - - public void clear() { - results = new LuceneSearchResult(0); - fireTableDataChanged(); - } - - @Override - public int getColumnCount() { - return 3; - } - - @Override - public int getRowCount() { - return results.getLength(); - } - - @Override - public String getColumnName(int col) { - if (col == 2) - return IndexItem.NAME; - - return ""; //$NON-NLS-1$ - } - - @Override - public boolean isCellEditable(int row, int col) { - if (col == 1) { - return true; - } else { - return false; - } - } - - @Override - public Class getColumnClass(int c) { - if (c == 1) { - return Boolean.class; - } else { - return String.class; - } - } - - @Override - public void setValueAt(Object value, int row, int col) { - App.get().appCase.getMultiBookmarks().setChecked((Boolean) value, - App.get().appCase.getItemId(results.getLuceneIds()[row])); - BookmarksController.get().updateUISelection(); - } - - @Override - public Object getValueAt(int row, int col) { - if (col == 0) { - return row + 1; - - } else if (col == 1) { - return App.get().appCase.getMultiBookmarks() - .isChecked(App.get().appCase.getItemId(results.getLuceneIds()[row])); - - } else { - try { - Document doc = App.get().appCase.getSearcher().doc(results.getLuceneIds()[row]); - return doc.get(IndexItem.NAME); - } catch (Exception e) { - // e.printStackTrace(); - } - return ""; //$NON-NLS-1$ - } - } - - @Override - public void mouseClicked(MouseEvent arg0) { - } - - @Override - public void mouseEntered(MouseEvent arg0) { - } - - @Override - public void mouseExited(MouseEvent arg0) { - } - - @Override - public void mousePressed(MouseEvent arg0) { - } - - @Override - public void mouseReleased(MouseEvent evt) { - if (evt.getClickCount() == 2 && selectedIndex != -1) { - int docId = results.getLuceneIds()[selectedIndex]; - ExternalFileOpen.open(docId); - } - - } - @Override public void valueChanged(ListSelectionEvent evt) { ListSelectionModel lsm = (ListSelectionModel) evt.getSource(); @@ -163,7 +57,6 @@ public void valueChanged(ListSelectionEvent evt) { FileProcessor parsingTask = new FileProcessor(id, false); parsingTask.execute(); - } public void listReferencingItems(Document doc) { @@ -205,21 +98,23 @@ public void listReferencingItems(Document doc) { if (textQuery != null || query != null) { try { - IPEDSearcher task = query != null ? new IPEDSearcher(App.get().appCase, query, BasicProps.NAME) : new IPEDSearcher(App.get().appCase, textQuery.toString(), BasicProps.NAME); + IPEDSearcher task = query != null ? new IPEDSearcher(App.get().appCase, query, BasicProps.NAME) + : new IPEDSearcher(App.get().appCase, textQuery.toString(), BasicProps.NAME); task.setRewritequery(false); results = MultiSearchResult.get(task.multiSearch(), App.get().appCase); - + final int length = results.getLength(); - + if (length > 0) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - App.get().referencesDock.setTitleText(Messages.getString("ReferencesTab.Title") + " " + length); + App.get().referencesDock + .setTitleText(Messages.getString("ReferencesTab.Title") + " " + length); } }); } - + } catch (Exception e) { results = new LuceneSearchResult(0); e.printStackTrace(); @@ -227,12 +122,5 @@ public void run() { } fireTableDataChanged(); - } - - @Override - public MultiSearchResult getSearchResult() { - return MultiSearchResult.get(App.get().appCase, results); - } - } diff --git a/iped-app/src/main/java/iped/app/ui/SubitemTableModel.java b/iped-app/src/main/java/iped/app/ui/SubitemTableModel.java index e038bc1907..399853abdc 100644 --- a/iped-app/src/main/java/iped/app/ui/SubitemTableModel.java +++ b/iped-app/src/main/java/iped/app/ui/SubitemTableModel.java @@ -19,14 +19,10 @@ package iped.app.ui; import java.awt.Rectangle; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.table.AbstractTableModel; import org.apache.lucene.document.Document; @@ -37,105 +33,10 @@ import iped.properties.BasicProps; import iped.utils.LocalizedFormat; -public class SubitemTableModel extends AbstractTableModel - implements MouseListener, ListSelectionListener, SearchResultTableModel { +public class SubitemTableModel extends BaseTableModel { - /** - * - */ private static final long serialVersionUID = 1L; - LuceneSearchResult results = new LuceneSearchResult(0); - int selectedIndex = -1; - - @Override - public int getColumnCount() { - return 3; - } - - @Override - public int getRowCount() { - return results.getLength(); - } - - @Override - public String getColumnName(int col) { - if (col == 2) - return IndexItem.NAME; - - return ""; //$NON-NLS-1$ - } - - @Override - public boolean isCellEditable(int row, int col) { - if (col == 1) { - return true; - } else { - return false; - } - } - - @Override - public Class getColumnClass(int c) { - if (c == 1) { - return Boolean.class; - } else { - return String.class; - } - } - - @Override - public void setValueAt(Object value, int row, int col) { - App.get().appCase.getMultiBookmarks().setChecked((Boolean) value, - App.get().appCase.getItemId(results.getLuceneIds()[row])); - BookmarksController.get().updateUISelection(); - } - - @Override - public Object getValueAt(int row, int col) { - if (col == 0) { - return row + 1; - - } else if (col == 1) { - return App.get().appCase.getMultiBookmarks() - .isChecked(App.get().appCase.getItemId(results.getLuceneIds()[row])); - - } else { - try { - Document doc = App.get().appCase.getSearcher().doc(results.getLuceneIds()[row]); - return doc.get(IndexItem.NAME); - } catch (Exception e) { - // e.printStackTrace(); - } - return ""; //$NON-NLS-1$ - } - } - - @Override - public void mouseClicked(MouseEvent arg0) { - } - - @Override - public void mouseEntered(MouseEvent arg0) { - } - - @Override - public void mouseExited(MouseEvent arg0) { - } - - @Override - public void mousePressed(MouseEvent arg0) { - } - - @Override - public void mouseReleased(MouseEvent evt) { - if (evt.getClickCount() == 2 && selectedIndex != -1) { - int docId = results.getLuceneIds()[selectedIndex]; - ExternalFileOpen.open(docId); - } - - } - @Override public void valueChanged(ListSelectionEvent evt) { ListSelectionModel lsm = (ListSelectionModel) evt.getSource(); @@ -158,10 +59,10 @@ public void listSubItems(Document doc) { String parentId = doc.get(IndexItem.ID); - String textQuery = IndexItem.PARENTID + ":" + parentId; //$NON-NLS-1$ + String textQuery = IndexItem.PARENTID + ":" + parentId; String sourceUUID = doc.get(IndexItem.EVIDENCE_UUID); - textQuery += " && " + IndexItem.EVIDENCE_UUID + ":" + sourceUUID; //$NON-NLS-1$ //$NON-NLS-2$ + textQuery += " && " + IndexItem.EVIDENCE_UUID + ":" + sourceUUID; try { IPEDSearcher task = new IPEDSearcher(App.get().appCase, textQuery, BasicProps.NAME); @@ -174,7 +75,7 @@ public void listSubItems(Document doc) { @Override public void run() { App.get().subitemDock.setTitleText( - LocalizedFormat.format(sumSubitens) + Messages.getString("SubitemTableModel.Subitens")); //$NON-NLS-1$ + LocalizedFormat.format(sumSubitens) + Messages.getString("SubitemTableModel.Subitens")); } }); } @@ -185,12 +86,5 @@ public void run() { } fireTableDataChanged(); - - } - - @Override - public MultiSearchResult getSearchResult() { - return MultiSearchResult.get(App.get().appCase, results); } - }