Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1631: feature to select items and (subItems / parent / references / referencedBy) #2288

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions iped-app/resources/localization/iped-desktop-messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ MenuClass.AddToGraph=Add to link analysis
MenuClass.ChangeGalleryColCount=Change Gallery Column Count
MenuClass.ChangeLayout=Change Vertical/Horizontal Layout
MenuClass.CheckHighlighted=Check Highlighted items
MenuClass.CheckRecursivelyHighlighted=Check highlighted items and subitems
MenuClass.CheckAdvanced=Advanced Check...
MenuClass.CheckHighlightedAndSubItems=Check highlighted items and subitems
MenuClass.CheckHighlightedAndParent=Check highlighted and parent items
MenuClass.CheckHighlightedAndReferences=Check highlighted and reference items
MenuClass.CheckHighlightedAndReferencedBy=Check highlighted and "referenced by" items
MenuClass.ClearSearches=Clear Search history
MenuClass.ColorTheme=Color Theme
MenuClass.CopyViewerImage=Take viewer screenshot
Expand Down Expand Up @@ -254,7 +258,10 @@ MenuClass.SaveBookmarks=Save Bookmarks
MenuClass.UiZoom=Change User Interface Zoom
MenuClass.IconSize=Icons Size
MenuClass.UnCheckHighlighted=Uncheck Highlighted items
MenuClass.UnCheckRecursivelyHighlighted=Uncheck highlighted items and subitems
MenuClass.UncheckHighlightedAndSubItems=Uncheck highlighted items and subitems
MenuClass.UncheckHighlightedAndParent=Uncheck highlighted and parent items
MenuClass.UncheckHighlightedAndReferences=Uncheck highlighted and reference items
MenuClass.UncheckHighlightedAndReferencedBy=Uncheck highlighted and "referenced by" items
MenuListener.ChatNotFound=Parent chat not found
MenuListener.Cols=Columns:
MenuListener.ExportTree.Warn=Highlight 01 (one) tree node as export reference\!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ MenuClass.AddToGraph=Zur Link-Analyse hinzufügen
MenuClass.ChangeGalleryColCount=Ändere Spaltenanzahl in der Galerie
MenuClass.ChangeLayout=Ändere vertikales/horizontales Layout
MenuClass.CheckHighlighted=Setze Haken bei markierten Elementen
MenuClass.CheckRecursivelyHighlighted=Setze Haken bei markierten Elementen und Unterelementen
MenuClass.CheckAdvanced=Advanced Check... [TBT]
MenuClass.CheckHighlightedAndSubItems=Setze Haken bei markierten Elementen und Unterelementen
MenuClass.CheckHighlightedAndParent=Check highlighted and parent items [TBT]
MenuClass.CheckHighlightedAndReferences=Check highlighted and reference items [TBT]
MenuClass.CheckHighlightedAndReferencedBy=Check highlighted and "referenced by" items [TBT]
MenuClass.ClearSearches=Lösche Suchhistorie
MenuClass.ColorTheme=Farbschema
MenuClass.CopyViewerImage=Erstelle Bildschirmkopie vom Betrachter
Expand Down Expand Up @@ -254,7 +258,10 @@ MenuClass.SaveBookmarks=Lesezeichen speichern
MenuClass.UiZoom=Ändere Zoom der Benutzeroberfläche
MenuClass.IconSize=Icon-Größe
MenuClass.UnCheckHighlighted=markierte Elemente abwählen
MenuClass.UnCheckRecursivelyHighlighted=markierte Elemente und Unterelemente abwählen
MenuClass.UncheckHighlightedAndSubItems=markierte Elemente und Unterelemente abwählen
MenuClass.UncheckHighlightedAndParent=Uncheck highlighted and parent items [TBT]
MenuClass.UncheckHighlightedAndReferences=Uncheck highlighted and reference items [TBT]
MenuClass.UncheckHighlightedAndReferencedBy=Uncheck highlighted and "referenced by" items [TBT]
MenuListener.ChatNotFound=übergeordneten Chat nicht gefunden
MenuListener.Cols=Spalten:
MenuListener.ExportTree.Warn=Markiere 01 (einen) Baumknoten als Exportreferenz\!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ MenuClass.AddToGraph=Añadir al análisis de enlaces
MenuClass.ChangeGalleryColCount=Cambiar número de columnas de la galería
MenuClass.ChangeLayout=Cambiar diseño vertical/horizontal
MenuClass.CheckHighlighted=Comprobar elementos resaltados
MenuClass.CheckRecursivelyHighlighted=Comprobar elementos y subelementos resaltados
MenuClass.CheckAdvanced=Advanced Check... [TBT]
MenuClass.CheckHighlightedAndSubItems=Comprobar elementos y subelementos resaltados
MenuClass.CheckHighlightedAndParent=Check highlighted and parent items [TBT]
MenuClass.CheckHighlightedAndReferences=Check highlighted and reference items [TBT]
MenuClass.CheckHighlightedAndReferencedBy=Check highlighted and "referenced by" items [TBT]
MenuClass.ClearSearches=Borrar historial de búsqueda
MenuClass.ColorTheme=Tema de color
MenuClass.CopyViewerImage=Tomar captura de pantalla del visor
Expand Down Expand Up @@ -254,7 +258,10 @@ MenuClass.SaveBookmarks=Guardar marcadores en un archivo
MenuClass.UiZoom=Cambiar zoom de interfaz de usuario
MenuClass.IconSize=Tamaño del icono de las categorías
MenuClass.UnCheckHighlighted=Desmarcar elementos resaltados
MenuClass.UnCheckRecursivelyHighlighted=Desmarcar elementos y subelementos resaltados
MenuClass.UncheckHighlightedAndSubItems=Desmarcar elementos y subelementos resaltados
MenuClass.UncheckHighlightedAndParent=Uncheck highlighted and parent items [TBT]
MenuClass.UncheckHighlightedAndReferences=Uncheck highlighted and reference items [TBT]
MenuClass.UncheckHighlightedAndReferencedBy=Uncheck highlighted and "referenced by" items [TBT]
MenuListener.ChatNotFound=Chat principal no encontrado
MenuListener.Cols=Columnas:
MenuListener.ExportTree.Warn=¡Resalte 01 (un) nodo del árbol como referencia de exportación\!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ MenuClass.AddToGraph=Ajouter à l''analyse de liens
MenuClass.ChangeGalleryColCount=Modifier le nombre de colonnes de la galerie
MenuClass.ChangeLayout=Changer la disposition Vertical/Horizontal
MenuClass.CheckHighlighted=Vérifier les éléments en surbrillance
MenuClass.CheckRecursivelyHighlighted=Vérifier les sous-éléments et éléments en surbrillance
MenuClass.CheckAdvanced=Advanced Check... [TBT]
MenuClass.CheckHighlightedAndSubItems=Vérifier les sous-éléments et éléments en surbrillance
MenuClass.CheckHighlightedAndParent=Check highlighted and parent items [TBT]
MenuClass.CheckHighlightedAndReferences=Check highlighted and reference items [TBT]
MenuClass.CheckHighlightedAndReferencedBy=Check highlighted and "referenced by" items [TBT]
MenuClass.ClearSearches=Supprimer l''historique des recherches
MenuClass.ColorTheme=Couleur du Thème
MenuClass.CopyViewerImage=Faire une capture d''écran de la visionneuse
Expand Down Expand Up @@ -254,7 +258,10 @@ MenuClass.SaveBookmarks=Sauvegarder les favoris
MenuClass.UiZoom=Réglage du zoom
MenuClass.IconSize=Taille des icones
MenuClass.UnCheckHighlighted=Décocher les éléments en surbrillance
MenuClass.UnCheckRecursivelyHighlighted=Décocher les éléments et sous-éléments en surbrillance
MenuClass.UncheckHighlightedAndSubItems=Décocher les éléments et sous-éléments en surbrillance
MenuClass.UncheckHighlightedAndParent=Uncheck highlighted and parent items [TBT]
MenuClass.UncheckHighlightedAndReferences=Uncheck highlighted and reference items [TBT]
MenuClass.UncheckHighlightedAndReferencedBy=Uncheck highlighted and "referenced by" items [TBT]
MenuListener.ChatNotFound=Origine du chat non trouvé
MenuListener.Cols=Colonnes :
MenuListener.ExportTree.Warn=Selectionner 01 (un) nœud de l''arborescence comme référence d''export \!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ MenuClass.AddToGraph=Aggiungi all''analisi dei collegamenti
MenuClass.ChangeGalleryColCount=Cambia il numero di colonne della Galleria
MenuClass.ChangeLayout=Cambia layout verticale/orizzontale
MenuClass.CheckHighlighted=Seleziona gli elementi evidenziati
MenuClass.CheckRecursivelyHighlighted=Seleziona gli elementi evidenziati e i sotto-elementi
MenuClass.CheckAdvanced=Advanced Check... [TBT]
MenuClass.CheckHighlightedAndSubItems=Seleziona gli elementi evidenziati e i sotto-elementi
MenuClass.CheckHighlightedAndParent=Check highlighted and parent items [TBT]
MenuClass.CheckHighlightedAndReferences=Check highlighted and reference items [TBT]
MenuClass.CheckHighlightedAndReferencedBy=Check highlighted and "referenced by" items [TBT]
MenuClass.ClearSearches=Cancella la cronologia di ricerca
MenuClass.ColorTheme=Colore tema
MenuClass.CopyViewerImage=Fai uno screenshot del Viewer
Expand Down Expand Up @@ -254,7 +258,10 @@ MenuClass.SaveBookmarks=Salva Segnalibri
MenuClass.UiZoom=Cambia lo zoom dell''interfaccia utente
MenuClass.IconSize=Dimensione icona
MenuClass.UnCheckHighlighted=Deseleziona elementi evidenziati
MenuClass.UnCheckRecursivelyHighlighted=Deseleziona gli elementi evidenziati e i sotto-elementi
MenuClass.UncheckHighlightedAndSubItems=Deseleziona gli elementi evidenziati e i sotto-elementi
MenuClass.UncheckHighlightedAndParent=Uncheck highlighted and parent items [TBT]
MenuClass.UncheckHighlightedAndReferences=Uncheck highlighted and reference items [TBT]
MenuClass.UncheckHighlightedAndReferencedBy=Uncheck highlighted and "referenced by" items [TBT]
MenuListener.ChatNotFound=Chat d''origine non trovata
MenuListener.Cols=Colonne:
MenuListener.ExportTree.Warn=Evidenzia 01 (un) nodo dell''albero come riferimento all''esportazione\!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ MenuClass.AddToGraph=Adicionar à análise de vínculos
MenuClass.ChangeGalleryColCount=Alterar Nº Colunas da Galeria
MenuClass.ChangeLayout=Alterar Disposição Vertical/Horizontal
MenuClass.CheckHighlighted=Marcar itens destacados
MenuClass.CheckRecursivelyHighlighted=Marcar itens destacados e subitens
MenuClass.CheckAdvanced=Marcação avançada...
MenuClass.CheckHighlightedAndSubItems=Marcar itens destacados e subitens
MenuClass.CheckHighlightedAndParent=Marcar itens destacados e item pai
MenuClass.CheckHighlightedAndReferences=Marcar itens destacados e referências
MenuClass.CheckHighlightedAndReferencedBy=Marcar itens destacados e "referenciado por"
MenuClass.ClearSearches=Limpar expressões pesquisadas
MenuClass.ColorTheme=Tema de Cores
MenuClass.CopyViewerImage=Copiar imagem do visualizador
Expand Down Expand Up @@ -254,7 +258,10 @@ MenuClass.SaveBookmarks=Salvar marcadores
MenuClass.UiZoom=Alterar Zoom da Interface
MenuClass.IconSize=Tamanho dos Ícones
MenuClass.UnCheckHighlighted=Remover marcação dos itens destacados
MenuClass.UnCheckRecursivelyHighlighted=Remover marcação dos itens destacados e subitens
MenuClass.UncheckHighlightedAndSubItems=Desmarcar itens destacados e subitens
MenuClass.UncheckHighlightedAndParent=Desmarcar itens destacados e item pai
MenuClass.UncheckHighlightedAndReferences=Desmarcar itens destacados e referências
MenuClass.UncheckHighlightedAndReferencedBy=Desmarcar itens destacados e "referenciado por"
MenuListener.ChatNotFound=Chat pai não encontrado
MenuListener.Cols=Colunas:
MenuListener.ExportTree.Warn=Selecione 01 (um) nó na árvore de diretórios como base de exportação\!
Expand Down
8 changes: 5 additions & 3 deletions iped-app/src/main/java/iped/app/ui/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public class App extends JFrame implements WindowListener, IMultiSearchResultPro
JButton searchButton, optionsButton, updateCaseData, helpButton, exportToZip;
JCheckBox checkBox, recursiveTreeList, filterDuplicates;
JTable resultsTable;
ResultTableListener resultTableListener;
GalleryTable gallery;
public HitsTable hitsTable;
AppGraphAnalytics appGraphAnalytics;
Expand Down Expand Up @@ -556,6 +557,7 @@ public void createGUI() {

resultsModel = new ResultTableModel();
resultsTable = new JTable(resultsModel);
resultTableListener = new ResultTableListener();
resultsScroll = new JScrollPane(resultsTable);
resultsTable.setFillsViewportHeight(true);
resultsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
Expand Down Expand Up @@ -778,9 +780,9 @@ protected void changed() {
updateCaseData.addActionListener(appletListener);
helpButton.addActionListener(appletListener);
checkBox.addActionListener(appletListener);
resultsTable.getSelectionModel().addListSelectionListener(new ResultTableListener());
resultsTable.addMouseListener(new ResultTableListener());
resultsTable.addKeyListener(new ResultTableListener());
resultsTable.getSelectionModel().addListSelectionListener(resultTableListener);
resultsTable.addMouseListener(resultTableListener);
resultsTable.addKeyListener(resultTableListener);

duplicatesFilterer = new DuplicatesFilterer();

Expand Down
56 changes: 55 additions & 1 deletion iped-app/src/main/java/iped/app/ui/BaseTableModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,30 @@
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.search.Query;

import iped.app.ui.bookmarks.BookmarkIcon;
import iped.engine.search.IPEDSearcher;
import iped.engine.search.LuceneSearchResult;
import iped.engine.search.MultiSearchResult;
import iped.engine.task.index.IndexItem;
import iped.engine.util.Util;
import iped.properties.BasicProps;
import iped.search.IMultiSearchResult;

public abstract class BaseTableModel extends AbstractTableModel implements MouseListener, ListSelectionListener, SearchResultTableModel {

private static final long serialVersionUID = 1L;

protected String sortResultsBy = BasicProps.NAME;
protected boolean cleanBeforeListItems;

protected LuceneSearchResult results = new LuceneSearchResult(0);
protected int selectedIndex = -1;
protected Document refDoc;
Expand Down Expand Up @@ -138,5 +145,52 @@ public final void valueChanged(ListSelectionEvent evt) {

public abstract void valueChanged(ListSelectionModel lsm);

public abstract void listItems(Document doc);
public abstract Query createQuery(Document doc);

protected abstract void onListItemsResultsComplete();

public final void listItems(Document doc) {

if (cleanBeforeListItems) {
results = new LuceneSearchResult(0);
fireTableDataChanged();
}

Query query = createQuery(doc);

if (query != null) {

try {
IPEDSearcher task = new IPEDSearcher(App.get().appCase, query, sortResultsBy);
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() {
onListItemsResultsComplete();
}
});
refDoc = doc;
} else {
refDoc = null;
}

} catch (Exception e) {
results = new LuceneSearchResult(0);
refDoc = null;
e.printStackTrace();
}
if (cleanBeforeListItems) {
fireTableDataChanged();
}
}

if (!cleanBeforeListItems) {
fireTableDataChanged();
}
}
}
4 changes: 2 additions & 2 deletions iped-app/src/main/java/iped/app/ui/BookmarksManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,8 @@ public void keyPressed(KeyEvent e) {
}

