public class SimpleChoiceCategory extends ChoiceCategory
ChoiceField
in a data object.Constructor and Description |
---|
SimpleChoiceCategory(java.lang.String name,
int keystoragelength) |
SimpleChoiceCategory(java.lang.String name,
int keystoragelength,
boolean pseudonumber) |
Modifier and Type | Method and Description |
---|---|
void |
addValue(ChoiceValue value)
adds a value to the choice category.
|
void |
generatetoFile(SourceGenerator sg,
Module module)
* generates the source of the choice category to a file
|
java.lang.String |
getDefinitionClass() |
int |
getDisplayLabelLength(int label)
This method checks what is the longest label in the choice values, and
returns that value, or the value of label length if higher
|
boolean |
isKeyPresent(java.lang.String key)
checks if a choice value with the given key is present
|
getKeyStorageLength, getParentModule, isPseudoNumber, setParentModule
changeName, cleanName, equals, getName
public SimpleChoiceCategory(java.lang.String name, int keystoragelength)
name
- has to be a unique name inside the package. It is
recommended to only put upper case and numbers. The
name should not start by a number.keystoragelength
- the storage length of the key in the database.
Storage code of {link
org.openlowcode.design.data.ChoiceValue} should be
smaller than the storage length of the key.public SimpleChoiceCategory(java.lang.String name, int keystoragelength, boolean pseudonumber)
name
- has to be a unique name inside the package. It is
recommended to only put upper case and numbers. The
name should not start by a number.keystoragelength
- the storage length of the key in the database.
Storage code of {link
org.openlowcode.design.data.ChoiceValue} should bepseudonumber
- true if all the values can be translated to a number,
either by specific setting or transforming the
display into an integer smaller than the storage
length of the key.public void addValue(ChoiceValue value)
value
- value to addpublic java.lang.String getDefinitionClass()
getDefinitionClass
in class ChoiceCategory
public void generatetoFile(SourceGenerator sg, Module module) throws java.io.IOException
ChoiceCategory
generatetoFile
in class ChoiceCategory
sg
- source generatormodule
- parent modulejava.io.IOException
- if anything nasty happens while writing the filepublic int getDisplayLabelLength(int label)
ChoiceCategory
getDisplayLabelLength
in class ChoiceCategory
label
- specifying the maximum of the labels of the choice values,
and the input length provided (typically for column title)public boolean isKeyPresent(java.lang.String key)
ChoiceCategory
isKeyPresent
in class ChoiceCategory
key
- the key