use of delta.games.lotro.lore.warbands.WarbandDefinition in project lotro-companion by dmorcellet.
the class WarbandsStats method dump.
/**
* Dump the contents of this object to the given stream.
* @param ps Output stream to use.
*/
public void dump(PrintStream ps) {
ps.println("Warbands statistics for [" + _name + "]:");
List<String> warbandNames = new ArrayList<String>(_stats.keySet());
Collections.sort(warbandNames);
WarbandsRegistry registry = WarbandsRegistry.getWarbandsRegistry();
for (String warbandName : warbandNames) {
WarbandDefinition warband = registry.getByName(warbandName);
WarbandStats stat = getWarbandStats(warband);
stat.dump(ps);
}
}
use of delta.games.lotro.lore.warbands.WarbandDefinition in project lotro-companion by dmorcellet.
the class WarbandsFilterController method getRegions.
private String[] getRegions() {
WarbandDefinition[] warbands = WarbandsRegistry.getWarbandsRegistry().getAllWarbands();
Set<String> regionsSets = new HashSet<String>();
for (WarbandDefinition warband : warbands) {
String region = warband.getRegion();
regionsSets.add(region);
}
List<String> regions = new ArrayList<String>(regionsSets);
Collections.sort(regions);
String[] ret = regions.toArray(new String[regions.size()]);
return ret;
}
use of delta.games.lotro.lore.warbands.WarbandDefinition in project lotro-companion by dmorcellet.
the class WarbandsTableController method buildWarbandColumn.
private TableColumnController<WarbandDefinition, WarbandDefinition> buildWarbandColumn() {
CellDataProvider<WarbandDefinition, WarbandDefinition> cell = new CellDataProvider<WarbandDefinition, WarbandDefinition>() {
@Override
public WarbandDefinition getData(WarbandDefinition item) {
return item;
}
};
TableColumnController<WarbandDefinition, WarbandDefinition> column = new TableColumnController<WarbandDefinition, WarbandDefinition>("Warbands", WarbandDefinition.class, cell);
// Init panels
int warbandColumnWidth = 0;
final HashMap<String, JPanel> warbandPanels = new HashMap<String, JPanel>();
WarbandsRegistry registry = WarbandsRegistry.getWarbandsRegistry();
WarbandDefinition[] warbands = registry.getAllWarbands();
for (WarbandDefinition warband : warbands) {
JPanel warbandPanel = buildWarbandPanel(warband);
warbandPanels.put(warband.getName(), warbandPanel);
// Column size
int width = warbandPanel.getPreferredSize().width;
warbandColumnWidth = Math.max(warbandColumnWidth, width);
}
column.setMinWidth(warbandColumnWidth + 10);
column.setPreferredWidth(warbandColumnWidth + 10);
// Cell renderer
TableCellRenderer renderer = buildWarbandCellRenderer(warbandPanels);
column.setCellRenderer(renderer);
// Header renderer
JPanel emptyHeaderPanel = GuiFactory.buildBackgroundPanel(new GridBagLayout());
TableCellRenderer headerRenderer = buildSimpleCellRenderer(emptyHeaderPanel);
column.setHeaderCellRenderer(headerRenderer);
// Comparator
Comparator<WarbandDefinition> warbandComparator = new Comparator<WarbandDefinition>() {
@Override
public int compare(WarbandDefinition w1, WarbandDefinition w2) {
String n1 = w1.getSafeShortName();
String n2 = w2.getSafeShortName();
return n1.compareTo(n2);
}
};
column.setComparator(warbandComparator);
return column;
}
use of delta.games.lotro.lore.warbands.WarbandDefinition in project lotro-companion by dmorcellet.
the class WarbandsTableController method buildDataProvider.
private DataProvider<WarbandDefinition> buildDataProvider() {
WarbandsRegistry registry = WarbandsRegistry.getWarbandsRegistry();
WarbandDefinition[] warbands = registry.getAllWarbands();
List<WarbandDefinition> warbandsList = Arrays.asList(warbands);
DataProvider<WarbandDefinition> ret = new ListDataProvider<WarbandDefinition>(warbandsList);
return ret;
}
Aggregations