Package com.jbidwatcher.auction

Examples of com.jbidwatcher.auction.AuctionEntry


     * This sucks.  I need to push the generic code up, and leave the auction-specific code here, or
     * somehow move all the non-auction-specific functionality to its own class.  This code is broken,
     * at the least because it has to use 'instanceof' to work.
     */
    Object resolvedObject = resolvePoint();
    AuctionEntry ae = null;

    if (resolvedObject != null && resolvedObject instanceof AuctionEntry) {
      ae = (AuctionEntry) resolvedObject;
    }

    int[] rowList = getPossibleRows();

    if (rowList != null && rowList.length != 0) {
      if (rowList.length == 1) {
        Object firstSelected = getIndexedEntry(rowList[0]);
        if (firstSelected != null && firstSelected instanceof AuctionEntry) {
          ae = (AuctionEntry) firstSelected;
        }
      } else {
        ae = null;
      }
    }

    //  Ignored if it wasn't renamed, but otherwise always restore to 'known state'.
    rename("Multisnipe", "Snipe");
    rename("Edit", "Add");               // Comment

    if (ae != null) {
      if (ae.getComment() == null) {
        disable("View");
        disable("Remove");
      } else {
        rename("Add", "Edit");
      }
      if (!ae.isSniped()) disable("Cancel Snipe");
      if (!ae.isComplete()) {
        disable("Complete");
        disable("Mark As Not Ended");
      } else {
        enable("Mark As Not Ended");
      }

      if (ae.isSeller() || ae.isComplete()) {
        disable("Buy");
        disable("Bid");
        disable("Snipe");
      }

      if (ae.isFixed()) {
        disable("Bid");
        disable("Snipe");
      }

      if (!ae.isFixed() && ae.getBuyNow().isNull()) {
        disable("Buy");
      }
    }

    if (rowList != null && rowList.length > 1) {
      disable("Bid");
      disable("Buy");
      disable("Show Last Error");
      disable("Set Shipping");
      disable("Add");
      disable("View");
      disable("Remove");

      boolean anySniped = false;
      boolean anyFixed = false;
      boolean anyEnded = false;
      boolean anyCurrent = false;
      for (int aRowList : rowList) {
        Object line = getIndexedEntry(aRowList);
        AuctionEntry step = (AuctionEntry) line;
        if (step.isSniped()) anySniped = true;
        if (step.isFixed()) anyFixed = true;
        if (step.isComplete()) anyEnded = true;
        if (!step.isComplete()) anyCurrent = true;
      }

      if (!anySniped) disable("Cancel Snipe");
      if (anyFixed || anyEnded) disable("Snipe");
      if (!anyCurrent) enable("Complete");
View Full Code Here


    //  Build a temporary table, because the items will vanish out of
    //  the table when we start refiltering them, and that will mess
    //  everything up.
    ArrayList<AuctionEntry> tempTable = new ArrayList<AuctionEntry>(rowList.length);
    for (int aRowList : rowList) {
      AuctionEntry moveEntry = (AuctionEntry) getIndexedEntry(aRowList);
      tempTable.add(moveEntry);
    }

    //  Now move all entries in the temporary table to the new tab.
    for (AuctionEntry moveEntry : tempTable) {
      moveEntry.setCategory(tab);
      MQFactory.getConcrete("redraw").enqueue(moveEntry.getIdentifier());
    }
  }
View Full Code Here

    JComponent returnComponent = (JComponent)super.getTableCellRendererComponent(table, value, isSelected, false, row, column);
    returnComponent.setOpaque(false);

    Object rowData = table.getValueAt(row, -1);
    if(rowData instanceof String) return returnComponent;
    AuctionEntry ae = (AuctionEntry)rowData;
    if(ae == null) return returnComponent;

    Color foreground = chooseForeground(ae, column, table.getForeground());

    mRow = row;

    mThumbnail = column == TableColumnController.THUMBNAIL;

    if (ae.isSniped() &&
        (column == TableColumnController.SNIPE_OR_MAX ||
         column == TableColumnController.SNIPE_TOTAL ||
         column == TableColumnController.SNIPE)) {
      returnComponent.setBackground(snipeBidBackground(ae));
      returnComponent.setOpaque(true);
View Full Code Here

    MQFactory.getConcrete("redraw").registerListener(this);

    MQFactory.getConcrete("delete").registerListener(new MessageQueue.Listener() {
      public void messageAction(Object deQ) {
        AuctionEntry ae = EntryCorral.getInstance().takeForRead(deQ.toString())//  Lock the item
        deleteAuction(ae);
        ae = (AuctionEntry) EntryCorral.getInstance().takeForWrite(deQ.toString())//  Lock the item
        EntryCorral.getInstance().erase(ae.getIdentifier())//  Remove and unlock it
      }
    });
    JTabManager.getInstance().setFilterManager(this);
  }
