use of delta.common.utils.misc.TypedProperties in project lotro-companion by dmorcellet.
the class Config method getMaxCharacterLevel.
/**
* Get the maximum character level.
* @return the maximum character level.
*/
public int getMaxCharacterLevel() {
TypedProperties props = getParameters();
int maxLevel = props.getIntProperty("max.character.level", 115);
return maxLevel;
}
use of delta.common.utils.misc.TypedProperties in project lotro-companion by dmorcellet.
the class AboutPanelController method buildProjectVersion.
private String buildProjectVersion() {
TypedProperties props = Config.getInstance().getParameters();
String name = props.getStringProperty("current.version.name", "?");
String date = props.getStringProperty("current.version.date", "01/01/1970");
return "Version " + name + " (" + date + ')';
}
use of delta.common.utils.misc.TypedProperties in project lotro-companion by dmorcellet.
the class FileChooserController method chooseFile.
/**
* Choose a file.
* @param parent Parent component.
* @param approveButtonText Title of the approve button.
* @return A file or <code>null</code> if none chosen.
*/
public File chooseFile(Component parent, String approveButtonText) {
_chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
Preferences preferences = Config.getInstance().getPreferences();
TypedProperties props = preferences.getPreferences(_id);
String dirStr = props.getStringProperty(CURRENT_FILE_PREFERENCE, null);
File currentDir = null;
if (dirStr != null) {
currentDir = new File(dirStr);
}
_chooser.setDialogTitle(_title);
_chooser.setMultiSelectionEnabled(false);
_chooser.setCurrentDirectory(currentDir);
int ok = _chooser.showDialog(parent, approveButtonText);
File chosenFile = null;
if (ok == JFileChooser.APPROVE_OPTION) {
chosenFile = _chooser.getSelectedFile();
currentDir = _chooser.getCurrentDirectory();
if (currentDir != null) {
props.setStringProperty(CURRENT_FILE_PREFERENCE, currentDir.getAbsolutePath());
preferences.savePreferences(props);
}
}
return chosenFile;
}
use of delta.common.utils.misc.TypedProperties in project lotro-companion by dmorcellet.
the class CharacterLevelWindowController method dispose.
/**
* Release all managed resources.
*/
@Override
public void dispose() {
super.dispose();
List<CharacterFile> toons = _stats.getToonsList();
Preferences preferences = Config.getInstance().getPreferences();
TypedProperties props = preferences.getPreferences(LEVELLING_PREFERENCES_NAME);
List<String> toonIds = new ArrayList<String>();
for (CharacterFile toon : toons) {
toonIds.add(toon.getIdentifier());
}
props.setStringList(TOON_NAME_PREFERENCE, toonIds);
_stats = null;
if (_levellingPanelController != null) {
_levellingPanelController.dispose();
_levellingPanelController = null;
}
}
use of delta.common.utils.misc.TypedProperties in project lotro-companion by dmorcellet.
the class GlobalPreferences method getGlobalProperties.
/**
* Get properties from the global preferences.
* @param id Identifier of the preferences set.
* @return Some properties or <code>null</code> if not managed.
*/
public static TypedProperties getGlobalProperties(String id) {
Preferences prefs = Config.getInstance().getPreferences();
TypedProperties props = prefs.getPreferences(id);
return props;
}
Aggregations