use of delta.games.lotro.gui.items.ItemChoiceTableColumnsManager 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;
}
Aggregations