Search in sources :

Example 1 with Tuple

use of net.parostroj.timetable.utils.Tuple in project grafikon by jub77.

the class FreightDestinationPanel method addFreightToNodes.

private void addFreightToNodes(DataModel model, NodeFreight nodeFreight) {
    Locale locale = Locale.getDefault();
    Collator collator = Collator.getInstance();
    List<Tuple<String>> lines = nodeFreight.getNodeConnections().stream().filter(e -> e.getTo().isVisible()).map(e -> {
        String node = util.freightNodeToString(e.getTo(), locale, false);
        String trains = util.intervalsToString(diagram, e.getTransport().getTrains(), locale).stream().collect(Collectors.joining(", "));
        return new Tuple<>(node, trains);
    }).sorted(comparator(collator)).collect(Collectors.toList());
    model.addLinesWithEmpty(lines);
}
Also used : Locale(java.util.Locale) TableColumnModel(javax.swing.table.TableColumnModel) OutputFreightUtil(net.parostroj.timetable.output2.util.OutputFreightUtil) TableCellRenderer(javax.swing.table.TableCellRenderer) Node(net.parostroj.timetable.model.Node) ArrayList(java.util.ArrayList) TimeInterval(net.parostroj.timetable.model.TimeInterval) ResourceLoader(net.parostroj.timetable.gui.utils.ResourceLoader) Locale(java.util.Locale) AbstractTableModel(javax.swing.table.AbstractTableModel) NodeFreight(net.parostroj.timetable.model.freight.NodeFreight) BorderLayout(java.awt.BorderLayout) JComboBox(javax.swing.JComboBox) Wrapper(net.parostroj.timetable.gui.wrappers.Wrapper) Collator(java.text.Collator) FlowLayout(java.awt.FlowLayout) ItemEvent(java.awt.event.ItemEvent) JButton(javax.swing.JButton) WrapperListModel(net.parostroj.timetable.gui.wrappers.WrapperListModel) Collection(java.util.Collection) GuiComponentUtils(net.parostroj.timetable.gui.utils.GuiComponentUtils) BorderFactory(javax.swing.BorderFactory) Component(java.awt.Component) Collectors(java.util.stream.Collectors) JScrollPane(javax.swing.JScrollPane) List(java.util.List) GuiIcon(net.parostroj.timetable.gui.utils.GuiIcon) Tuple(net.parostroj.timetable.utils.Tuple) JTable(javax.swing.JTable) RxActionHandler(net.parostroj.timetable.gui.actions.execution.RxActionHandler) Comparator(java.util.Comparator) FreightAnalyser(net.parostroj.timetable.model.freight.FreightAnalyser) TrainDiagram(net.parostroj.timetable.model.TrainDiagram) JPanel(javax.swing.JPanel) Tuple(net.parostroj.timetable.utils.Tuple) Collator(java.text.Collator)

Example 2 with Tuple

use of net.parostroj.timetable.utils.Tuple in project grafikon by jub77.

the class FreightDestinationPanel method addFreightToRegions.

private void addFreightToRegions(DataModel model, NodeFreight nodeFreight) {
    Locale locale = Locale.getDefault();
    Collator collator = Collator.getInstance();
    List<Tuple<String>> lines = nodeFreight.getRegionConnections().stream().map(e -> {
        String region = util.freightRegionsToString(e.getTo(), locale).stream().collect(Collectors.joining(", "));
        String transport = util.transportToString(diagram, e.getTransport(), locale).stream().collect(Collectors.joining(", "));
        return new Tuple<>(region, transport);
    }).sorted(comparator(collator)).collect(Collectors.toList());
    model.addLinesWithEmpty(lines);
}
Also used : Locale(java.util.Locale) Tuple(net.parostroj.timetable.utils.Tuple) Collator(java.text.Collator)

Example 3 with Tuple

