introduced StringUtil class with .isEmpty(String input) and .isNotEmpty(String input), to replace str != null && str.length()>0 statements

This commit is contained in:
ingmargoudt 2016-09-16 20:51:51 +02:00
parent fb15c79964
commit f1cf9e7adb
47 changed files with 132 additions and 96 deletions

View file

@ -42,6 +42,7 @@ import javax.swing.JTextField;
import mage.client.MageFrame;
import mage.client.SessionHandler;
import mage.client.util.GUISizeHelper;
import mage.util.StringUtil;
import mage.view.ChatMessage.MessageColor;
import mage.view.ChatMessage.MessageType;
import org.mage.card.arcane.ManaSymbols;
@ -221,13 +222,13 @@ public class ChatPanelBasic extends javax.swing.JPanel {
textColor = MESSAGE_COLOR;
userSeparator = ": ";
}
if (color.equals(MessageColor.ORANGE)) {
if (color == MessageColor.ORANGE) {
textColor = "Orange";
}
if (color.equals(MessageColor.YELLOW)) {
if (color == MessageColor.YELLOW) {
textColor = "Yellow";
}
if (username != null && !username.isEmpty()) {
if (StringUtil.isNotEmpty(username)) {
text.append(getColoredText(userColor, username + userSeparator));
}
text.append(getColoredText(textColor, ManaSymbols.replaceSymbolsWithHTML(message, ManaSymbols.Type.CHAT)));