net.ctdp.rfdynhud.util
Class ConfigurationLoader

java.lang.Object
  extended by net.ctdp.rfdynhud.util.ConfigurationLoader
All Implemented Interfaces:
PropertyLoader

public class ConfigurationLoader
extends java.lang.Object
implements PropertyLoader

This utility class servs to load HUD configuration files.

Author:
Marvin Froehlich (CTDP)

Constructor Summary
ConfigurationLoader(WidgetsConfiguration.ConfigurationLoadListener loadListener)
           
 
Method Summary
 void clearConfiguration(WidgetsConfiguration widgetsConfig, LiveGameData gameData, boolean isEditorMode)
          Loads fully configured Widgets to a WidgetsConfiguration.
 ConfigurationCandidatesIterator getCandidatesIterator()
           
 java.lang.String getCurrentKey()
          Gets the currently loaded property key.
 java.lang.String getCurrentValue()
          Gets the currently loaded property value.
 java.lang.String getKeyPrefix()
           
 java.lang.String getNoConfigFoundMessage()
           
 Version getSourceVersion()
          Gets the rfDynHUD version, the source file was written by.
 boolean isDefaultLoadingEnabled()
           
 void loadConfiguration(java.io.InputStream in, java.lang.String name, WidgetsConfiguration widgetsConfig, LiveGameData gameData, boolean isEditorMode)
          Loads fully configured Widgets to a WidgetsConfiguration.
 boolean loadProperty(Property property)
          Attempts to load the value into the passed property.
static int[] readDesignResolutionFromConfiguration(java.io.File file, boolean quietMode)
          Loads fully configured Widgets to a WidgetsConfiguration.
 void setCandidatesIterator(ConfigurationCandidatesIterator it)
           
 void setDefaultLoadingEnabled(boolean enabled)
           
 void setKeyPrefix(java.lang.String prefix)
           
 void setNoConfigFoundMessage(java.lang.String message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationLoader

public ConfigurationLoader(WidgetsConfiguration.ConfigurationLoadListener loadListener)
Method Detail

setCandidatesIterator

public void setCandidatesIterator(ConfigurationCandidatesIterator it)

getCandidatesIterator

public final ConfigurationCandidatesIterator getCandidatesIterator()

setDefaultLoadingEnabled

public void setDefaultLoadingEnabled(boolean enabled)

isDefaultLoadingEnabled

public final boolean isDefaultLoadingEnabled()

setNoConfigFoundMessage

public void setNoConfigFoundMessage(java.lang.String message)

getNoConfigFoundMessage

public final java.lang.String getNoConfigFoundMessage()

setKeyPrefix

public void setKeyPrefix(java.lang.String prefix)

getKeyPrefix

public final java.lang.String getKeyPrefix()

getCurrentKey

public final java.lang.String getCurrentKey()
Description copied from interface: PropertyLoader
Gets the currently loaded property key.

Specified by:
getCurrentKey in interface PropertyLoader
Returns:
the currently loaded property key.

getCurrentValue

public final java.lang.String getCurrentValue()
Description copied from interface: PropertyLoader
Gets the currently loaded property value.

Specified by:
getCurrentValue in interface PropertyLoader
Returns:
the currently loaded property value.

getSourceVersion

public final Version getSourceVersion()
Description copied from interface: PropertyLoader
Gets the rfDynHUD version, the source file was written by.

Specified by:
getSourceVersion in interface PropertyLoader
Returns:
the rfDynHUD version, the source file was written by.

loadProperty

public boolean loadProperty(Property property)
Description copied from interface: PropertyLoader
Attempts to load the value into the passed property.

Specified by:
loadProperty in interface PropertyLoader
Returns:
true, if and only if the property accepted the key and value.

readDesignResolutionFromConfiguration

public static int[] readDesignResolutionFromConfiguration(java.io.File file,
                                                          boolean quietMode)
                                                   throws java.io.IOException
Loads fully configured Widgets to a WidgetsConfiguration.

Parameters:
file - the file to parse
quietMode - suppress warnings to the log?
Returns:
the design resolution as an int array or null.
Throws:
java.io.IOException - if anything went wrong.

clearConfiguration

public void clearConfiguration(WidgetsConfiguration widgetsConfig,
                               LiveGameData gameData,
                               boolean isEditorMode)
                        throws java.io.IOException
Loads fully configured Widgets to a WidgetsConfiguration.

Parameters:
widgetsConfig -
gameData -
isEditorMode -
Throws:
java.io.IOException - if anything went wrong.

loadConfiguration

public void loadConfiguration(java.io.InputStream in,
                              java.lang.String name,
                              WidgetsConfiguration widgetsConfig,
                              LiveGameData gameData,
                              boolean isEditorMode)
                       throws java.io.IOException
Loads fully configured Widgets to a WidgetsConfiguration.

Parameters:
in -
name -
widgetsConfig -
gameData -
isEditorMode -
Throws:
java.io.IOException - if anything went wrong.