use of javax.faces.component.behavior.ClientBehaviorHolder in project empire-db by apache.
the class InputControl method createInput.
/* createInput */
public void createInput(UIComponent comp, InputInfo ii, FacesContext context) {
// createInputComponents
List<UIComponent> children = comp.getChildren();
try {
this.creatingComponents = true;
createInputComponents(comp, ii, context, children);
// check
boolean resetChildId = ii.isInsideUIData();
if (resetChildId && log.isDebugEnabled()) {
// Debug-Info only
UIComponent c1 = comp.getChildren().get(0);
String clientId = c1.getClientId();
log.debug("Performing ChildId-reset for {}", clientId);
}
// add attached objects
UIComponent parent = comp;
while (!(parent instanceof UIInput)) parent = parent.getParent();
for (UIComponent child : children) {
// reset child-id
if (resetChildId && child.getId() != null)
child.setId(child.getId());
// check type
if (!(child instanceof ClientBehaviorHolder))
continue;
// add attached objects
addAttachedObjects(parent, context, ii, ((UIComponentBase) child));
}
} finally {
this.creatingComponents = false;
}
}
use of javax.faces.component.behavior.ClientBehaviorHolder in project empire-db by apache.
the class InputControl method updateInputState.
public void updateInputState(UIComponent parent, InputInfo ii, FacesContext context, PhaseId phaseId) {
List<UIComponent> cl = parent.getChildren();
if (cl.isEmpty())
return;
updateInputState(cl, ii, context, phaseId);
// update attached objects
List<UIComponent> children = parent.getChildren();
while (!(parent instanceof UIInput)) parent = parent.getParent();
for (UIComponent child : children) {
// check type
if (!(child instanceof ClientBehaviorHolder))
continue;
// update attached objects
updateAttachedObjects(parent, context, ii, ((UIComponentBase) child));
}
}
use of javax.faces.component.behavior.ClientBehaviorHolder in project primefaces by primefaces.
the class ComponentUtils method decodeBehaviors.
public static void decodeBehaviors(FacesContext context, UIComponent component) {
if (!(component instanceof ClientBehaviorHolder)) {
return;
}
Map<String, List<ClientBehavior>> behaviors = ((ClientBehaviorHolder) component).getClientBehaviors();
if (behaviors.isEmpty()) {
return;
}
Map<String, String> params = context.getExternalContext().getRequestParameterMap();
String behaviorEvent = params.get(Constants.RequestParams.PARTIAL_BEHAVIOR_EVENT_PARAM);
if (null != behaviorEvent) {
List<ClientBehavior> behaviorsForEvent = behaviors.get(behaviorEvent);
if (behaviorsForEvent != null && !behaviorsForEvent.isEmpty()) {
String behaviorSource = params.get(Constants.RequestParams.PARTIAL_SOURCE_PARAM);
String clientId = component.getClientId(context);
if (behaviorSource != null && clientId.equals(behaviorSource)) {
for (ClientBehavior behavior : behaviorsForEvent) {
behavior.decode(context, component);
}
}
}
}
}
Aggregations