net.ctdp.rfdynhud.widgets.base.needlemeter
Class NeedleMeterWidget

java.lang.Object
  extended by net.ctdp.rfdynhud.widgets.base.widget.Widget
      extended by net.ctdp.rfdynhud.widgets.base.needlemeter.NeedleMeterWidget
All Implemented Interfaces:
java.lang.Cloneable, PropertiesKeeper
Direct Known Subclasses:
AbstractRevNeedleMeterWidget

public abstract class NeedleMeterWidget
extends Widget

The NeedleMeterWidget is an abstract Widget implementation for meter widgets with a needle on an analogue scale.

Author:
Marvin Froehlich (CTDP)

Field Summary
protected  BooleanProperty displayMarkerNumbers
           
protected  BooleanProperty displayMarkers
           
protected  BooleanProperty displayValue
           
protected  FactoredFloatProperty firstMarkerNumberOffset
           
protected  BooleanProperty lastMarkerBig
           
protected  FactoredFloatProperty lastMarkerNumberOffset
           
protected  BooleanProperty markerNumbersCentered
           
protected  BooleanProperty markerNumbersInside
           
protected  IntProperty markersBigStep
           
protected  ColorProperty markersColor
           
protected  FontProperty markersFont
           
protected  ColorProperty markersFontColor
           
protected  ColorProperty markersFontDropShadowColor
           
protected  IntProperty markersInnerRadius
           
protected  IntProperty markersLength
           
protected  BooleanProperty markersOnCircle
           
protected  IntProperty markersSmallStep
           
protected  FloatProperty maxValue
           
protected static float MIN_MAX_VALUE_NONE
           
protected  FloatProperty minValue
           
static int NEEDLE_LOCAL_Z_INDEX
           
protected  IntProperty needleMountX
           
protected  IntProperty needleMountY
           
protected  IntProperty needlePivotBottomOffset
           
protected  FactoredFloatProperty needleRotationForMaxValue
           
protected  FactoredFloatProperty needleRotationForMinValue
           
protected  ImageProperty valueBackgroundImageName
           
protected  FontProperty valueFont
           
protected  ColorProperty valueFontColor
           
protected  IntProperty valuePosX
           
protected  IntProperty valuePosY
           
 
Fields inherited from class net.ctdp.rfdynhud.widgets.base.widget.Widget
LOG_CHANNEL, NEEDED_DATA_ALL, NEEDED_DATA_SCORING, NEEDED_DATA_TELEMETRY
 
Constructor Summary
NeedleMeterWidget(WidgetSet widgetSet, WidgetPackage widgetPackage, float width, boolean widthPercent, float height, boolean heightPercent)
          Creates a new NeedleMeterWidget.
NeedleMeterWidget(WidgetSet widgetSet, WidgetPackage widgetPackage, float width, float height)
          Creates a new NeedleMeterWidget.
 
Method Summary
protected  void addMaxValuePropertyToContainer(PropertiesContainer propsCont, boolean forceAll)
          Adds the maxValue property to the container.
protected  void addMinValuePropertyToContainer(PropertiesContainer propsCont, boolean forceAll)
          Adds the minValue property to the container.
protected  boolean doRenderNeedle(LiveGameData gameData, boolean isEditorMode)
          Live-checks, whether the needle is to be rendered or not.
protected  void drawBackground(LiveGameData gameData, boolean isEditorMode, TextureImage2D texture, int offsetX, int offsetY, int width, int height, boolean isRoot)
          You can use this method to directly draw static content onto your Widget's background.
protected  void drawMarkers(LiveGameData gameData, boolean isEditorMode, Texture2DCanvas texCanvas, int offsetX, int offsetY, int width, int height)
          Draws the markers.
protected  void drawWidget(Clock clock, boolean needsCompleteRedraw, LiveGameData gameData, boolean isEditorMode, TextureImage2D texture, int offsetX, int offsetY, int width, int height)
          This method must contain the actual drawing code for this Widget.
