use of delta.games.lotro.utils.FixedDecimalsInteger in project lotro-companion by dmorcellet.
the class ItemChoiceTableController method buildStatColumn.
private TableColumnController<Item, FixedDecimalsInteger> buildStatColumn(final STAT stat) {
CellDataProvider<Item, FixedDecimalsInteger> statCell = new CellDataProvider<Item, FixedDecimalsInteger>() {
@Override
public FixedDecimalsInteger getData(Item item) {
BasicStatsSet stats = item.getStats();
FixedDecimalsInteger value = stats.getStat(stat);
return value;
}
};
TableColumnController<Item, FixedDecimalsInteger> statColumn = new TableColumnController<Item, FixedDecimalsInteger>(stat.name(), stat.getName(), FixedDecimalsInteger.class, statCell);
statColumn.setWidthSpecs(55, 55, 50);
return statColumn;
}
use of delta.games.lotro.utils.FixedDecimalsInteger in project lotro-companion by dmorcellet.
the class CharacterStatsSummaryPanelController method update.
/**
* Update contents.
*/
public void update() {
STAT[] stats = STAT.values();
int nbStats = stats.length;
for (int i = 0; i < nbStats; i++) {
String statValue = "";
if (_toon != null) {
BasicStatsSet characterStats = _toon.getStats();
FixedDecimalsInteger value = characterStats.getStat(stats[i]);
if (value != null) {
statValue = String.valueOf(value.intValue());
} else {
statValue = "-";
}
}
if (_statValues[i] != null) {
_statValues[i].setText(statValue);
}
}
DetailedCharacterStatsWindowController detailsStatsController = getDetailsController();
if (detailsStatsController != null) {
detailsStatsController.update();
}
StatContribsWindowController contribsController = getContribsController();
if (contribsController != null) {
contribsController.update();
}
}
use of delta.games.lotro.utils.FixedDecimalsInteger in project lotro-companion by dmorcellet.
the class StatsEditionPanelController method initFromStats.
/**
* Initialize the managed panel with the given stats.
* @param stats Stats to set.
*/
public void initFromStats(BasicStatsSet stats) {
_statControllers.clear();
for (STAT stat : STAT.values()) {
FixedDecimalsInteger value = stats.getStat(stat);
if (value != null) {
SingleStatController ctrl = new SingleStatController();
ctrl.setStat(stat, value);
_statControllers.add(ctrl);
}
}
if (_statControllers.size() == 0) {
addNewStatController();
}
updateUi();
}
use of delta.games.lotro.utils.FixedDecimalsInteger in project lotro-companion by dmorcellet.
the class StatContribsChartPanelController method setContributions.
/**
* Set the contributions to display.
* @param contribs Contributions to display.
*/
public void setContributions(ContribsByStat contribs) {
// Update data
_data.clear();
for (StatContribution contrib : contribs.getContribs()) {
String source = contrib.getSource().getLabel();
FixedDecimalsInteger value = contrib.getValue();
_data.setValue(source, value.doubleValue());
}
}
use of delta.games.lotro.utils.FixedDecimalsInteger in project lotro-companion by dmorcellet.
the class StatContribsPanelController method updateTotals.
private void updateTotals(ContribsByStat contribs, FixedDecimalsInteger expectedTotal) {
FixedDecimalsInteger total = new FixedDecimalsInteger();
List<StatContribution> statContribs = contribs.getContribs();
for (StatContribution statContrib : statContribs) {
total.add(statContrib.getValue());
}
int expected = (expectedTotal != null) ? expectedTotal.getInternalValue() : 0;
boolean positive = (expected >= 0);
int actual = total.getInternalValue();
boolean same = (actual == Math.abs(expected));
boolean isPercentage = _statChooser.getSelectedItem().isPercentage();
String totalStr = StatDisplayUtils.getStatDisplay(total, isPercentage);
if (!positive)
totalStr = "-" + totalStr;
String expectedTotalStr = StatDisplayUtils.getStatDisplay(expectedTotal, isPercentage);
String label = "Total: " + (same ? totalStr : totalStr + " / " + expectedTotalStr);
_totals.setText(label);
}
Aggregations