ConForM.CoopnTools.CoKer
Class CoopnFlag

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.CoopnFlag
All Implemented Interfaces:
CoopnOption

public class CoopnFlag
extends java.lang.Object
implements CoopnOption

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

See Also:

Field Summary
protected  javax.swing.JCheckBox component
           
protected  boolean defaultValue
           
protected  java.lang.String helpText
           
protected  java.lang.String label
           
protected  int level
           
protected  java.lang.String name
           
protected  java.lang.String trigger
           
protected  java.lang.String triggerText
           
 
Fields inherited from interface ConForM.CoopnTools.CoKer.CoopnOption
ALL, BASIC, EXTENDED
 
Constructor Summary
CoopnFlag(java.lang.String trigger, int level, boolean defaultValue, CoopnEnvMgr envMgr)
          Creates a new flag with the default resource file.
CoopnFlag(java.lang.String trigger, int level, java.lang.String resource, boolean defaultValue, CoopnEnvMgr envMgr)
          Creates a new flag.
 
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, "get all items" for "-a".
 java.lang.String getLabel()
          Return the label of the option; for instance "all" for "-a".
 int getLevel()
          Get the level of the option.
 java.lang.String getName()
          Return the name of the option; for instance, "-a" for option "-a".
 
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

level

protected int level

defaultValue

protected boolean defaultValue

label

protected java.lang.String label

helpText

protected java.lang.String helpText

triggerText

protected java.lang.String triggerText

name

protected java.lang.String name

component

protected javax.swing.JCheckBox component
Constructor Detail

CoopnFlag

public CoopnFlag(java.lang.String trigger,
                 int level,
                 java.lang.String resource,
                 boolean defaultValue,
                 CoopnEnvMgr envMgr)
Creates a new flag.
Parameters:
trigger - the trigger text, for instance "a"
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

CoopnFlag

public CoopnFlag(java.lang.String trigger,
                 int level,
                 boolean defaultValue,
                 CoopnEnvMgr envMgr)
Creates a new flag with the default resource file.
Parameters:
trigger - the trigger text, for instance "a"
level - the level of option, one of ALL, BASIC or EXTENDED
defaultValue - the default value
envMgr - the associated environment manager
Method Detail

getName

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

getLabel

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

getHelpText

public java.lang.String getHelpText()
Return the help text associated to the option; for instance, "get all items" for "-a".
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.