Search in sources :

Example 1 with TypedProperties

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;
}
Also used : TypedProperties(delta.common.utils.misc.TypedProperties)

Example 2 with TypedProperties

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 + ')';
}
Also used : TypedProperties(delta.common.utils.misc.TypedProperties)

Example 3 with TypedProperties

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;
}
Also used : Preferences(delta.common.utils.misc.Preferences) TypedProperties(delta.common.utils.misc.TypedProperties) File(java.io.File)

Example 4 with TypedProperties

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;
    }
}
Also used : ArrayList(java.util.ArrayList) Preferences(delta.common.utils.misc.Preferences) TypedProperties(delta.common.utils.misc.TypedProperties) CharacterFile(delta.games.lotro.character.CharacterFile)

Example 5 with TypedProperties

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;
}
Also used : Preferences(delta.common.utils.misc.Preferences) TypedProperties(delta.common.utils.misc.TypedProperties)

Aggregations

TypedProperties (delta.common.utils.misc.TypedProperties)19 Preferences (delta.common.utils.misc.Preferences)9 CharacterFile (delta.games.lotro.character.CharacterFile)4 ArrayList (java.util.ArrayList)4 ItemChoiceWindowController (delta.games.lotro.gui.items.ItemChoiceWindowController)2 Item (delta.games.lotro.lore.items.Item)2 ComboBoxController (delta.common.ui.swing.combobox.ComboBoxController)1 ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)1 EQUIMENT_SLOT (delta.games.lotro.character.CharacterEquipment.EQUIMENT_SLOT)1 CharacterClass (delta.games.lotro.common.CharacterClass)1 Race (delta.games.lotro.common.Race)1 DeedDisplayWindowController (delta.games.lotro.gui.deed.form.DeedDisplayWindowController)1 ItemChoiceTableColumnsManager (delta.games.lotro.gui.items.ItemChoiceTableColumnsManager)1 ItemFilterConfiguration (delta.games.lotro.gui.items.ItemFilterConfiguration)1 ItemFilterController (delta.games.lotro.gui.items.ItemFilterController)1 DeedDescription (delta.games.lotro.lore.deeds.DeedDescription)1 ItemsManager (delta.games.lotro.lore.items.ItemsManager)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1