protected  void getDigiValueProperties(PropertiesContainer propsCont, boolean forceAll)
          Collects the properties for the digital value.
protected  java.lang.String getDigiValuePropertiesGroupName()
          Gets the display name of the properties group for the digital value in the editor.
protected  boolean getDisplayMarkerNumbers()
           
protected  boolean getDisplayMarkers()
           
 boolean getDisplayValue()
           
protected  java.lang.String getInitialBackground()
          Gets the initial value for the background property.
protected  java.lang.String getInitialNeedleImage()
           
protected  java.awt.Color getMarkerColorForValue(LiveGameData gameData, boolean isEditorMode, int value, int minValue, int maxValue)
          Gets a certain marker's color at the given value.
protected abstract  java.lang.String getMarkerLabelForValue(LiveGameData gameData, boolean isEditorMode, float value)
          Gets the text label for the big markers at the given value.
protected  java.awt.Color getMarkerNumberColorForValue(LiveGameData gameData, boolean isEditorMode, int value, int minValue, int maxValue)
          Gets a certain marker number's color at the given value.
protected  boolean getMarkerNumbersInside()
           
protected  int getMarkersBigStepLowerLimit()
           
protected  int getMarkersInnerRadius()
           
protected  int getMarkersLength()
           
protected  boolean getMarkersOnCircle()
           
protected  void getMarkersProperties(PropertiesContainer propsCont, boolean forceAll)
          Collects the properties for the markers.
protected  int getMarkersSmallStepLowerLimit()
           
protected abstract  float getMaxDataValue(LiveGameData gameData, boolean isEditorMode)
          Gets the maximum value for the markers and needle coming from game data or known limits.
protected  float getMaxValue(LiveGameData gameData, boolean isEditorMode)
          Gets the maximum value for the markers and needle.
protected abstract  float getMinDataValue(LiveGameData gameData, boolean isEditorMode)
          Gets the minimum value for the markers and needle coming from game data or known limits.
protected  float getMinValue(LiveGameData gameData, boolean isEditorMode)
          Gets the minimum value for the markers and needle.
protected  ImageTemplate getNeedleImage()
           
protected  boolean getNeedleMayExceedMaximum()
          Gets, whether the needle may go beyond the getMaxValue(LiveGameData, boolean) result.
protected  boolean getNeedleMayExceedMinimum()
          Gets, whether the needle may go below the getMinValue(LiveGameData, boolean) result.
protected  int getNeedleMountX(int widgetWidth)
           
protected  int getNeedleMountY(int widgetHeight)
           
protected  int getNeedlePivotBottomOffset()
           
protected  void getNeedleProperties(PropertiesContainer propsCont, boolean forceAll)
          Collects the properties for the needle.
protected  float getNeedleRotationForMaxValue()
           
protected  float getNeedleRotationForMinValue()
           
protected  TransformableTexture getNeedleTexture()
           
 void getProperties(PropertiesContainer propsCont, boolean forceAll)
          Puts all editable properties to the editor.
protected  boolean getSpecificPropertiesFirst(PropertiesContainer propsCont, boolean forceAll)
          Collects the widget type specific properties before needle, markers and digi value.
protected abstract  float getValue(LiveGameData gameData, boolean isEditorMode)
          Gets the value for the needle and the digital value display.
protected  ImageTemplate getValueBackgroundImage()
           
protected  FontProperty getValueFont()
          Gets the FontProperty for the value.
protected  ColorProperty getValueFontColor()
          Gets the ColorProperty for the value.
protected  int getValueForValueDisplay(LiveGameData gameData, boolean isEditorMode)
          Gets the value for the digital value display.
protected  int getValuePosX()
           
protected  int getValuePosY()
           
protected  void initialize(LiveGameData gameData, boolean isEditorMode, DrawnStringFactory dsf, TextureImage2D texture, int width, int height)
          This method is called once to initialized DrawnStrings used on this Widget.
