Crossfire JXClient, Trunk  R20561
ActiveSkillGaugeUpdater.java
Go to the documentation of this file.
1 /*
2  * This file is part of JXClient, the Fullscreen Java Crossfire Client.
3  *
4  * JXClient is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * JXClient is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with JXClient; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * Copyright (C) 2005-2008 Yann Chachkoff.
19  * Copyright (C) 2006-2011 Andreas Kirschbaum.
20  */
21 
22 package com.realtime.crossfire.jxclient.gui.gauge;
23 
27 import org.jetbrains.annotations.NotNull;
28 
33 public class ActiveSkillGaugeUpdater extends GaugeUpdater {
34 
38  @NotNull
39  private final String skill;
40 
44  @NotNull
45  private final Stats stats;
46 
50  @NotNull
51  private final StatsListener statsListener = new StatsListener() {
52 
53  @Override
54  public void reset() {
55  // ignore
56  }
57 
58  @Override
59  public void statChanged(final int statNo, final int value) {
60  // ignore
61  }
62 
63  @Override
64  public void simpleWeaponSpeedChanged(final boolean simpleWeaponSpeed) {
65  // ignore
66  }
67 
68  @Override
69  public void titleChanged(@NotNull final String title) {
70  // ignore
71  }
72 
73  @Override
74  public void rangeChanged(@NotNull final String range) {
75  // ignore
76  }
77 
78  @Override
79  public void activeSkillChanged(@NotNull final String activeSkill) {
80  setValues(activeSkill.equals(skill) ? 1 : 0, 0, 1);
81  }
82 
83  @Override
84  public void experienceChanged(final long exp) {
85  // ignore
86  }
87 
88  @Override
89  public void experienceNextLevelChanged(final long expNextLevel) {
90  // ignore
91  }
92 
93  };
94 
101  public ActiveSkillGaugeUpdater(@NotNull final ExperienceTable experienceTable, @NotNull final String skill, @NotNull final Stats stats) {
102  super(experienceTable, false);
103  this.skill = skill;
104  this.stats = stats;
105  this.stats.addCrossfireStatsListener(statsListener);
106  }
107 
111  @Override
112  public void dispose() {
113  stats.removeCrossfireStatsListener(statsListener);
114  }
115 
116 }
void removeCrossfireStatsListener(@NotNull final StatsListener statsListener)
Removes a StatsListener to be notified about stat changes.
Definition: Stats.java:778
void addCrossfireStatsListener(@NotNull final StatsListener statsListener)
Adds a StatsListener to be notified about stat changes.
Definition: Stats.java:770
ActiveSkillGaugeUpdater(@NotNull final ExperienceTable experienceTable, @NotNull final String skill, @NotNull final Stats stats)
Creates a new instance.
final ExperienceTable experienceTable
The experience table to query.
final StatsListener statsListener
The StatsListener registered to be notified about stat changes.
Interface for listeners interested in changes of Stats instances.
Updates the displayed values in a GUIGauge.
void setValues(final int curValue, final int minValue, final int maxValue)
Updates the gauge values.
This is the representation of all the statistics of a player, like its speed or its experience...
Definition: Stats.java:43