use of net.parostroj.timetable.utils.Tuple 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);
}
Also used : Locale(java.util.Locale) TableColumnModel(javax.swing.table.TableColumnModel) OutputFreightUtil(net.parostroj.timetable.output2.util.OutputFreightUtil) TableCellRenderer(javax.swing.table.TableCellRenderer) Node(net.parostroj.timetable.model.Node) ArrayList(java.util.ArrayList) TimeInterval(net.parostroj.timetable.model.TimeInterval) ResourceLoader(net.parostroj.timetable.gui.utils.ResourceLoader) Locale(java.util.Locale) AbstractTableModel(javax.swing.table.AbstractTableModel) NodeFreight(net.parostroj.timetable.model.freight.NodeFreight) BorderLayout(java.awt.BorderLayout) JComboBox(javax.swing.JComboBox) Wrapper(net.parostroj.timetable.gui.wrappers.Wrapper) Collator(java.text.Collator) FlowLayout(java.awt.FlowLayout) ItemEvent(java.awt.event.ItemEvent) JButton(javax.swing.JButton) WrapperListModel(net.parostroj.timetable.gui.wrappers.WrapperListModel) Collection(java.util.Collection) GuiComponentUtils(net.parostroj.timetable.gui.utils.GuiComponentUtils) BorderFactory(javax.swing.BorderFactory) Component(java.awt.Component) Collectors(java.util.stream.Collectors) JScrollPane(javax.swing.JScrollPane) List(java.util.List) GuiIcon(net.parostroj.timetable.gui.utils.GuiIcon) Tuple(net.parostroj.timetable.utils.Tuple) JTable(javax.swing.JTable) RxActionHandler(net.parostroj.timetable.gui.actions.execution.RxActionHandler) Comparator(java.util.Comparator) FreightAnalyser(net.parostroj.timetable.model.freight.FreightAnalyser) TrainDiagram(net.parostroj.timetable.model.TrainDiagram) JPanel(javax.swing.JPanel) TimeInterval(net.parostroj.timetable.model.TimeInterval) Tuple(net.parostroj.timetable.utils.Tuple)

Example 4 with Tuple

use of net.parostroj.timetable.utils.Tuple 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);
}
Also used : Locale(java.util.Locale) TableColumnModel(javax.swing.table.TableColumnModel) OutputFreightUtil(net.parostroj.timetable.output2.util.OutputFreightUtil) TableCellRenderer(javax.swing.table.TableCellRenderer) Node(net.parostroj.timetable.model.Node) ArrayList(java.util.ArrayList) TimeInterval(net.parostroj.timetable.model.TimeInterval) ResourceLoader(net.parostroj.timetable.gui.utils.ResourceLoader) Locale(java.util.Locale) AbstractTableModel(javax.swing.table.AbstractTableModel) NodeFreight(net.parostroj.timetable.model.freight.NodeFreight) BorderLayout(java.awt.BorderLayout) JComboBox(javax.swing.JComboBox) Wrapper(net.parostroj.timetable.gui.wrappers.Wrapper) Collator(java.text.Collator) FlowLayout(java.awt.FlowLayout) ItemEvent(java.awt.event.ItemEvent) JButton(javax.swing.JButton) WrapperListModel(net.parostroj.timetable.gui.wrappers.WrapperListModel) Collection(java.util.Collection) GuiComponentUtils(net.parostroj.timetable.gui.utils.GuiComponentUtils) BorderFactory(javax.swing.BorderFactory) Component(java.awt.Component) Collectors(java.util.stream.Collectors) JScrollPane(javax.swing.JScrollPane) List(java.util.List) GuiIcon(net.parostroj.timetable.gui.utils.GuiIcon) Tuple(net.parostroj.timetable.utils.Tuple) JTable(javax.swing.JTable) RxActionHandler(net.parostroj.timetable.gui.actions.execution.RxActionHandler) Comparator(java.util.Comparator) FreightAnalyser(net.parostroj.timetable.model.freight.FreightAnalyser) TrainDiagram(net.parostroj.timetable.model.TrainDiagram) JPanel(javax.swing.JPanel) TimeInterval(net.parostroj.timetable.model.TimeInterval) Tuple(net.parostroj.timetable.utils.Tuple)

