mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
reset controls on reopen
This commit is contained in:
parent
e082c4f376
commit
84179456c0
@ -60,7 +60,6 @@ public final class PersonasTopComponent extends TopComponent {
|
|||||||
private List<Persona> currentResults = null;
|
private List<Persona> currentResults = null;
|
||||||
private Persona selectedPersona = null;
|
private Persona selectedPersona = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listens for when this component will be rendered and executes a search to
|
* Listens for when this component will be rendered and executes a search to
|
||||||
* update gui when it is displayed.
|
* update gui when it is displayed.
|
||||||
@ -68,7 +67,8 @@ public final class PersonasTopComponent extends TopComponent {
|
|||||||
private final AncestorListener onAddListener = new AncestorListener() {
|
private final AncestorListener onAddListener = new AncestorListener() {
|
||||||
@Override
|
@Override
|
||||||
public void ancestorAdded(AncestorEvent event) {
|
public void ancestorAdded(AncestorEvent event) {
|
||||||
setKeywordSearchEnabled(false);
|
resetSearchControls();
|
||||||
|
setKeywordSearchEnabled(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -82,14 +82,12 @@ public final class PersonasTopComponent extends TopComponent {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@Messages({
|
@Messages({
|
||||||
"PersonasTopComponent_Name=Personas",
|
"PersonasTopComponent_Name=Personas",
|
||||||
"PersonasTopComponent_delete_exception_Title=Delete failure",
|
"PersonasTopComponent_delete_exception_Title=Delete failure",
|
||||||
"PersonasTopComponent_delete_exception_msg=Failed to delete persona.",
|
"PersonasTopComponent_delete_exception_msg=Failed to delete persona.",
|
||||||
"PersonasTopComponent_delete_confirmation_Title=Are you sure?",
|
"PersonasTopComponent_delete_confirmation_Title=Are you sure?",
|
||||||
"PersonasTopComponent_delete_confirmation_msg=Are you sure you want to delete this persona?",
|
"PersonasTopComponent_delete_confirmation_msg=Are you sure you want to delete this persona?",})
|
||||||
})
|
|
||||||
public PersonasTopComponent() {
|
public PersonasTopComponent() {
|
||||||
initComponents();
|
initComponents();
|
||||||
setName(Bundle.PersonasTopComponent_Name());
|
setName(Bundle.PersonasTopComponent_Name());
|
||||||
@ -121,9 +119,9 @@ public final class PersonasTopComponent extends TopComponent {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
NotifyDescriptor confirm = new NotifyDescriptor.Confirmation(
|
NotifyDescriptor confirm = new NotifyDescriptor.Confirmation(
|
||||||
Bundle.PersonasTopComponent_delete_confirmation_msg(),
|
Bundle.PersonasTopComponent_delete_confirmation_msg(),
|
||||||
Bundle.PersonasTopComponent_delete_confirmation_Title(),
|
Bundle.PersonasTopComponent_delete_confirmation_Title(),
|
||||||
NotifyDescriptor.YES_NO_OPTION);
|
NotifyDescriptor.YES_NO_OPTION);
|
||||||
DialogDisplayer.getDefault().notify(confirm);
|
DialogDisplayer.getDefault().notify(confirm);
|
||||||
if (confirm.getValue().equals(NotifyDescriptor.YES_OPTION)) {
|
if (confirm.getValue().equals(NotifyDescriptor.YES_OPTION)) {
|
||||||
try {
|
try {
|
||||||
@ -133,9 +131,9 @@ public final class PersonasTopComponent extends TopComponent {
|
|||||||
} catch (CentralRepoException ex) {
|
} catch (CentralRepoException ex) {
|
||||||
logger.log(Level.SEVERE, "Failed to delete persona: " + selectedPersona.getName(), ex);
|
logger.log(Level.SEVERE, "Failed to delete persona: " + selectedPersona.getName(), ex);
|
||||||
JOptionPane.showMessageDialog(PersonasTopComponent.this,
|
JOptionPane.showMessageDialog(PersonasTopComponent.this,
|
||||||
Bundle.PersonasTopComponent_delete_exception_msg(),
|
Bundle.PersonasTopComponent_delete_exception_msg(),
|
||||||
Bundle.PersonasTopComponent_delete_exception_Title(),
|
Bundle.PersonasTopComponent_delete_exception_Title(),
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
executeSearch();
|
executeSearch();
|
||||||
@ -188,8 +186,24 @@ public final class PersonasTopComponent extends TopComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setKeywordSearchEnabled(boolean selected) {
|
/**
|
||||||
if (cbFilterByKeyword.isSelected() != selected) {
|
* Resets search controls to default state.
|
||||||
|
*/
|
||||||
|
private void resetSearchControls() {
|
||||||
|
searchField.setText("");
|
||||||
|
searchNameRadio.setSelected(true);
|
||||||
|
searchAccountRadio.setSelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up the GUI for appropriate state for keyword search enabled state.
|
||||||
|
*
|
||||||
|
* @param selected Whether or not keyword search is enabled.
|
||||||
|
* @param setFilterCb Whether or not the filter checkbox should be
|
||||||
|
* manipulated as a part of this change.
|
||||||
|
*/
|
||||||
|
private void setKeywordSearchEnabled(boolean selected, boolean setFilterCb) {
|
||||||
|
if (setFilterCb && cbFilterByKeyword.isSelected() != selected) {
|
||||||
cbFilterByKeyword.setSelected(selected);
|
cbFilterByKeyword.setSelected(selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,8 +298,7 @@ public final class PersonasTopComponent extends TopComponent {
|
|||||||
} else {
|
} else {
|
||||||
results = Persona.getPersonaByAccountIdentifierLike(searchField.getText());
|
results = Persona.getPersonaByAccountIdentifierLike(searchField.getText());
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
results = Persona.getPersonaByName("");
|
results = Persona.getPersonaByName("");
|
||||||
}
|
}
|
||||||
} catch (CentralRepoException ex) {
|
} catch (CentralRepoException ex) {
|
||||||
@ -466,7 +479,7 @@ public final class PersonasTopComponent extends TopComponent {
|
|||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
private void cbFilterByKeywordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbFilterByKeywordActionPerformed
|
private void cbFilterByKeywordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbFilterByKeywordActionPerformed
|
||||||
setKeywordSearchEnabled(cbFilterByKeyword.isSelected());
|
setKeywordSearchEnabled(cbFilterByKeyword.isSelected(), false);
|
||||||
}//GEN-LAST:event_cbFilterByKeywordActionPerformed
|
}//GEN-LAST:event_cbFilterByKeywordActionPerformed
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
Loading…
x
Reference in New Issue
Block a user