use of delta.common.utils.misc.Preferences in project lotro-companion by dmorcellet.
the class UpdatesChecker method doCheck.
private void doCheck() {
Version current = loadCurrentVersion();
Version remote = loadRemoteVersion();
if ((current != null) && (remote != null)) {
int remoteId = remote.getId();
int currentId = current.getId();
if (remoteId > currentId) {
_logger.info("New version available: " + remote);
_logger.info("Old version: " + current);
showInfoWindow(current, remote);
}
}
// Update the timestamp of the check for updates
long now = System.currentTimeMillis();
Preferences preferences = Config.getInstance().getPreferences();
TypedProperties props = preferences.getPreferences(UPDATES_PREFERENCES_NAME);
props.setLongProperty(LAST_UPDATE_CHECK_PROPERTY_NAME, now);
preferences.savePreferences(props);
}
use of delta.common.utils.misc.Preferences in project lotro-companion by dmorcellet.
the class CharacterPreferencesManager method getUserProperties.
/**
* Get the preferences for a character.
* @param toonFile Character file.
* @param id Identifier of the preferences set.
* @return Some properties or <code>null</code> if not managed.
*/
public static TypedProperties getUserProperties(CharacterFile toonFile, String id) {
TypedProperties props = null;
if (id.startsWith(ItemChoiceWindowController.ITEM_CHOOSER_PROPERTIES_ID)) {
if (toonFile != null) {
Preferences prefs = toonFile.getPreferences();
props = prefs.getPreferences(id);
List<String> columnIds = props.getStringList(ItemChoiceWindowController.COLUMNS_PROPERTY);
if (columnIds == null) {
String slotKey = id.substring(id.indexOf("#") + 1);
EQUIMENT_SLOT slot = EQUIMENT_SLOT.valueOf(slotKey);
CharacterClass characterClass = toonFile.getSummary().getCharacterClass();
ItemChoiceTableColumnsManager mgr = new ItemChoiceTableColumnsManager();
columnIds = mgr.getItemChoiceColumns(characterClass, slot);
props.setStringList(ItemChoiceWindowController.COLUMNS_PROPERTY, columnIds);
prefs.savePreferences(props);
}
}
} else if (ItemChoiceWindowController.ESSENCE_CHOOSER_PROPERTIES_ID.equals(id)) {
Preferences prefs = toonFile.getPreferences();
props = prefs.getPreferences(id);
List<String> columnIds = props.getStringList(ItemChoiceWindowController.COLUMNS_PROPERTY);
if (columnIds == null) {
CharacterClass characterClass = toonFile.getSummary().getCharacterClass();
ItemChoiceTableColumnsManager mgr = new ItemChoiceTableColumnsManager();
columnIds = mgr.getEssenceChoiceColumns(characterClass);
props.setStringList(ItemChoiceWindowController.COLUMNS_PROPERTY, columnIds);
prefs.savePreferences(props);
}
}
return props;
}
use of delta.common.utils.misc.Preferences in project lotro-companion by dmorcellet.
the class CraftingSynopsisWindowController method dispose.
/**
* Release all managed resources.
*/
@Override
public void dispose() {
saveBoundsPreferences();
super.dispose();
if (_panelController != null) {
Preferences preferences = Config.getInstance().getPreferences();
TypedProperties props = preferences.getPreferences(CRAFTING_PREFERENCES_NAME);
List<String> toonIds = new ArrayList<String>();
for (CharacterFile toon : _panelController.getTableController().getToons()) {
toonIds.add(toon.getIdentifier());
}
props.setStringList(TOON_NAME_PREFERENCE, toonIds);
_panelController.dispose();
_panelController = null;
}
}
use of delta.common.utils.misc.Preferences in project lotro-companion by dmorcellet.
the class ReputationSynopsisWindowController method dispose.
/**
* Release all managed resources.
*/
@Override
public void dispose() {
saveBoundsPreferences();
super.dispose();
if (_panelController != null) {
Preferences preferences = Config.getInstance().getPreferences();
TypedProperties props = preferences.getPreferences(REPUTATION_PREFERENCES_NAME);
List<String> toonIds = new ArrayList<String>();
for (CharacterFile toon : _panelController.getTableController().getToons()) {
toonIds.add(toon.getIdentifier());
}
props.setStringList(TOON_NAME_PREFERENCE, toonIds);
_panelController.dispose();
_panelController = null;
}
}
use of delta.common.utils.misc.Preferences in project lotro-companion by dmorcellet.
the class MainFrameController method doQuit.
private void doQuit() {
int result = GuiFactory.showQuestionDialog(getFrame(), "Do you really want to quit?", "Quit?", JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.OK_OPTION) {
dispose();
}
Preferences preferences = Config.getInstance().getPreferences();
preferences.saveAllPreferences();
}
Aggregations