Package megameklab.util
Class CConfig
java.lang.Object
megameklab.util.CConfig
Class for Client's configuration.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic voidCreates a new Config file, and directories, if it is missing.static StringformatScale(double val, boolean showUnits) Applies the scale factor to a value and optionally adds the unit abbreviationstatic ColorgetBackgroundColor(String fieldName) static booleangetBooleanParam(String param) static <E extends Enum<E>>
EgetEnumParam(String key, Class<E> enumClass, E defaultVal) Return the enum value of a given config property.static ColorgetForegroundColor(String fieldName) static intgetIntParam(String param) Return the int value of a given config property.static intgetIntParam(String param, int defaultVal) Return the int value of a given config property.getMainUiWindowPosition(MenuBarOwner mainUi) getMainUiWindowSize(MenuBarOwner mainUi) static MekChassisArrangementgetNamedWindowSize(String name) Deprecated, for removal: This API element is subject to removal in a future version.static StringGet a config value.static StringGet a config value, with a default value to be used if the value is not found.static StringgetRecentFile(int recentFileNumber) static MMLStartUpstatic voidimportSettings(MenuBarOwner menuBarOwner, File settingsFile) Tries to import settings from the given properties file.static booleanstatic voidload()Loads the MegaMekLab configuration.static voidLoads the Config file.static voidstatic voidWrite the config file out to ./data/mwconfig.txt.static RSScalestatic <E extends Enum<E>>
voidsetEnumParam(String key, E value) Deprecated, for removal: This API element is subject to removal in a future version.static voidsetMostRecentFile(String newFile) static voidSet a config value.static voidwriteFileChooserSettings(JDialog dialog) static voidwriteForceBuildPosition(JFrame frame) static voidstatic voidwriteNamedWindowSize(String name, Window component) Deprecated, for removal: This API element is subject to removal in a future version.
-
Field Details
-
CONFIG_DIR
- See Also:
-
CONFIG_FILE
- See Also:
-
CONFIG_BACKUP_FILE
- See Also:
-
MISC_STARTUP
- See Also:
-
MISC_SUMMARY_FORMAT_TRO
- See Also:
-
MISC_SKIP_SAFETY_PROMPTS
- See Also:
-
MISC_APPLICATION_EXIT_PROMPT
- See Also:
-
MISC_MUL_OPEN_BEHAVIOUR
- See Also:
-
MISC_INCLUDE_LICENSE
- See Also:
-
GUI_PLAF
- See Also:
-
GUI_COLOR_WEAPONS
- See Also:
-
GUI_COLOR_AMMO
- See Also:
-
GUI_COLOR_EQUIPMENT
- See Also:
-
GUI_COLOR_SYSTEMS
- See Also:
-
GUI_COLOR_EMPTY
- See Also:
-
GUI_COLOR_NON_HITTABLE
- See Also:
-
GUI_FOREGROUND
- See Also:
-
GUI_BACKGROUND
- See Also:
-
GUI_FULLSCREEN
- See Also:
-
GUI_BM_MAIN_UI_WINDOW
- See Also:
-
GUI_CV_MAIN_UI_WINDOW
- See Also:
-
GUI_AS_MAIN_UI_WINDOW
- See Also:
-
GUI_SV_MAIN_UI_WINDOW
- See Also:
-
GUI_PM_MAIN_UI_WINDOW
- See Also:
-
GUI_BA_MAIN_UI_WINDOW
- See Also:
-
GUI_CI_MAIN_UI_WINDOW
- See Also:
-
GUI_DS_MAIN_UI_WINDOW
- See Also:
-
GUI_WS_MAIN_UI_WINDOW
- See Also:
-
GUI_HHW_MAIN_UI_WINDOW
- See Also:
-
GUI_TABBED_WINDOW
- See Also:
-
RECENT_FILE_COUNT
public static final int RECENT_FILE_COUNT- See Also:
-
FILE_RECENT_PREFIX
- See Also:
-
FILE_LAST_DIRECTORY
- See Also:
-
FILE_CHOOSER_WINDOW
- See Also:
-
FORCE_BUILD_WINDOW
- See Also:
-
TECH_PROGRESSION
- See Also:
-
TECH_USE_YEAR
- See Also:
-
TECH_YEAR
- See Also:
-
TECH_SHOW_FACTION
- See Also:
-
TECH_EXTINCT
- See Also:
-
TECH_UNOFFICIAL_NO_YEAR
- See Also:
-
RS_PAPER_SIZE
- See Also:
-
RS_COLOR
- See Also:
-
RS_HEAT_SCALE_MARKER
- See Also:
-
RS_ROW_SHADING
- See Also:
-
RS_FONT
- See Also:
-
RS_PROGRESS_BAR
- See Also:
-
RS_SHOW_QUIRKS
- See Also:
-
RS_SHOW_C3BV
- See Also:
-
RS_SHOW_PILOT_DATA
- See Also:
-
RS_SHOW_ERA
- See Also:
-
RS_SHOW_ROLE
- See Also:
-
RS_HEAT_PROFILE
- See Also:
-
RS_TAC_OPS_HEAT
- See Also:
-
RS_REFERENCE
- See Also:
-
RS_CONDENSED_REFERENCE
- See Also:
-
RS_SCALE_FACTOR
- See Also:
-
RS_SCALE_UNITS
- See Also:
-
RS_MEK_NAMES
- See Also:
-
RS_ARMOR_GROUPING
- See Also:
-
RS_FRAMELESS
- See Also:
-
RS_BOLD_TYPE
- See Also:
-
RS_DAMAGE
- See Also:
-
RS_DAMAGE_COLOR
- See Also:
-
RS_WEAPONS_ORDER
- See Also:
-
RS_MERGE_IDENTICAL_EQUIPMENT
- See Also:
-
RS_HIT_MOD
- See Also:
-
RS_INTRINSIC_PHYSICALS
- See Also:
-
RS_EXPLICIT_ZERO_MOD
- See Also:
-
RS_EXTRA_PHYSICALS
- See Also:
-
RS_FANCY_PIPS
- See Also:
-
RS_TAC_OPS_VEHICLE_EFFECTIVENESS
- See Also:
-
NAG_EQUIPMENT_CTRL_CLICK
- See Also:
-
NAG_IMPORT_SETTINGS
- See Also:
-
MEK_AUTOFILL
- See Also:
-
MEK_AUTO_SORT
- See Also:
-
MEK_AUTO_COMPACT
- See Also:
-
PQ_SINGLE_PRINT
- See Also:
-
PQ_ADJUSTED_BV
- See Also:
-
PQ_DAMAGE
- See Also:
-
PQ_SHOW_PILOT_DATA
- See Also:
-
-
Method Details
-
load
public static void load()Loads the MegaMekLab configuration. -
importSettings
Tries to import settings from the given properties file. When successful, also applies some of the settings and shows a popup message.- Parameters:
menuBarOwner- The MenuBar owner frame calling thissettingsFile- The file (should always be megameklab.properties in another MML install)
-
loadConfigFile
public static void loadConfigFile()Loads the Config file. -
ensureConfigFileExists
public static void ensureConfigFileExists()Creates a new Config file, and directories, if it is missing. -
getParam
Get a config value, with a default value to be used if the value is not found.- Parameters:
param- The keydefaultVal- The value to return if the entry is not found- Returns:
- The value associated with the key
-
getParam
Get a config value.- Parameters:
param- The key- Returns:
- The value associated with the key. If not found, an empty String is returned
-
setParam
Set a config value.- Parameters:
param- the name of the parametervalue- the value to set the parameter to
-
getIntParam
Return the int value of a given config property. Return the provided default value if the property is a non-number.- Parameters:
param- The parameter namedefaultVal- The value to return if the property does not exist or is not a valid string representation of the integer- Returns:
- The integer value of the property
-
getIntParam
Return the int value of a given config property. Return a 0 if the property is a non-number.- Parameters:
param- The parameter name- Returns:
- The integer value of the property
-
getEnumParam
Return the enum value of a given config property. -
setEnumParam
@Deprecated(since="0.51.0", forRemoval=true) public static <E extends Enum<E>> void setEnumParam(String key, E value) Deprecated, for removal: This API element is subject to removal in a future version.Set a config value to the name of the enum.- Parameters:
key- the name of the parametervalue- the value to set the parameter to
-
getBooleanParam
- Parameters:
param- the parameter's name- Returns:
- the boolean value of a given config property. Return a false if the property does not exist.
-
saveConfig
public static void saveConfig()Write the config file out to ./data/mwconfig.txt. -
getForegroundColor
-
getBackgroundColor
-
setMostRecentFile
-
getRecentFiles
-
scaleUnits
- Returns:
- The currently selected scale units for record sheet printing
-
formatScale
Applies the scale factor to a value and optionally adds the unit abbreviation- Parameters:
val- The base distance (standard hexes)showUnits- Whether to append the unit abbreviation- Returns:
- A String representation of the scaled value
-
getFileChooserSize
-
getFileChooserPosition
-
writeFileChooserSettings
-
getForceBuildPosition
-
writeForceBuildPosition
-
getMainUiWindowSize
-
getMainUiWindowPosition
-
getNamedWindowSize
@Deprecated(since="0.51.0", forRemoval=true) public static Optional<Dimension> getNamedWindowSize(String name) Deprecated, for removal: This API element is subject to removal in a future version. -
writeMainUiWindowSettings
-
writeNamedWindowSize
@Deprecated(since="0.51.0", forRemoval=true) public static void writeNamedWindowSize(String name, Window component) Deprecated, for removal: This API element is subject to removal in a future version. -
getRecentFile
-
getStartUpType
-
getMekNameArrangement
-
includeLicense
public static boolean includeLicense() -
resetWindowPositions
public static void resetWindowPositions()
-