Search in sources :

Example 1 with TreeType

use of net.parostroj.timetable.gui.views.TrainListView.TreeType 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)1 IniConfigSection (net.parostroj.timetable.gui.ini.IniConfigSection)1 TreeType (net.parostroj.timetable.gui.views.TrainListView.TreeType)1