use of delta.games.lotro.character.log.CharacterLogItem in project lotro-companion by dmorcellet.
the class CharacterLogTableController method buildTable.
private GenericTableController<CharacterLogItem> buildTable() {
DataProvider<CharacterLogItem> provider = new DataProvider<CharacterLogItem>() {
@Override
public CharacterLogItem getAt(int index) {
return _log.getLogItem(index);
}
@Override
public int getCount() {
return _log.getNbItems();
}
};
GenericTableController<CharacterLogItem> table = new GenericTableController<CharacterLogItem>(provider);
// Date column
{
CellDataProvider<CharacterLogItem, Date> dateCell = new CellDataProvider<CharacterLogItem, Date>() {
@Override
public Date getData(CharacterLogItem item) {
long timestamp = item.getDate();
return new Date(timestamp);
}
};
TableColumnController<CharacterLogItem, Date> dateColumn = new TableColumnController<CharacterLogItem, Date>("Date", Date.class, dateCell);
dateColumn.setWidthSpecs(100, 100, 50);
dateColumn.setCellRenderer(new DateRenderer(Formats.DATE_PATTERN));
table.addColumnController(dateColumn);
}
// Type column
{
CellDataProvider<CharacterLogItem, LogItemType> typeCell = new CellDataProvider<CharacterLogItem, LogItemType>() {
@Override
public LogItemType getData(CharacterLogItem item) {
return item.getLogItemType();
}
};
TableColumnController<CharacterLogItem, LogItemType> typeColumn = new TableColumnController<CharacterLogItem, LogItemType>("Type", LogItemType.class, typeCell);
typeColumn.setWidthSpecs(100, 100, 50);
typeColumn.setCellRenderer(new LogItemTypeRenderer());
typeColumn.setUseToString(Boolean.TRUE);
table.addColumnController(typeColumn);
}
// Label column
{
CellDataProvider<CharacterLogItem, String> labelCell = new CellDataProvider<CharacterLogItem, String>() {
@Override
public String getData(CharacterLogItem item) {
return item.getLabel();
}
};
TableColumnController<CharacterLogItem, String> labelColumn = new TableColumnController<CharacterLogItem, String>("Label", String.class, labelCell);
labelColumn.setWidthSpecs(150, -1, 150);
table.addColumnController(labelColumn);
}
return table;
}
use of delta.games.lotro.character.log.CharacterLogItem in project lotro-companion by dmorcellet.
the class QuestsCompletionStats method parseQuestItems.
private void parseQuestItems(List<CharacterLogItem> items) {
for (CharacterLogItem item : items) {
Integer id = item.getResourceIdentifier();
if (_expectedIds.contains(id)) {
Integer nb = _nbTimesPerQuest.get(id);
if (nb == null) {
nb = Integer.valueOf(1);
} else {
nb = Integer.valueOf(nb.intValue() + 1);
}
_nbTimesPerQuest.put(id, nb);
}
}
_nbQuestsDone = _nbTimesPerQuest.size();
}
use of delta.games.lotro.character.log.CharacterLogItem in project lotro-companion by dmorcellet.
the class QuestsCompletionStats method getQuestItems.
private List<CharacterLogItem> getQuestItems(CharacterLog log) {
List<CharacterLogItem> ret = new ArrayList<CharacterLogItem>();
int nb = log.getNbItems();
for (int i = 0; i < nb; i++) {
CharacterLogItem item = log.getLogItem(i);
if ((item != null) && (item.getLogItemType() == LogItemType.QUEST)) {
ret.add(item);
}
}
return ret;
}
use of delta.games.lotro.character.log.CharacterLogItem in project lotro-companion by dmorcellet.
the class VirtuesStats method getLogItems.
private List<CharacterLogItem> getLogItems(CharacterLog log, LogItemType type) {
List<CharacterLogItem> ret = new ArrayList<CharacterLogItem>();
int nb = log.getNbItems();
for (int i = 0; i < nb; i++) {
CharacterLogItem item = log.getLogItem(i);
if ((item != null) && (item.getLogItemType() == type)) {
ret.add(item);
}
}
return ret;
}
use of delta.games.lotro.character.log.CharacterLogItem in project lotro-companion by dmorcellet.
the class VirtuesStats method parseDeedItems.
private void parseDeedItems(List<CharacterLogItem> items) {
DeedsManager dm = DeedsManager.getInstance();
for (CharacterLogItem item : items) {
Integer id = item.getResourceIdentifier();
if (id != null) {
DeedDescription deed = dm.getDeed(id.intValue());
if (deed != null) {
Rewards rewards = deed.getRewards();
String name = deed.getName();
handleRewards("Deed:" + name, rewards);
}
}
}
}
Aggregations