use of net.parostroj.timetable.gui.ini.IniConfigSection in project grafikon by jub77.
the class TrainViewColumns method saveToPreferences.
@Override
public IniConfigSection saveToPreferences(IniConfig prefs) {
IniConfigSection section = getTrainsSection(prefs);
// get displayed columns and save theirs order
prefs.removeSection(CURRENT_COLUMNS_KEY);
String order = createColumnConfiguration();
if (order != null) {
section.put(CURRENT_COLUMNS_KEY, order);
}
// stored columns
section.remove(STORED_COLUMNS_KEY);
columnConfigurations.forEach((key, config) -> section.add(STORED_COLUMNS_KEY, key + DELIMITER + config));
return section;
}
use of net.parostroj.timetable.gui.ini.IniConfigSection 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;
}
use of net.parostroj.timetable.gui.ini.IniConfigSection in project grafikon by jub77.
the class TrainsCyclesPane method saveToPreferences.
@Override
public IniConfigSection saveToPreferences(IniConfig prefs) {
IniConfigSection section = prefs.getSection(getKey());
section.put("divider", splitPane.getDividerLocation());
section.put("gtv", graphicalTimetableView.getSettings().getStorageString());
return section;
}
use of net.parostroj.timetable.gui.ini.IniConfigSection 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;
}
use of net.parostroj.timetable.gui.ini.IniConfigSection in project grafikon by jub77.
the class TrainsPane method saveToPreferences.
@Override
public IniConfigSection saveToPreferences(IniConfig prefs) {
IniConfigSection section = prefs.getSection("trains");
section.put("divider", scrollPane.isVisible() ? splitPane.getDividerLocation() : splitPane.getLastDividerLocation());
section.put("divider.2", trainsSplitPane.getDividerLocation());
// save if the gtview in trains pane is visible
section.put("show.gtview", scrollPane.isVisible());
section.put("gtv", graphicalTimetableView.getSettings().getStorageString());
section.put("listtype", trainListView.getTreeType().name());
trainView.saveToPreferences(prefs);
return section;
}
Aggregations