Before working with the Item Selector API, you should learn about its components. You’ll work with these components as you leverage the API in your apps:
-
Selection views: These are the framework’s key components. They show entities of particular types from different sources. For example, an Item Selector configured to show images might show selection views from Documents and Media, a third-party image provider, or a drag-and-drop UI.
-
Markup: A markup file that renders the selection view. You have a great deal of flexibility in the markup language you choose. For example, you can use a JSP, FreeMarker, or even pure HTML and JavaScript.
-
Return Type: A class that represents the type of information returned from the entities selected by the users. For example, if users select images and you want to return the selected image’s URL, then you need a URL return type class. Each return type class must implement the
ItemSelectorReturnType
interface. Such classes are named after the data they return and suffixed withItemSelectorReturnType
. For example, the URL return type class isURLItemSelectorReturnType
. -
Criterion: A class that represents the entity selected by the users. For example, if users select images then you need an image criterion class. Each criterion class must implement the
ItemSelectorCriterion
interface. Criterion classes are named for the entity they represent and suffixed withItemSelectorCriterion
. For example, the criterion class for images isImageItemSelectorCriterion
. -
Criterion Handler: A class that gets the appropriate selection view. Each criterion requires a criterion handler. Criterion handler classes extend the
BaseItemSelectorCriterionHandler
class with the criterion’s entity as a type argument. Criterion handler classes are named after the criterion’s entity and suffixed byItemSelectorCriterionHandler
. For example, the image criterion handler class isImageItemSelectorCriterionHandler
. It extendsBaseItemSelectorCriterionHandler<ImageItemSelectorCriterion>
.
This diagram shows how these components interact to form a working API.
Related Topics
Selecting Entities Using an Item Selector