use of jakarta.faces.component.ActionSource in project myfaces by apache.
the class ActionListenerHandler method applyAttachedObject.
@Override
public void applyAttachedObject(FacesContext context, UIComponent parent) {
// Retrieve the current FaceletContext from FacesContext object
FaceletContext faceletContext = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
ActionSource as = (ActionSource) parent;
ValueExpression b = null;
if (this.binding != null) {
b = this.binding.getValueExpression(faceletContext, ActionListener.class);
}
ActionListener listener = new LazyActionListener(this.listenerType, b);
as.addActionListener(listener);
}
use of jakarta.faces.component.ActionSource in project mojarra by eclipse-ee4j.
the class SetPropertyActionListenerHandler method applyAttachedObject.
@Override
public void applyAttachedObject(FacesContext context, UIComponent parent) {
FaceletContext faceletContext = (FaceletContext) context.getAttributes().get(FACELET_CONTEXT_KEY);
ActionSource src = (ActionSource) parent;
ValueExpression valueExpr = value.getValueExpression(faceletContext, Object.class);
ValueExpression targetExpr = target.getValueExpression(faceletContext, Object.class);
src.addActionListener(new SetPropertyListener(valueExpr, targetExpr));
}
use of jakarta.faces.component.ActionSource in project mojarra by eclipse-ee4j.
the class ActionListenerHandler method applyAttachedObject.
@Override
public void applyAttachedObject(FacesContext context, UIComponent parent) {
FaceletContext ctx = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
ActionSource as = (ActionSource) parent;
ValueExpression b = null;
if (binding != null) {
b = binding.getValueExpression(ctx, ActionListener.class);
}
ActionListener listener = new LazyActionListener(listenerType, b);
as.addActionListener(listener);
}
use of jakarta.faces.component.ActionSource in project mojarra by eclipse-ee4j.
the class ResetValuesHandler method applyAttachedObject.
@Override
public void applyAttachedObject(FacesContext context, UIComponent parent) {
FaceletContext ctx = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
ActionSource as = (ActionSource) parent;
String renderStr = (String) render.getObject(ctx, String.class);
ActionListener listener = new LazyActionListener(toList(renderStr));
as.addActionListener(listener);
}
use of jakarta.faces.component.ActionSource in project myfaces by apache.
the class ResetValuesActionListenerHandler method applyAttachedObject.
public void applyAttachedObject(FacesContext context, UIComponent parent, boolean checkForParentCC) {
UIComponent topParentComponent = null;
// Retrieve the current FaceletContext from FacesContext object
FaceletContext faceletContext = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
if (checkForParentCC) {
FaceletCompositionContext mctx = FaceletCompositionContext.getCurrentInstance(faceletContext);
UIComponent parentComponent = parent;
while (parentComponent != null) {
if (UIComponent.isCompositeComponent(parentComponent)) {
List<AttachedObjectHandler> handlerList = mctx.getAttachedObjectHandlers(parentComponent);
if (handlerList != null && handlerList.contains(this)) {
// Found, but we need to go right to the top for it.
topParentComponent = parentComponent;
}
}
parentComponent = parentComponent.getParent();
}
}
ActionSource as = (ActionSource) parent;
ActionListener listener = null;
if (_render.isLiteral()) {
listener = new LiteralResetValuesActionListener(_clientIds, topParentComponent != null ? (Location) topParentComponent.getAttributes().get(CompositeComponentELUtils.LOCATION_KEY) : null);
} else {
listener = new ResetValuesActionListener(_render.getValueExpression(faceletContext, Object.class), topParentComponent != null ? (Location) topParentComponent.getAttributes().get(CompositeComponentELUtils.LOCATION_KEY) : null);
}
as.addActionListener(listener);
}
Aggregations