Package com.jbidwatcher.util

Examples of com.jbidwatcher.util.Currency$CurrencyTypeException


  public Currency getSnipeOrMax() { return Currency.convertToUSD(entry.getCurrentUSPrice(), entry.getCurrentPrice(), getMaxOrSnipe(entry)); }
  public Currency getFixedPrice() { return Currency.convertToUSD(entry.getCurrentUSPrice(), entry.getCurrentPrice(), entry.getBuyNow()); }

  public Currency getShippingInsurance() {
    Currency si = (!entry.getShipping().isNull())?entry.getShippingWithInsurance(): Currency.NoValue();
    //  This is crack.  I'm insane to even think about doing this, but it works...
    return Currency.convertToUSD(entry.getCurrentUSPrice(), entry.getCurrentPrice(), si);
  }
View Full Code Here


    //  This is crack.  I'm insane to even think about doing this, but it works...
    return Currency.convertToUSD(entry.getCurrentUSPrice(), entry.getCurrentPrice(), si);
  }

  public Currency getMax() {
    Currency bid = entry.isBidOn()?entry.getBid(): Currency.NoValue();
    return Currency.convertToUSD(entry.getCurrentUSPrice(), entry.getCurrentPrice(), bid);
  }
View Full Code Here

    Currency bid = entry.isBidOn()?entry.getBid(): Currency.NoValue();
    return Currency.convertToUSD(entry.getCurrentUSPrice(), entry.getCurrentPrice(), bid);
  }

  public Currency getSnipe() {
    Currency snipe = entry.getSnipeAmount();
    return Currency.convertToUSD(entry.getCurrentUSPrice(), entry.getCurrentPrice(), snipe);
  }
