public class LabelFieldValue extends java.lang.Object implements FieldValue
Item.getLabelValue(com.canto.cumulus.GUID)
to get this wrapper class object. You can then use Item.setLabelValue(com.canto.cumulus.GUID, LabelFieldValue)
to set the field value back into the item.Constructor and Description |
---|
LabelFieldValue(FieldDefinition fieldDefinition)
Creates a new instance for the given label field.
|
Modifier and Type | Method and Description |
---|---|
void |
clearValue()
Clear the field's value.
|
int |
getColor()
Get the color value for this label field value.
|
java.lang.String |
getDisplayString()
Return a string representation for the color of this label.
|
java.lang.String |
getDisplayString(java.util.Locale locale)
Return a string representation for the color of this label.
|
int |
getID()
Because a "Label" field is a value interpretation of a string list field this method allows you to get down to the ID of the string list value.
|
boolean |
hasValue()
Return whether this field has a value.
|
void |
setColor(int color)
Set the label field value from a color value.
|
void |
setFromDisplayString(java.util.Locale locale,
java.lang.String value)
Set the label field value from a string representation of the color.
|
void |
setFromDisplayString(java.lang.String value)
Set the label field value from a string representation of the color.
|
void |
setID(int enumID)
Because a "Label" field is a value interpretation of a string list field this method allows you to set the field value using the ID of the underlying
string list value.
|
java.lang.String |
toString()
Same as
getDisplayString() . |
public LabelFieldValue(FieldDefinition fieldDefinition)
fieldDefinition
- label fieldpublic boolean hasValue()
hasValue
in interface FieldValue
true
if the field has a value, false
otherwise.public void clearValue()
Item.save()
to
save this change back to the catalog.clearValue
in interface FieldValue
public java.lang.String getDisplayString()
getDisplayString
in interface FieldValue
public java.lang.String getDisplayString(java.util.Locale locale)
getDisplayString
in interface FieldValue
locale
- This parameter is not used.public void setFromDisplayString(java.lang.String value) throws InvalidArgumentException
Item.save()
to save this change back to the catalog. The string is formatted according to the HTML specification using
"#RRGGBB" where "RR" is the red, "GG" the green and "BB" the blue component in two hex digits each.setFromDisplayString
in interface FieldValue
value
- The display string to set the value from.InvalidArgumentException
- if the given string is not correct.public void setFromDisplayString(java.util.Locale locale, java.lang.String value) throws InvalidArgumentException
Item.save()
to save this change back to the catalog. The string is formatted according to the HTML specification using
"#RRGGBB" where "RR" is the red, "GG" the green and "BB" the blue component in two hex digits each.setFromDisplayString
in interface FieldValue
locale
- This parameter is not used.value
- The display string to set the value from.InvalidArgumentException
- if the given string is not correct.public int getColor()
public void setColor(int color)
Item.save()
to save this change back to the catalog. The color value needs to match one of the possible values for this field in the
catalog.color
- The new color value of this label field value.public int getID()
public void setID(int enumID)
Item.save()
to save
this change back to the catalog. The ID does not correspond to the color value but identifies an entry in the string list.enumID
- The underlying string list ID value for this field value.public java.lang.String toString()
getDisplayString()
.toString
in class java.lang.Object
www.canto.com
Canto, the Canto logo, the Cumulus logo, and Cumulus are registered trademarks of Canto GmbH, registered in the U.S. and other countries.