protected  void initParentProperties()
          This method is called as the last item in the constructor.
protected  void initSubTextures(LiveGameData gameData, boolean isEditorMode, int widgetInnerWidth, int widgetInnerHeight, SubTextureCollector collector)
          Gets the TransformableTextures, that this Widget keeps.
 void loadProperty(PropertyLoader loader)
          Loads (and parses) a certain property from a config file.
protected  void onBackgroundChanged(boolean imageChanged, float deltaScaleX, float deltaScaleY)
          This method is invoked when the background has changed.
 void onNeededDataComplete(LiveGameData gameData, boolean isEditorMode)
          This method is called when the needed data is available in realtime mode.
protected  void onNeedleImageNameChanged()
           
 void onPropertyChanged(Property property, java.lang.Object oldValue, java.lang.Object newValue)
          Invoked when a kept Property has changed.
 void onRealtimeEntered(LiveGameData gameData, boolean isEditorMode)
          This method is called when a the user entered realtime mode.
 void onVehicleSetupUpdated(LiveGameData gameData, boolean isEditorMode)
          This method is called when VehicleSetup has been updated.
 void prepareForMenuItem()
          This method is called by the editor before it draws the Widget to a menu item.
protected  void prepareMarkersBackground(LiveGameData gameData, boolean isEditorMode, Texture2DCanvas texCanvas, int offsetX, int offsetY, int width, int height, float innerRadius, float bigOuterRadius, float smallOuterRadius)
           
protected  void saveDigiValueProperties(PropertyWriter writer)
           
protected  void saveMarkersProperties(PropertyWriter writer)
           
protected  void saveNeedleProperties(PropertyWriter writer)
           
 void saveProperties(PropertyWriter writer)
          Saves all settings to the config file.
 void setDisplayValue(boolean display)
           
 
Methods inherited from class net.ctdp.rfdynhud.widgets.base.widget.Widget
addBackgroundPropertyToContainer, addBorderPropertyToContainer, addFontPropertiesToContainer, addPaddingPropertiesToContainer, addPositionAndSizePropertiesToContainer, addTypeAndNamePropertiesToContainer, addVisibilityPropertiesToContainer, afterConfigurationLoaded, bake, beforeConfigurationCleared, canHaveBackground, canHaveBorder, checkForChanges, clearBackgroundRegion, clearRegion, clearRegion, clone, cloneProperty, debug, debugCS, drawBorder, drawWidget, forceAndSetDirty, forceCompleteRedraw, forceReinitialization, getAbsoluteOffsetX, getAbsoluteOffsetY, getAutoVisibility, getBackground, getBackgroundProperty, getBorder, getBorderProperty, getConfiguration, getDefaultBorderValue, getDefaultNamedColorValue, getDefaultNamedFontValue, getDirtyFlag, getDocumentationSource, getDrawnStringFactory, getEffectiveHeight, getEffectiveWidth, getFont, getFontColor, getFontColorProperty, getFontProperty, getInnerSize, getInputActions, getInputVisibility, getMasterWidget, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getName, getNeededData, getNewInstanceForClone, getOffsetXToRootMasterWidget, getOffsetYToRootMasterWidget, getPaddingBottom, getPaddingLeft, getPaddingPropertyBottom, getPaddingPropertyLeft, getPaddingPropertyRight, getPaddingPropertyTop, getPaddingRight, getPaddingTop, getPosition, getPropertiesForParentGroup, getPropertiesIterator, getSize, getSubTextures, getUpdatedVisibility, getWidgetController, getWidgetPackage, getWidgetSet, getZIndex, hasBorder, hasFixedSize, hasMasterCanvas, hasText, isFontAntiAliased, isVisible, log, log, logCS, logCS, onBoundInputStateChanged, onCanvasSizeChanged, onCompleteRedrawForced, onDirtyFlagSet, onGarageEntered, onGarageExited, onLapStarted, onPitsEntered, onPitsExited, onPositionChanged, onRealtimeExited, onReinitializationForced, onScoringInfoUpdated, onSessionStarted, onSizeChanged, onTrackChanged, onVehicleControlChanged, onVisibilityChanged, setAllPosAndSizeToPercents, setAllPosAndSizeToPixels, setDirtyFlag, setName, setPadding, setWidgetController, setZIndex, updateVisibility, visibilityChangedSinceLastDraw
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEEDLE_LOCAL_Z_INDEX

