- java.lang.Object
-
- jakarta.faces.component.UIComponent
-
- jakarta.faces.component.UIComponentBase
-
- org.omnifaces.component.util.UtilFamily
-
- org.omnifaces.component.util.MoveComponent
-
- All Implemented Interfaces:
ClientBehaviorHolder
,PartialStateHolder
,StateHolder
,TransientStateHolder
,ComponentSystemEventListener
,FacesListener
,SystemEventListener
,SystemEventListenerHolder
,EventListener
public class MoveComponent extends UtilFamily implements SystemEventListener, ClientBehaviorHolder
The
<o:moveComponent>
component is a utility component via which components, facets and behaviors can be moved at runtime to a target component in various ways. This allows for simple programmatic composition of components using a declarative page author centric approach.The destination of a move operation is specified in terms of a location that's relative to a given target component. The following shows a list of supported destinations:
-
BEFORE
- Component is moved right before target component, i.e. as a sibling with an index that's 1 position lower. -
ADD_FIRST
- Component is added as the first child of the target component, any other children will have their index increased by 1. -
ADD_LAST
- Component is added as the last child of the target component, any other children will stay at their original location. -
FACET
- Component will be moved to the facet section of the target component under the name denoted by "facet". -
BEHAVIOR
- A Behavior will be moved to the behavior section of the target component. -
AFTER
- Component is moved right after target component, i.e. as a sibling with an index that's 1 position higher.
- Since:
- 2.0
- Author:
- Arjan Tijms
- See Also:
UtilFamily
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MoveComponent.Destination
Destination of component to be moved byMoveComponent
.
-
Field Summary
Fields Modifier and Type Field Description static String
COMPONENT_TYPE
The component type, which is "org.omnifaces.component.util.MoveComponent".static String
DEFAULT_SCOPE
The default scope, which is "facelet".-
Fields inherited from class org.omnifaces.component.util.UtilFamily
COMPONENT_FAMILY
-
Fields inherited from class jakarta.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, VIEW_LOCATION_KEY
-
-
Constructor Summary
Constructors Constructor Description MoveComponent()
Constructs the component.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addClientBehavior(String eventName, ClientBehavior behavior)
String
getBehaviorDefaultEvent()
Returns in case thedestination
is set to BEHAVIOR, the name of the default event that the target component is 'supposed' to have.String
getBehaviorEvents()
Returns in case thedestination
is set to BEHAVIOR, the comma separated list events that the target component is 'supposed' to support.String
getDefaultEventName()
MoveComponent.Destination
getDestination()
Returns the destination relative to the target component where the source component(s) are moved to.Collection<String>
getEventNames()
String
getFacet()
Returns in case thedestination
is set to FACET, the name of the facet in the target component to which the components should be moved.String
getFor()
Returns ID of the target component for which the component moving will be done.boolean
isListenerForSource(Object source)
void
processEvent(SystemEvent event)
void
setBehaviorDefaultEvent(String behaviorDefaultEventValue)
Sets in case thedestination
is set to BEHAVIOR, the name of the default event that the target component is 'supposed' to have.void
setBehaviorEvents(String behaviorEventsValue)
Sets in case thedestination
is set to BEHAVIOR, the comma separated list events that the target component is 'supposed' to support.void
setDestination(MoveComponent.Destination destinationValue)
Sets the destination relative to the target component where the source component(s) are moved to.void
setFacet(String facetValue)
Sets in case thedestination
is set to FACET, the name of the facet in the target component to which the components should be moved.void
setFor(String forValue)
Sets ID of the target component for which the component moving will be done.-
Methods inherited from class org.omnifaces.component.util.UtilFamily
getFamily, getRendersChildren
-
Methods inherited from class jakarta.faces.component.UIComponentBase
addFacesListener, broadcast, clearInitialState, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getPassThroughAttributes, getRenderer, getRendererType, getValueBinding, invokeOnComponent, isRendered, isTransient, markInitialState, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEvent
-
Methods inherited from class jakarta.faces.component.UIComponent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression, visitTree
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jakarta.faces.component.behavior.ClientBehaviorHolder
getClientBehaviors
-
-
-
-
Field Detail
-
COMPONENT_TYPE
public static final String COMPONENT_TYPE
The component type, which is "org.omnifaces.component.util.MoveComponent".- See Also:
- Constant Field Values
-
DEFAULT_SCOPE
public static final String DEFAULT_SCOPE
The default scope, which is "facelet".- See Also:
- Constant Field Values
-
-
Method Detail
-
isListenerForSource
public boolean isListenerForSource(Object source)
- Specified by:
isListenerForSource
in interfaceSystemEventListener
-
processEvent
public void processEvent(SystemEvent event)
- Specified by:
processEvent
in interfaceSystemEventListener
-
addClientBehavior
public void addClientBehavior(String eventName, ClientBehavior behavior)
- Specified by:
addClientBehavior
in interfaceClientBehaviorHolder
- Overrides:
addClientBehavior
in classUIComponentBase
-
getDefaultEventName
public String getDefaultEventName()
- Specified by:
getDefaultEventName
in interfaceClientBehaviorHolder
- Overrides:
getDefaultEventName
in classUIComponentBase
-
getEventNames
public Collection<String> getEventNames()
- Specified by:
getEventNames
in interfaceClientBehaviorHolder
- Overrides:
getEventNames
in classUIComponentBase
-
getFor
public String getFor()
Returns ID of the target component for which the component moving will be done.- Returns:
- ID of the target component for which the component moving will be done.
-
setFor
public void setFor(String forValue)
Sets ID of the target component for which the component moving will be done.- Parameters:
forValue
- ID of the target component for which the component moving will be done.
-
getDestination
public MoveComponent.Destination getDestination()
Returns the destination relative to the target component where the source component(s) are moved to. Default isADD_LAST
.- Returns:
- The destination relative to the target component where the source component(s) are moved to.
-
setDestination
public void setDestination(MoveComponent.Destination destinationValue)
Sets the destination relative to the target component where the source component(s) are moved to. Valid values are-
BEFORE
- Component is moved right before target component, i.e. as a sibling with an index that's 1 position lower -
ADD_FIRST
- Component is added as the first child of the target component, any other children will have their index increased by 1 -
ADD_LAST
- Component is added as the last child of the target component, any other children will stay at their original location -
FACET
- Component will be moved to the facet section of the target component under the name denoted by "facet" -
BEHAVIOR
- A Behavior will be moved to the behavior section of the target component -
AFTER
- Component is moved right after target component, i.e. as a sibling with an index that's 1 position higher
- Parameters:
destinationValue
- The destination relative to the target component where the source component(s) are moved to.
-
-
getFacet
public String getFacet()
Returns in case thedestination
is set to FACET, the name of the facet in the target component to which the components should be moved.- Returns:
- In case the
destination
is set to FACET, the name of the facet in the target component to which the components should be moved.
-
setFacet
public void setFacet(String facetValue)
Sets in case thedestination
is set to FACET, the name of the facet in the target component to which the components should be moved.- Parameters:
facetValue
- In case thedestination
is set to FACET, the name of the facet in the target component to which the components should be moved.
-
getBehaviorDefaultEvent
public String getBehaviorDefaultEvent()
Returns in case thedestination
is set to BEHAVIOR, the name of the default event that the target component is 'supposed' to have.- Returns:
- In case the
destination
is set to BEHAVIOR, the name of the default event that the target component is 'supposed' to have.
-
setBehaviorDefaultEvent
public void setBehaviorDefaultEvent(String behaviorDefaultEventValue)
Sets in case thedestination
is set to BEHAVIOR, the name of the default event that the target component is 'supposed' to have. This normally does not need to be set, but might be needed for some over-eager tag handlers associated with a behavior that in advance try to check whether the behavior event matches with what the component supports.- Parameters:
behaviorDefaultEventValue
- In case thedestination
is set to BEHAVIOR, the name of the default event that the target component is 'supposed' to have.
-
getBehaviorEvents
public String getBehaviorEvents()
Returns in case thedestination
is set to BEHAVIOR, the comma separated list events that the target component is 'supposed' to support.- Returns:
- In case the
destination
is set to BEHAVIOR, the comma separated list events that the target component is 'supposed' to support.
-
setBehaviorEvents
public void setBehaviorEvents(String behaviorEventsValue)
Sets in case thedestination
is set to BEHAVIOR, the comma separated list events that the target component is 'supposed' to support. This normally does not need to be set, but might be needed for some over-eager tag handlers associated with a behavior that in advance try to check whether the behavior event matches with what the component supports.- Parameters:
behaviorEventsValue
- In case thedestination
is set to BEHAVIOR, the comma separated list events that the target component is 'supposed' to support.
-
-