use of delta.games.lotro.character.CharacterFile in project lotro-companion by dmorcellet.
the class CraftingSynopsisPanelController 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 CraftingSynopsisTableController method buildRowHeaderColumn.
private TableColumnController<CraftingSynopsisItem, String> buildRowHeaderColumn() {
CellDataProvider<CraftingSynopsisItem, String> cell = new CellDataProvider<CraftingSynopsisItem, String>() {
@Override
public String getData(CraftingSynopsisItem item) {
CharacterFile character = item.getCharacter();
String name = character.getName();
return name;
}
};
TableColumnController<CraftingSynopsisItem, String> column = new TableColumnController<CraftingSynopsisItem, String>("Name", String.class, cell);
// Init widths
column.setMinWidth(100);
column.setPreferredWidth(150);
column.setMaxWidth(300);
// Header renderer
JPanel emptyHeaderPanel = GuiFactory.buildBackgroundPanel(new GridBagLayout());
TableCellRenderer headerRenderer = buildSimpleCellRenderer(emptyHeaderPanel);
column.setHeaderCellRenderer(headerRenderer);
// Cell renderer
TableCellRenderer renderer = buildCharacterNameCellRenderer();
column.setCellRenderer(renderer);
return column;
}
use of delta.games.lotro.character.CharacterFile 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;
}
}
use of delta.games.lotro.character.CharacterFile in project lotro-companion by dmorcellet.
the class CharacterLevelChartController method refresh.
/**
* Refresh chart data from the underlying statistics.
*/
public void refresh() {
XYSeriesCollection data = (XYSeriesCollection) _chart.getXYPlot().getDataset();
List<CharacterFile> newToons = _stats.getToonsList();
// Find added/removed toons
ArrayList<Integer> indexesToRemove = new ArrayList<Integer>();
HashSet<String> toonIDsToRemove = new HashSet<String>();
for (String toonID : _toonID2SeriesIndex.keySet()) {
CharacterFile foundToon = null;
for (CharacterFile toon : newToons) {
if (toonID.equals(toon.getIdentifier())) {
foundToon = toon;
break;
}
}
if (foundToon != null) {
newToons.remove(foundToon);
} else {
Integer index = _toonID2SeriesIndex.get(toonID);
indexesToRemove.add(index);
toonIDsToRemove.add(toonID);
}
}
// Remove no more used toons
for (String toonID : toonIDsToRemove) {
_toonID2SeriesIndex.remove(toonID);
}
Collections.sort(indexesToRemove);
for (int i = indexesToRemove.size() - 1; i >= 0; i--) {
int index = indexesToRemove.get(i).intValue();
data.removeSeries(index);
}
// Added new toons
for (CharacterFile toon : newToons) {
addSeriesForToon(data, toon);
String toonID = toon.getIdentifier();
setVisible(toonID, true);
}
}
use of delta.games.lotro.character.CharacterFile in project lotro-companion by dmorcellet.
the class CharacterLevelChartController method createDataset.
private XYSeriesCollection createDataset() {
XYSeriesCollection data = new XYSeriesCollection();
List<CharacterFile> toons = _stats.getToonsList();
for (CharacterFile toon : toons) {
addSeriesForToon(data, toon);
}
return data;
}
Aggregations