Exemplo n.º 1
0
  /**
   * 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;
  }
Exemplo n.º 2
0
 /** Updates the list of DVDs/Games. */
 public void updateDVDs() {
   fireContentsChanged(this, 0, listDVDs.size());
 }
Exemplo n.º 3
0
 /**
  * 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());
 }
Exemplo n.º 4
0
 /**
  * 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());
   }
 }
Exemplo n.º 5
0
 public DVD getDVD(int index) {
   return listDVDs.get(index);
 }
Exemplo n.º 6
0
 /** Returns the size of the list as an int. */
 @Override
 public int getSize() {
   return listDVDs.size();
 }