Search in sources :

Example 16 with TypedProperties

use of delta.common.utils.misc.TypedProperties in project lotro-companion by dmorcellet.

the class EssenceChoice method chooseEssence.

/**
 * Choose an essence.
 * @param parent Parent controller.
 * @return An essence item or <code>null</code>.
 */
public static Item chooseEssence(WindowController parent) {
    List<Item> essences = ItemsManager.getInstance().getEssences();
    EssenceFilterController filterController = new EssenceFilterController(_filter);
    TypedProperties prefs = null;
    if (parent != null) {
        prefs = parent.getUserProperties(ItemChoiceWindowController.ESSENCE_CHOOSER_PROPERTIES_ID);
    }
    ItemChoiceWindowController choiceCtrl = new ItemChoiceWindowController(parent, prefs, essences, _filter, filterController);
    Item ret = choiceCtrl.editModal();
    return ret;
}
Also used : Item(delta.games.lotro.lore.items.Item) ItemChoiceWindowController(delta.games.lotro.gui.items.ItemChoiceWindowController) TypedProperties(delta.common.utils.misc.TypedProperties)

Example 17 with TypedProperties

use of delta.common.utils.misc.TypedProperties 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;
    }
}
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 18 with TypedProperties

use of delta.common.utils.misc.TypedProperties 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;
    }
}
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 19 with TypedProperties

use of delta.common.utils.misc.TypedProperties in project lotro-companion by dmorcellet.

the class NewToonDialogController method buildNewToonPanel.

private JPanel buildNewToonPanel() {
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    // Toon name
    _toonName = GuiFactory.buildTextField("");
    _toonName.setColumns(TOON_NAME_SIZE);
    // Server
    _server = CharacterUiUtils.buildServerCombo();
    TypedProperties props = Config.getInstance().getParameters();
    String defaultServer = props.getStringProperty("default.server", null);
    if (defaultServer != null) {
        _server.selectItem(defaultServer);
    }
    // Class
    _class = new CharacterClassController();
    // Race
    _race = CharacterUiUtils.buildRaceCombo(false);
    ItemSelectionListener<Race> listener = new ItemSelectionListener<Race>() {

        @Override
        public void itemSelected(Race race) {
            _class.setRace(race);
        }
    };
    _race.addListener(listener);
    // Sex
    _sex = CharacterUiUtils.buildSexCombo();
    Insets insets = new Insets(5, 5, 5, 5);
    GridBagConstraints gbc = new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, insets, 0, 0);
    panel.add(GuiFactory.buildLabel("Name:"), gbc);
    gbc.gridx = 0;
    gbc.gridy = 1;
    panel.add(GuiFactory.buildLabel("Server:"), gbc);
    gbc.gridx = 0;
    gbc.gridy = 2;
    panel.add(GuiFactory.buildLabel("Race:"), gbc);
    gbc.gridx = 0;
    gbc.gridy = 3;
    panel.add(GuiFactory.buildLabel("Class:"), gbc);
    gbc.gridx = 0;
    gbc.gridy = 4;
    panel.add(GuiFactory.buildLabel("Sex:"), gbc);
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    panel.add(_toonName, gbc);
    gbc.gridx = 1;
    gbc.gridy = 1;
    panel.add(_server.getComboBox(), gbc);
    gbc.gridx = 1;
    gbc.gridy = 2;
    panel.add(_race.getComboBox(), gbc);
    gbc.gridx = 1;
    gbc.gridy = 3;
    panel.add(_class.getComboBoxController().getComboBox(), gbc);
    gbc.gridx = 1;
    gbc.gridy = 4;
    panel.add(_sex.getComboBox(), gbc);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ItemSelectionListener(delta.common.ui.swing.combobox.ItemSelectionListener) Race(delta.games.lotro.common.Race) 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