Another pass at fixing the USD translation, at least when there are other items that actually have the approximate USD equivalence of non-USD currencies.
- M jbidwatcher/trunk/src/com/jbidwatcher/ui/auctionTableModel.java view
- M jbidwatcher/trunk/src/com/jbidwatcher/util/Currency.java view
| 600 | 602 | |
|---|---|---|
| 171 | 171 | switch(j) { |
| 172 | 172 | case -1: return aEntry; |
| 173 | 173 | case TableColumnController.ID: return aEntry.getIdentifier(); |
| 174 | case TableColumnController.CUR_BID: return aEntry.getUSCurBid(); | |
| 174 | case TableColumnController.CUR_BID: | |
| 175 | Currency rval = aEntry.getUSCurBid(); | |
| 176 | if(rval.getValue() == 0.0 && rval.getCurrencyType() == Currency.US_DOLLAR) { | |
| 177 | return Currency.convertToUSD(null, null, aEntry.getCurBid()); | |
| 178 | } | |
| 179 | return rval; | |
| 175 | 180 | case TableColumnController.SNIPE_OR_MAX: |
| 176 | 181 | return Currency.convertToUSD(aEntry.getUSCurBid(), aEntry.getCurBid(), getMaxOrSnipe(aEntry)); |
| 177 | 182 | case TableColumnController.TIME_LEFT: return aEntry.getEndDate(); |
| 598 | 602 | |
|---|---|---|
| 41 | 41 | public static Currency convertToUSD(Currency usd, Currency nonusd, Currency cvt) { |
| 42 | 42 | if(cvt != null && !cvt.isNull() && cvt.getCurrencyType() != US_DOLLAR) { |
| 43 | 43 | double multiple; |
| 44 | if((usd == null || usd.isNull() || usd.getValue() == 0.0 || | |
| 45 | nonusd == null || nonusd.isNull() || nonusd.getValue() == 0.0) && | |
| 46 | sCurrencyMap.containsKey(cvt.getCurrencyType())) { | |
| 47 | multiple = sCurrencyMap.get(cvt.getCurrencyType()); | |
| 44 | if(usd == null || usd.isNull() || usd.getValue() == 0.0 || | |
| 45 | nonusd == null || nonusd.isNull() || nonusd.getValue() == 0.0) { | |
| 46 | if(sCurrencyMap.containsKey(cvt.getCurrencyType())) { | |
| 47 | multiple = sCurrencyMap.get(cvt.getCurrencyType()); | |
| 48 | } else { | |
| 49 | multiple = 0.0; | |
| 50 | } | |
| 48 | 51 | } else { |
| 49 | 52 | multiple = usd.getValue() / nonusd.getValue(); |
| 50 | 53 | if(multiple != 0.0) sCurrencyMap.put(nonusd.getCurrencyType(), multiple); |
