diff --git a/api/src/main/java/org/jboss/seam/faces/event/qualifier/After.java b/api/src/main/java/org/jboss/seam/faces/event/qualifier/After.java
index 8965d1d..d281a3d 100644
--- a/api/src/main/java/org/jboss/seam/faces/event/qualifier/After.java
+++ b/api/src/main/java/org/jboss/seam/faces/event/qualifier/After.java
@@ -16,22 +16,24 @@
*/
package org.jboss.seam.faces.event.qualifier;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import javax.inject.Qualifier;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
/**
* Qualifies observer method parameters to select events that occur in a "after" phase in the JSF lifecycle
*
* @author Nicklas Karlsson
*/
@Qualifier
-@Target({FIELD, PARAMETER})
+@Target({TYPE, FIELD, METHOD, PARAMETER})
@Retention(RUNTIME)
public @interface After {
}
diff --git a/api/src/main/java/org/jboss/seam/faces/event/qualifier/ApplyRequestValues.java b/api/src/main/java/org/jboss/seam/faces/event/qualifier/ApplyRequestValues.java
index 6202718..4773bb4 100644
--- a/api/src/main/java/org/jboss/seam/faces/event/qualifier/ApplyRequestValues.java
+++ b/api/src/main/java/org/jboss/seam/faces/event/qualifier/ApplyRequestValues.java
@@ -23,7 +23,9 @@
import javax.inject.Qualifier;
import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
@@ -36,7 +38,7 @@
* @see javax.faces.event.PhaseEvent
*/
@Qualifier
-@Target({FIELD, PARAMETER})
+@Target({TYPE, FIELD, METHOD, PARAMETER})
@Retention(RUNTIME)
public @interface ApplyRequestValues {
}
diff --git a/api/src/main/java/org/jboss/seam/faces/event/qualifier/Before.java b/api/src/main/java/org/jboss/seam/faces/event/qualifier/Before.java
index b82c509..a27adca 100644
--- a/api/src/main/java/org/jboss/seam/faces/event/qualifier/Before.java
+++ b/api/src/main/java/org/jboss/seam/faces/event/qualifier/Before.java
@@ -16,22 +16,24 @@
*/
package org.jboss.seam.faces.event.qualifier;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import javax.inject.Qualifier;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
/**
* Qualifies observer method parameters to select events that occur in a "before" phase in the JSF lifecycle
*
* @author Nicklas Karlsson
*/
@Qualifier
-@Target({FIELD, PARAMETER})
+@Target({TYPE, FIELD, METHOD, PARAMETER})
@Retention(RUNTIME)
public @interface Before {
}
diff --git a/api/src/main/java/org/jboss/seam/faces/event/qualifier/InvokeApplication.java b/api/src/main/java/org/jboss/seam/faces/event/qualifier/InvokeApplication.java
index a911a38..e4fbf19 100644
--- a/api/src/main/java/org/jboss/seam/faces/event/qualifier/InvokeApplication.java
+++ b/api/src/main/java/org/jboss/seam/faces/event/qualifier/InvokeApplication.java
@@ -23,7 +23,9 @@
import javax.inject.Qualifier;
import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
@@ -34,7 +36,7 @@
* @author Nicklas Karlsson
*/
@Qualifier
-@Target({FIELD, PARAMETER})
+@Target({TYPE, FIELD, METHOD, PARAMETER})
@Retention(RUNTIME)
public @interface InvokeApplication {
}
diff --git a/api/src/main/java/org/jboss/seam/faces/event/qualifier/ProcessValidations.java b/api/src/main/java/org/jboss/seam/faces/event/qualifier/ProcessValidations.java
index 94bd20c..fe8e1c6 100644
--- a/api/src/main/java/org/jboss/seam/faces/event/qualifier/ProcessValidations.java
+++ b/api/src/main/java/org/jboss/seam/faces/event/qualifier/ProcessValidations.java
@@ -23,7 +23,9 @@
import javax.inject.Qualifier;
import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
@@ -35,7 +37,7 @@
* @After}. The event parameter is a {@link PhaseEvent}.
*/
@Qualifier
-@Target({FIELD, PARAMETER})
+@Target({TYPE, FIELD, METHOD, PARAMETER})
@Retention(RUNTIME)
public @interface ProcessValidations {
}
diff --git a/api/src/main/java/org/jboss/seam/faces/event/qualifier/RenderResponse.java b/api/src/main/java/org/jboss/seam/faces/event/qualifier/RenderResponse.java
index d259613..f27b3a5 100644
--- a/api/src/main/java/org/jboss/seam/faces/event/qualifier/RenderResponse.java
+++ b/api/src/main/java/org/jboss/seam/faces/event/qualifier/RenderResponse.java
@@ -23,7 +23,9 @@
import javax.inject.Qualifier;
import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
@@ -34,7 +36,7 @@
* @author Nicklas Karlsson
*/
@Qualifier
-@Target({FIELD, PARAMETER})
+@Target({TYPE, FIELD, METHOD, PARAMETER})
@Retention(RUNTIME)
public @interface RenderResponse {
}
diff --git a/api/src/main/java/org/jboss/seam/faces/event/qualifier/RestoreView.java b/api/src/main/java/org/jboss/seam/faces/event/qualifier/RestoreView.java
index 5943387..38ec850 100644
--- a/api/src/main/java/org/jboss/seam/faces/event/qualifier/RestoreView.java
+++ b/api/src/main/java/org/jboss/seam/faces/event/qualifier/RestoreView.java
@@ -23,7 +23,9 @@
import javax.inject.Qualifier;
import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
@@ -34,7 +36,7 @@
* @author Nicklas Karlsson
*/
@Qualifier
-@Target({FIELD, PARAMETER})
+@Target({TYPE, FIELD, METHOD, PARAMETER})
@Retention(RUNTIME)
public @interface RestoreView {
}
diff --git a/api/src/main/java/org/jboss/seam/faces/event/qualifier/UpdateModelValues.java b/api/src/main/java/org/jboss/seam/faces/event/qualifier/UpdateModelValues.java
index 91b58a5..00b8fea 100644
--- a/api/src/main/java/org/jboss/seam/faces/event/qualifier/UpdateModelValues.java
+++ b/api/src/main/java/org/jboss/seam/faces/event/qualifier/UpdateModelValues.java
@@ -23,7 +23,9 @@
import javax.inject.Qualifier;
import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
@@ -35,7 +37,7 @@
* @After}. The event parameter is a {@link PhaseEvent}.
*/
@Qualifier
-@Target({FIELD, PARAMETER})
+@Target({TYPE, FIELD, METHOD, PARAMETER})
@Retention(RUNTIME)
public @interface UpdateModelValues {
}
diff --git a/api/src/main/java/org/jboss/seam/faces/view/action/ViewAction.java b/api/src/main/java/org/jboss/seam/faces/view/action/ViewAction.java
new file mode 100644
index 0000000..aeb8ea3
--- /dev/null
+++ b/api/src/main/java/org/jboss/seam/faces/view/action/ViewAction.java
@@ -0,0 +1,37 @@
+package org.jboss.seam.faces.view.action;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.jboss.seam.faces.event.qualifier.RenderResponse;
+
+/**
+ * The EL MethodExpression is executed when this annotation is applied to a ViewConfig.
+ *
+ * The MethodExpression is called by default before RENDER_RESPONSE phase. You can change this
+ * behaviour by using phase and before fields.
+ *
+ * @author Adriàn Gonzalez
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface ViewAction {
+ /**
+ * El MethodExpression
+ */
+ String value();
+
+ /**
+ * On which JSF phase must this viewAction be executed ?
+ */
+ Class> phase() default RenderResponse.class;
+
+ /**
+ * Is this viewAction executed before phase ?
+ */
+ boolean before() default true;
+}
diff --git a/api/src/main/java/org/jboss/seam/faces/view/action/ViewActionBindingType.java b/api/src/main/java/org/jboss/seam/faces/view/action/ViewActionBindingType.java
new file mode 100644
index 0000000..6f54760
--- /dev/null
+++ b/api/src/main/java/org/jboss/seam/faces/view/action/ViewActionBindingType.java
@@ -0,0 +1,22 @@
+package org.jboss.seam.faces.view.action;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Applied to an annotation to indicate that it is a faces action binding type.
+ *
+ * By default, this method will be called before RENDER_RESPONSE phase.
+ * You can change the jsf phase by using the annotations from org.jboss.seam.faces.event.qualifier package
+ * on your custom annotation.
+ *
+ * @author Adriàn Gonzalez
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface ViewActionBindingType {
+}
diff --git a/api/src/main/java/org/jboss/seam/faces/view/action/ViewController.java b/api/src/main/java/org/jboss/seam/faces/view/action/ViewController.java
new file mode 100644
index 0000000..f040d1a
--- /dev/null
+++ b/api/src/main/java/org/jboss/seam/faces/view/action/ViewController.java
@@ -0,0 +1,39 @@
+package org.jboss.seam.faces.view.action;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.jboss.seam.faces.event.qualifier.After;
+import org.jboss.seam.faces.event.qualifier.ApplyRequestValues;
+import org.jboss.seam.faces.event.qualifier.Before;
+import org.jboss.seam.faces.event.qualifier.InvokeApplication;
+import org.jboss.seam.faces.event.qualifier.ProcessValidations;
+import org.jboss.seam.faces.event.qualifier.RenderResponse;
+import org.jboss.seam.faces.event.qualifier.UpdateModelValues;
+
+/**
+ * This annotation must be used on a ViewConfig to specify its viewControllers.
+ *
+ *
A viewController is a managed bean handling a specific view.
+ * Some methods of the bean can be called during the lifecycle of the view.
+ * Those methods must be annotated with {@link BeforeRenderResponse}, {@link AfterRenderResponse}, or a mixture of
+ * {@link Before}, {@link After}, {@link ApplyRequestValues}, {@link ProcessValidations}, {@link UpdateModelValues},
+ * {@link InvokeApplication} or {@link RenderResponse}.
+ *
+ *
Classic use case are :
+ *
+ *
{@link BeforeRenderResponse} for handling view initialization data (i.e. fetching data from database).