mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
fix issue where panel wouldn't show
This commit is contained in:
parent
61bb6785fc
commit
01f9452215
@ -33,6 +33,7 @@ import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSettingsPanel;
|
||||
* Options panel for CyberTriage.
|
||||
*/
|
||||
public class CTOptionsPanel extends IngestModuleGlobalSettingsPanel {
|
||||
|
||||
private static final int MAX_SUBPANEL_WIDTH = 500;
|
||||
|
||||
private static final Logger logger = Logger.getLogger(CTOptionsPanel.class.getName());
|
||||
@ -47,6 +48,16 @@ public class CTOptionsPanel extends IngestModuleGlobalSettingsPanel {
|
||||
Collection<? extends CTOptionsSubPanel> coll = Lookup.getDefault().lookupAll(CTOptionsSubPanel.class);
|
||||
Stream<? extends CTOptionsSubPanel> panelStream = coll != null ? coll.stream() : Stream.empty();
|
||||
this.subPanels = panelStream
|
||||
.map(panel -> {
|
||||
try {
|
||||
// lookup is returning singleton instances which means this panel gets messed up when accessed
|
||||
// from multiple places because the panel's children are being added to a different CTOptionsPanel
|
||||
return (CTOptionsSubPanel) panel.getClass().getConstructor().newInstance();
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter(item -> item != null)
|
||||
.sorted(Comparator.comparing(p -> p.getClass().getSimpleName().toUpperCase()))
|
||||
.collect(Collectors.toList());
|
||||
addSubOptionsPanels(this.subPanels);
|
||||
@ -64,7 +75,7 @@ public class CTOptionsPanel extends IngestModuleGlobalSettingsPanel {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = i;
|
||||
@ -76,29 +87,28 @@ public class CTOptionsPanel extends IngestModuleGlobalSettingsPanel {
|
||||
|
||||
contentPane.add(subPanel, gridBagConstraints);
|
||||
}
|
||||
|
||||
GridBagConstraints verticalConstraints = new GridBagConstraints();
|
||||
verticalConstraints.gridx = 0;
|
||||
verticalConstraints.gridy = subPanels.size();
|
||||
verticalConstraints.weighty = 1;
|
||||
verticalConstraints.weightx = 0;
|
||||
|
||||
JPanel verticalSpacer = new JPanel();
|
||||
|
||||
verticalSpacer.setMinimumSize(new Dimension(MAX_SUBPANEL_WIDTH, 0));
|
||||
verticalSpacer.setPreferredSize(new Dimension(MAX_SUBPANEL_WIDTH, 0));
|
||||
verticalSpacer.setMaximumSize(new Dimension(MAX_SUBPANEL_WIDTH, Short.MAX_VALUE));
|
||||
contentPane.add(verticalSpacer, verticalConstraints);
|
||||
|
||||
|
||||
GridBagConstraints horizontalConstraints = new GridBagConstraints();
|
||||
horizontalConstraints.gridx = 1;
|
||||
horizontalConstraints.gridy = 0;
|
||||
horizontalConstraints.weighty = 0;
|
||||
horizontalConstraints.weightx = 1;
|
||||
|
||||
JPanel horizontalSpacer = new JPanel();
|
||||
contentPane.add(horizontalSpacer, horizontalConstraints);
|
||||
|
||||
GridBagConstraints verticalConstraints = new GridBagConstraints();
|
||||
verticalConstraints.gridx = 0;
|
||||
verticalConstraints.gridy = subPanels.size();
|
||||
verticalConstraints.weighty = 1;
|
||||
verticalConstraints.weightx = 0;
|
||||
|
||||
JPanel verticalSpacer = new JPanel();
|
||||
|
||||
verticalSpacer.setMinimumSize(new Dimension(MAX_SUBPANEL_WIDTH, 0));
|
||||
verticalSpacer.setPreferredSize(new Dimension(MAX_SUBPANEL_WIDTH, 0));
|
||||
verticalSpacer.setMaximumSize(new Dimension(MAX_SUBPANEL_WIDTH, Short.MAX_VALUE));
|
||||
contentPane.add(verticalSpacer, verticalConstraints);
|
||||
|
||||
GridBagConstraints horizontalConstraints = new GridBagConstraints();
|
||||
horizontalConstraints.gridx = 1;
|
||||
horizontalConstraints.gridy = 0;
|
||||
horizontalConstraints.weighty = 0;
|
||||
horizontalConstraints.weightx = 1;
|
||||
|
||||
JPanel horizontalSpacer = new JPanel();
|
||||
contentPane.add(horizontalSpacer, horizontalConstraints);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ public class CTMalwareScannerOptionsPanel extends CTOptionsSubPanel {
|
||||
private static final DateTimeFormatter LICENSE_EXPIRES_FORMAT = DateTimeFormatter
|
||||
.ofPattern("MMMM d, YYYY")
|
||||
.withZone(ZoneId.of(UserPreferences.getTimeZoneForDisplays()));
|
||||
|
||||
|
||||
private static final DateTimeFormatter MALWARE_SCANS_RESET_FORMAT = DateTimeFormatter
|
||||
.ofPattern("MMM d, YYYY' at 'h:mma")
|
||||
.withZone(ZoneId.of(UserPreferences.getTimeZoneForDisplays()));
|
||||
@ -175,11 +175,9 @@ public class CTMalwareScannerOptionsPanel extends CTOptionsSubPanel {
|
||||
setMalwareScansDisplay(null, null);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
setMalwareScansDisplay(null, Bundle.CTOPtionsPanel_loadMalwareScansInfo_loading());
|
||||
|
||||
|
||||
|
||||
this.authTokenFetcher = new AuthTokenFetcher(licenseInfo.getDecryptedLicense());
|
||||
this.authTokenFetcher.execute();
|
||||
}
|
||||
@ -452,8 +450,20 @@ public class CTMalwareScannerOptionsPanel extends CTOptionsSubPanel {
|
||||
|
||||
@Override
|
||||
protected LicenseInfo doInBackground() throws Exception {
|
||||
if (this.isCancelled()) {
|
||||
return null;
|
||||
}
|
||||
LicenseResponse licenseResponse = ctApiDAO.getLicenseInfo(licenseText);
|
||||
|
||||
if (this.isCancelled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ctPersistence.saveLicenseResponse(licenseResponse);
|
||||
|
||||
if (this.isCancelled()) {
|
||||
return null;
|
||||
}
|
||||
return LicenseDecryptorUtil.getInstance().createLicenseInfo(licenseResponse);
|
||||
}
|
||||
|
||||
@ -508,6 +518,10 @@ public class CTMalwareScannerOptionsPanel extends CTOptionsSubPanel {
|
||||
|
||||
@Override
|
||||
protected AuthTokenResponse doInBackground() throws Exception {
|
||||
if (this.isCancelled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ctApiDAO.getAuthToken(decryptedLicense);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user