use of net.parostroj.timetable.model.freight.FreightAnalyser in project grafikon by jub77.
the class FreightDestinationPanel method addFreightTrainsFromNode.
private void addFreightTrainsFromNode(DataModel model, Node node, FreightAnalyser analyser) {
Locale locale = Locale.getDefault();
List<TimeInterval> intervalsFrom = analyser.getFreightIntervalsFrom(node);
List<Tuple<String>> trains = intervalsFrom.stream().map(i -> new Tuple<>(util.intervalToString(diagram, i, locale), util.freightListToString(analyser.getConnectionStrategy().getFreightToNodes(i), locale).stream().collect(Collectors.joining(", ")))).collect(Collectors.toList());
model.addLinesWithEmpty(trains);
}
use of net.parostroj.timetable.model.freight.FreightAnalyser in project grafikon by jub77.
the class FreightDestinationPanel method addFreightTrainUnitsFromNode.
private void addFreightTrainUnitsFromNode(DataModel model, Node node, FreightAnalyser analyser) {
Locale locale = Locale.getDefault();
List<TimeInterval> intervals = analyser.getFreightTrainUnitIntervals(node);
List<Tuple<String>> trains = intervals.stream().map(i -> new Tuple<>(util.intervalToString(diagram, i, locale), util.intervalFreightTrainUnitToString(diagram, i).stream().collect(Collectors.joining(", ")))).collect(Collectors.toList());
model.addLinesWithEmpty(trains);
}
use of net.parostroj.timetable.model.freight.FreightAnalyser in project grafikon by jub77.
the class FreightDestinationPanel method updateView.
public void updateView(Node node) {
// update selection
if (nodesModel.getSelectedObject() != node) {
nodesModel.setSelectedObject(node);
}
tableModel.clear();
if (node != null) {
DataModel model = new DataModel();
RxActionHandler.createInstance().newExecution("freight_dest", GuiComponentUtils.getTopLevelComponent(this), diagram).addConsumer((c, diagram) -> {
c.setWaitMessage(ResourceLoader.getString("wait.message.processing"));
c.setWaitDialogVisible(true);
}).onBackground().addConsumer((c, diagram) -> {
FreightAnalyser analyser = new FreightAnalyser(diagram.getFreightNet().getConnectionStrategy());
NodeFreight freight = analyser.getNodeFreightFrom(node);
addFreightToNodes(model, freight);
addFreightToRegions(model, freight);
addFreightToColors(model, freight);
addFreightTrainsFromNode(model, node, analyser);
addFreightTrainUnitsFromNode(model, node, analyser);
}).addConsumer((c, diagram) -> {
tableModel.addLines(model);
adjustColumnWidth.run();
}).execute();
}
}
Aggregations