public class CategoriesFieldValue extends java.lang.Object implements FieldValue
RecordItem.getCategoriesValue()
to get this wrapper class object. You can then use RecordItem.setCategoriesValue(CategoriesFieldValue)
to set the field value back into the item.
You can use the wrapper object from one RecordItem to save it to another RecordItem but both have to belong to the same catalog.Modifier and Type | Method and Description |
---|---|
void |
addID(int categoryID)
Add a single category assignment to the list.
|
void |
addIDs(java.util.Set<java.lang.Integer> categoryIDs)
Add category assignments to the list.
|
void |
clearValue()
Remove all category assignment.
|
java.lang.String |
getDisplayString()
Get a string to be displayed to the user.
|
java.lang.String |
getDisplayString(java.util.Locale locale)
Get a string to be displayed to the user.
|
java.util.Set<java.lang.Integer> |
getIDs()
Get the IDs of the assigned categories.
|
java.util.List<java.lang.Integer> |
getSortedIDs()
Get the IDs of the assigned categories sorted alphabetically by the category name.
|
boolean |
hasValue()
Return whether the record item has any categories assigned to it.
|
void |
removeID(int categoryID)
Remove one category assignment.
|
void |
removeIDs(java.util.Set<java.lang.Integer> categoryIDs)
Remove some category assignments.
|
void |
setFromDisplayString(java.util.Locale locale,
java.lang.String value)
This method is not supported for categories.
|
void |
setFromDisplayString(java.lang.String value)
This method is not supported for categories.
|
void |
setIDs(java.util.Set<java.lang.Integer> categoryIDs)
Set the list of assigned categories.
|
java.lang.String |
toString()
Return a string representation of the assigned categories.
|
public boolean hasValue()
hasValue
in interface FieldValue
true
if the record item has categories assigned, 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
setFromDisplayString
in interface FieldValue
value
- The display string to set the value from.InvalidArgumentException
- if the display string is not of the right format.public void setFromDisplayString(java.util.Locale locale, java.lang.String value) throws InvalidArgumentException
setFromDisplayString
in interface FieldValue
locale
- The locale to use for formatting and language selection.value
- The display string to set the value from.InvalidArgumentException
- if the display string is not of the right format.public java.util.Set<java.lang.Integer> getIDs()
public java.util.List<java.lang.Integer> getSortedIDs()
public void setIDs(java.util.Set<java.lang.Integer> categoryIDs) throws InvalidArgumentException
Item.save()
to save this change back to the catalog.categoryIDs
- The new assigned categories.InvalidArgumentException
- if one of the category IDs is invalid.public void addIDs(java.util.Set<java.lang.Integer> categoryIDs) throws InvalidArgumentException
Item.save()
to save this change back to the catalog.categoryIDs
- The IDs of the categories to be added to the list of assigned categories.InvalidArgumentException
- if one of the category IDs is invalid.public void addID(int categoryID) throws InvalidArgumentException
Item.save()
to save this change back to the catalog.categoryID
- The ID of the category to be added to the list of assigned categories.InvalidArgumentException
- if the category ID is invalid.public void removeID(int categoryID) throws InvalidArgumentException
Item.save()
to save this change back to the catalog.categoryID
- The ID of the category to be removed from the assignments.InvalidArgumentException
- if the category ID is invalid.public void removeIDs(java.util.Set<java.lang.Integer> categoryIDs) throws InvalidArgumentException
Item.save()
to save this change back to the catalog.categoryIDs
- The IDs of the categories to be removed from the assignments.InvalidArgumentException
- if one of the category IDs is invalid.public java.lang.String toString()
toString
in class java.lang.Object
getDisplayString()
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.