public void actionPerformed(ActionEvent e) {
   try {
     String scannedDestination = ((JTextField) e.getSource()).getText().toUpperCase();
     validateDestinationScan(scannedDestination);
     DefaultListModel listModel = (DefaultListModel) destinationsList.getModel();
     int lastPosition = listModel.getSize();
     int seedsCount = 0;
     // todo: do we have to worry about more trays than required..?
     for (int i = 0; i < seedPlates.length; i++) {
       if (seedPlates[i].getSeedPlateBarcode() != null
           && SCANNED.equals(seedPlates[i].getStatus())
           && !isContainedInList(seedPlates[i].getSeedPlateBarcode(), failedPlatesList)) {
         seedsCount++;
       }
     }
     if (lastPosition >= seedsCount) {
       throw new ChippingManagerException(DESTINATIONS_LIMIT_EXCEEDED);
     }
     addDestination(scannedDestination);
   } catch (Throwable cmException) {
     logger.error("Unable to scan destination ", cmException);
     JOptionPane.showMessageDialog(
         new JFrame(),
         cmException.getMessage(),
         TITLE_CHIPPING_MANAGER,
         JOptionPane.WARNING_MESSAGE);
   }
   scanDestination.setText(BLANK);
 }
 public void actionPerformed(ActionEvent e) {
   DefaultListModel listModel = null;
   if (((JButton) e.getSource()).getName().equals(REMOVE_ALL)) {
     listModel = (DefaultListModel) failedPlatesList.getModel();
   } else {
     listModel = (DefaultListModel) destinationsList.getModel();
   }
   listModel.removeAllElements();
 }
 public void actionPerformed(ActionEvent e) {
   DefaultListModel listModel = null;
   JList list = null;
   if (((JButton) e.getSource()).getName().equals(REMOVE_SELECTED)) {
     list = failedPlatesList;
     listModel = (DefaultListModel) failedPlatesList.getModel();
   } else {
     list = destinationsList;
     listModel = (DefaultListModel) destinationsList.getModel();
   }
   if (list.getSelectedIndices().length > 0) {
     int[] temp = list.getSelectedIndices();
     int[] selectedIndices = list.getSelectedIndices();
     for (int i = temp.length - 1; i >= 0; i--) {
       selectedIndices = list.getSelectedIndices();
       listModel.removeElementAt(selectedIndices[i]);
     }
   }
 }