Fixes a couple of occurrences of incorrect code, performance-related warnings.

cusax-fix
Lyubomir Marinov 17 years ago
parent 68312559fe
commit 5256f0c860

@ -300,18 +300,17 @@ else if (evt.getPropertyName().equals(
else if (evt.getPropertyName().equals(
WizardModel.NEXT_FINISH_BUTTON_ENABLED_PROPERTY))
{
nextButton.setEnabled(((Boolean) evt.getNewValue()).booleanValue());
nextButton.setEnabled((Boolean) evt.getNewValue());
}
else if (evt.getPropertyName().equals(
WizardModel.BACK_BUTTON_ENABLED_PROPERTY))
{
backButton.setEnabled(((Boolean) evt.getNewValue()).booleanValue());
backButton.setEnabled((Boolean) evt.getNewValue());
}
else if (evt.getPropertyName().equals(
WizardModel.CANCEL_BUTTON_ENABLED_PROPERTY))
{
cancelButton.setEnabled(((Boolean) evt.getNewValue())
.booleanValue());
cancelButton.setEnabled((Boolean) evt.getNewValue());
}
else if (evt.getPropertyName().equals(
WizardModel.NEXT_FINISH_BUTTON_ICON_PROPERTY))
@ -338,7 +337,7 @@ else if (evt.getPropertyName().equals(
*/
public boolean isBackButtonEnabled()
{
return wizardModel.getBackButtonEnabled().booleanValue();
return wizardModel.getBackButtonEnabled();
}
/**
@ -348,7 +347,7 @@ public boolean isBackButtonEnabled()
*/
public void setBackButtonEnabled(boolean newValue)
{
wizardModel.setBackButtonEnabled(new Boolean(newValue));
wizardModel.setBackButtonEnabled(newValue);
}
/**
@ -358,7 +357,7 @@ public void setBackButtonEnabled(boolean newValue)
*/
public boolean isNextFinishButtonEnabled()
{
return wizardModel.getNextFinishButtonEnabled().booleanValue();
return wizardModel.getNextFinishButtonEnabled();
}
/**
@ -368,7 +367,7 @@ public boolean isNextFinishButtonEnabled()
*/
public void setNextFinishButtonEnabled(boolean newValue)
{
wizardModel.setNextFinishButtonEnabled(new Boolean(newValue));
wizardModel.setNextFinishButtonEnabled(newValue);
}
/**
@ -378,7 +377,7 @@ public void setNextFinishButtonEnabled(boolean newValue)
*/
public boolean isCancelButtonEnabled()
{
return wizardModel.getCancelButtonEnabled().booleanValue();
return wizardModel.getCancelButtonEnabled();
}
/**
@ -388,7 +387,7 @@ public boolean isCancelButtonEnabled()
*/
public void setCancelButtonEnabled(boolean newValue)
{
wizardModel.setCancelButtonEnabled(new Boolean(newValue));
wizardModel.setCancelButtonEnabled(newValue);
}
/**

@ -304,10 +304,12 @@ Boolean getBackButtonEnabled() {
* @param newValue <code>true</code> to enable the Back button,
* <code>false</code> to disable it.
*/
void setBackButtonEnabled(Boolean newValue) {
void setBackButtonEnabled(boolean enabled)
{
Boolean newValue = enabled;
Boolean oldValue = getBackButtonEnabled();
if (newValue != oldValue) {
if (!newValue.equals(oldValue))
{
buttonEnabledHashmap.put(BACK_BUTTON_ENABLED_PROPERTY, newValue);
firePropertyChange(BACK_BUTTON_ENABLED_PROPERTY,
oldValue, newValue);
@ -328,10 +330,12 @@ Boolean getNextFinishButtonEnabled() {
* @param newValue <code>true</code> to enable the Next/Finish button,
* <code>false</code> to disable it.
*/
void setNextFinishButtonEnabled(Boolean newValue) {
void setNextFinishButtonEnabled(boolean enabled)
{
Boolean newValue = enabled;
Boolean oldValue = getNextFinishButtonEnabled();
if (newValue != oldValue) {
if (!newValue.equals(oldValue))
{
buttonEnabledHashmap.put(
NEXT_FINISH_BUTTON_ENABLED_PROPERTY, newValue);
firePropertyChange(NEXT_FINISH_BUTTON_ENABLED_PROPERTY,
@ -353,10 +357,12 @@ Boolean getCancelButtonEnabled() {
* @param newValue <code>true</code> to enable the Cancel button,
* <code>false</code> to disable it.
*/
void setCancelButtonEnabled(Boolean newValue) {
void setCancelButtonEnabled(boolean enabled)
{
Boolean newValue = enabled;
Boolean oldValue = getCancelButtonEnabled();
if (newValue != oldValue) {
if (!newValue.equals(oldValue))
{
buttonEnabledHashmap.put(CANCEL_BUTTON_ENABLED_PROPERTY, newValue);
firePropertyChange(CANCEL_BUTTON_ENABLED_PROPERTY,
oldValue, newValue);

@ -219,13 +219,14 @@ protected void close(boolean isEscaped)
*/
private class KickParticipantThread extends Thread
{
private ChatRoom chatRoom;
private final ChatRoom chatRoom;
private String reason;
private final String reason;
KickParticipantThread(ChatRoom chatRoom, String reason)
{
this.chatRoom = chatRoom;
this.reason = reason;
}
public void run()
@ -233,8 +234,7 @@ public void run()
try
{
chatRoom.kickParticipant(
(ChatRoomMember) chatContact
.getDescriptor(),
(ChatRoomMember) chatContact.getDescriptor(),
reason);
}
catch (OperationFailedException e)

@ -4,7 +4,6 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.gui.main.contactlist;
import java.awt.event.*;
@ -39,7 +38,7 @@ public class CListKeySearchListener implements KeyListener {
private JList contactList;
private String lastTypedKey;
private char lastTypedKey = KeyEvent.CHAR_UNDEFINED;
private long lastTypedTimestamp = 0;
@ -75,15 +74,15 @@ public void keyTyped(KeyEvent e) {
return;
long eventTimestamp = e.getWhen();
String keyChar = String.valueOf(e.getKeyChar());
char keyChar = e.getKeyChar();
if(e.getKeyChar() == ' ') {
if(keyChar == ' ') {
closeGroup();
}
else if(e.getKeyChar() == '+') {
else if(keyChar == '+') {
openGroup();
}
else if(e.getKeyChar() == '-') {
else if(keyChar == '-') {
closeGroup();
}
else {
@ -117,20 +116,18 @@ else if(e.getKeyChar() == '-') {
// 1) the newly entered character is different from the last one
// or
// 2) the currently selected contact starts with a different letter
int contactIndex = -1;
if (lastTypedKey != keyChar || !selectedSameLetterContact) {
contactIndex = this.contactList.getNextMatch(
keyBuffer.toString(), 0, Position.Bias.Forward);
} else {
contactIndex = this.contactList.getNextMatch(
keyBuffer.toString(),
selectedIndex + 1, Position.Bias.Forward);
}
int contactIndex = contactList.getNextMatch(
keyBuffer.toString(),
(lastTypedKey != keyChar || !selectedSameLetterContact)
? 0
: selectedIndex + 1,
Position.Bias.Forward);
int currentlySelectedIndex = this.contactList.getSelectedIndex();
if (currentlySelectedIndex != contactIndex && contactIndex != -1) {
this.contactList.setSelectedIndex(contactIndex);
currentlySelectedIndex = contactList.getSelectedIndex();
}
this.contactList.ensureIndexIsVisible(currentlySelectedIndex);
@ -176,4 +173,4 @@ public void openGroup() {
}
}
}
}

@ -173,8 +173,9 @@ private void init()
else
this.uinValue = new JTextField(userCredentials.getUserName());
if(userCredentials.getPassword() != null) {
this.passwdField.setText(userCredentials.getPassword().toString());
char[] password = userCredentials.getPassword();
if (password != null) {
this.passwdField.setText(String.valueOf(password));
}
this.realmTextArea.setEditable(false);

@ -231,14 +231,8 @@ else if(month == 12)
*/
private static String formatTime(int time)
{
String timeString = new Integer(time).toString();
String timeString = Integer.toString(time);
String resultString = "";
if (timeString.length() < 2)
resultString = resultString.concat("0").concat(timeString);
else
resultString = timeString;
return resultString;
return (timeString.length() < 2) ? "0".concat(timeString) : timeString;
}
}

@ -16,7 +16,7 @@
public abstract class SIPCommDialog extends JDialog
{
private Logger logger = Logger.getLogger(SIPCommDialog.class);
private final Logger logger = Logger.getLogger(SIPCommDialog.class);
private ActionMap amap;
private InputMap imap;
@ -140,29 +140,12 @@ public void windowClosing(WindowEvent e)
*/
private void saveSizeAndLocation()
{
ConfigurationService configService =
UtilActivator.getConfigurationService();
String className = this.getClass().getName();
try {
configService.setProperty(
className + ".width",
new Integer(getWidth()));
configService.setProperty(
className + ".height",
new Integer(getHeight()));
configService.setProperty(
className + ".x",
new Integer(getX()));
configService.setProperty(
className + ".y",
new Integer(getY()));
try
{
SIPCommFrame.saveSizeAndLocation(this);
}
catch (PropertyVetoException e1) {
catch (PropertyVetoException e1)
{
logger.error("The proposed property change "
+ "represents an unacceptable value");
}

@ -135,22 +135,9 @@ public void windowClosing(WindowEvent e)
*/
private void saveSizeAndLocation()
{
ConfigurationService configService =
UtilActivator.getConfigurationService();
String className = this.getClass().getName();
try
{
configService.setProperty(className + ".width", new Integer(
getWidth()));
configService.setProperty(className + ".height", new Integer(
getHeight()));
configService.setProperty(className + ".x", new Integer(getX()));
configService.setProperty(className + ".y", new Integer(getY()));
saveSizeAndLocation(this);
}
catch (PropertyVetoException e1)
{
@ -159,6 +146,18 @@ private void saveSizeAndLocation()
}
}
static void saveSizeAndLocation(Component component)
throws PropertyVetoException
{
ConfigurationService config = UtilActivator.getConfigurationService();
String className = component.getClass().getName();
config.setProperty(className + ".width", component.getWidth());
config.setProperty(className + ".height", component.getHeight());
config.setProperty(className + ".x", component.getX());
config.setProperty(className + ".y", component.getY());
}
/**
* Sets window size and position.
*/

@ -52,7 +52,7 @@ public class SIPCommTabbedPaneUI
private Vector htmlViews;
private Hashtable mnemonicToIndexMap;
private Map<Integer, Integer> mnemonicToIndexMap;
/**
* InputMap used for mnemonics. Only non-null if the JTabbedPane has
@ -111,12 +111,11 @@ public class SIPCommTabbedPaneUI
protected JMenuItem closeItem;
protected Vector highlightedTabs = new Vector();
protected final java.util.List<Integer> highlightedTabs
= new Vector<Integer>();
public SIPCommTabbedPaneUI()
{
super();
//closeImgB = UtilActivator.getImage(CLOSE_TAB_SELECTED_ICON);
//maxImgB = new BufferedImage(BUTTONSIZE, BUTTONSIZE,
@ -583,7 +582,7 @@ private void addMnemonic(int index, int mnemonic)
mnemonicInputMap.put(KeyStroke.getKeyStroke(mnemonic, Event.ALT_MASK),
"setSelectedIndex");
mnemonicToIndexMap.put(new Integer(mnemonic), new Integer(index));
mnemonicToIndexMap.put(mnemonic, index);
}
/**
@ -591,7 +590,7 @@ private void addMnemonic(int index, int mnemonic)
*/
private void initMnemonics()
{
mnemonicToIndexMap = new Hashtable();
mnemonicToIndexMap = new Hashtable<Integer, Integer>();
mnemonicInputMap = new InputMapUIResource();
mnemonicInputMap.setParent(SwingUtilities.getUIInputMap(tabPane,
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT));
@ -1029,8 +1028,7 @@ public void actionPerformed(ActionEvent e)
mnemonic -= ('a' - 'A');
}
Integer index = (Integer) ui.mnemonicToIndexMap
.get(new Integer(mnemonic));
Integer index = ui.mnemonicToIndexMap.get(mnemonic);
if (index != null && pane.isEnabledAt(index.intValue()))
{
pane.setSelectedIndex(index.intValue());
@ -1729,20 +1727,18 @@ public void mouseDragged(MouseEvent e)
public void tabAddHightlight(int tabIndex)
{
this.highlightedTabs.add(new Integer(tabIndex));
this.highlightedTabs.add(tabIndex);
}
public void tabRemoveHighlight(int tabIndex)
{
Enumeration highlightedEnum = this.highlightedTabs.elements();
Iterator<Integer> highlightedIter = highlightedTabs.iterator();
while (highlightedEnum.hasMoreElements())
while (highlightedIter.hasNext())
{
Integer element = (Integer) highlightedEnum.nextElement();
if (element.intValue() == tabIndex)
if (highlightedIter.next().intValue() == tabIndex)
{
this.highlightedTabs.remove(element);
highlightedIter.remove();
break;
}
}
@ -1750,16 +1746,7 @@ public void tabRemoveHighlight(int tabIndex)
public boolean isTabHighlighted(int tabIndex)
{
Enumeration highlightedEnum = this.highlightedTabs.elements();
while (highlightedEnum.hasMoreElements())
{
Integer element = (Integer) highlightedEnum.nextElement();
if (element.intValue() == tabIndex)
return true;
}
return false;
return highlightedTabs.contains(tabIndex);
}
/**

Loading…
Cancel
Save