Example 5 with Tuple

use of net.parostroj.timetable.utils.Tuple in project grafikon by jub77.

the class FreightDestinationPanel method addFreightToColors.

private void addFreightToColors(DataModel model, NodeFreight nodeFreight) {
    Locale locale = Locale.getDefault();
    List<Tuple<String>> lines = nodeFreight.getFreightColorConnections().stream().map(e -> {
        String color = util.freightColorsToString(e.getTo(), locale).stream().collect(Collectors.joining(", "));
        String transport = util.transportToString(diagram, e.getTransport(), locale).stream().collect(Collectors.joining(", "));
        return new Tuple<>(color, transport);
    }).collect(Collectors.toList());
    model.addLinesWithEmpty(lines);
}
Also used : Locale(java.util.Locale) TableColumnModel(javax.swing.table.TableColumnModel) OutputFreightUtil(net.parostroj.timetable.output2.util.OutputFreightUtil) TableCellRenderer(javax.swing.table.TableCellRenderer) Node(net.parostroj.timetable.model.Node) ArrayList(java.util.ArrayList) TimeInterval(net.parostroj.timetable.model.TimeInterval) ResourceLoader(net.parostroj.timetable.gui.utils.ResourceLoader) Locale(java.util.Locale) AbstractTableModel(javax.swing.table.AbstractTableModel) NodeFreight(net.parostroj.timetable.model.freight.NodeFreight) BorderLayout(java.awt.BorderLayout) JComboBox(javax.swing.JComboBox) Wrapper(net.parostroj.timetable.gui.wrappers.Wrapper) Collator(java.text.Collator) FlowLayout(java.awt.FlowLayout) ItemEvent(java.awt.event.ItemEvent) JButton(javax.swing.JButton) WrapperListModel(net.parostroj.timetable.gui.wrappers.WrapperListModel) Collection(java.util.Collection) GuiComponentUtils(net.parostroj.timetable.gui.utils.GuiComponentUtils) BorderFactory(javax.swing.BorderFactory) Component(java.awt.Component) Collectors(java.util.stream.Collectors) JScrollPane(javax.swing.JScrollPane) List(java.util.List) GuiIcon(net.parostroj.timetable.gui.utils.GuiIcon) Tuple(net.parostroj.timetable.utils.Tuple) JTable(javax.swing.JTable) RxActionHandler(net.parostroj.timetable.gui.actions.execution.RxActionHandler) Comparator(java.util.Comparator) FreightAnalyser(net.parostroj.timetable.model.freight.FreightAnalyser) TrainDiagram(net.parostroj.timetable.model.TrainDiagram) JPanel(javax.swing.JPanel) Tuple(net.parostroj.timetable.utils.Tuple)

Aggregations

Collator (java.text.Collator)5 Locale (java.util.Locale)5 Tuple (net.parostroj.timetable.utils.Tuple)5 BorderLayout (java.awt.BorderLayout)4 Component (java.awt.Component)4 FlowLayout (java.awt.FlowLayout)4 ItemEvent (java.awt.event.ItemEvent)4 ArrayList (java.util.ArrayList)4 Collection (java.util.Collection)4 Comparator (java.util.Comparator)4 List (java.util.List)4 Collectors (java.util.stream.Collectors)4 BorderFactory (javax.swing.BorderFactory)4 JButton (javax.swing.JButton)4 JComboBox (javax.swing.JComboBox)4 JPanel (javax.swing.JPanel)4 JScrollPane (javax.swing.JScrollPane)4 JTable (javax.swing.JTable)4 AbstractTableModel (javax.swing.table.AbstractTableModel)4 TableCellRenderer (javax.swing.table.TableCellRenderer)4