19 package org.sleuthkit.autopsy.datasourcesummary.uiutils;
21 import java.util.Collection;
22 import java.util.logging.Level;
23 import javax.swing.JPanel;
24 import org.openide.util.NbBundle;
31 "AbstractLoadableComponent_loadingMessage_defaultText=Loading results...",
32 "AbstractLoadableComponent_errorMessage_defaultText=There was an error loading results.",
33 "AbstractLoadableComponent_noDataExists_defaultText=No data exists.",})
36 private static final long serialVersionUID = 1L;
41 public static final String DEFAULT_LOADING_MESSAGE = Bundle.AbstractLoadableComponent_loadingMessage_defaultText();
46 public static final String DEFAULT_ERROR_MESSAGE = Bundle.AbstractLoadableComponent_errorMessage_defaultText();
51 public static final String DEFAULT_NO_RESULTS_MESSAGE = Bundle.AbstractLoadableComponent_noDataExists_defaultText();
59 return DEFAULT_ERROR_MESSAGE;
66 return DEFAULT_NO_RESULTS_MESSAGE;
77 setMessage(
true, message);
86 showMessage(DEFAULT_LOADING_MESSAGE);
97 setMessage(
false, null);
115 if (result == null) {
116 logger.log(Level.SEVERE,
"Null data fetch result received.");
123 if (data == null || (data instanceof Collection<?> && ((Collection<?>) data).isEmpty())) {
124 showMessage(noResultsMessage);
132 logger.log(Level.WARNING,
"An exception was caused while results were loaded.", result.
getException());
133 showMessage(errorMessage);
137 logger.log(Level.SEVERE,
"No known loading state was found in result.");
151 showDataFetchResult(result, DEFAULT_ERROR_MESSAGE, DEFAULT_NO_RESULTS_MESSAGE);
161 protected abstract void setMessage(
boolean visible, String message);
169 protected abstract void setResults(T data);
ResultType getResultType()
synchronized void showResults(T data)
void showDataFetchResult(DataFetchResult< T > result)
void showDataFetchResult(DataFetchResult< T > result, String errorMessage, String noResultsMessage)
static String getDefaultNoResultsMessage()
synchronized void showMessage(String message)
void showDefaultLoadingMessage()
synchronized static Logger getLogger(String name)
static String getDefaultErrorMessage()