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) { try { validateUnloadPlatesDialog(); unloadPlates(); } catch (Throwable cmException) { logger.error("error to unload to multiple destinations", cmException); JOptionPane.showMessageDialog( new JFrame(), cmException.getMessage(), TITLE_CHIPPING_MANAGER, JOptionPane.WARNING_MESSAGE); } }