View Full Code Here

  }

  public void messageAction(Object deQ) {
    String cmd = deQ.toString();
    if(StringTools.isNumberOnly(cmd)) {
      AuctionEntry ae = EntryCorral.getInstance().takeForRead(cmd);
      if(ae != null) {
//        ae.reload();
        AuctionListHolder old = mIdentifierToList.get(ae.getIdentifier());
        AuctionListHolder newAuction = refilterAuction(ae);
        if (newAuction != null) {
          MQFactory.getConcrete("Swing").enqueue("Moved to " + newAuction.getList().getName() + " " + Auctions.getTitleAndComment(ae));
          if (old != null) old.getUI().redrawAll();
          newAuction.getUI().redrawAll();
View Full Code Here

  /** Delete an auction from the Auctions list that it's in.
   *
   * @param ae - The auction to delete.
   */
  public void deleteAuction(AuctionEntry ae) {
    AuctionEntry deleteEntry = EntryCorral.getInstance().takeForRead(ae.getIdentifier());
    AuctionListHolder which = mIdentifierToList.get(deleteEntry.getIdentifier());
    if(which != null) which.getUI().delEntry(ae);

    mIdentifierToList.remove(ae.getIdentifier());
  }
View Full Code Here

  * the loaded filters.
  *
  * @param ae - The auction to add.
  */
  public void addAuction(AuctionEntry ae) {
    AuctionEntry newEntry = EntryCorral.getInstance().takeForRead(ae.getIdentifier());
    AuctionListHolder which = mIdentifierToList.get(newEntry.getIdentifier());

    if(which != null) {
      //  If it's already sorted into a Auctions list, tell that list
      //  to handle it.
      if(which.getList().allowAddEntry(newEntry)) {
        which.getUI().addEntry(newEntry);
      }
    } else {
      AuctionListHolder sendTo = matchAuction(newEntry);

      //  If we have no auction collections, then this isn't relevant.
      if(sendTo != null) {
        if (sendTo.getList().allowAddEntry(newEntry)) {
          sendTo.getUI().addEntry(newEntry);
          mIdentifierToList.put(newEntry.getIdentifier(), sendTo);
        }
      }
    }
  }
View Full Code Here

    }
    return null;
  }

  public void actionPerformed(ActionEvent event) {
    AuctionEntry whichAuction = null;
    String actionString = event.getActionCommand();
    JTable chosenTable = getCurrentTable();
    boolean isButton = false;

    if(actionString.startsWith("BT-")) {
View Full Code Here

      inTable.clearSelection();

      boolean foundOne = false;
      for (int i = 0; i < inTable.getRowCount(); i++) {
        boolean match = false;
        AuctionEntry ae = (AuctionEntry) inTable.getValueAt(i, -1);

        if (          seller_t) match = ae.getSellerName().matches(trueSearch);
        if (!match && buyer_t && ae.getHighBidder() != null) match = ae.getHighBidder().matches(trueSearch);
        if (!match && comment_t && ae.getComment() != null) match = ae.getComment().matches(trueSearch);
        if (!match && number_t) match = ae.getIdentifier().matches(trueSearch);
        //  If seller or buyer search was set, ignore the title / comments.
        if (!match && (all_t || (!seller_t && !buyer_t && !comment_t))) {
          match = ae.getTitle().matches(trueSearch);
        }
        if (invert) match = !match;
        if (match) {
          inTable.addRowSelectionInterval(i, i);
          foundOne = true;
View Full Code Here

  private static boolean do_uber_debug = false;
  private static String lastSeen = null;

  public void messageAction(Object deQ) {
    if (deQ instanceof String && StringTools.isNumberOnly((String)deQ)) {
      AuctionEntry ae = EntryCorral.getInstance().takeForRead((String) deQ);
      if (ae != null) {
        boolean lostAuction = !ae.hasAuction();
        ae.update();
        if (lostAuction) AuctionsManager.getInstance().addEntry(ae);
        return;
      }
    }
View Full Code Here

TOP

Related Classes of com.jbidwatcher.auction.AuctionEntry

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.