com.planet_ink.coffee_mud.Libraries.interfaces
Interface AbilityParameters.AbilityParmEditor

All Known Implementing Classes:
CMAbleParms.AbilityParmEditorImpl
Enclosing interface:
AbilityParameters

public static interface AbilityParameters.AbilityParmEditor

The main interface for the individual column editors. It's methods reflect both the different ways the parameters can be edited, and the different kinds of editors necessary to make it work.


Method Summary
 int appliesToClass(java.lang.Object o)
          Returns how much this editor applies as the appropriate editor to the given object.
 PairList<java.lang.String,java.lang.String> choices()
          Creates key/display pairs whose identity depends entirely on this editor.
 java.lang.String colHeader()
          The displayable name of this column.
 java.lang.String commandLinePrompt(MOB mob, java.lang.String oldVal, int[] showNumber, int showFlag)
          Presents the given mob player the official command line prompt for this editor and lets them enter a value or values before returning the final value as a result.
 boolean confirmValue(java.lang.String oldVal)
          Returns whether the given value constitutes a valid value for this editor.
 java.lang.String convertFromItem(ItemCraftor A, Item I)
          Createa a new value field from an item, given the specific craftor to which this editor was made.
 PairList<java.lang.String,java.lang.String> createChoices(java.util.Enumeration<? extends java.lang.Object> e)
          Creates key/display pairs from an enumeration of objects whose identity depends entirely on this editor.
 PairList<java.lang.String,java.lang.String> createChoices(java.lang.String[] S)
          Creates key/display pairs from a list of strings whose identity depends entirely on this editor.
 PairList<java.lang.String,java.lang.String> createChoices(java.util.Vector<? extends java.lang.Object> V)
          Creates key/display pairs from a list of objects whose identity depends entirely on this editor.
 java.lang.String defaultValue()
          The default value to use when no previous value is available.
 java.lang.String[] fakeUserInput(java.lang.String oldVal)
          Presents fake user input for testing.
 java.lang.String ID()
          The code-word/identifier for this editor.
 int maxColWidth()
          The maximum width to give this column when building a table This is a nominal value, so Integer.MAX_VALUE would be a good default.
 int minColWidth()
          The minimum width to give this column when building a table This is a nominal value, so 0 would be a good default.
 AbilityParameters.ParmType parmType()
          The general type of data being manipulated by the editor.
 java.lang.String prompt()
          The display prompt used for command line editors.
 java.lang.String webField(com.planet_ink.coffee_web.interfaces.HTTPRequest httpReq, java.util.Map<java.lang.String,java.lang.String> parms, java.lang.String oldVal, java.lang.String fieldName)
          Returns the html tag field, complete with current value, for this editor
 java.lang.String webTableField(com.planet_ink.coffee_web.interfaces.HTTPRequest httpReq, java.util.Map<java.lang.String,java.lang.String> parms, java.lang.String oldVal)
          The current web value of this field, sufficient to be put into the overview table showing the value of all the fields.
 java.lang.String webValue(com.planet_ink.coffee_web.interfaces.HTTPRequest httpReq, java.util.Map<java.lang.String,java.lang.String> parms, java.lang.String oldVal, java.lang.String fieldName)
          The current web value of this field, sufficient to be put into the VALUE field of a text or hidden tag.
 

Method Detail

ID

java.lang.String ID()
The code-word/identifier for this editor. Corresponds directly to the bits in the coded parameter string.

Returns:
code-word/identifier for this editor

parmType

AbilityParameters.ParmType parmType()
The general type of data being manipulated by the editor.

Returns:
general type of data being manipulated by the editor
See Also:
AbilityParameters.ParmType

createChoices

PairList<java.lang.String,java.lang.String> createChoices(java.util.Enumeration<? extends java.lang.Object> e)
Creates key/display pairs from an enumeration of objects whose identity depends entirely on this editor. It returns a pair list where the first entry is the actual returnable value, and the second is the user-enterable selectable display key.

Parameters:
e - the enumeration of objects to create choices from
Returns:
key/display pairs

createChoices

PairList<java.lang.String,java.lang.String> createChoices(java.util.Vector<? extends java.lang.Object> V)
Creates key/display pairs from a list of objects whose identity depends entirely on this editor. It returns a pair list where the first entry is the actual returnable value, and the second is the user-enterable selectable display key.

Parameters:
V - the list of objects to create choices from
Returns:
key/display pairs

createChoices

