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) {
|
if(content != null) {
|
||||||
try {
|
try {
|
||||||
int size = content.getAllArtifacts().size();
|
long size = content.getAllArtifactsCount();
|
||||||
return size > 0;
|
return size > 0;
|
||||||
} catch (TskException ex) {
|
} 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;
|
return false;
|
||||||
|
@ -484,9 +484,90 @@ class ExtractedContentPanel extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swingworker to get makrup source content String from Solr in background thread
|
* Update page and search controls for selected source
|
||||||
* and then set the panel text in the EDT
|
*
|
||||||
* Helps not to block the UI while content from Solr is retrieved.
|
* @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> {
|
private final class SetMarkup extends SwingWorker<Object, Void> {
|
||||||
|
|
||||||
@ -519,6 +600,10 @@ class ExtractedContentPanel extends javax.swing.JPanel {
|
|||||||
} else {
|
} else {
|
||||||
setPanelText("");
|
setPanelText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateControls(source);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,8 +84,8 @@ public class ExtractedContentViewer implements DataContentViewer {
|
|||||||
if (!solrHasContent(selectedNode)) {
|
if (!solrHasContent(selectedNode)) {
|
||||||
//currentNode = null;
|
//currentNode = null;
|
||||||
//resetComponent();
|
//resetComponent();
|
||||||
// first source will be the default displayed
|
// first source will be the default displayed
|
||||||
setPanel(sources);
|
setPanel(sources);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Content content = selectedNode.getLookup().lookup(Content.class);
|
Content content = selectedNode.getLookup().lookup(Content.class);
|
||||||
@ -222,22 +222,21 @@ public class ExtractedContentViewer implements DataContentViewer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//initialize the source
|
||||||
|
newSource.getNumberPages();
|
||||||
|
|
||||||
currentSource = newSource;
|
currentSource = newSource;
|
||||||
sources.add(newSource);
|
sources.add(newSource);
|
||||||
|
|
||||||
|
|
||||||
//init pages
|
//init pages
|
||||||
final int totalPages = currentSource.getNumberPages();
|
|
||||||
int currentPage = currentSource.getCurrentPage();
|
int currentPage = currentSource.getCurrentPage();
|
||||||
if (currentPage == 0 && currentSource.hasNextPage()) {
|
if (currentPage == 0 && currentSource.hasNextPage()) {
|
||||||
currentSource.nextPage();
|
currentSource.nextPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
updatePageControls();
|
updatePageControls();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// first source will be the default displayed
|
// first source will be the default displayed
|
||||||
setPanel(sources);
|
setPanel(sources);
|
||||||
// If node has been selected before, return to the previous position
|
// If node has been selected before, return to the previous position
|
||||||
@ -275,7 +274,7 @@ public class ExtractedContentViewer implements DataContentViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getComponent() {
|
public synchronized Component getComponent() {
|
||||||
if (panel == null) {
|
if (panel == null) {
|
||||||
panel = new ExtractedContentPanel();
|
panel = new ExtractedContentPanel();
|
||||||
panel.addPrevMatchControlListener(new PrevFindActionListener());
|
panel.addPrevMatchControlListener(new PrevFindActionListener());
|
||||||
@ -520,9 +519,6 @@ public class ExtractedContentViewer implements DataContentViewer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int totalPages = currentSource.getNumberPages();
|
|
||||||
final int currentPage = currentSource.getCurrentPage();
|
|
||||||
|
|
||||||
updatePageControls();
|
updatePageControls();
|
||||||
updateSearchControls();
|
updateSearchControls();
|
||||||
|
|
||||||
@ -530,60 +526,11 @@ public class ExtractedContentViewer implements DataContentViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateSearchControls() {
|
private void updateSearchControls() {
|
||||||
//setup search controls
|
panel.updateSearchControls(currentSource);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePageControls() {
|
private void updatePageControls() {
|
||||||
if (currentSource == null) {
|
panel.updateControls(currentSource);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void nextPage() {
|
private void nextPage() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user