/** * Creates the string to be displayed in the RentalStoreGUI JList. * * @param arg0 */ @Override public Object getElementAt(int arg0) { DVD d = listDVDs.get(arg0); String s = ""; if (d.getNameOfRenter() != null) { s += "" + d.getNameOfRenter() + " "; } if (d.getTitle() != null) { s += " Rented: " + d.getTitle() + " "; } if (d.getRentalDate() != null) { s += " Date Rented: " + fmt.format(listDVDs.get(arg0).getRentalDate().getTime()) + " "; } if (d.getDueBack() != null) { s += " Due Back: " + fmt.format(d.getDueBack().getTime()) + " "; } if (d instanceof Game) { s += " Console: " + ((Game) d).getConsole(); } return s; }
/** Updates the list of DVDs/Games. */ public void updateDVDs() { fireContentsChanged(this, 0, listDVDs.size()); }
/** * Deletes the selected unit from the list and updates the list. * * @param index unit to be deleted. */ public void deleteDVD(int index) { DVD unit = listDVDs.get(index); listDVDs.remove(index); fireIntervalRemoved(unit, 0, listDVDs.size()); }
/** * Adds a DVD or Game to the list and updates the list. * * @param unit the object to be added. */ public void addDVD(DVD unit) { if (unit != null) { listDVDs.add(unit); fireIntervalAdded(this, 0, listDVDs.size()); } }
public DVD getDVD(int index) { return listDVDs.get(index); }
/** Returns the size of the list as an int. */ @Override public int getSize() { return listDVDs.size(); }