Class GaugeUpdater
- java.lang.Object
-
- com.realtime.crossfire.jxclient.gui.gauge.GaugeUpdater
-
- Direct Known Subclasses:
ActiveSkillGaugeUpdater,SkillGaugeUpdater,StatGaugeUpdater
public abstract class GaugeUpdater extends java.lang.ObjectUpdates the displayed values in aGUIGauge.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedGaugeUpdater(@NotNull ExperienceTable experienceTable, boolean hideIfEmpty)Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voiddispose()Frees allocated resources.protected longgetExperienceToNextLevel(int level, long experience)Returns the experience needed to reach next level.protected intgetPercentsToNextLevel(int level, long experience)Returns the experience fraction of the current level.voidsetGauge(@NotNull GUIGaugeListener gauge)Sets the gauge to update.protected voidsetValues(int curValue, int minValue, int maxValue)Updates the gauge values.protected voidsetValues(int curValue, int minValue, int maxValue, @NotNull java.lang.String labelText, @NotNull java.lang.String tooltipText)Updates the gauge values.
-
-
-
Constructor Detail
-
GaugeUpdater
protected GaugeUpdater(@NotNull @NotNull ExperienceTable experienceTable, boolean hideIfEmpty)Creates a new instance.- Parameters:
experienceTable- the experience table to queryhideIfEmpty- if true the gauge will be hidden if all values are 0
-
-
Method Detail
-
dispose
public abstract void dispose()
Frees allocated resources.
-
setGauge
public void setGauge(@NotNull @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 valueminValue- the minimum valuemaxValue- the maximum value
-
setValues
protected void setValues(int curValue, int minValue, int maxValue, @NotNull @NotNull java.lang.String labelText, @NotNull @NotNull java.lang.String tooltipText)Updates the gauge values.- Parameters:
curValue- the current valueminValue- the minimum valuemaxValue- the maximum valuelabelText- the text to draw on the gaugetooltipText- the tooltip suffix
-
getPercentsToNextLevel
protected int getPercentsToNextLevel(int level, long experience)Returns the experience fraction of the current level.- Parameters:
level- the levelexperience- the experience- Returns:
- the fraction in percents
-
getExperienceToNextLevel
protected long getExperienceToNextLevel(int level, long experience)Returns the experience needed to reach next level.- Parameters:
level- the levelexperience- the experience- Returns:
- the needed experience
-
-