public static final int NEEDLE_LOCAL_Z_INDEX
See Also:
Constant Field Values

MIN_MAX_VALUE_NONE

protected static final float MIN_MAX_VALUE_NONE
See Also:
Constant Field Values

minValue

protected final FloatProperty minValue

maxValue

protected final FloatProperty maxValue

displayMarkers

protected final BooleanProperty displayMarkers

displayMarkerNumbers

protected final BooleanProperty displayMarkerNumbers

markerNumbersInside

protected final BooleanProperty markerNumbersInside

markersInnerRadius

protected final IntProperty markersInnerRadius

markersLength

protected final IntProperty markersLength

markersOnCircle

protected final BooleanProperty markersOnCircle

firstMarkerNumberOffset

protected final FactoredFloatProperty firstMarkerNumberOffset

lastMarkerNumberOffset

protected final FactoredFloatProperty lastMarkerNumberOffset

markersBigStep

protected final IntProperty markersBigStep

markersSmallStep

protected final IntProperty markersSmallStep

lastMarkerBig

protected final BooleanProperty lastMarkerBig

markersColor

protected final ColorProperty markersColor

markersFont

protected final FontProperty markersFont

markersFontColor

protected final ColorProperty markersFontColor

markersFontDropShadowColor

protected final ColorProperty markersFontDropShadowColor

markerNumbersCentered

protected final BooleanProperty markerNumbersCentered

needleMountX

protected final IntProperty needleMountX

needleMountY

protected final IntProperty needleMountY

needlePivotBottomOffset

protected final IntProperty needlePivotBottomOffset

needleRotationForMinValue

protected final FactoredFloatProperty needleRotationForMinValue

needleRotationForMaxValue

protected final FactoredFloatProperty needleRotationForMaxValue

displayValue

protected final BooleanProperty displayValue

valueBackgroundImageName

protected final ImageProperty valueBackgroundImageName

valuePosX

protected final IntProperty valuePosX

valuePosY

protected final IntProperty valuePosY

valueFont

protected final FontProperty valueFont

valueFontColor

protected final ColorProperty valueFontColor
Constructor Detail

NeedleMeterWidget

public NeedleMeterWidget(WidgetSet widgetSet,
                         WidgetPackage widgetPackage,
                         float width,
                         boolean widthPercent,
                         float height,
                         boolean heightPercent)
Creates a new NeedleMeterWidget.

Parameters:
widgetSet - the WidgetSet this Widget belongs to
widgetPackage - the package in the editor
width - negative numbers for (screen_width - width)
widthPercent - width parameter treated as percents
height - negative numbers for (screen_height - height)
heightPercent - height parameter treated as percents

NeedleMeterWidget

public NeedleMeterWidget(WidgetSet widgetSet,
                         WidgetPackage widgetPackage,
                         float width,
                         float height)
Creates a new NeedleMeterWidget.

Parameters:
widgetSet - the WidgetSet this Widget belongs to
widgetPackage - the package in the editor
width - negative numbers for (screen_width - width)
height - negative numbers for (screen_height - height)
Method Detail

getInitialBackground

protected java.lang.String getInitialBackground()
Description copied from class: Widget
Gets the initial value for the background property.

Overrides:
getInitialBackground in class Widget
Returns:
the initial value for the background property.

onBackgroundChanged

protected void onBackgroundChanged(boolean imageChanged,
                                   float deltaScaleX,
                                   float deltaScaleY)
Description copied from class: Widget
This method is invoked when the background has changed.

