Rename method, use statics for prefix symbol

This commit is contained in:
Manfred Karrer 2016-11-13 22:30:53 +01:00
parent 54bbf54c64
commit 08695377ce
5 changed files with 18 additions and 14 deletions

View file

@ -22,6 +22,10 @@ import io.bitsquare.app.Version;
public final class CryptoCurrency extends TradeCurrency {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
// http://boschista.deviantart.com/journal/Cool-ASCII-Symbols-214218618
private final static String PREFIX = "";
private boolean isAsset;
public CryptoCurrency(String currencyCode, String name) {
@ -42,7 +46,7 @@ public final class CryptoCurrency extends TradeCurrency {
}
@Override
public String getGUISymbol() {
return "";
public String getDisplayPrefix() {
return PREFIX;
}
}

View file

@ -26,6 +26,9 @@ public final class FiatCurrency extends TradeCurrency {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
// http://boschista.deviantart.com/journal/Cool-ASCII-Symbols-214218618
private final static String PREFIX = "";
private final Currency currency;
public FiatCurrency(String currencyCode) {
@ -41,10 +44,10 @@ public final class FiatCurrency extends TradeCurrency {
public Currency getCurrency() {
return currency;
}
@Override
public String getGUISymbol() {
return "";
public String getDisplayPrefix() {
return PREFIX;
}
@Override

View file

@ -57,9 +57,9 @@ public abstract class TradeCurrency implements Persistable, Comparable<TradeCurr
public String getSymbol() {
return symbol;
}
public String getGUISymbol() {
return "-";
public String getDisplayPrefix() {
return "";
}
public String getNameAndCode() {

View file

@ -145,7 +145,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Activatab
@Override
public String toString(TradeCurrency tradeCurrency) {
// http://boschista.deviantart.com/journal/Cool-ASCII-Symbols-214218618
return tradeCurrency.getGUISymbol() + tradeCurrency.getNameAndCode();
return tradeCurrency.getDisplayPrefix() + tradeCurrency.getNameAndCode();
}
@Override

View file

@ -25,9 +25,7 @@ import com.googlecode.jcsv.writer.internal.CSVWriterBuilder;
import io.bitsquare.app.DevFlags;
import io.bitsquare.common.util.Utilities;
import io.bitsquare.gui.main.overlays.popups.Popup;
import io.bitsquare.locale.CryptoCurrency;
import io.bitsquare.locale.CurrencyUtil;
import io.bitsquare.locale.FiatCurrency;
import io.bitsquare.locale.TradeCurrency;
import io.bitsquare.payment.PaymentAccount;
import io.bitsquare.storage.Storage;
@ -184,7 +182,6 @@ public class GUIUtil {
public String toString(CurrencyListItem item) {
TradeCurrency tradeCurrency = item.tradeCurrency;
String code = tradeCurrency.getCode();
// http://boschista.deviantart.com/journal/Cool-ASCII-Symbols-214218618
if (code.equals(GUIUtil.SHOW_ALL_FLAG))
return "▶ Show all";
else if (code.equals(GUIUtil.EDIT_FLAG))
@ -193,7 +190,7 @@ public class GUIUtil {
String displayString = CurrencyUtil.getNameByCode(code) + " (" + code + ")";
if (preferences.getSortMarketCurrenciesNumerically())
displayString += " - " + item.numTrades + " " + postFix;
return tradeCurrency.getGUISymbol() + displayString;
return tradeCurrency.getDisplayPrefix() + displayString;
}
}
@ -215,7 +212,7 @@ public class GUIUtil {
return "▶ Show all";
else if (code.equals(GUIUtil.EDIT_FLAG))
return "▼ Edit currency list";
return tradeCurrency.getGUISymbol() + displayString;
return tradeCurrency.getDisplayPrefix() + displayString;
}
@Override