use of delta.games.lotro.lore.warbands.WarbandsRegistry in project lotro-companion by dmorcellet.
the class WarbandsStats method parseItem.
private void parseItem(CharacterLogItem item) {
String label = item.getLabel();
String warbandName = label.substring(WARBAND_SEED.length()).trim();
long date = item.getDate();
WarbandsRegistry registry = WarbandsRegistry.getWarbandsRegistry();
WarbandDefinition warband = registry.getByName(warbandName);
if (warband == null) {
_logger.warn("Unknown warband [" + warbandName + "]. Ignored.");
} else {
WarbandStats stat = getWarbandStats(warband, true);
stat.add(date);
}
}
use of delta.games.lotro.lore.warbands.WarbandsRegistry 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.WarbandsRegistry 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.WarbandsRegistry 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;
}
use of delta.games.lotro.lore.warbands.WarbandsRegistry in project lotro-tools by dmorcellet.
the class WarbandsGenerator method doIt.
private void doIt() {
LotroCoreConfig cfg = LotroCoreConfig.getInstance();
File loreDir = cfg.getLoreDir();
File warbandsFile = new File(loreDir, "warbands.xml");
WarbandsRegistry r = buildRegistry();
WarbandsRegistryXMLWriter w = new WarbandsRegistryXMLWriter();
w.write(warbandsFile, r, EncodingNames.UTF_8);
}
Aggregations