use of delta.games.lotro.lore.reputation.FactionLevel in project lotro-companion by dmorcellet.
the class FactionStatusEditionPanelController method handleDateChange.
private void handleDateChange(DateEditionController source, long completionDate) {
int index = 0;
Faction faction = _status.getFaction();
for (FactionLevel level : faction.getLevels()) {
FactionLevelStatus status = _status.getStatusForLevel(level);
FactionLevelEditionGadgets proficiency = _gadgets.get(index);
if (source == proficiency.getCompletionDate()) {
status.setCompletionDate(completionDate);
}
index++;
}
triggerChartUpdateTimer();
}
use of delta.games.lotro.lore.reputation.FactionLevel in project lotro-companion by dmorcellet.
the class ReputationSynopsisTableController method getColorForFactionLevel.
private static Color getColorForFactionLevel(Faction faction, FactionLevel level) {
int index = level.getValue();
if (index == -1)
return Color.RED;
if (index == 0)
return Color.GRAY;
FactionLevel[] levels = faction.getLevels();
int max = levels[levels.length - 1].getValue();
if (max == 1)
return Color.GREEN;
// Gradient from orange to green
Color[] gradient = Gradients.getOrangeToGreen(max);
Color ret = null;
if (gradient != null) {
ret = gradient[index - 1];
} else {
ret = Color.WHITE;
}
return ret;
}
use of delta.games.lotro.lore.reputation.FactionLevel in project lotro-companion by dmorcellet.
the class ReputationSynopsisTableController method configureFactionLabel.
private static void configureFactionLabel(JLabel label, FactionStatus factionStatus) {
Color backgroundColor = null;
String text = "";
if (factionStatus != null) {
FactionLevel level = factionStatus.getFactionLevel();
backgroundColor = getColorForFactionLevel(factionStatus.getFaction(), level);
text = level.getName();
}
label.setForeground(Color.BLACK);
if (backgroundColor != null) {
label.setOpaque(true);
backgroundColor = new Color(backgroundColor.getRed(), backgroundColor.getGreen(), backgroundColor.getBlue(), 128);
label.setBackground(backgroundColor);
} else {
label.setOpaque(false);
}
label.setText(text);
label.setHorizontalAlignment(SwingConstants.CENTER);
Dimension preferredSize = label.getPreferredSize();
label.setMaximumSize(new Dimension(50, preferredSize.height));
}
use of delta.games.lotro.lore.reputation.FactionLevel in project lotro-companion by dmorcellet.
the class FactionHistoryChartController method updateData.
/**
* Update graph data.
*/
public void updateData() {
_data.removeAllSeries();
XYSeries series = new XYSeries("History");
Faction faction = _stats.getFaction();
FactionLevel[] levels = faction.getLevels();
for (FactionLevel level : levels) {
FactionLevelStatus levelStatus = _stats.getStatusForLevel(level);
if (levelStatus != null) {
boolean isCompleted = levelStatus.isCompleted();
if (isCompleted) {
long date = levelStatus.getCompletionDate();
if (date != 0) {
series.add(date, level.getValue());
}
}
}
}
_data.addSeries(series);
}
Aggregations