@Override
    public void actionPerformed(ActionEvent e) {
        String command = e.getActionCommand();
        if (ALL.equals(command)) {
            for (int i = 0; i < goodsList.getModel().getSize() && i < maxCargo;
                 i++) {
                GoodsItem gi = (GoodsItem) goodsList.getModel().getElementAt(i);
                gi.setSelected(true);
                updateComponents();
            }
        } else if (NONE.equals(command)) {
            for (int i = 0; i < goodsList.getModel().getSize(); i++) {
                GoodsItem gi = (GoodsItem) goodsList.getModel().getElementAt(i);
                gi.setSelected(false);
                updateComponents();
            }
        } else if (OK.equals(command)) {
            ArrayList<Goods> list = new ArrayList<Goods>();
            for (int i = 0; i < goodsList.getModel().getSize(); i++) {
                GoodsItem gi = (GoodsItem) goodsList.getModel().getElementAt(i);
                if (gi.isSelected()) list.add(gi.getGoods());
            }
            setResponse(list);
        } else {
            logger.warning("Invalid action command: " + command);
        }
    }