Package com.jbidwatcher.util

Examples of com.jbidwatcher.util.Currency


    }
  }

  private String formatTotalSnipe(AuctionEntry aEntry, String errorNote) {
    if(!aEntry.isSniped()) return "--";
    Currency shipping = aEntry.getShippingWithInsurance();
    if (shipping.getCurrencyType() == Currency.NONE || aEntry.getSnipeAmount().getCurrencyType() == Currency.NONE) {
      return "--"; // shipping not set so cannot add up values
    }

    Currency totalSnipe;

    try {
      totalSnipe = aEntry.getSnipeAmount().add(shipping);
    } catch (Currency.CurrencyTypeException e) {
      /* Should never happen, since we've checked the currency already.  */
      JConfig.log().handleException("Currency addition threw a bad currency exception, which should be very difficult to cause to happen.", e); //$NON-NLS-1$
      return "--";
    }

    MultiSnipe ms = MultiSnipeManager.getInstance().getForAuctionIdentifier(aEntry.getIdentifier());
    if (ms != null) {
      if (aEntry.isSnipeValid()) {
        return errorNote + "Multi: " + totalSnipe;
      } else {
        return errorNote + "Multi: (" + totalSnipe + ')';
      }
    } else {
      if (aEntry.isSnipeValid()) {
        return errorNote + totalSnipe.toString();
      } else {
        return errorNote + '(' + totalSnipe + ')';
      }
    }
  }
View Full Code Here


      String errorNote = aEntry.getErrorPage()==null?"":"*";
      Seller seller = getSeller(aEntry.getSellerId());
      switch(columnIndex) {
        case TableColumnController.ID: return aEntry.getIdentifier();
        case TableColumnController.CUR_BID:
          Currency curPrice = aEntry.getCurrentPrice();
          if(aEntry.isFixed()) {
            return curPrice + " (FP" + ((aEntry.getQuantity() > 1) ? " x " + aEntry.getQuantity() + ")" : ")");
          } else {
            return curPrice + " (" + Integer.toString(aEntry.getNumBidders()) + ')';
          }
        case TableColumnController.SNIPE_OR_MAX: return formatSnipeAndBid(aEntry);
        case TableColumnController.MAX: return aEntry.isBidOn()?formatBid(aEntry, errorNote):neverBid;
        case TableColumnController.SNIPE:
          if (aEntry.isSniped()) {
            return formatSnipe(aEntry, errorNote);
          }
          if(aEntry.snipeCancelled() && aEntry.isComplete()) {
            return errorNote + '(' + aEntry.getCancelledSnipe() + ')';
          }

          return neverBid;
        case TableColumnController.TIME_LEFT: {
          if (aEntry.getEndDate() == null || aEntry.getEndDate().equals(Constants.FAR_FUTURE))
            return "N/A";
          String endTime = aEntry.getTimeLeft();
          if(endTime.equals(AuctionEntry.endedAuction)) {
            SimpleDateFormat fmt = new SimpleDateFormat("dd-MMM-yy HH:mm:ss zzz");
            endTime = fmt.format(aEntry.getEndDate());
            if(!aEntry.isComplete()) {
              endTime = "<html><body color=\"red\">" + endTime + "</body></html>";
            }
          }
          return endTime;
        }
        case TableColumnController.END_DATE: {
          if (aEntry.getEndDate() == null || aEntry.getEndDate().equals(Constants.FAR_FUTURE))
            return "N/A";
          SimpleDateFormat fmt = new SimpleDateFormat("dd-MMM-yy HH:mm:ss zzz");
          return fmt.format(aEntry.getEndDate());
        }
        case TableColumnController.TITLE: return XMLElement.decodeString(aEntry.getTitle());
        case TableColumnController.STATUS: return getEntryIcon(aEntry);
        case TableColumnController.THUMBNAIL: {
          String thumb = aEntry.getThumbnail();
          if (thumb != null) {
            if(iconCache.containsKey(thumb)) return iconCache.get(thumb);
            thumb = thumb.replaceAll("file:", "");
            ImageIcon thumbIcon = scaleImage(thumb);
            iconCache.put(thumb, thumbIcon);
            return thumbIcon;
          } else return dummyIcon;
        }
        case TableColumnController.SELLER: return aEntry.getSellerName();
        case TableColumnController.COMMENT:
          String comment = aEntry.getComment();
          return(comment==null?"":comment);
        case TableColumnController.BIDDER:
          String bidder = aEntry.getHighBidder();
          if(bidder != null && bidder.length() != 0) return bidder;
          return "--";
        case TableColumnController.FIXED_PRICE:
          Currency bin = aEntry.getBuyNow();
          if(bin.isNull()) return "--";
          return bin;
        case TableColumnController.SHIPPING_INSURANCE:
          Currency ship = aEntry.getShippingWithInsurance();
          if(ship.isNull()) return "--";
          return ship;
        case TableColumnController.ITEM_LOCATION:
          return aEntry.getItemLocation();
        case TableColumnController.BIDCOUNT:
          if(aEntry.getNumBidders() < 0) return "(FP)";
          return Integer.toString(aEntry.getNumBidders());
        case TableColumnController.JUSTPRICE:
          return aEntry.getCurrentPrice();
        case TableColumnController.SELLER_FEEDBACK:
          return seller.getFeedback();
        case TableColumnController.SELLER_POSITIVE_FEEDBACK:
          String fbp = seller.getPositivePercentage();
          return (fbp == null || fbp.length() == 0)?"--":fbp;
        case TableColumnController.CUR_TOTAL:
          Currency shipping = aEntry.getShippingWithInsurance();
          if(shipping.getCurrencyType() == Currency.NONE) {
            return "--"; // shipping not set so cannot add up values
          }
          try {
            return aEntry.getCurrentPrice().add(shipping);
          } catch (Currency.CurrencyTypeException e) {
View Full Code Here

TOP

Related Classes of com.jbidwatcher.util.Currency

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.