ConForM.CoopnTools.CoKer
Class CoopnChoiceOption

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.CoopnChoiceOption
All Implemented Interfaces:
CoopnOption, CoopnParamOption

public class CoopnChoiceOption
extends java.lang.Object
implements CoopnParamOption

Choice options in CO-OPN tools environments. The values of these options may be given by decoding a specific option with parameter in the command line or by an apposite graphical dialog.

See Also:

Field Summary
protected  java.lang.String badOptionSText
           
protected  java.lang.String badOptionText
           
protected  javax.swing.JComboBox component
           
protected  int defaultValue
           
protected  java.io.PrintWriter errStream
           
protected  java.lang.String helpText
           
protected  java.lang.String label
           
protected  int level
           
protected  java.lang.String name
           
protected  java.lang.String paramText
           
protected  java.lang.String partialHelpText
           
protected  java.lang.String[] possibleValues
           
protected  java.lang.String trigger
           
protected  java.lang.String triggerText
           
 
Fields inherited from interface ConForM.CoopnTools.CoKer.CoopnOption
ALL, BASIC, EXTENDED
 
Constructor Summary
CoopnChoiceOption(java.lang.String trigger, java.lang.String[] possibleValues, int level, int defaultValue, CoopnEnvMgr envMgr)
          Creates a new choice option with the default resource file.
CoopnChoiceOption(java.lang.String trigger, java.lang.String[] possibleValues, int level, java.lang.String defaultValue, CoopnEnvMgr envMgr)
          Creates a new choice option with the default resource file.
CoopnChoiceOption(java.lang.String trigger, java.lang.String[] possibleValues, int level, java.lang.String resource, int defaultValue, CoopnEnvMgr envMgr)
          Creates a new choice option.
CoopnChoiceOption(java.lang.String trigger, java.lang.String[] possibleValues, int level, java.lang.String resource, java.lang.String defaultValue, CoopnEnvMgr envMgr)
          Creates a new choice option.
 
Method Summary
 boolean decodeCommandLine(java.util.List elements, java.util.Map decodedOptions)
          Decode the command line.
 boolean decodeDialog(java.util.Map decodedOptions)
          Decode the dialog component.
 javax.swing.JComponent getDialogComponent()
          Return the SWING component associated to the option; for instance, a checkbox in the case of "-a". there is one dialog component per flag object; multiple invocations to this method of the same object will return each time the same JComponent.
 java.lang.String getHelpText()
          Return the help text associated to the option; for instance, "specify the output file" for "-o file".
 java.lang.String getLabel()
          Return the label of the option; for instance "output file" for "-o file".
 int getLevel()
          Get the level of the option.
 java.lang.String getName()
          Return the name of the option; for instance, "-o file" for option "-o file".
 java.lang.String parameterText()
          Return the parameter text of the option; for instance, "file" for option "-o file".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

trigger

protected java.lang.String trigger

possibleValues

protected java.lang.String[] possibleValues

level

protected int level

defaultValue

protected int defaultValue

badOptionSText

protected java.lang.String badOptionSText

errStream

protected java.io.PrintWriter errStream

label

protected java.lang.String label

helpText

protected java.lang.String helpText

partialHelpText

protected java.lang.String partialHelpText

paramText

protected java.lang.String paramText

triggerText

protected java.lang.String triggerText

name

protected java.lang.String name

component

protected javax.swing.JComboBox component

badOptionText

protected java.lang.String badOptionText
Constructor Detail

CoopnChoiceOption

public CoopnChoiceOption(java.lang.String trigger,
                         java.lang.String[] possibleValues,
                         int level,
                         java.lang.String resource,
                         java.lang.String defaultValue,
                         CoopnEnvMgr envMgr)
Creates a new choice option.
Parameters:
trigger - the trigger text, for instance "locale"
possibleValues - an array of strings representing the possible values
level - the level of option, one of ALL, BASIC or EXTENDED
resource - the resource file for the trigger, or null for the default resource file; following string keys are serached: LABELx and HELPx, where x is the trigger
defaultValue - the default value
envMgr - the associated environment manager

CoopnChoiceOption

public CoopnChoiceOption(java.lang.String trigger,
                         java.lang.String[] possibleValues,
                         int level,
                         java.lang.String defaultValue,
                         CoopnEnvMgr envMgr)
Creates a new choice option with the default resource file.
Parameters:
trigger - the trigger text, for instance "a"
possibleValues - an array of strings representing the possible values
level - the level of option, one of ALL, BASIC or EXTENDED
defaultValue - the default value
envMgr - the associated environment manager

CoopnChoiceOption

public CoopnChoiceOption(java.lang.String trigger,
                         java.lang.String[] possibleValues,
                         int level,
                         java.lang.String resource,
                         int defaultValue,
                         CoopnEnvMgr envMgr)
Creates a new choice option.
Parameters:
trigger - the trigger text, for instance "locale"
possibleValues - an array of strings representing the possible values
level - the level of option, one of ALL, BASIC or EXTENDED
resource - the resource file for the trigger, or null for the default resource file; following string keys are serached: LABELx and HELPx, where x is the trigger
defaultValue - the default value, as an integer, index in the array of the possible choices
envMgr - the associated environment manager

CoopnChoiceOption

public CoopnChoiceOption(java.lang.String trigger,
                         java.lang.String[] possibleValues,
                         int level,
                         int defaultValue,
                         CoopnEnvMgr envMgr)
Creates a new choice option with the default resource file.
Parameters:
trigger - the trigger text, for instance "a"
possibleValues - an array of strings representing the possible values
level - the level of option, one of ALL, BASIC or EXTENDED
defaultValue - the default value, as an integer, index in the array of the possible choices
envMgr - the associated environment manager
Method Detail

parameterText

public java.lang.String parameterText()
Return the parameter text of the option; for instance, "file" for option "-o file".
Specified by:
parameterText in interface CoopnParamOption

getName

public java.lang.String getName()
Return the name of the option; for instance, "-o file" for option "-o file".
Specified by:
getName in interface CoopnOption

getLabel

public java.lang.String getLabel()
Return the label of the option; for instance "output file" for "-o file".
Specified by:
getLabel in interface CoopnOption

getHelpText

public java.lang.String getHelpText()
Return the help text associated to the option; for instance, "specify the output file" for "-o file".
Specified by:
getHelpText in interface CoopnOption

getDialogComponent

public javax.swing.JComponent getDialogComponent()
Return the SWING component associated to the option; for instance, a checkbox in the case of "-a". there is one dialog component per flag object; multiple invocations to this method of the same object will return each time the same JComponent.
Specified by:
getDialogComponent in interface CoopnOption

getLevel

public int getLevel()
Get the level of the option.
Specified by:
getLevel in interface CoopnOption

decodeCommandLine

public boolean decodeCommandLine(java.util.List elements,
                                 java.util.Map decodedOptions)
Decode the command line. The words of the command line are stored into a list; if the option is found in the command line, the associated elements are discarded form the list, and the association is put in a map
Specified by:
decodeCommandLine in interface CoopnOption
Parameters:
elements - A list of String
decodedOptions - The mapping of options
Returns:
false iff the option is found, but erroneous in the elements.

decodeDialog

public boolean decodeDialog(java.util.Map decodedOptions)
Decode the dialog component.
Specified by:
decodeDialog in interface CoopnOption
Returns:
false iff the option is found, but erroneous in the dialog.