Search in sources :

Example 1 with GTViewSettings

use of net.parostroj.timetable.gui.components.GTViewSettings in project grafikon by jub77.

the class FreightNetPane2 method loadFromPreferences.

@Override
public IniConfigSection loadFromPreferences(IniConfig prefs) {
    IniConfigSection section = prefs.getSection("freigh.net");
    GTViewSettings gtvs = null;
    try {
        gtvs = GTViewSettings.parseStorageString(section.get("gtv"));
    } catch (Exception e) {
        // use default values
        log.warn("Wrong GTView settings - using default values.");
    }
    if (gtvs != null) {
        graphicalTimetableView.setSettings(graphicalTimetableView.getSettings().merge(gtvs));
    }
    return section;
}
Also used : GTViewSettings(net.parostroj.timetable.gui.components.GTViewSettings) IniConfigSection(net.parostroj.timetable.gui.ini.IniConfigSection)

Example 2 with GTViewSettings

use of net.parostroj.timetable.gui.components.GTViewSettings in project grafikon by jub77.

the class TrainsPane method loadFromPreferences.

@Override
public IniConfigSection loadFromPreferences(IniConfig prefs) {
    IniConfigSection section = prefs.getSection("trains");
    int dividerLoc = section.get("divider", Integer.class, splitPane.getDividerLocation());
    int div = section.get("divider.2", Integer.class, trainsSplitPane.getDividerLocation());
    int preferredWidth = trainListView.getPreferredSize().width;
    if (preferredWidth < div) {
        trainsSplitPane.setDividerLocation(div);
    }
    GTViewSettings gtvs = null;
    try {
        gtvs = GTViewSettings.parseStorageString(section.get("gtv"));
    } catch (Exception e) {
        // use default values
        log.warn("Wrong GTView settings - using default values.");
    }
    if (gtvs != null) {
        graphicalTimetableView.setSettings(graphicalTimetableView.getSettings().merge(gtvs));
    }
    scrollPane.setVisible(section.get("show.gtview", Boolean.class, true));
    if (scrollPane.isVisible()) {
        splitPane.setDividerLocation(dividerLoc);
    } else {
        splitPane.setLastDividerLocation(dividerLoc);
    }
    String treeType = section.get("listtype", "TYPES");
    TreeType treeTypeEnum = TreeType.TYPES;
    try {
        treeTypeEnum = TreeType.valueOf(treeType);
    } catch (IllegalArgumentException e) {
    // ignore unknown value
    }
    trainListView.setTreeType(treeTypeEnum);
    trainView.loadFromPreferences(prefs);
    return section;
}
Also used : TreeType(net.parostroj.timetable.gui.views.TrainListView.TreeType) GTViewSettings(net.parostroj.timetable.gui.components.GTViewSettings) IniConfigSection(net.parostroj.timetable.gui.ini.IniConfigSection)

Aggregations

GTViewSettings (net.parostroj.timetable.gui.components.GTViewSettings)2 IniConfigSection (net.parostroj.timetable.gui.ini.IniConfigSection)2 TreeType (net.parostroj.timetable.gui.views.TrainListView.TreeType)1