Overrides:
onBackgroundChanged in class Widget
Parameters:
imageChanged - whether the image has changed
deltaScaleX - the x-scale factor in as a difference between the old background image and the new one or -1 of no background image was selected
deltaScaleY - the y-scale factor in as a difference between the old background image and the new one or -1 of no background image was selected

getMarkersBigStepLowerLimit

protected int getMarkersBigStepLowerLimit()

getMarkersSmallStepLowerLimit

protected int getMarkersSmallStepLowerLimit()

onNeedleImageNameChanged

protected void onNeedleImageNameChanged()

getInitialNeedleImage

protected java.lang.String getInitialNeedleImage()

onPropertyChanged

public void onPropertyChanged(Property property,
                              java.lang.Object oldValue,
                              java.lang.Object newValue)
Description copied from class: Widget
Invoked when a kept Property has changed.

Specified by:
onPropertyChanged in interface PropertiesKeeper
Overrides:
onPropertyChanged in class Widget
Parameters:
property - the changed property
oldValue - the old value
newValue - the new value

setDisplayValue

public void setDisplayValue(boolean display)

getDisplayValue

public boolean getDisplayValue()

getDisplayMarkers

protected boolean getDisplayMarkers()

getDisplayMarkerNumbers

protected boolean getDisplayMarkerNumbers()

getMarkerNumbersInside

protected boolean getMarkerNumbersInside()

getMarkersInnerRadius

protected int getMarkersInnerRadius()

getMarkersLength

protected int getMarkersLength()

getMarkersOnCircle

protected boolean getMarkersOnCircle()

getNeedleImage

protected ImageTemplate getNeedleImage()

getNeedleTexture

protected final TransformableTexture getNeedleTexture()

getNeedlePivotBottomOffset

protected int getNeedlePivotBottomOffset()

getNeedleMountX

protected int getNeedleMountX(int widgetWidth)

getNeedleMountY

protected int getNeedleMountY(int widgetHeight)

getNeedleRotationForMinValue

protected float getNeedleRotationForMinValue()

getNeedleRotationForMaxValue

protected float getNeedleRotationForMaxValue()

getValueBackgroundImage

protected ImageTemplate getValueBackgroundImage()

getValuePosX

protected int getValuePosX()

getValuePosY

protected int getValuePosY()

getValueFont

protected FontProperty getValueFont()
Gets the FontProperty for the value.

Returns:
the FontProperty for the value.

getValueFontColor

protected ColorProperty getValueFontColor()
Gets the ColorProperty for the value.

Returns:
the ColorProperty for the value.

initSubTextures

protected void initSubTextures(LiveGameData gameData,
                               boolean isEditorMode,
                               int widgetInnerWidth,
                               int widgetInnerHeight,
                               SubTextureCollector collector)
Gets the TransformableTextures, that this Widget keeps.

Specified by:
initSubTextures in class Widget
Parameters:
gameData - the live game data
isEditorMode - rendering in the editor?
widgetInnerWidth - the total widget width excluding borders
widgetInnerHeight - the total widget height excluding borders
collector - the collector to collect all the sub textures

onRealtimeEntered

public void onRealtimeEntered(LiveGameData gameData,
                              boolean isEditorMode)
This method is called when a the user entered realtime mode. If your Widget needs some data to be drawn correctly, consider using Widget.onNeededDataComplete(LiveGameData, boolean).

Overrides:
onRealtimeEntered in class Widget
Parameters:
gameData - the live game data
isEditorMode - true, if the Editor is used for rendering instead of rFactor

onVehicleSetupUpdated

public void onVehicleSetupUpdated(LiveGameData gameData,
                                  boolean isEditorMode)
This method is called when VehicleSetup has been updated.

Overrides:
onVehicleSetupUpdated in class Widget
Parameters:
gameData - the live game data
isEditorMode - true, if the Editor is used for rendering instead of rFactor

onNeededDataComplete

public void onNeededDataComplete(LiveGameData gameData,
                                 boolean isEditorMode)