PairList<java.lang.String,java.lang.String> createChoices(java.lang.String[] S)
Creates key/display pairs from a list of strings whose identity depends entirely on this editor. It returns a pair list where the first entry is the actual returnable value, and the second is the user-enterable selectable display key. In this case, they would both be the same.

Parameters:
S - the array of strings to create choices from
Returns:
key/display pairs

choices

PairList<java.lang.String,java.lang.String> choices()
Creates key/display pairs whose identity depends entirely on this editor. It returns a pair list where the first entry is the actual returnable value, and the second is the user-enterable selectable display key.

Returns:
key/display pairs

appliesToClass

int appliesToClass(java.lang.Object o)
Returns how much this editor applies as the appropriate editor to the given object. A number less than 0 means it definitely doesn't apply. The higher the number, the more likely it is to be the correct edior.

Parameters:
o - the object to check and see if this is an editor of
Returns:
a number denoting how likely it is that this is the editor.

confirmValue

boolean confirmValue(java.lang.String oldVal)
Returns whether the given value constitutes a valid value for this editor.

Parameters:
oldVal - the data to check
Returns:
true if the value is acceptable, false otherwise

fakeUserInput

java.lang.String[] fakeUserInput(java.lang.String oldVal)
Presents fake user input for testing. The String array is the pre-parsed commands that a user would have entered to satisfy the prompt or prompts represented by this editor.

Parameters:
oldVal - the current value
Returns:
fake user input for testing

commandLinePrompt

java.lang.String commandLinePrompt(MOB mob,
                                   java.lang.String oldVal,
                                   int[] showNumber,
                                   int showFlag)
                                   throws java.io.IOException
Presents the given mob player the official command line prompt for this editor and lets them enter a value or values before returning the final value as a result.

Parameters:
mob - the player who is being prompted
oldVal - the old/previous value for this field
showNumber - the arbitrary number of this field 1, 2, 3..
showFlag - same as shownumber to edit, -1 to display, -999 to always edit
Returns:
the value entered by the user
Throws:
java.io.IOException - typically means a dropped carrier

colHeader

java.lang.String colHeader()
The displayable name of this column.

Returns:
displayable name of this column.

prompt

java.lang.String prompt()
The display prompt used for command line editors.

Returns:
display prompt used for command line editors.

defaultValue

java.lang.String defaultValue()
The default value to use when no previous value is available.

Returns:
default value to use when no previous value is available

webValue

java.lang.String webValue(com.planet_ink.coffee_web.interfaces.HTTPRequest httpReq,
                          java.util.Map<java.lang.String,java.lang.String> parms,
                          java.lang.String oldVal,
                          java.lang.String fieldName)
The current web value of this field, sufficient to be put into the VALUE field of a text or hidden tag.

Parameters:
httpReq - the request objects, containing access to url parameters
parms - the tag url parameters map
oldVal - the original previous value of this field
fieldName - the name of the field
Returns:
current web value of this field

webField

java.lang.String webField(com.planet_ink.coffee_web.interfaces.HTTPRequest httpReq,
                          java.util.Map<java.lang.String,java.lang.String> parms,
                          java.lang.String oldVal,
                          java.lang.String fieldName)
Returns the html tag field, complete with current value, for this editor

Parameters:
httpReq - the request objects, containing access to url parameters
parms - the tag url parameters map
oldVal - the original previous value of this field
fieldName - the name of the field
Returns:
the html tag field, complete with current value, for this editor

webTableField

java.lang.String webTableField(com.planet_ink.coffee_web.interfaces.HTTPRequest httpReq,
                               java.util.Map<java.lang.String,java.lang.String> parms,
                               java.lang.String oldVal)
The current web value of this field, sufficient to be put into the overview table showing the value of all the fields.

Parameters:
httpReq - the request objects, containing access to url parameters
parms - the tag url parameters map
oldVal - the original previous value of this field
Returns:
current web value of this field for an overview table

convertFromItem

java.lang.String convertFromItem(ItemCraftor A,
                                 Item I)
Createa a new value field from an item, given the specific craftor to which this editor was made.

Parameters:
A - the item craftor that this editor belongs to
I - the item to grab a field from
Returns:
the value from the item

maxColWidth

int maxColWidth()
The maximum width to give this column when building a table This is a nominal value, so Integer.MAX_VALUE would be a good default.

Returns:
maximum width to give this column when building a table

minColWidth

int minColWidth()
The minimum width to give this column when building a table This is a nominal value, so 0 would be a good default.

Returns:
minimum width to give this column when building a table