/** * @see com.sun.faces.application.annotation.ConfigAnnotationHandler#collect(Class, java.lang.annotation.Annotation) */ @Override public void collect(Class<?> target, Annotation annotation) { if (behaviors == null) { behaviors = new HashMap<>(); } behaviors.put(((FacesBehavior) annotation).value(), target.getName()); }
@FacesBehavior(value = EventBehavior.BEHAVIOR_ID) public class EventBehavior extends ClientBehaviorBase {
public <T> void collect(@Observes ProcessManagedBean<T> event) { if (event.getAnnotatedBeanClass().isAnnotationPresent(FacesBehavior.class)) { Annotated annotated = event.getAnnotatedBeanClass(); Type type = annotated.getBaseType(); FacesBehavior conv = (FacesBehavior) annotated.getAnnotation(FacesBehavior.class); if (conv.managed()) { boolean hasValue = conv.value().length() > 0; if (hasValue) { types.add(new FacesBehaviorInfo(type, conv.value())); } } } }
if (annotation != null && annotation.managed())
/** * @see com.sun.faces.application.annotation.ConfigAnnotationHandler#collect(Class, java.lang.annotation.Annotation) */ public void collect(Class<?> target, Annotation annotation) { if (behaviors == null) { behaviors = new HashMap<String,String>(); } behaviors.put(((FacesBehavior) annotation).value(), target.getName()); }
@ICEResourceDependency(name = "jquery/jquery.js") }) @FacesBehavior("org.icefaces.ace.component.AjaxBehavior") public class AjaxBehavior extends ClientBehaviorBase { static enum Property {
/** * @see com.sun.faces.application.annotation.ConfigAnnotationHandler#collect(Class, java.lang.annotation.Annotation) */ @Override public void collect(Class<?> target, Annotation annotation) { if (behaviors == null) { behaviors = new HashMap<>(); } behaviors.put(((FacesBehavior) annotation).value(), target.getName()); }
@ICEResourceDependency(name = "animation/animation.js") }) @FacesBehavior("org.icefaces.ace.animation.Animation") public class AnimationBehavior extends BehaviorBase { public final static String BEHAVIOR_ID = "org.icefaces.ace.animation.Animation";
/** * @see com.sun.faces.application.annotation.ConfigAnnotationHandler#collect(Class, java.lang.annotation.Annotation) */ @Override public void collect(Class<?> target, Annotation annotation) { if (behaviors == null) { behaviors = new HashMap<>(); } behaviors.put(((FacesBehavior) annotation).value(), target.getName()); }
private void handleFacesBehavior(FacesConfigImpl facesConfig, Set<Class<?>> classes) { for (Class<?> clazz : classes) { FacesBehavior facesBehavior = (FacesBehavior) clazz.getAnnotation(FacesBehavior.class); if (facesBehavior != null) { // Can only apply @FacesBehavior to Behavior implementors. if (!javax.faces.component.behavior.Behavior.class.isAssignableFrom(clazz)) { // Just log this. We'll catch it later in the runtime. if (log.isLoggable(Level.WARNING)) { log.warning(clazz.getName() + " is annotated with @javax.faces.component.behavior.FacesBehavior, " + "but does not implement javax.faces.component.behavior.Behavior"); } } if (log.isLoggable(Level.FINEST)) { log.finest("addBehavior(" + facesBehavior.value() + ", " + clazz.getName() + ")"); } BehaviorImpl behavior = new BehaviorImpl(); behavior.setBehaviorId(facesBehavior.value()); behavior.setBehaviorClass(clazz.getName()); facesConfig.addBehavior(behavior); } } }