This method is called when the needed data is available in realtime mode.

Overrides:
onNeededDataComplete in class Widget
Parameters:
gameData - the live game data
isEditorMode - true, if the Editor is used for rendering instead of rFactor

initialize

protected void initialize(LiveGameData gameData,
                          boolean isEditorMode,
                          DrawnStringFactory dsf,
                          TextureImage2D texture,
                          int width,
                          int height)
This method is called once to initialized DrawnStrings used on this Widget.

Specified by:
initialize in class Widget
Parameters:
gameData - the live game data
isEditorMode - true, if the Editor is used for rendering instead of rFactor
dsf - a factory to get DrawnString instances from
texture - the texture image to draw on. Use TextureImage2D.getTextureCanvas() to retrieve the Texture2DCanvas for Graphics2D drawing.
width - the width on the texture
height - the height on the texture

getValue

protected abstract float getValue(LiveGameData gameData,
                                  boolean isEditorMode)
Gets the value for the needle and the digital value display. Override getValueForValueDisplay(LiveGameData, boolean) to use a different value for the digital value.

Parameters:
gameData -
isEditorMode -
Returns:
the value for the needle and the digital value display.

getValueForValueDisplay

protected int getValueForValueDisplay(LiveGameData gameData,
                                      boolean isEditorMode)
Gets the value for the digital value display. The default implementation simply gets the result of getValue(LiveGameData, boolean) and converts it to an int.

Parameters:
gameData -
isEditorMode -
Returns:
the value for the digital value display.

getMinDataValue

protected abstract float getMinDataValue(LiveGameData gameData,
                                         boolean isEditorMode)
Gets the minimum value for the markers and needle coming from game data or known limits.

Parameters:
gameData -
isEditorMode -
Returns:
the minimum value for the markers and needle.

getMaxDataValue

protected abstract float getMaxDataValue(LiveGameData gameData,
                                         boolean isEditorMode)
Gets the maximum value for the markers and needle coming from game data or known limits.

Parameters:
gameData -
isEditorMode -
Returns:
the maximum value for the markers and needle.

getMinValue

protected final float getMinValue(LiveGameData gameData,
                                  boolean isEditorMode)
Gets the minimum value for the markers and needle. If the minValue property is set to a valid value, the value is returned, otherwise the result of getMinDataValue(LiveGameData, boolean) is returned.

Parameters:
gameData -
isEditorMode -
Returns:
the minimum value for the markers and needle.

getMaxValue

protected final float getMaxValue(LiveGameData gameData,
                                  boolean isEditorMode)
Gets the maximum value for the markers and needle. If the maxValue property is set to a valid value, the value is returned, otherwise the result of getMaxDataValue(LiveGameData, boolean) is returned.

Parameters:
gameData -
isEditorMode -
Returns:
the maximum value for the markers and needle.

getNeedleMayExceedMinimum

protected boolean getNeedleMayExceedMinimum()
Gets, whether the needle may go below the getMinValue(LiveGameData, boolean) result. The default implementation returns false.

Returns:
whether the needle may go below the getMinValue(LiveGameData, boolean) result.

getNeedleMayExceedMaximum

protected boolean getNeedleMayExceedMaximum()
Gets, whether the needle may go beyond the getMaxValue(LiveGameData, boolean) result. The default implementation returns true.

Returns:
whether the needle may go beyond the getMaxValue(LiveGameData, boolean) result.

getMarkerLabelForValue

protected abstract java.lang.String getMarkerLabelForValue(LiveGameData gameData,
                                                           boolean isEditorMode,
                                                           float value)
Gets the text label for the big markers at the given value.

Parameters:
gameData -
isEditorMode -
value -
Returns:
the text label for the big markers at the given value.

prepareMarkersBackground

protected void prepareMarkersBackground(LiveGameData gameData,
                                        boolean isEditorMode,
                                        Texture2DCanvas texCanvas,
                                        int offsetX,
                                        int offsetY,
                                        int width,
                                        int height,
                                        float innerRadius,
                                        float bigOuterRadius,
                                        float smallOuterRadius)
