* @param isNewNode true: an initial configuration is set; false: upgrading
* from previous node configuration version, set default to maintain
* previous behaviour
*/
public void updateModuleConfigDefaults(boolean isNewNode) {
ModuleConfiguration config = getModuleConfiguration();
if (isNewNode) {
// use defaults for new course building blocks
config.setBooleanEntry(STCourseNodeEditController.CONFIG_KEY_ALLOW_RELATIVE_LINKS, Boolean.FALSE.booleanValue());
// set the default display to peekview in two columns
config.setStringValue(STCourseNodeEditController.CONFIG_KEY_DISPLAY_TYPE, STCourseNodeEditController.CONFIG_VALUE_DISPLAY_PEEKVIEW);
config.setIntValue(STCourseNodeEditController.CONFIG_KEY_COLUMNS, 2);
config.setConfigurationVersion(3);
} else {
// update to version 2
if (config.getConfigurationVersion() < 2) {
// use values accoring to previous functionality
config.setBooleanEntry(STCourseNodeEditController.CONFIG_KEY_ALLOW_RELATIVE_LINKS, Boolean.FALSE.booleanValue());
// previous version of score st node didn't have easy mode on score
// calculator, se to expert mode
if (getScoreCalculator() != null) {
getScoreCalculator().setExpertMode(true);
}
config.setConfigurationVersion(2);
}
// update to version 3
if (config.getConfigurationVersion() < 3) {
String fileName = (String) config.get(STCourseNodeEditController.CONFIG_KEY_FILE);
if (fileName != null) {
// set to custom file display config
config.setStringValue(STCourseNodeEditController.CONFIG_KEY_DISPLAY_TYPE, STCourseNodeEditController.CONFIG_VALUE_DISPLAY_FILE);
} else {
// set the default display to plain vanilla TOC view in one column
config.setStringValue(STCourseNodeEditController.CONFIG_KEY_DISPLAY_TYPE, STCourseNodeEditController.CONFIG_VALUE_DISPLAY_TOC);
config.setIntValue(STCourseNodeEditController.CONFIG_KEY_COLUMNS, 1);
}
config.setConfigurationVersion(3);
}
}
}