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
 /**
  * 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.º 3
0
 public DVD getDVD(int index) {
   return listDVDs.get(index);
 }