com.realtime.crossfire.jxclient.gui.gauge
Class GaugeUpdater

java.lang.Object
  extended by com.realtime.crossfire.jxclient.gui.gauge.GaugeUpdater
Direct Known Subclasses:
ActiveSkillGaugeUpdater, SkillGaugeUpdater, StatGaugeUpdater

public abstract class GaugeUpdater
extends java.lang.Object

Updates the displayed values in a GUIGauge.


Field Summary
private  ExperienceTable experienceTable
          The experience table to query.
private  GUIGaugeListener gauge
          Set the gauge to update.
 
Constructor Summary
protected GaugeUpdater(ExperienceTable experienceTable)
          Creates a new instance.
 
Method Summary
abstract  void dispose()
          Frees allocated resources.
protected  long getExperienceToNextLevel(int level, long experience)
          Returns the experience needed to reach next level.
protected  int getPercentsToNextLevel(int level, long experience)
          Returns the experience fraction of the current level.
 void setGauge(GUIGaugeListener gauge)
          Sets the gauge to update.
protected  void setValues(int curValue, int minValue, int maxValue)
          Updates the gauge values.
protected  void setValues(int curValue, int minValue, int maxValue, java.lang.String labelText, java.lang.String tooltipText)
          Updates the gauge values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

experienceTable

@NotNull
private final ExperienceTable experienceTable
The experience table to query.


gauge

@Nullable
private GUIGaugeListener gauge
Set the gauge to update.

Constructor Detail

GaugeUpdater

protected GaugeUpdater(@NotNull
                       ExperienceTable experienceTable)
Creates a new instance.

Parameters:
experienceTable - the experience table to query
Method Detail

dispose

public abstract void dispose()
Frees allocated resources.


getExperienceToNextLevel

protected long getExperienceToNextLevel(int level,
                                        long experience)
Returns the experience needed to reach next level.

Parameters:
level - the level
experience - the experience
Returns:
the needed experience

getPercentsToNextLevel

protected int getPercentsToNextLevel(int level,
                                     long experience)
Returns the experience fraction of the current level.

Parameters:
level - the level
experience - the experience
Returns:
the fraction in percents

setGauge

public void setGauge(@NotNull
                     GUIGaugeListener gauge)
Sets the gauge to update.

Parameters:
gauge - the gauge

setValues

protected void setValues(int curValue,
                         int minValue,
                         int maxValue)
Updates the gauge values.

Parameters:
curValue - the current value
minValue - the minimum value
maxValue - the maximum value

setValues

protected void setValues(int curValue,
                         int minValue,
                         int maxValue,
                         @NotNull
                         java.lang.String labelText,
                         @NotNull
                         java.lang.String tooltipText)
Updates the gauge values.

Parameters:
curValue - the current value
minValue - the minimum value
maxValue - the maximum value
labelText - the text to draw on the gauge
tooltipText - the tooltip suffix