deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rafab...@apache.org
Subject deltaspike git commit: DELTASPIKE-862 - document JsfMessage
Date Thu, 02 Apr 2015 21:33:20 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 44a87b103 -> bfe93c93d


DELTASPIKE-862 - document JsfMessage


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/bfe93c93
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/bfe93c93
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/bfe93c93

Branch: refs/heads/master
Commit: bfe93c93dde423de632d77b5dc5eb4a22c1c4bc2
Parents: 44a87b1
Author: Rafael Benevides <rafabene@gmail.com>
Authored: Thu Apr 2 17:33:01 2015 -0400
Committer: Rafael Benevides <rafabene@gmail.com>
Committed: Thu Apr 2 17:33:01 2015 -0400

----------------------------------------------------------------------
 documentation/src/main/asciidoc/jsf.adoc | 34 +++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/bfe93c93/documentation/src/main/asciidoc/jsf.adoc
----------------------------------------------------------------------
diff --git a/documentation/src/main/asciidoc/jsf.adoc b/documentation/src/main/asciidoc/jsf.adoc
index 0958a66..bf04f96 100644
--- a/documentation/src/main/asciidoc/jsf.adoc
+++ b/documentation/src/main/asciidoc/jsf.adoc
@@ -50,6 +50,40 @@ aware of
 https://issues.apache.org/jira/browse/DELTASPIKE-335[DELTASPIKE-335] and
 the corresponding impact.
 
+=== JSF Messages
+
+DeltaSpike provides an injectable component for typesafe FacesMessages.
+
+Is provides an integration with <<core.adoc#_messages_and_i18n,MessageBundle>>
making the use of JSF messages and I18N simple and type-safe.
+
+Usage:
+
+[source,java]
+---------------------------------------------
+
+@MessageBundle
+public interface Messages
+{
+    @MessageTemplate("Welcome to DeltaSpike")
+    String welcomeToDeltaSpike();
+}
+
+ @Model
+ public class MyJSFBean
+ {
+    @Inject
+    private JsfMessage<Messages> messages;
+
+    ...
+    messages.addInfo().welcomeToDeltaSpike();
+}
+---------------------------------------------
+
+MessageBundle methods which are used as JsfMessage can return a `org.apache.deltaspike.core.api.message.Message`
or a String.
+In case of a String we use it for both the summary and detail information on the FacesMessage.

+
+If a Message is returned, we lookup the 'detail' and 'summary' categories (see `org.apache.deltaspike.core.api.message.Message#toString(String)`
for creating the FacesMessage.
+
 === Multi-Window Handling
 
 ==== Background


Mime
View raw message