Search in sources :

Example 11 with TypedProperties

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

the class DeedsExplorerWindowController method initDeedsTable.

private void initDeedsTable() {
    TypedProperties prefs = GlobalPreferences.getGlobalProperties("DeedsExplorer");
    _tableController = new DeedsTableController(prefs, _filter);
    ActionListener al = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent event) {
            String action = event.getActionCommand();
            if (DeedsTableController.DOUBLE_CLICK.equals(action)) {
                DeedDescription deed = (DeedDescription) event.getSource();
                DeedDisplayWindowController window = new DeedDisplayWindowController(DeedsExplorerWindowController.this);
                window.setDeed(deed);
                window.show(false);
            }
        }
    };
    _tableController.addActionListener(al);
}
Also used : DeedDisplayWindowController(delta.games.lotro.gui.deed.form.DeedDisplayWindowController) DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) TypedProperties(delta.common.utils.misc.TypedProperties)

Example 12 with TypedProperties

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

the class CharacterUiUtils method buildServerCombo.

/**
 * Build a server combobox.
 * @return a server combobox.
 */
public static ComboBoxController<String> buildServerCombo() {
    ComboBoxController<String> ctrl = new ComboBoxController<String>();
    List<String> servers = Config.getInstance().getServerNames();
    for (String server : servers) {
        ctrl.addItem(server, server);
    }
    TypedProperties props = Config.getInstance().getParameters();
    String defaultServer = props.getStringProperty("default.server", null);
    ctrl.selectItem(defaultServer);
    return ctrl;
}
Also used : ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController) TypedProperties(delta.common.utils.misc.TypedProperties)

Example 13 with TypedProperties

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

the class DeedsManagementController method buildDeedsTable.

private DeedsTableController buildDeedsTable() {
    TypedProperties prefs = GlobalPreferences.getGlobalProperties("DeedsEditor");
    DeedsTableController tableController = new DeedsTableController(prefs, null);
    tableController.addActionListener(this);
    return tableController;
}
Also used : TypedProperties(delta.common.utils.misc.TypedProperties)

Example 14 with TypedProperties

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

the class EquipmentPanelController method chooseItem.

private Item chooseItem(EQUIMENT_SLOT slot, List<Item> items) {
    ItemsManager itemsManager = new ItemsManager(items);
    List<Item> selectedItems = itemsManager.getItems(_toonData, slot);
    ItemFilterConfiguration cfg = new ItemFilterConfiguration();
    cfg.initFromItems(selectedItems);
    ItemFilterController filterController = new ItemFilterController(cfg);
    Filter<Item> filter = filterController.getFilter();
    String id = ItemChoiceWindowController.ITEM_CHOOSER_PROPERTIES_ID + "#" + slot.name();
    TypedProperties props = _parentWindow.getUserProperties(id);
    ItemChoiceWindowController choiceCtrl = new ItemChoiceWindowController(_parentWindow, props, selectedItems, filter, filterController);
    Item ret = choiceCtrl.editModal();
    return ret;
}
Also used : JMenuItem(javax.swing.JMenuItem) Item(delta.games.lotro.lore.items.Item) ItemsManager(delta.games.lotro.lore.items.ItemsManager) ItemChoiceWindowController(delta.games.lotro.gui.items.ItemChoiceWindowController) ItemFilterController(delta.games.lotro.gui.items.ItemFilterController) TypedProperties(delta.common.utils.misc.TypedProperties) ItemFilterConfiguration(delta.games.lotro.gui.items.ItemFilterConfiguration)

Example 15 with TypedProperties

use of delta.common.utils.misc.TypedProperties 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;
}
Also used : EQUIMENT_SLOT(delta.games.lotro.character.CharacterEquipment.EQUIMENT_SLOT) ItemChoiceTableColumnsManager(delta.games.lotro.gui.items.ItemChoiceTableColumnsManager) List(java.util.List) TypedProperties(delta.common.utils.misc.TypedProperties) Preferences(delta.common.utils.misc.Preferences) CharacterClass(delta.games.lotro.common.CharacterClass)

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