View Full Code Here

    return seller.getFeedback();
  }

  public Currency getCurrentTotal() {
    Currency shipping = entry.getShippingWithInsurance();
    if (shipping.getCurrencyType() == Currency.NONE) {
      return shipping; // shipping not set so cannot add up values
    }

    Currency shippingUSD = Currency.convertToUSD(entry.getCurrentUSPrice(), entry.getCurrentPrice(), entry.getShippingWithInsurance());
    try {
      return entry.getUSCurBid().add(shippingUSD);
    } catch (Currency.CurrencyTypeException e) {
      JConfig.log().handleException("Threw a bad currency exception, which should be unlikely.", e); //$NON-NLS-1$
      return Currency.NoValue();
View Full Code Here

      return Currency.NoValue();
    }
  }

  public Currency getSnipeTotal() {
    Currency shipping2 = entry.getShippingWithInsurance();
    if (shipping2.getCurrencyType() == Currency.NONE) {
      return shipping2; // shipping not set so cannot add up values
    }

    Currency shippingUSD2 = Currency.convertToUSD(entry.getCurrentUSPrice(), entry.getCurrentPrice(), entry.getShippingWithInsurance());
    try {
      return Currency.convertToUSD(entry.getCurrentUSPrice(), entry.getCurrentPrice(), entry.getSnipeAmount()).add(shippingUSD2);
    } catch (Currency.CurrencyTypeException e) {
      JConfig.log().handleException("Currency addition or conversion threw a bad currency exception, which should be unlikely.", e); //$NON-NLS-1$
      return Currency.NoValue();
View Full Code Here

      MQFactory.getConcrete("user").enqueue(ADD_AUCTION + auctionId);
    }
  }

  private String makeUsefulString(AuctionEntry ae) {
    Currency currentPrice = ae.getCurrentPrice();
    String result;

    if(ae.isSeller()) {
      result = ae.getHighBidder();
      if(result == null) result = "";
View Full Code Here

      JOptionPane.showMessageDialog(src, "Creating new multi-snipes is disabled in this version, as the underlying high-bidder detection code isn't currently working.", "MultiSniping Disabled", JOptionPane.WARNING_MESSAGE);
      return;
    }

    int[] rowList = mTabs.getPossibleRows();
    Currency baseAllBid = Currency.NoValue();

    //  You must select multiple auctions to make this work.
    if(rowList.length == 0) {
      JOptionPane.showMessageDialog(src, "No auctions selected to set to MultiSnipe mode!", "Error setting multisnipe", JOptionPane.PLAIN_MESSAGE);
      return;
    }

    //  Go through the list of auctions to make sure they're all the
    //  same currency, and other similar requirements.
    MultiSnipe aeMS = null;
    int i;
    boolean seenCurrencyWarning = false;
    for(i=0; i<rowList.length; i++) {
      AuctionEntry tempAE = (AuctionEntry) mTabs.getIndexedEntry(rowList[i]);
      Currency curBid = tempAE.getCurBid();

      if(tempAE.getServer().isDefaultUser()) {
        JOptionPane.showMessageDialog(src, "One or more of your auctions to multisnipe is on a server that you have not\n" +
                                      "entered your user account information for.  Go to the the " + tempAE.getServer().getName() + " configuration tab,\n" +
                                      "and fill it out.",
                                      "No auction account error", JOptionPane.PLAIN_MESSAGE);
        return;
      }

      if(tempAE.isComplete()) {
        JOptionPane.showMessageDialog(src, "You cannot place a multi-snipe on a set of entries that include an ended auction",
                                      "Snipe error", JOptionPane.PLAIN_MESSAGE);
        return;
      }

      if(tempAE.isPrivate()) {
        JOptionPane.showMessageDialog(src, "Multisnipes cannot include private auctions.  Unfortunately,\n" +
                                      "private auctions make it impossible under certain circumstances\n" +
                                      "to know if a bid was ultimately the winner or not.  The two\n" +
                                      "potential answers are to either fail conservatively (think you\n" +
                                      "won, and cancel later multisnipes), or fail liberally (think\n" +
                                      "you lost, and allow later multisnipes).  Neither is a good\n" +
                                      "solution, so private auctions are barred from multisnipe groups.",
                                      "Private auction/multisnipe error", JOptionPane.PLAIN_MESSAGE);
        return;
      }

      Currency minBid;
      try {
        minBid = curBid.add(tempAE.getServer().getMinimumBidIncrement(curBid, tempAE.getNumBidders()));
      } catch(Currency.CurrencyTypeException cte) {
        //  Don't worry about different currencies, here, it just
        //  means the auctions are in a different currency than the
View Full Code Here

      JOptionPane.showMessageDialog(src, "You cannot place a snipe on an ended auction",
                                    "Snipe error", JOptionPane.PLAIN_MESSAGE);
      return;
    }

    Currency minimumNextBid;
    try {
      minimumNextBid = ae.getCurBid().add(ae.getServer().getMinimumBidIncrement(ae.getCurBid(), ae.getNumBidders()));
    } catch(Currency.CurrencyTypeException cte) {
      minimumNextBid = null;
    }
    String prompt = genBidSnipeHTML(ae, minimumNextBid);
    prompt += "</body></html>";

    String previous = "";
    if(ae.isSniped()) previous = ae.getSnipeAmount().getValueString();
    SnipeDialog sd = new SnipeDialog(previous);
    sd.clear();
    sd.setPrompt(prompt);
    sd.pack();
    Rectangle rec = OptionUI.findCenterBounds(sd.getPreferredSize());
    sd.setLocation(rec.x, rec.y);
    sd.setVisible(true);

    if(sd.isCancelled() || sd.getAmount().length() == 0) return;

    String snipeAmount = sd.getAmount();

    try {
      Currency bidAmount = Currency.getCurrency(ae.getCurBid().fullCurrencyName(), snipeAmount);
      if(sd.subtractShipping()) {
        Currency shipping = ae.getShippingWithInsurance();
        if(shipping != null && !shipping.isNull()) {
          bidAmount = bidAmount.subtract(shipping);
        }
      }
      boolean wasSniped = ae.isSniped();
      ae.prepareSnipe(bidAmount);
View Full Code Here

    //  They closed the window
    if (endResult == null) {
      return;
    }

    Currency shippingAmount;
    try {
      if(endResult != null) endResult = endResult.replace(',', '.');
      shippingAmount = Currency.getCurrency(ae.getCurrentPrice().fullCurrencyName(), endResult);
    } catch(NumberFormatException nfe) {
      JOptionPane.showMessageDialog(src, "You have entered a bad shipping amount.\n" +
View Full Code Here

  }

  private void DoBid(Component src, AuctionEntry ae) {
    if(anyBiddingErrors(src, ae)) return;

    Currency minimumNextBid;
    try {
      minimumNextBid = ae.getCurBid().add(ae.getServer().getMinimumBidIncrement(ae.getCurBid(), ae.getNumBidders()));
    } catch(Currency.CurrencyTypeException cte) {
      minimumNextBid = null;
    }
    String prompt = genBidSnipeHTML(ae, minimumNextBid);
    prompt += "How much do you wish to bid?</body></html>";

    String endResult;
    if(minimumNextBid != null) {
      endResult = promptString(src, prompt, "Bidding", Float.toString((float) minimumNextBid.getValue()));
    } else {
      endResult = promptString(src, prompt, "Bidding");
    }

    //  They closed the window
    if (endResult == null) {
      return;
    }

    Currency bidAmount;
    try {
      if(endResult != null) endResult = endResult.replace(',','.');
      bidAmount = Currency.getCurrency(ae.getCurBid().fullCurrencyName(), endResult);
    } catch(NumberFormatException nfe) {
      JOptionPane.showMessageDialog(src, "You have entered a bad price for your bid.\n" +
View Full Code Here

TOP

Related Classes of com.jbidwatcher.util.Currency$CurrencyTypeException

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.