// Avoid conflict with keys that are used for item selection (space) and
// recursive item selection (R).
if (e.getKeyCode() == KeyEvent.VK_SPACE || e.getKeyCode() == 'R') {
// recursive item selection (R), parents (P), references (F) and referenced by (D)
if (e.getKeyCode() == KeyEvent.VK_SPACE || Arrays.asList('R', 'P', 'F', 'D').contains((char) e.getKeyCode())) {
if (e.getSource() == list) {
showMessage(Messages.getString("BookmarksManager.KeyStrokeAlert4"));
e.consume();
Expand Down
60 changes: 27 additions & 33 deletions iped-app/src/main/java/iped/app/ui/DuplicatesTableModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,28 @@
import java.awt.Rectangle;

import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;

import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.IntPoint;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;

import iped.engine.search.IPEDSearcher;
import iped.engine.search.LuceneSearchResult;
import iped.engine.search.MultiSearchResult;
import iped.engine.task.index.IndexItem;
import iped.properties.BasicProps;
import iped.search.IIPEDSearcher;

public class DuplicatesTableModel extends BaseTableModel {

private static final long serialVersionUID = 1L;

public DuplicatesTableModel() {
sortResultsBy = BasicProps.PATH;
}

@Override
public Object getValueAt(int row, int col) {
if (col == 3) {
Expand All @@ -60,40 +67,27 @@ public void valueChanged(ListSelectionModel lsm) {
}

@Override
public void listItems(Document doc) {
public void onListItemsResultsComplete() {
App.get().duplicateDock.setTitleText(results.getLength() + Messages.getString("DuplicatesTableModel.Duplicates"));
}

@Override
public Query createQuery(Document doc) {
String hash = doc.get(IndexItem.HASH);
if (hash == null || hash.trim().isEmpty())
return;

String textQuery = IndexItem.HASH + ":" + hash;
if (StringUtils.isBlank(hash)) {
return null;
}

String id = doc.get(IndexItem.ID);
String sourceUUID = doc.get(IndexItem.EVIDENCE_UUID);

textQuery += " && NOT (" + IndexItem.ID + ":" + id;
textQuery += " && " + IndexItem.EVIDENCE_UUID + ":" + sourceUUID + ")";

try {
IIPEDSearcher task = new IPEDSearcher(App.get().appCase, textQuery, BasicProps.PATH);
results = MultiSearchResult.get(task.multiSearch(), App.get().appCase);

final int duplicates = results.getLength();

if (duplicates > 0) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
App.get().duplicateDock.setTitleText(duplicates + Messages.getString("DuplicatesTableModel.Duplicates"));
}
});
}

} catch (Exception e) {
results = new LuceneSearchResult(0);
e.printStackTrace();
}
BooleanQuery.Builder queryBuilder = new BooleanQuery.Builder();
queryBuilder.add(new TermQuery(new Term(IndexItem.HASH, hash.toLowerCase())), Occur.MUST);
queryBuilder.add(new BooleanClause(new BooleanQuery.Builder()
.add(IntPoint.newExactQuery(IndexItem.ID, Integer.parseInt(id)), Occur.MUST)
.add(new TermQuery(new Term(IndexItem.EVIDENCE_UUID, sourceUUID)), Occur.MUST)
.build(), Occur.MUST_NOT));

fireTableDataChanged();
return queryBuilder.build();
}
}
Loading