Search in sources :

Example 6 with FactionLevel

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();
}
Also used : FactionLevelStatus(delta.games.lotro.character.reputation.FactionLevelStatus) FactionLevel(delta.games.lotro.lore.reputation.FactionLevel) Faction(delta.games.lotro.lore.reputation.Faction)

Example 7 with FactionLevel

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;
}
Also used : Color(java.awt.Color) FactionLevel(delta.games.lotro.lore.reputation.FactionLevel)

Example 8 with FactionLevel

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));
}
Also used : Color(java.awt.Color) Dimension(java.awt.Dimension) FactionLevel(delta.games.lotro.lore.reputation.FactionLevel)

Example 9 with FactionLevel

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);
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) FactionLevelStatus(delta.games.lotro.character.reputation.FactionLevelStatus) FactionLevel(delta.games.lotro.lore.reputation.FactionLevel) Faction(delta.games.lotro.lore.reputation.Faction)

Aggregations

FactionLevel (delta.games.lotro.lore.reputation.FactionLevel)9 Faction (delta.games.lotro.lore.reputation.Faction)6 FactionLevelStatus (delta.games.lotro.character.reputation.FactionLevelStatus)3 Color (java.awt.Color)3 CheckboxController (delta.common.ui.swing.checkbox.CheckboxController)1 DateEditionController (delta.common.ui.swing.text.dates.DateEditionController)1 DateListener (delta.common.ui.swing.text.dates.DateListener)1 FactionStatus (delta.games.lotro.character.reputation.FactionStatus)1 Dimension (java.awt.Dimension)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 Paint (java.awt.Paint)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 FieldPosition (java.text.FieldPosition)1 NumberFormat (java.text.NumberFormat)1 ParsePosition (java.text.ParsePosition)1 SimpleDateFormat (java.text.SimpleDateFormat)1 JCheckBox (javax.swing.JCheckBox)1