org.zkoss.bind.annotation.MatchMedia Maven / Gradle / Ivy
/* MatchMedia.java
Purpose:
Description:
History:
Feb 18, 2016 12:50:02 PM, Created by wenninghsu
Copyright (C) 2016 Potix Corporation. All Rights Reserved.
*/
package org.zkoss.bind.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marker annotation to identify a MatchMedia method in View Model.
* A MatchMedia method could also use with {@link ContextParam} to get the {@link org.zkoss.zk.ui.event.ClientInfoEvent}.
* The annotated methods are not in any particular order if the intervals are overlapping.
*
* This annotation is for RWD in zk mvvm.
*
* Example:
* @MatchMedia("all and (max-width: 500px)")
* public void method(@ContextParam(ContextType.TRIGGER_EVENT) ClientInfoEvent event)
*
* When the media query matches the value in the annotation, it'll trigger a {@link org.zkoss.zk.ui.event.ClientInfoEvent} and the annotated method in the viewmodel will be invoked .
* You could get the client's information by {@link ContextParam}
*
* The values of this annotation should be unique in each viewmodel, and has to follow the criteria which is listed in this media query's spec
*
*
* @author wenninghsu
* @since 8.0.2
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface MatchMedia {
String[] value();
}