Addressed Ramans concerns

This commit is contained in:
Kelly Kelly 2020-07-15 15:40:59 -04:00
parent 6fd07ffce5
commit 5b17ce9e04
5 changed files with 37 additions and 45 deletions

View File

@ -14,7 +14,7 @@ FiltersPanel.endCheckBox.text=End:
FiltersPanel.refreshButton.text=Refresh
FiltersPanel.deviceRequiredLabel.text=Select at least one.
FiltersPanel.accountTypeRequiredLabel.text=Select at least one.
FiltersPanel.needsRefreshLabel.text=Displayed data is out of date. Press Refresh.
FiltersPanel.needsRefreshLabel.text=Displayed data maybe out of date. Press Refresh to update.
VisualizationPanel.jButton1.text=Fast Organic
CVTTopComponent.vizPanel.TabConstraints.tabTitle=Visualize
CVTTopComponent.accountsBrowser.TabConstraints.tabTitle_1=Browse

View File

@ -26,7 +26,7 @@ FiltersPanel.endCheckBox.text=End:
FiltersPanel.refreshButton.text=Refresh
FiltersPanel.deviceRequiredLabel.text=Select at least one.
FiltersPanel.accountTypeRequiredLabel.text=Select at least one.
FiltersPanel.needsRefreshLabel.text=Displayed data is out of date. Press Refresh.
FiltersPanel.needsRefreshLabel.text=Displayed data maybe out of date. Press Refresh to update.
OpenCVTAction.displayName=Communications
PinAccountsAction.pluralText=Add Selected Accounts to Visualization
PinAccountsAction.singularText=Add Selected Account to Visualization

View File

@ -45,7 +45,6 @@ import org.sleuthkit.datamodel.TskCoreException;
abstract class CVTFilterRefresher implements RefreshThrottler.Refresher {
private static final Logger logger = Logger.getLogger(CVTFilterRefresher.class.getName());
/**
* contains all of the gui control specific update code. Refresh will call
* this method with an involkLater so that the updating of the swing

View File

@ -189,8 +189,7 @@ public final class CVTTopComponent extends TopComponent {
*
* Re-applying the filters means we will lose the selection...
*/
filtersPane.setEnabled(false);
filtersPane.updateFilters();
filtersPane.initalizeFilters();
}
@Override

View File

