diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2008-12-16 12:53:28 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2008-12-16 12:53:28 +0000 |
commit | d02eba788a62f9a5e12c0a3e5324c9024b1606c7 (patch) | |
tree | 2328fc9b722d8cdf6bcdaa24294839f85067d8b2 /src/net/java/sip/communicator/plugin/dictaccregwizz | |
parent | 6df051d5c9aca787c36696a6e4537635db6f6e75 (diff) | |
download | jitsi-d02eba788a62f9a5e12c0a3e5324c9024b1606c7.zip jitsi-d02eba788a62f9a5e12c0a3e5324c9024b1606c7.tar.gz jitsi-d02eba788a62f9a5e12c0a3e5324c9024b1606c7.tar.bz2 |
- Reduces garbage created when working with AccoutID.getAccountProperties() which creates a copy of the internal Hashtable by introducing getAccountProperty(), getAccountPropertyString(), getAccountPropertyBoolean() and getAccountPropertyInt(). The last two also carry out the conversions between Object and boolean/int without additional allocations in contrast to most of the previous uses which would perform allocations.
- Modifies SimpleStatusMenu to load its necessary image once instead of three times and to spare a ImageIcon instance.
Diffstat (limited to 'src/net/java/sip/communicator/plugin/dictaccregwizz')
-rw-r--r-- | src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java index 4c65b41..02a5489 100644 --- a/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java @@ -313,11 +313,14 @@ public class FirstWizardPage boolean isModified = false; if (this.initAccountID instanceof AccountID) - { // We check if there is modifications to the server - String accHost = (String) this.initAccountID.getAccountProperties() - .get(ProtocolProviderFactory.SERVER_ADDRESS); - int accPort = Integer.parseInt((String) this.initAccountID.getAccountProperties() - .get(ProtocolProviderFactory.SERVER_PORT)); + { // We check if there is modifications to the server + String accHost = + this.initAccountID + .getAccountPropertyString(ProtocolProviderFactory.SERVER_ADDRESS); + int accPort = + Integer + .parseInt(this.initAccountID + .getAccountPropertyString(ProtocolProviderFactory.SERVER_PORT)); if (accHost != host || accPort != port) { @@ -470,12 +473,15 @@ public class FirstWizardPage public void loadAccount(ProtocolProviderService protocolProvider) { AccountID accountID = protocolProvider.getAccountID(); - String host = (String) accountID.getAccountProperties() - .get(ProtocolProviderFactory.SERVER_ADDRESS); - String port = (String) accountID.getAccountProperties() - .get(ProtocolProviderFactory.SERVER_PORT); - String strategy = (String) accountID.getAccountProperties() - .get(ProtocolProviderFactory.STRATEGY); + String host = + accountID + .getAccountPropertyString(ProtocolProviderFactory.SERVER_ADDRESS); + String port = + accountID + .getAccountPropertyString(ProtocolProviderFactory.SERVER_PORT); + String strategy = + accountID + .getAccountPropertyString(ProtocolProviderFactory.STRATEGY); this.initAccountID = accountID; @@ -530,22 +536,23 @@ public class FirstWizardPage ProtocolProviderFactory factory = DictAccRegWizzActivator.getDictProtocolProviderFactory(); - ArrayList registeredAccounts = factory.getRegisteredAccounts(); - String accHost; int accPort; - for (int i = 0; i < registeredAccounts.size(); i++) + for (AccountID accountID : factory.getRegisteredAccounts()) { - AccountID accountID = (AccountID) registeredAccounts.get(i); - accHost = (String) accountID.getAccountProperties() - .get(ProtocolProviderFactory.SERVER_ADDRESS); + accHost = + accountID + .getAccountPropertyString(ProtocolProviderFactory.SERVER_ADDRESS); if (host.equalsIgnoreCase(accHost)) { - // We check the port, only if there is an account with the same host - accPort = Integer.parseInt((String) accountID.getAccountProperties() - .get(ProtocolProviderFactory.SERVER_PORT)); + // We check the port, only if there is an account with the same + // host + accPort = + Integer + .parseInt(accountID + .getAccountPropertyString(ProtocolProviderFactory.SERVER_PORT)); if (port == accPort) { |