Search in sources :

Example 1 with TrainWrapperDelegate

use of net.parostroj.timetable.gui.wrappers.TrainWrapperDelegate in project grafikon by jub77.

the class ChangedTrainsPanel method addTrainToList.

public void addTrainToList(Train train) {
    // check if the last train is the same ...
    if (listModel.getSize() > 0) {
        int index = listModel.getSize() - 1;
        Train lastTrain = listModel.getIndex(index).getElement();
        if (lastTrain == train) {
            listModel.refreshIndex(index);
            return;
        }
    }
    limitTrains(limit);
    // add to list
    Wrapper<Train> wrapper = Wrapper.getWrapper(train, new TrainWrapperDelegate(TrainWrapperDelegate.Type.NAME_AND_END_NODES_WITH_TIME, train.getDiagram().getTrainsData().getTrainComparator()));
    listModel.addWrapper(wrapper);
    trainsList.ensureIndexIsVisible(listModel.getSize() - 1);
}
Also used : Train(net.parostroj.timetable.model.Train) TrainWrapperDelegate(net.parostroj.timetable.gui.wrappers.TrainWrapperDelegate)

Aggregations

TrainWrapperDelegate (net.parostroj.timetable.gui.wrappers.TrainWrapperDelegate)1 Train (net.parostroj.timetable.model.Train)1