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.refreshButton.text=Refresh
FiltersPanel.deviceRequiredLabel.text=Select at least one. FiltersPanel.deviceRequiredLabel.text=Select at least one.
FiltersPanel.accountTypeRequiredLabel.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 VisualizationPanel.jButton1.text=Fast Organic
CVTTopComponent.vizPanel.TabConstraints.tabTitle=Visualize CVTTopComponent.vizPanel.TabConstraints.tabTitle=Visualize
CVTTopComponent.accountsBrowser.TabConstraints.tabTitle_1=Browse CVTTopComponent.accountsBrowser.TabConstraints.tabTitle_1=Browse

View File

@ -26,7 +26,7 @@ FiltersPanel.endCheckBox.text=End:
FiltersPanel.refreshButton.text=Refresh FiltersPanel.refreshButton.text=Refresh
FiltersPanel.deviceRequiredLabel.text=Select at least one. FiltersPanel.deviceRequiredLabel.text=Select at least one.
FiltersPanel.accountTypeRequiredLabel.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 OpenCVTAction.displayName=Communications
PinAccountsAction.pluralText=Add Selected Accounts to Visualization PinAccountsAction.pluralText=Add Selected Accounts to Visualization
PinAccountsAction.singularText=Add Selected Account 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 { abstract class CVTFilterRefresher implements RefreshThrottler.Refresher {
private static final Logger logger = Logger.getLogger(CVTFilterRefresher.class.getName()); private static final Logger logger = Logger.getLogger(CVTFilterRefresher.class.getName());
/** /**
* contains all of the gui control specific update code. Refresh will call * contains all of the gui control specific update code. Refresh will call
* this method with an involkLater so that the updating of the swing * 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... * Re-applying the filters means we will lose the selection...
*/ */
filtersPane.setEnabled(false); filtersPane.initalizeFilters();
filtersPane.updateFilters();
} }
@Override @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_CONTACT.getTypeID()
|| eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG.getTypeID() || eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG.getTypeID()
|| eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.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 -> { this.ingestJobListener = pce -> {
String eventType = pce.getPropertyName(); String eventType = pce.getPropertyName();
if (eventType.equals(COMPLETED.toString())) { if (eventType.equals(COMPLETED.toString())) {
needsRefresh = true; if(!needsRefresh) {
needsRefresh = true;
validateFilters();
}
} }
}; };
@ -214,33 +220,11 @@ final public class FiltersPanel extends JPanel {
} }
} }
@Override void initalizeFilters() {
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() {
Runnable runnable = new Runnable() { Runnable runnable = new Runnable() {
@Override @Override
public void run() { public void run() {
new FilterPanelRefresher().refresh(); new FilterPanelRefresher(true, true).refresh();
} }
}; };
runnable.run(); runnable.run();
@ -289,13 +273,12 @@ final public class FiltersPanel extends JPanel {
* *
* @return True, if a new accountType was found * @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 newOneFound = false;
boolean selected = accountTypeMap.isEmpty() || (accountTypeMap.size() == 1 && accountTypeMap.containsKey(Account.Type.DEVICE));
for (Account.Type type : accountTypesInUse) { for (Account.Type type : accountTypesInUse) {
if (!accountTypeMap.containsKey(type) && !type.equals(Account.Type.CREDIT_CARD)) { 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()); accountTypeMap.put(type, panel.getCheckBox());
accountTypeListPane.add(panel); accountTypeListPane.add(panel);
@ -338,15 +321,14 @@ final public class FiltersPanel extends JPanel {
* *
* @return true if a new device was found * @return true if a new device was found
*/ */
private void updateDeviceFilterPanel(Map<String, DataSource> dataSourceMap) { private void updateDeviceFilterPanel(Map<String, DataSource> dataSourceMap, boolean checkNewOnes) {
needsRefresh = devicesMap.isEmpty();
boolean newOneFound = false; boolean newOneFound = false;
for (Entry<String, DataSource> entry : dataSourceMap.entrySet()) { for (Entry<String, DataSource> entry : dataSourceMap.entrySet()) {
if (devicesMap.containsKey(entry.getValue().getDeviceId())) { if (devicesMap.containsKey(entry.getValue().getDeviceId())) {
continue; continue;
} }
final JCheckBox jCheckBox = new JCheckBox(entry.getKey(), needsRefresh); final JCheckBox jCheckBox = new JCheckBox(entry.getKey(), checkNewOnes);
jCheckBox.addItemListener(validationListener); jCheckBox.addItemListener(validationListener);
jCheckBox.setToolTipText(entry.getKey()); jCheckBox.setToolTipText(entry.getKey());
devicesListPane.add(jCheckBox); devicesListPane.add(jCheckBox);
@ -844,9 +826,10 @@ final public class FiltersPanel extends JPanel {
* Post an event with the new filters. * Post an event with the new filters.
*/ */
void applyFilters() { void applyFilters() {
validateFilters(); needsRefresh = false;
CVTEvents.getCVTEventBus().post(new CVTEvents.FilterChangeEvent(getFilter(), getStartControlState(), getEndControlState())); validateFilters();
needsRefresh = false; CVTEvents.getCVTEventBus().post(new CVTEvents.FilterChangeEvent(getFilter(), getStartControlState(), getEndControlState()));
} }
/** /**
@ -1147,22 +1130,33 @@ final public class FiltersPanel extends JPanel {
*/ */
final class FilterPanelRefresher extends CVTFilterRefresher { 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 @Override
void updateFilterPanel(CVTFilterRefresher.FilterPanelData data) { void updateFilterPanel(CVTFilterRefresher.FilterPanelData data) {
updateDateTimePicker(data.getStartTime(), data.getEndTime()); updateDateTimePicker(data.getStartTime(), data.getEndTime());
updateDeviceFilterPanel(data.getDataSourceMap()); updateDeviceFilterPanel(data.getDataSourceMap(), selectNewOption);
updateAccountTypeFilter(data.getAccountTypesInUse()); updateAccountTypeFilter(data.getAccountTypesInUse(), selectNewOption);
FiltersPanel.this.repaint(); FiltersPanel.this.repaint();
if (needsRefresh) { if (refreshAfterUpdate) {
applyFilters(); applyFilters();
} }
if (!isEnabled()) { if (!isEnabled()) {
setEnabled(true); setEnabled(true);
} }
validateFilters(); validateFilters();
repaint();
} }
} }