mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
updates to subscribe to event bus
This commit is contained in:
parent
2915429b5c
commit
d5b17eceee
@ -392,16 +392,27 @@ final public class Accounts implements AutopsyVisitableItem {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the given node with the reviewStatusBus and returns
|
||||||
|
* the node wrapped in an array.
|
||||||
|
* @param node The node to be wrapped.
|
||||||
|
* @return The array containing this node.
|
||||||
|
*/
|
||||||
|
private Node[] getNodeArr(Node node) {
|
||||||
|
reviewStatusBus.register(node);
|
||||||
|
return new Node[]{node};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Node[] createNodesForKey(String acountTypeName) {
|
protected Node[] createNodesForKey(String acountTypeName) {
|
||||||
|
|
||||||
if (Account.Type.CREDIT_CARD.getTypeName().equals(acountTypeName)) {
|
if (Account.Type.CREDIT_CARD.getTypeName().equals(acountTypeName)) {
|
||||||
return new Node[]{new CreditCardNumberAccountTypeNode()};
|
return getNodeArr(new CreditCardNumberAccountTypeNode());
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Account.Type accountType = skCase.getCommunicationsManager().getAccountType(acountTypeName);
|
Account.Type accountType = skCase.getCommunicationsManager().getAccountType(acountTypeName);
|
||||||
return new Node[]{new DefaultAccountTypeNode(accountType)};
|
return getNodeArr(new DefaultAccountTypeNode(accountType));
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
LOGGER.log(Level.SEVERE, "Error getting display name for account type. ", ex);
|
LOGGER.log(Level.SEVERE, "Error getting display name for account type. ", ex);
|
||||||
}
|
}
|
||||||
@ -580,11 +591,20 @@ final public class Accounts implements AutopsyVisitableItem {
|
|||||||
return getClass().getName();
|
return getClass().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Subscribes to the event bus to get the latest counts for the account type and
|
|
||||||
* then update the name.
|
|
||||||
*/
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
void handleReviewStatusChange(ReviewStatusChangeEvent event) {
|
||||||
|
updateName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
void handleDataAdded(ModuleDataEvent event) {
|
||||||
|
updateName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the latest counts for the account type and then updates the name.
|
||||||
|
*/
|
||||||
public void updateName() {
|
public void updateName() {
|
||||||
setName(String.format("%s (%d)", accountType.getDisplayName(), accountTypeResults.getCount(accountType.getTypeName())));
|
setName(String.format("%s (%d)", accountType.getDisplayName(), accountTypeResults.getCount(accountType.getTypeName())));
|
||||||
}
|
}
|
||||||
@ -719,14 +739,22 @@ final public class Accounts implements AutopsyVisitableItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subscribes to the event bus to get the latest counts for the account type and
|
* Gets the latest counts for the account type and then updates the name.
|
||||||
* then update the name.
|
|
||||||
*/
|
*/
|
||||||
@Subscribe
|
|
||||||
public void updateName() {
|
public void updateName() {
|
||||||
setName(String.format("%s (%d)", Account.Type.CREDIT_CARD.getDisplayName(), accountTypeResults.getCount(Account.Type.CREDIT_CARD.getTypeName())));
|
setName(String.format("%s (%d)", Account.Type.CREDIT_CARD.getDisplayName(), accountTypeResults.getCount(Account.Type.CREDIT_CARD.getTypeName())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
void handleReviewStatusChange(ReviewStatusChangeEvent event) {
|
||||||
|
updateName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
void handleDataAdded(ModuleDataEvent event) {
|
||||||
|
updateName();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLeafTypeNode() {
|
public boolean isLeafTypeNode() {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user