use of delta.games.lotro.character.stats.contribs.StatContribution 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.character.stats.contribs.StatContribution 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