use of delta.games.lotro.character.CharacterFile in project lotro-companion by dmorcellet.
the class ReputationSynopsisTableController method buildCharacterColumn.
private TableColumnController<Faction, FactionStatus> buildCharacterColumn(CharacterFile character) {
final CharacterFile toon = character;
CellDataProvider<Faction, FactionStatus> cell = new CellDataProvider<Faction, FactionStatus>() {
@Override
public FactionStatus getData(Faction item) {
ReputationStatus status = toon.getReputation();
return status.getOrCreateFactionStat(item);
}
};
String id = character.getIdentifier();
TableColumnController<Faction, FactionStatus> column = new TableColumnController<Faction, FactionStatus>(id, "Faction", FactionStatus.class, cell);
// Cell renderer
TableCellRenderer renderer = buildFactionStatusCellRenderer();
column.setCellRenderer(renderer);
// Header renderer
JPanel headerPanel = buildToonHeaderPanel(character);
TableCellRenderer headerRenderer = buildSimpleCellRenderer(headerPanel);
column.setHeaderCellRenderer(headerRenderer);
int minWidth = headerPanel.getPreferredSize().width;
column.setMinWidth(minWidth);
column.setPreferredWidth(minWidth);
// Comparator
final FactionLevelComparator factionLevelComparator = new FactionLevelComparator();
Comparator<FactionStatus> statsComparator = new Comparator<FactionStatus>() {
@Override
public int compare(FactionStatus data1, FactionStatus data2) {
return factionLevelComparator.compare(data1.getFactionLevel(), data2.getFactionLevel());
}
};
column.setComparator(statsComparator);
return column;
}
use of delta.games.lotro.character.CharacterFile in project lotro-companion by dmorcellet.
the class ReputationSynopsisTableController method setToons.
/**
* Set the displayed toons.
* @param toons Toons to display.
*/
public void setToons(List<CharacterFile> toons) {
for (CharacterFile toon : _toons) {
removeToon(toon);
}
_toons.clear();
_toons.addAll(toons);
for (CharacterFile toon : _toons) {
addToon(toon);
}
_table.updateColumns();
}
use of delta.games.lotro.character.CharacterFile in project lotro-companion by dmorcellet.
the class WarbandsPanelController method doChooseToons.
private void doChooseToons() {
CharactersManager manager = CharactersManager.getInstance();
List<CharacterFile> toons = manager.getAllToons();
List<CharacterFile> selectedToons = _tableController.getToons();
List<CharacterFile> enabledToons = new ArrayList<CharacterFile>();
for (CharacterFile toon : toons) {
if (toon.hasLog()) {
enabledToons.add(toon);
}
}
List<CharacterFile> newSelectedToons = CharactersChooserController.selectToons(_parent, enabledToons, selectedToons);
if (newSelectedToons != null) {
_tableController.refresh(newSelectedToons);
}
}
use of delta.games.lotro.character.CharacterFile in project lotro-companion by dmorcellet.
the class ReputationSynopsisPanelController method doChooseToons.
private void doChooseToons() {
CharactersManager manager = CharactersManager.getInstance();
List<CharacterFile> toons = manager.getAllToons();
List<CharacterFile> selectedToons = _tableController.getToons();
List<CharacterFile> newSelectedToons = CharactersChooserController.selectToons(_parent, toons, selectedToons);
if (newSelectedToons != null) {
_tableController.setToons(newSelectedToons);
}
}
use of delta.games.lotro.character.CharacterFile 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;
}
}
Aggregations