megamek.common.options
Class Option

java.lang.Object
  extended by megamek.common.options.Option
All Implemented Interfaces:
java.io.Serializable, IBasicOption, IOption, IOptionInfo

public class Option
extends java.lang.Object
implements IOption, java.io.Serializable

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface megamek.common.options.IOption
BOOLEAN, CHOICE, FLOAT, INTEGER, STRING
 
Constructor Summary
Option(IOptions owner, java.lang.String name, boolean defaultValue)
           
Option(IOptions owner, java.lang.String name, float defaultValue)
           
Option(IOptions owner, java.lang.String name, int defaultValue)
           
Option(IOptions owner, java.lang.String name, int type, java.lang.Object defaultValue)
           
Option(IOptions owner, java.lang.String name, java.lang.String defaultValue)
           
Option(IOptions owner, java.lang.String name, java.util.Vector<java.lang.String> defaultValue)
           
 
Method Summary
 boolean booleanValue()
          Return the value as the boolean
 void clearValue()
          Resets the value to its "default" state
 float floatValue()
          Return the value as the float
 java.lang.Object getDefault()
          Returns default option value
 java.lang.String getDescription()
          Return verbose description of the option suitable for context help, tip etc.
 java.lang.String getDisplayableName()
          Returns the user friendly name suitable for displaying in the options editor dialogs etc.
 java.lang.String getDisplayableNameWithValue()
          Returns the user friendly name suitable for displaying in cases where not only the Name but also it value is required (like edge).
 java.lang.String getName()
          Returns the option name
 IOptions getOwner()
          Returns this option container - GameOptions, PilotOptions etc
 int getTextFieldLength()
          returns the length of the textfield (how many characters).
 int getType()
          Returns option type.
 java.lang.Object getValue()
          Returns the option value
 int intValue()
          Return the value as the int
 boolean isLabelBeforeTextField()
          returns on which side of the text field the label is.
 void setValue(boolean value)
          Sets the boolean value
 void setValue(float value)
          Sets the float value
 void setValue(int value)
          Sets the int value
 void setValue(java.lang.Object value)
          Sets the value
 void setValue(java.lang.String value)
          Sets the String value
 java.lang.String stringValue()
          Return the value as the String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Option

public Option(IOptions owner,
              java.lang.String name,
              java.lang.String defaultValue)

Option

public Option(IOptions owner,
              java.lang.String name,
              boolean defaultValue)

Option

public Option(IOptions owner,
              java.lang.String name,
              int defaultValue)

Option

public Option(IOptions owner,
              java.lang.String name,
              float defaultValue)

Option

public Option(IOptions owner,
              java.lang.String name,
              java.util.Vector<java.lang.String> defaultValue)

Option

public Option(IOptions owner,
              java.lang.String name,
              int type,
              java.lang.Object defaultValue)
Method Detail

getOwner

public IOptions getOwner()
Description copied from interface: IOption
Returns this option container - GameOptions, PilotOptions etc

Specified by:
getOwner in interface IOption
Returns:
option container

getName

public java.lang.String getName()
Description copied from interface: IBasicOption
Returns the option name

Specified by:
getName in interface IBasicOption
Returns:
name of the option

getDisplayableNameWithValue

public java.lang.String getDisplayableNameWithValue()
Description copied from interface: IOptionInfo
Returns the user friendly name suitable for displaying in cases where not only the Name but also it value is required (like edge).

Specified by:
getDisplayableNameWithValue in interface IOptionInfo
Returns:
displayable name

getDisplayableName

public java.lang.String getDisplayableName()
Description copied from interface: IOptionInfo
Returns the user friendly name suitable for displaying in the options editor dialogs etc.

Specified by:
getDisplayableName in interface IOptionInfo
Returns:
displayable name

getDescription

public java.lang.String getDescription()
Description copied from interface: IOptionInfo
Return verbose description of the option suitable for context help, tip etc.

Specified by:
getDescription in interface IOptionInfo
Returns:
option description

getTextFieldLength

public int getTextFieldLength()
Description copied from interface: IOptionInfo
returns the length of the textfield (how many characters).

Specified by:
getTextFieldLength in interface IOptionInfo

isLabelBeforeTextField

public boolean isLabelBeforeTextField()
Description copied from interface: IOptionInfo
returns on which side of the text field the label is.

Specified by:
isLabelBeforeTextField in interface IOptionInfo

getType

public int getType()
Description copied from interface: IOption
Returns option type.

Specified by:
getType in interface IOption
Returns:
option type
See Also:
etc

getDefault

public java.lang.Object getDefault()
Description copied from interface: IOption
Returns default option value

Specified by:
getDefault in interface IOption
Returns:
default option value

getValue

public java.lang.Object getValue()
Description copied from interface: IBasicOption
Returns the option value

Specified by:
getValue in interface IBasicOption
Returns:
option value

booleanValue

public boolean booleanValue()
Description copied from interface: IOption
Return the value as the boolean

Specified by:
booleanValue in interface IOption

intValue

public int intValue()
Description copied from interface: IOption
Return the value as the int

Specified by:
intValue in interface IOption

floatValue

public float floatValue()
Description copied from interface: IOption
Return the value as the float

Specified by:
floatValue in interface IOption

stringValue

public java.lang.String stringValue()
Description copied from interface: IOption
Return the value as the String

Specified by:
stringValue in interface IOption

setValue

public void setValue(java.lang.Object value)
Description copied from interface: IOption
Sets the value

Specified by:
setValue in interface IOption
Parameters:
value - value to set

setValue

public void setValue(java.lang.String value)
Description copied from interface: IOption
Sets the String value

Specified by:
setValue in interface IOption
Parameters:
value - value to set

setValue

public void setValue(boolean value)
Description copied from interface: IOption
Sets the boolean value

Specified by:
setValue in interface IOption
Parameters:
value - value to set

setValue

public void setValue(int value)
Description copied from interface: IOption
Sets the int value

Specified by:
setValue in interface IOption
Parameters:
value - value to set

setValue

public void setValue(float value)
Description copied from interface: IOption
Sets the float value

Specified by:
setValue in interface IOption
Parameters:
value - value to set

clearValue

public void clearValue()
Description copied from interface: IOption
Resets the value to its "default" state

Specified by:
clearValue in interface IOption