@Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        SimpleDateFormat format = new SimpleDateFormat("HH:mm");

        switch(columnIndex) {
            case 0: return trains.get(rowIndex).getNumber();
            case 1: return trains.get(rowIndex).getFromStation();
            case 2: return trains.get(rowIndex).getToStation();
            case 3: if (trains.get(rowIndex).getDepartureTime() == null) return "";
                    else return format.format(trains.get(rowIndex).getDepartureTime());
            case 4: if (trains.get(rowIndex).getArrivalTime() == null) return "";
                    else return format.format(trains.get(rowIndex).getArrivalTime());
            case 5: return trains.get(rowIndex).getTicketsAmount();
            default: return null;
        }
    }