@ -162,17 +162,23 @@ final public class FiltersPanel extends JPanel {
|| eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT.getTypeID()
|| eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG.getTypeID()
|| eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID())) {
needsRefresh = true;
if(!needsRefresh) {
needsRefresh = true;
validateFilters();
}
}
}
};
refreshThrottler = new RefreshThrottler(new FilterPanelRefresher());
refreshThrottler = new RefreshThrottler(new FilterPanelRefresher(false, false));
this.ingestJobListener = pce -> {
String eventType = pce.getPropertyName();
if (eventType.equals(COMPLETED.toString())) {
needsRefresh = true;
if(!needsRefresh) {
needsRefresh = true;
validateFilters();
}
}
};
@ -214,33 +220,11 @@ final public class FiltersPanel extends JPanel {
}
}
@Override
public void setEnabled(boolean enabled) {
this.applyFiltersButton.setEnabled(enabled);
this.refreshButton.setEnabled(enabled && needsRefresh);
this.startCheckBox.setEnabled(enabled);
this.endCheckBox.setEnabled(enabled);
this.startDatePicker.setEnabled(enabled && startCheckBox.isSelected());
this.endDatePicker.setEnabled(enabled && endCheckBox.isSelected());
this.limitComboBox.setEnabled(enabled);
this.unCheckAllAccountTypesButton.setEnabled(enabled);
this.unCheckAllDevicesButton.setEnabled(enabled);
this.checkAllAccountTypesButton.setEnabled(enabled);
this.checkAllDevicesButton.setEnabled(enabled);
this.devicesListPane.setEnabled(enabled);
this.accountTypeListPane.setEnabled(enabled);
}
void updateFilters() {
void initalizeFilters() {
Runnable runnable = new Runnable() {
@Override
public void run() {
new FilterPanelRefresher().refresh();
new FilterPanelRefresher(true, true).refresh();
}
};
runnable.run();
@ -289,13 +273,12 @@ final public class FiltersPanel extends JPanel {
*
* @return True, if a new accountType was found
*/
private boolean updateAccountTypeFilter(List<Account.Type> accountTypesInUse) {
private boolean updateAccountTypeFilter(List<Account.Type> accountTypesInUse, boolean checkNewOnes) {
boolean newOneFound = false;
boolean selected = accountTypeMap.isEmpty() || (accountTypeMap.size() == 1 && accountTypeMap.containsKey(Account.Type.DEVICE));
for (Account.Type type : accountTypesInUse) {
if (!accountTypeMap.containsKey(type) && !type.equals(Account.Type.CREDIT_CARD)) {
CheckBoxIconPanel panel = createAccoutTypeCheckBoxPanel(type, selected);
CheckBoxIconPanel panel = createAccoutTypeCheckBoxPanel(type, checkNewOnes);
accountTypeMap.put(type, panel.getCheckBox());
accountTypeListPane.add(panel);
@ -338,15 +321,14 @@ final public class FiltersPanel extends JPanel {
*
* @return true if a new device was found
*/
private void updateDeviceFilterPanel(Map<String, DataSource> dataSourceMap) {
needsRefresh = devicesMap.isEmpty();
private void updateDeviceFilterPanel(Map<String, DataSource> dataSourceMap, boolean checkNewOnes) {
boolean newOneFound = false;
for (Entry<String, DataSource> entry : dataSourceMap.entrySet()) {
if (devicesMap.containsKey(entry.getValue().getDeviceId())) {
continue;
}
final JCheckBox jCheckBox = new JCheckBox(entry.getKey(), needsRefresh);
final JCheckBox jCheckBox = new JCheckBox(entry.getKey(), checkNewOnes);
jCheckBox.addItemListener(validationListener);
jCheckBox.setToolTipText(entry.getKey());
devicesListPane.add(jCheckBox);
@ -844,9 +826,10 @@ final public class FiltersPanel extends JPanel {
* Post an event with the new filters.
*/
void applyFilters() {
validateFilters();
CVTEvents.getCVTEventBus().post(new CVTEvents.FilterChangeEvent(getFilter(), getStartControlState(), getEndControlState()));
needsRefresh = false;
needsRefresh = false;
validateFilters();
CVTEvents.getCVTEventBus().post(new CVTEvents.FilterChangeEvent(getFilter(), getStartControlState(), getEndControlState()));
}
/**
@ -1147,22 +1130,33 @@ final public class FiltersPanel extends JPanel {
*/
final class FilterPanelRefresher extends CVTFilterRefresher {
private boolean selectNewOption = false;
private boolean refreshAfterUpdate = false;
FilterPanelRefresher(boolean selectNewOptions, boolean refreshAfterUpdate) {
this.selectNewOption = selectNewOptions;
this.refreshAfterUpdate = refreshAfterUpdate;
}
@Override
void updateFilterPanel(CVTFilterRefresher.FilterPanelData data) {
updateDateTimePicker(data.getStartTime(), data.getEndTime());
updateDeviceFilterPanel(data.getDataSourceMap());
updateAccountTypeFilter(data.getAccountTypesInUse());
updateDeviceFilterPanel(data.getDataSourceMap(), selectNewOption);
updateAccountTypeFilter(data.getAccountTypesInUse(), selectNewOption);
FiltersPanel.this.repaint();
if (needsRefresh) {
if (refreshAfterUpdate) {
applyFilters();
}
if (!isEnabled()) {
setEnabled(true);
}
validateFilters();
repaint();
}
}