Parameters:
gameData -
isEditorMode -
texCanvas -
offsetX -
offsetY -
width -
height -
innerRadius -
bigOuterRadius -
smallOuterRadius -

getMarkerColorForValue

protected java.awt.Color getMarkerColorForValue(LiveGameData gameData,
                                                boolean isEditorMode,
                                                int value,
                                                int minValue,
                                                int maxValue)
Gets a certain marker's color at the given value.

Parameters:
gameData -
isEditorMode -
value -
minValue -
maxValue -
Returns:
a certain marker's color at the given value.

getMarkerNumberColorForValue

protected java.awt.Color getMarkerNumberColorForValue(LiveGameData gameData,
                                                      boolean isEditorMode,
                                                      int value,
                                                      int minValue,
                                                      int maxValue)
Gets a certain marker number's color at the given value.

Parameters:
gameData -
isEditorMode -
value -
minValue -
maxValue -
Returns:
a certain marker's color at the given value.

drawMarkers

protected void drawMarkers(LiveGameData gameData,
                           boolean isEditorMode,
                           Texture2DCanvas texCanvas,
                           int offsetX,
                           int offsetY,
                           int width,
                           int height)
Draws the markers.

Parameters:
gameData -
isEditorMode -
texCanvas -
offsetX -
offsetY -
width -
height -

drawBackground

protected void drawBackground(LiveGameData gameData,
                              boolean isEditorMode,
                              TextureImage2D texture,
                              int offsetX,
                              int offsetY,
                              int width,
                              int height,
                              boolean isRoot)
Description copied from class: Widget
You can use this method to directly draw static content onto your Widget's background. Overriding this method makes the Widget use a background texture no matter, if the background is defined with a color only or an image.

Overrides:
drawBackground in class Widget
Parameters:
gameData - the live game data
isEditorMode - true, if the Editor is used for rendering instead of rFactor
texture - the texture image to draw on. Use TextureImage2D.getTextureCanvas() to retrieve the Texture2DCanvas for Graphics2D drawing.
offsetX - the x-offset on the drawing texture
offsetY - the y offset on the drawing texture
width - the width of the area on the drawing texture
height - the height of the area on the drawing texture
isRoot - if this is true, you can possibly clear your stuff onto the texture instead of drawing it.

doRenderNeedle

protected boolean doRenderNeedle(LiveGameData gameData,
                                 boolean isEditorMode)
Live-checks, whether the needle is to be rendered or not.

Parameters:
gameData -
isEditorMode -
Returns:
whether to render the needle or not.

drawWidget

protected void drawWidget(Clock clock,
                          boolean needsCompleteRedraw,
                          LiveGameData gameData,
                          boolean isEditorMode,
                          TextureImage2D texture,
                          int offsetX,
                          int offsetY,
                          int width,
                          int height)
Description copied from class: Widget
This method must contain the actual drawing code for this Widget.

Specified by:
drawWidget in class Widget
Parameters:
clock - this is a clock for very dynamic content, that needs smooth display. If 'needsCompleteRedraw' is true, clock1 is also true.
needsCompleteRedraw - whether this widget needs to be completely redrawn (true) or just the changed parts (false)
gameData - the live game data
isEditorMode - true, if the Editor is used for rendering instead of rFactor
texture - the texture image to draw on. Use TextureImage2D.getTextureCanvas() to retrieve the Texture2DCanvas for Graphics2D drawing.
offsetX - the x-offset on the texture
offsetY - the y-offset on the texture
width - the width on the texture
height - the height on the texture

saveMarkersProperties

protected void saveMarkersProperties(PropertyWriter writer)
                              throws java.io.IOException
Throws:
java.io.IOException

saveNeedleProperties

protected void saveNeedleProperties(PropertyWriter writer)
                             throws java.io.IOException
