Interface Component<C extends Component<C>>
-
- All Superinterfaces:
Comparable<C>
,Copyable<C>
,Serializable
- All Known Subinterfaces:
ActionGrid<G>
,ActionView<V>
,AugmentableView<V>
,BuilderFieldSource<D>
,CollapsibleGroup<G>
,Column<C>
,ConditionalColumn<C>
,ControlGroup<G>
,CreateEntityView<V>
,CustomAttributesGridField<F>
,DateColumn<C>
,DateField<F>
,Dependent<D>
,DerivedField<F>
,DerivedSelectField<F>
,DerivedUrlField<F>
,DynamicColumn<C>
,DynamicField<F>
,EmbeddedListColumn<C>
,EntityBrowseView<V>
,EntityFormView<V>
,EntityGridView<V>
,EntityView<V>
,EnumColumn<C>
,ExportGrid<G>
,ExportHistoryEntityGridView<V>
,ExportHistoryGrid<G>
,ExportHistoryGridExternal<E>
,External<E>
,FetchEntity<C>
,FetchGrid<G>
,Field<F>
,FieldArrayBlockField<F>
,FieldArrayField<F>
,FieldArrayGridField<F>
,FileInputField<F>
,Filterable<D>
,FilterableGrid<G>
,Form<F>
,FormComponent<C>
,FormView<V>
,Grid<G>
,GridExternal<E>
,GridView<V>
,Group<G>
,ImportGrid<G>
,InlineGroup<G>
,IntegerField<F>
,LinkColumn<C>
,LinkExternal<E>
,LinkGroup<G>
,LookupField<F>
,LookupFieldModal<V>
,MoneyColumn<C>
,MoneyField<F>
,Orderable<R>
,PageableFetch<C>
,PhoneField<F>
,Pollable<G>
,PreviewableView<V>
,ProgressColumn<C>
,QueryBuilderField<F>
,ResidentGridField<F>
,ResidentMapField<F>
,ResourceGrid<G>
,RuleBuilderField<F>
,Selectable<S>
,SelectField<F>
,SelectTargetEntityFormView<V>
,SelectTargetEntityGridView<V>
,SortableGrid<G>
,SpelRuleColumn<C>
,ThumbnailColumn<C>
,Trackable<T>
,Tree<T>
,TreeExternal<E>
,TreeGridView<V>
,TreeView<V>
,UpdateEntityView<V>
,View<V>
- All Known Implementing Classes:
AbstractColumn
,AbstractComponent
,AbstractExternal
,AbstractField
,AbstractFormComponent
,AbstractGroup
,AbstractSelectTargetEntityFormView
,AbstractView
,DefaultBasicGroup
,DefaultCollapsibleGroup
,DefaultColumn
,DefaultConditionalColumn
,DefaultControlGroup
,DefaultCreateEntityLongFormView
,DefaultCreateEntityView
,DefaultCustomAttributesGridField
,DefaultDateColumn
,DefaultDateField
,DefaultDerivedField
,DefaultDerivedSelectField
,DefaultDerivedUrlField
,DefaultDynamicColumn
,DefaultDynamicField
,DefaultEmbeddedListColumn
,DefaultEntityBrowseView
,DefaultEntityFormView
,DefaultEntityGridView
,DefaultEnumArrayColumn
,DefaultEnumColumn
,DefaultExportHistoryEntityGridView
,DefaultExportHistoryGridExternal
,DefaultExternal
,DefaultField
,DefaultFieldArrayBlockField
,DefaultFieldArrayGridField
,DefaultFileInputField
,DefaultFormView
,DefaultGridExternal
,DefaultGroup
,DefaultInlineGroup
,DefaultIntegerField
,DefaultLinkColumn
,DefaultLinkExternal
,DefaultLinkGroup
,DefaultLookupField
,DefaultLookupFieldModal
,DefaultMoneyColumn
,DefaultMoneyField
,DefaultPhoneField
,DefaultProgressColumn
,DefaultQueryBuilderField
,DefaultResidentGridField
,DefaultResidentMapField
,DefaultRuleBuilderField
,DefaultSelectField
,DefaultSelectTargetEntityGridView
,DefaultSpelRuleColumn
,DefaultThumbnailColumn
,DefaultTreeExternal
,DefaultTreeGridView
,DefaultTreeView
,DefaultUpdateEntityLongFormView
,DefaultUpdateEntityView
public interface Component<C extends Component<C>> extends Serializable, Comparable<C>, Copyable<C>
Represents the metadata of a component. Component metadata is interpreted by the client application in order to render a user interface. Metadata provides the application with configuration detailing how a component should look and behave.This specification is a representation of the most basic component metadata. There are many extensions of this base specification that include additional properties and helper methods to create a more guided experience when building various components.
There are several core extensions of this specification that represent distinct component classifications.
View
specifications are used for representing view components.Field
,External
, andGroup
specifications all extendFormComponent
and are used for representing different types of components rendered within forms. Various extensions of these core specifications exist that serve as a guide when creating metadata for more complicated components.- Author:
- Nick Crum (ncrum)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default C
addAction(Action<?> action)
Adds an action using the action's ID as the key.default C
addAction(String key, Action<?> action)
Adds an action at the given key.default C
addComponent(String key, Component<?> component)
Primary method of adding a child component.default C
addEndpoint(Endpoint<?> endpoint)
Adds the provided endpoint to this component.default C
addEndpoint(String type, Endpoint<?> endpoint)
Adds the provided endpoint with the given type to this component.default C
apply(Consumer<? super C> fn)
Executes the provided function with this component as an argument.default C
attribute(String key, Object value)
Adds an attributes with the provided key and value.default C
augmentationKey(String augmentationKey)
Sets the augmentation key of this component.default C
classifier(String classifier)
Sets the classifier of this component.default C
clearConditionals()
Clears the current conditions on this component.default C
clearEndpoints()
Clears the existing set of endpoints.default C
conditional(Conditional<?>... conditionals)
Adds one or more conditions to this component.default C
conditionals(List<Conditional<?>> conditionals)
Adds one or more conditions to this component.default C
description(InternationalizedMessage description)
Sets the description message for this component.default C
description(String descriptionKey)
Sets the description message key for this component.default Optional<Action<?>>
findAction(String key)
Finds the action at the given key.default Optional<Action<?>>
findAction(Predicate<Action<?>> predicate)
Retrieves a single action matching the given predicate.default List<Action<?>>
findActions(Predicate<Action<?>> predicate)
Retrieves a list of actions matching the given predicate.default Optional<Object>
findAttribute(String key)
Finds the attribute at the given key.default Optional<Component<?>>
findComponent(String key)
Finds the component stored at the given key.default Optional<Component<?>>
findComponent(Predicate<Component<?>> predicate)
Retrieves a single child component that matches the given predicate.default List<Component<?>>
findComponents(Predicate<Component<?>> predicate)
Retrieves a list of child components that match the given predicate.default Optional<Endpoint<?>>
findEndpoint(String type)
Finds the endpoint stored at the given type.default Optional<Endpoint<?>>
findEndpoint(Predicate<Endpoint<?>> predicate)
Retrieves a single endpoint matching the given predicate.default List<Endpoint<?>>
findEndpoints(Predicate<Endpoint<?>> predicate)
Retrieves a list of endpoints that match the given predicate.default Component<?>
get(String key)
Alias forgetComponent(String)
.default <T extends Component<T>>
Tget(String key, Class<T> clazz)
Alias forgetComponent(String, Class)
.default Action<?>
getAction(String key)
Returns the action at the provided key.default <T extends Action<T>>
TgetAction(String key, Class<T> clazz)
Returns the action at the provided key with the given type.Map<String,Action<?>>
getActions()
A key-value map of actions used for managing the actions of this component.default Collection<Action<?>>
getActionsList()
The serializable, sorted list of actions.default Object
getAttribute(String key)
Retrieves the attribute at the given key.default <A> A
getAttribute(String key, Class<A> clazz)
Retrieves the attribute at the given key and casts to the provided type.Map<String,Object>
getAttributes()
A key-value map used to provide additional metadata beyond the first-class properties.String
getAugmentationKey()
A unique identifier for the component within its full component tree.String
getClassifier()
An indicator of the class of components this component belongs to.default Component<?>
getComponent(String key)
Retrieves the component stored at the given key, if it exists.default <T extends Component<T>>
TgetComponent(String key, Class<T> clazz)
Retrieves the component of the provided type stored at the given key, if it exists.Map<String,Component<?>>
getComponents()
A key-value map of components used for managing the children components of this component.default Collection<Component<?>>
getComponentsList()
The serializable, sorted list of children components.List<Conditional<?>>
getConditionals()
A set of conditions used to indicate when this component should be rendered.InternationalizedMessage
getDescription()
A description used for display purposes.default Endpoint<?>
getEndpoint(String type)
Retrieves the endpoint at the given type, if it exists.default <T extends Endpoint<T>>
TgetEndpoint(String type, Class<T> clazz)
Retrieves the endpoint at the given key as the given type.Map<String,Endpoint<?>>
getEndpoints()
A key-value map of endpoints used for managing the endpoints of this component.default Collection<Endpoint<?>>
getEndpointsList()
The serializable list of endpoints.String
getId()
A unique identifier for the component among its siblings.InternationalizedMessage
getLabel()
A label used for display purposes.Integer
getOrder()
The absolute ordering of this component among its siblings.String
getScope()
The resource scope necessary for this component.String
getType()
An indicator of the type of this component.default boolean
hasAction(String key)
Returns whether or not an action exists at the given key.default boolean
hasAttribute(String key)
Returns whether or not the attribute at the given key exists.default boolean
hasComponent(String key)
Returns whether or not a child is stored at the given key.default boolean
hasEndpoint(String key)
Returns whether or not an endpoint exists at the given key.default C
id(String id)
Sets the id of this component.default boolean
isAugmentable()
Whether or not the component is able to be augmented.boolean
isTranslatable()
Whether or not this component deals with translatable data.default C
label(InternationalizedMessage label)
Sets the label message for this component.default C
label(String labelKey)
Sets the label message key for this component.default C
notTranslatable()
Sets this component as not translatable.default C
order(Integer order)
Sets the order for this component.default C
removeAction(String key)
Removes the action at the given key.default C
removeAttribute(String key)
Removes the attributes at the given key.default C
removeComponent(String key)
Removes the component at the given key.default C
removeEndpoint(String type)
Removes the endpoint with the given type.default C
scope(String scope)
Sets the scope for this component.default C
self()
Used internally to grab this component casted toComponent
.void
setActions(Map<String,Action<?>> actions)
void
setAttributes(Map<String,Object> attributes)
void
setAugmentationKey(String augmentationKey)
void
setClassifier(String classifier)
void
setComponents(Map<String,Component<?>> components)
void
setConditionals(List<Conditional<?>> conditionals)
void
setDescription(InternationalizedMessage description)
void
setEndpoints(Map<String,Endpoint<?>> endpoints)
void
setId(String id)
void
setLabel(InternationalizedMessage label)
void
setOrder(Integer order)
void
setScope(String scope)
void
setTranslatable(boolean translatable)
void
setType(String type)
default C
translatable()
Sets this component as translatable.default C
translatable(boolean translatable)
Sets whether or not the component is translatable.default C
type(String type)
Sets the type of this component.-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
getClassifier
@Nullable String getClassifier()
An indicator of the class of components this component belongs to. This is used to distinguish components that behave in similar ways within a context. For instance,Classifiers.FIELD
is used to distinguish fields from other form components, and fields have unique interactions available to them, such as interacting with the form state.- Returns:
- the classifier of the component
- See Also:
for a list of classifiers
-
getType
@Nullable String getType()
An indicator of the type of this component. This is used to target a specific component within a class of components. For instance, a type ofFieldTypes.STRING
for aClassifiers.FIELD
will result in a text input for managing a property.- Returns:
- the type of the component
-
getId
@Nullable String getId()
A unique identifier for the component among its siblings. Not necessarily globally unique.- Returns:
- the ID of the component
-
getAugmentationKey
@Nullable String getAugmentationKey()
A unique identifier for the component within its full component tree. Used for targeting augmentations.- Returns:
- the augmentation key
-
isAugmentable
default boolean isAugmentable()
Whether or not the component is able to be augmented. True if the augmentation key is present.- Returns:
- whether or not augmentable
-
getDescription
@Nullable InternationalizedMessage getDescription()
A description used for display purposes.- Returns:
- the description
-
getLabel
@Nullable InternationalizedMessage getLabel()
A label used for display purposes.- Returns:
- the label
-
getOrder
@Nullable Integer getOrder()
The absolute ordering of this component among its siblings. If null, will be sorted last.- Returns:
- the order
-
getScope
@Nullable String getScope()
The resource scope necessary for this component. This is used by many components in order to gate access based on the resource scopes a user has access to.- Returns:
- the scope
-
isTranslatable
boolean isTranslatable()
Whether or not this component deals with translatable data. The meaning of this field varies between classes of components and types of components.- Returns:
- whether or not translatable
-
getConditionals
List<Conditional<?>> getConditionals()
A set of conditions used to indicate when this component should be rendered. This is most commonly used by form components to hide/show fields and grids depending on the form state.- Returns:
- the set of conditionals
-
getAttributes
Map<String,Object> getAttributes()
A key-value map used to provide additional metadata beyond the first-class properties.- Returns:
- the attributes map
-
getComponents
Map<String,Component<?>> getComponents()
A key-value map of components used for managing the children components of this component.- Returns:
- the map of children
-
getActions
Map<String,Action<?>> getActions()
A key-value map of actions used for managing the actions of this component.- Returns:
- the map of actions
-
getEndpoints
Map<String,Endpoint<?>> getEndpoints()
A key-value map of endpoints used for managing the endpoints of this component. The type of the endpoint is used as the key in the map.- Returns:
- the map of endpoints
-
getComponentsList
default Collection<Component<?>> getComponentsList()
The serializable, sorted list of children components.- Returns:
- a serializable, sorted list of children components
-
getActionsList
default Collection<Action<?>> getActionsList()
The serializable, sorted list of actions.- Returns:
- a serializable, sorted list of actions.
-
getEndpointsList
default Collection<Endpoint<?>> getEndpointsList()
The serializable list of endpoints.- Returns:
- a serializable list of endpoints
-
setClassifier
void setClassifier(String classifier)
-
setType
void setType(String type)
-
setId
void setId(String id)
-
setAugmentationKey
void setAugmentationKey(String augmentationKey)
-
setLabel
void setLabel(InternationalizedMessage label)
-
setDescription
void setDescription(InternationalizedMessage description)
-
setOrder
void setOrder(Integer order)
-
setScope
void setScope(String scope)
-
setTranslatable
void setTranslatable(boolean translatable)
-
setConditionals
void setConditionals(List<Conditional<?>> conditionals)
-
apply
default C apply(Consumer<? super C> fn)
Executes the provided function with this component as an argument.- Parameters:
fn
- the function- Returns:
- this
-
classifier
default C classifier(String classifier)
Sets the classifier of this component.- Parameters:
classifier
- the classifier- Returns:
- this
-
type
default C type(String type)
Sets the type of this component.- Parameters:
type
- the type- Returns:
- this
-
augmentationKey
default C augmentationKey(String augmentationKey)
Sets the augmentation key of this component.- Parameters:
augmentationKey
- the augmentation key- Returns:
- this
-
description
default C description(String descriptionKey)
Sets the description message key for this component. If there is no matching message key, the provided string will be used as the description.- Parameters:
descriptionKey
- the description's message key.- Returns:
- this
-
description
default C description(InternationalizedMessage description)
Sets the description message for this component.- Parameters:
description
- the description message- Returns:
- this
-
label
default C label(String labelKey)
Sets the label message key for this component. If there is no matching message key, the provided string will be used as the label.- Parameters:
labelKey
- the label's message key.- Returns:
- this
-
label
default C label(InternationalizedMessage label)
Sets the label message for this component.- Parameters:
label
- the label message- Returns:
- this
-
order
default C order(Integer order)
Sets the order for this component.- Parameters:
order
- the order- Returns:
- this
-
scope
default C scope(String scope)
Sets the scope for this component.- Parameters:
scope
- the scope- Returns:
- this
-
translatable
default C translatable(boolean translatable)
Sets whether or not the component is translatable.- Parameters:
translatable
- whether or not translatable- Returns:
- this
-
translatable
default C translatable()
Sets this component as translatable.- Returns:
- this
-
notTranslatable
default C notTranslatable()
Sets this component as not translatable.- Returns:
- this
-
conditional
default C conditional(Conditional<?>... conditionals)
Adds one or more conditions to this component.- Parameters:
conditionals
- the condition(s)- Returns:
- this
-
conditionals
default C conditionals(List<Conditional<?>> conditionals)
Adds one or more conditions to this component.- Parameters:
conditionals
- the condition(s)- Returns:
- this
-
clearConditionals
default C clearConditionals()
Clears the current conditions on this component.- Returns:
- this
-
attribute
default C attribute(String key, @Nullable Object value)
Adds an attributes with the provided key and value.- Parameters:
key
- the keyvalue
- the value- Returns:
- this
-
removeAttribute
default C removeAttribute(String key)
Removes the attributes at the given key.- Parameters:
key
- the key- Returns:
- this
-
hasAttribute
default boolean hasAttribute(String key)
Returns whether or not the attribute at the given key exists.- Parameters:
key
- the key- Returns:
- whether or not the attribute exists
-
getAttribute
default Object getAttribute(String key)
Retrieves the attribute at the given key.- Parameters:
key
- the key- Returns:
- the attribute value
- Throws:
IllegalArgumentException
- if no attribute exists at the key
-
getAttribute
default <A> A getAttribute(String key, Class<A> clazz)
Retrieves the attribute at the given key and casts to the provided type.- Type Parameters:
A
- the type- Parameters:
key
- the keyclazz
- the type of attribute- Returns:
- the attribute value
-
findAttribute
default Optional<Object> findAttribute(String key)
Finds the attribute at the given key. Null-safe version ofgetAttribute(String)
.- Parameters:
key
- the key- Returns:
- an optional with the attribute value or empty
-
addComponent
default C addComponent(String key, Component<?> component)
Primary method of adding a child component. Inserts the component at the provided key into the component map.- Parameters:
key
- the keycomponent
- the child component- Returns:
- this
-
removeComponent
default C removeComponent(String key)
Removes the component at the given key.- Parameters:
key
- the key- Returns:
- this
-
hasComponent
default boolean hasComponent(String key)
Returns whether or not a child is stored at the given key.- Parameters:
key
- the key- Returns:
- whether or not a child exists at the key
-
getComponent
default Component<?> getComponent(String key)
Retrieves the component stored at the given key, if it exists.- Parameters:
key
- the key- Returns:
- this
- Throws:
IllegalArgumentException
- if no component is found with that key
-
getComponent
default <T extends Component<T>> T getComponent(String key, Class<T> clazz)
Retrieves the component of the provided type stored at the given key, if it exists.- Parameters:
key
- the keyclazz
- the type of the component- Returns:
- this
- Throws:
IllegalArgumentException
- if no component is found with that key
-
get
default Component<?> get(String key)
Alias forgetComponent(String)
.
-
get
default <T extends Component<T>> T get(String key, Class<T> clazz)
Alias forgetComponent(String, Class)
.
-
findComponent
default Optional<Component<?>> findComponent(String key)
Finds the component stored at the given key. Null-safe version ofgetComponent(String)
.- Parameters:
key
- the key- Returns:
- an optional of the component, or empty
-
findComponents
default List<Component<?>> findComponents(Predicate<Component<?>> predicate)
Retrieves a list of child components that match the given predicate.- Parameters:
predicate
- the predicate- Returns:
- the matching components
-
findComponent
default Optional<Component<?>> findComponent(Predicate<Component<?>> predicate)
Retrieves a single child component that matches the given predicate.- Parameters:
predicate
- the predicate- Returns:
- an optional with the matching component, or empty
-
hasEndpoint
default boolean hasEndpoint(String key)
Returns whether or not an endpoint exists at the given key.- Parameters:
key
- the key- Returns:
- whether or not the endpoint exists
-
getEndpoint
default Endpoint<?> getEndpoint(String type)
Retrieves the endpoint at the given type, if it exists.- Parameters:
type
- the type- Returns:
- the endpoint
- Throws:
IllegalArgumentException
- if the endpoint does not exist
-
getEndpoint
default <T extends Endpoint<T>> T getEndpoint(String type, Class<T> clazz)
Retrieves the endpoint at the given key as the given type.- Type Parameters:
T
- the type- Parameters:
type
- the typeclazz
- the type- Returns:
- the endpoint
-
findEndpoint
default Optional<Endpoint<?>> findEndpoint(String type)
Finds the endpoint stored at the given type. Null-safe version ofgetEndpoint(String)
.- Parameters:
type
- the key- Returns:
- an optional of the endpoint, or empty
-
findEndpoints
default List<Endpoint<?>> findEndpoints(Predicate<Endpoint<?>> predicate)
Retrieves a list of endpoints that match the given predicate.- Parameters:
predicate
- the predicate- Returns:
- the list of matching endpoints
-
findEndpoint
default Optional<Endpoint<?>> findEndpoint(Predicate<Endpoint<?>> predicate)
Retrieves a single endpoint matching the given predicate.- Parameters:
predicate
- the predicate- Returns:
- an optional of the matching endpoint, or empty
-
addEndpoint
default C addEndpoint(Endpoint<?> endpoint)
Adds the provided endpoint to this component.- Parameters:
endpoint
- the endpoint to add- Returns:
- this
-
addEndpoint
default C addEndpoint(String type, Endpoint<?> endpoint)
Adds the provided endpoint with the given type to this component.- Parameters:
type
- the typeendpoint
- the endpoint- Returns:
- this
-
removeEndpoint
default C removeEndpoint(String type)
Removes the endpoint with the given type.- Parameters:
type
- the type- Returns:
- this
-
clearEndpoints
default C clearEndpoints()
Clears the existing set of endpoints.- Returns:
- this
-
addAction
default C addAction(Action<?> action)
Adds an action using the action's ID as the key.- Parameters:
action
- the action- Returns:
- this
-
addAction
default C addAction(String key, Action<?> action)
Adds an action at the given key.- Parameters:
key
- the keyaction
- the action- Returns:
- this
-
removeAction
default C removeAction(String key)
Removes the action at the given key.- Parameters:
key
- the key- Returns:
- this
-
hasAction
default boolean hasAction(String key)
Returns whether or not an action exists at the given key.- Parameters:
key
- the key- Returns:
- whether or not the action exists
-
getAction
default Action<?> getAction(String key)
Returns the action at the provided key.- Parameters:
key
- the key- Returns:
- the action
- Throws:
IllegalArgumentException
- if no action exists- See Also:
for a null-safe get operation
-
getAction
default <T extends Action<T>> T getAction(String key, Class<T> clazz)
Returns the action at the provided key with the given type.- Type Parameters:
T
- the type- Parameters:
key
- the keyclazz
- the type- Returns:
- the action
-
findAction
default Optional<Action<?>> findAction(String key)
Finds the action at the given key. Null-safe version ofgetAction(String)
.- Parameters:
key
- the key- Returns:
- an optional of the action, or empty
-
findActions
default List<Action<?>> findActions(Predicate<Action<?>> predicate)
Retrieves a list of actions matching the given predicate.- Parameters:
predicate
- the predicate- Returns:
- the list of actions matching the predicate
-
-