mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
This commit is contained in:
commit
9dfd0c14e8
@ -304,10 +304,10 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
||||
}
|
||||
if(content != null) {
|
||||
try {
|
||||
int size = content.getAllArtifacts().size();
|
||||
long size = content.getAllArtifactsCount();
|
||||
return size > 0;
|
||||
} catch (TskException ex) {
|
||||
logger.log(Level.WARNING, "Couldn't get All Blackboard Artifacts", ex);
|
||||
logger.log(Level.WARNING, "Couldn't get All Blackboard Artifacts Count", ex);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -484,9 +484,90 @@ class ExtractedContentPanel extends javax.swing.JPanel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Swingworker to get makrup source content String from Solr in background thread
|
||||
* and then set the panel text in the EDT
|
||||
* Helps not to block the UI while content from Solr is retrieved.
|
||||
* Update page and search controls for selected source
|
||||
*
|
||||
* @param source the selected source
|
||||
*/
|
||||
void updateControls(MarkupSource source) {
|
||||
updatePageControls(source);
|
||||
updateSearchControls(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* update page controls given the selected source
|
||||
*
|
||||
* @param source selected source
|
||||
*/
|
||||
void updatePageControls(MarkupSource source) {
|
||||
if (source == null) {
|
||||
enableNextPageControl(false);
|
||||
enablePrevPageControl(false);
|
||||
updateCurrentPageDisplay(0);
|
||||
updateTotalPageslDisplay(0);
|
||||
return;
|
||||
}
|
||||
|
||||
updateCurrentPageDisplay(source.getCurrentPage());
|
||||
int totalPages = source.getNumberPages();
|
||||
updateTotalPageslDisplay(totalPages);
|
||||
|
||||
|
||||
if (totalPages == 1) {
|
||||
enableNextPageControl(false);
|
||||
enablePrevPageControl(false);
|
||||
} else {
|
||||
if (source.hasNextPage()) {
|
||||
enableNextPageControl(true);
|
||||
} else {
|
||||
enableNextPageControl(false);
|
||||
}
|
||||
|
||||
if (source.hasPreviousPage()) {
|
||||
enablePrevPageControl(true);
|
||||
} else {
|
||||
enablePrevPageControl(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* update search controls given the selected source
|
||||
*
|
||||
* @param source selected source
|
||||
*/
|
||||
void updateSearchControls(MarkupSource source) {
|
||||
//setup search controls
|
||||
if (source != null && source.isSearchable()) {
|
||||
|
||||
updateCurrentMatchDisplay(source.currentItem());
|
||||
updateTotaMatcheslDisplay(source.getNumberHits());
|
||||
|
||||
if (source.hasNextItem() || source.hasNextPage()) {
|
||||
enableNextMatchControl(true);
|
||||
} else {
|
||||
enableNextMatchControl(false);
|
||||
}
|
||||
|
||||
if (source.hasPreviousItem() || source.hasPreviousPage()) {
|
||||
enablePrevMatchControl(true);
|
||||
} else {
|
||||
enablePrevMatchControl(false);
|
||||
}
|
||||
|
||||
} else {
|
||||
enableNextMatchControl(false);
|
||||
enablePrevMatchControl(false);
|
||||
updateCurrentMatchDisplay(0);
|
||||
updateTotaMatcheslDisplay(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Swingworker to get makrup source content String from Solr in background
|
||||
* thread and then set the panel text in the EDT Helps not to block the UI
|
||||
* while content from Solr is retrieved.
|
||||
*/
|
||||
private final class SetMarkup extends SwingWorker<Object, Void> {
|
||||
|
||||
@ -519,6 +600,10 @@ class ExtractedContentPanel extends javax.swing.JPanel {
|
||||
} else {
|
||||
setPanelText("");
|
||||
}
|
||||
|
||||
updateControls(source);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,8 +84,8 @@ public class ExtractedContentViewer implements DataContentViewer {
|
||||
if (!solrHasContent(selectedNode)) {
|
||||
//currentNode = null;
|
||||
//resetComponent();
|
||||
// first source will be the default displayed
|
||||
setPanel(sources);
|
||||
// first source will be the default displayed
|
||||
setPanel(sources);
|
||||
return;
|
||||
}
|
||||
Content content = selectedNode.getLookup().lookup(Content.class);
|
||||
@ -222,22 +222,21 @@ public class ExtractedContentViewer implements DataContentViewer {
|
||||
}
|
||||
};
|
||||
|
||||
//initialize the source
|
||||
newSource.getNumberPages();
|
||||
|
||||
currentSource = newSource;
|
||||
sources.add(newSource);
|
||||
|
||||
|
||||
|
||||
//init pages
|
||||
final int totalPages = currentSource.getNumberPages();
|
||||
int currentPage = currentSource.getCurrentPage();
|
||||
if (currentPage == 0 && currentSource.hasNextPage()) {
|
||||
currentSource.nextPage();
|
||||
}
|
||||
|
||||
|
||||
updatePageControls();
|
||||
|
||||
|
||||
|
||||
// first source will be the default displayed
|
||||
setPanel(sources);
|
||||
// If node has been selected before, return to the previous position
|
||||
@ -275,7 +274,7 @@ public class ExtractedContentViewer implements DataContentViewer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getComponent() {
|
||||
public synchronized Component getComponent() {
|
||||
if (panel == null) {
|
||||
panel = new ExtractedContentPanel();
|
||||
panel.addPrevMatchControlListener(new PrevFindActionListener());
|
||||
@ -520,9 +519,6 @@ public class ExtractedContentViewer implements DataContentViewer {
|
||||
return;
|
||||
}
|
||||
|
||||
final int totalPages = currentSource.getNumberPages();
|
||||
final int currentPage = currentSource.getCurrentPage();
|
||||
|
||||
updatePageControls();
|
||||
updateSearchControls();
|
||||
|
||||
@ -530,60 +526,11 @@ public class ExtractedContentViewer implements DataContentViewer {
|
||||
}
|
||||
|
||||
private void updateSearchControls() {
|
||||
//setup search controls
|
||||
if (currentSource != null && currentSource.isSearchable()) {
|
||||
|
||||
panel.updateCurrentMatchDisplay(currentSource.currentItem());
|
||||
panel.updateTotaMatcheslDisplay(currentSource.getNumberHits());
|
||||
|
||||
if (currentSource.hasNextItem() || currentSource.hasNextPage()) {
|
||||
panel.enableNextMatchControl(true);
|
||||
} else {
|
||||
panel.enableNextMatchControl(false);
|
||||
}
|
||||
|
||||
if (currentSource.hasPreviousItem() || currentSource.hasPreviousPage()) {
|
||||
panel.enablePrevMatchControl(true);
|
||||
} else {
|
||||
panel.enablePrevMatchControl(false);
|
||||
}
|
||||
|
||||
} else {
|
||||
panel.enableNextMatchControl(false);
|
||||
panel.enablePrevMatchControl(false);
|
||||
panel.updateCurrentMatchDisplay(0);
|
||||
panel.updateTotaMatcheslDisplay(0);
|
||||
}
|
||||
panel.updateSearchControls(currentSource);
|
||||
}
|
||||
|
||||
private void updatePageControls() {
|
||||
if (currentSource == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int currentPage = currentSource.getCurrentPage();
|
||||
final int totalPages = currentSource.getNumberPages();
|
||||
panel.updateTotalPageslDisplay(totalPages);
|
||||
panel.updateCurrentPageDisplay(currentPage);
|
||||
|
||||
|
||||
if (totalPages == 1) {
|
||||
panel.enableNextPageControl(false);
|
||||
panel.enablePrevPageControl(false);
|
||||
} else {
|
||||
if (currentSource.hasNextPage()) {
|
||||
panel.enableNextPageControl(true);
|
||||
} else {
|
||||
panel.enableNextPageControl(false);
|
||||
}
|
||||
|
||||
if (currentSource.hasPreviousPage()) {
|
||||
panel.enablePrevPageControl(true);
|
||||
} else {
|
||||
panel.enablePrevPageControl(false);
|
||||
}
|
||||
}
|
||||
|
||||
panel.updateControls(currentSource);
|
||||
}
|
||||
|
||||
private void nextPage() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user