Throws:
java.io.IOException

saveDigiValueProperties

protected void saveDigiValueProperties(PropertyWriter writer)
                                throws java.io.IOException
Throws:
java.io.IOException

saveProperties

public void saveProperties(PropertyWriter writer)
                    throws java.io.IOException
Saves all settings to the config file.

Specified by:
saveProperties in interface PropertiesKeeper
Overrides:
saveProperties in class Widget
Parameters:
writer - the widgets configuration writer to write properties to
Throws:
java.io.IOException - if something went wrong

loadProperty

public void loadProperty(PropertyLoader loader)
Loads (and parses) a certain property from a config file.

Specified by:
loadProperty in interface PropertiesKeeper
Overrides:
loadProperty in class Widget
Parameters:
loader - the property loader to load properties from

addMinValuePropertyToContainer

protected void addMinValuePropertyToContainer(PropertiesContainer propsCont,
                                              boolean forceAll)
Adds the minValue property to the container.

Parameters:
propsCont - the container to add the properties to
forceAll - If true, all properties provided by this Widget must be added. If false, only the properties, that are relevant for the current Widget's situation have to be added, some can be ignored.

addMaxValuePropertyToContainer

protected void addMaxValuePropertyToContainer(PropertiesContainer propsCont,
                                              boolean forceAll)
Adds the maxValue property to the container.

Parameters:
propsCont - the container to add the properties to
forceAll - If true, all properties provided by this Widget must be added. If false, only the properties, that are relevant for the current Widget's situation have to be added, some can be ignored.

getSpecificPropertiesFirst

protected boolean getSpecificPropertiesFirst(PropertiesContainer propsCont,
                                             boolean forceAll)
Collects the widget type specific properties before needle, markers and digi value.

Parameters:
propsCont - the container to add the properties to
forceAll - If true, all properties provided by this Widget must be added. If false, only the properties, that are relevant for the current Widget's situation have to be added, some can be ignored.
Returns:
true, if the implementation has added a group, false otherwise.

getMarkersProperties

protected void getMarkersProperties(PropertiesContainer propsCont,
                                    boolean forceAll)
Collects the properties for the markers.

Parameters:
propsCont - the container to add the properties to
forceAll - If true, all properties provided by this Widget must be added. If false, only the properties, that are relevant for the current Widget's situation have to be added, some can be ignored.

getNeedleProperties

protected void getNeedleProperties(PropertiesContainer propsCont,
                                   boolean forceAll)
Collects the properties for the needle.

Parameters:
propsCont - the container to add the properties to
forceAll - If true, all properties provided by this Widget must be added. If false, only the properties, that are relevant for the current Widget's situation have to be added, some can be ignored.

getDigiValuePropertiesGroupName

protected java.lang.String getDigiValuePropertiesGroupName()
Gets the display name of the properties group for the digital value in the editor.

Returns:
the display name of the properties group for the digital value in the editor.

getDigiValueProperties

protected void getDigiValueProperties(PropertiesContainer propsCont,
                                      boolean forceAll)
Collects the properties for the digital value.

Parameters:
propsCont - the container to add the properties to
forceAll - If true, all properties provided by this Widget must be added. If false, only the properties, that are relevant for the current Widget's situation have to be added, some can be ignored.

getProperties

public void getProperties(PropertiesContainer propsCont,
                          boolean forceAll)
Puts all editable properties to the editor.

Specified by:
getProperties in interface PropertiesKeeper
Overrides:
getProperties in class Widget
Parameters:
propsCont - the container to add the properties to
forceAll - If true, all properties provided by this PropertiesKeeper must be added. If false, only the properties, that are relevant for the current PropertiesKeeper's situation have to be added, some can be ignored.

initParentProperties

protected void initParentProperties()
This method is called as the last item in the constructor.


prepareForMenuItem

public void prepareForMenuItem()
This method is called by the editor before it draws the Widget to a menu item.

Overrides:
prepareForMenuItem in class Widget