openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r758932 - in /incubator/openwebbeans/trunk/samples/guess/src/main: java/org/apache/webbeans/sample/conversation/ java/org/apache/webbeans/sample/model/conversation/ resources/ webapp/ webapp/WEB-INF/
Date Thu, 26 Mar 2009 23:55:08 GMT
Author: gerdogdu
Date: Thu Mar 26 23:55:07 2009
New Revision: 758932

URL: http://svn.apache.org/viewvc?rev=758932&view=rev
Log:
Adding a conversation management sample.

Added:
    incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/conversation/ShoppingCardBean.java
  (with props)
    incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/model/conversation/
    incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/model/conversation/ConversationModel.java
  (with props)
    incubator/openwebbeans/trunk/samples/guess/src/main/webapp/conversation.xhtml   (with
props)
Modified:
    incubator/openwebbeans/trunk/samples/guess/src/main/resources/log4j.properties
    incubator/openwebbeans/trunk/samples/guess/src/main/webapp/WEB-INF/   (props changed)

Added: incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/conversation/ShoppingCardBean.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/conversation/ShoppingCardBean.java?rev=758932&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/conversation/ShoppingCardBean.java
(added)
+++ incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/conversation/ShoppingCardBean.java
Thu Mar 26 23:55:07 2009
@@ -0,0 +1,90 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.sample.conversation;
+
+import java.io.Serializable;
+
+import javax.annotation.Named;
+import javax.context.Conversation;
+import javax.context.RequestScoped;
+import javax.inject.Current;
+
+import org.apache.webbeans.sample.model.conversation.ConversationModel;
+import org.apache.webbeans.util.JSFUtil;
+
+@RequestScoped
+@Named
+public class ShoppingCardBean implements Serializable
+{
+    private @Current Conversation conversation;
+    
+    private @Current ConversationModel model;
+    
+    private String book;
+    
+    public String startConversation()
+    {
+        conversation.begin();
+        
+        JSFUtil.addInfoMessage("Conversation with id : " + conversation.getId() + " is started");
+        
+        return null;
+    }
+    
+    public String addNewBook()
+    {
+        model.getList().add(this.book);
+        
+        StringBuffer buffer = new StringBuffer("Your shopping card contents : [");
+        
+        for(String b : model.getList())
+        {
+            buffer.append("," + b);
+        }
+        
+        JSFUtil.addInfoMessage("Your shopping card contents : " + buffer.toString() + "]");
+        
+        return null;
+    }
+    
+    public String endConversation()
+    {
+        JSFUtil.addInfoMessage("Conversation with id : " + conversation.getId() + " is ended");
+        
+        conversation.end();        
+        
+        return null;
+    }
+
+    /**
+     * @return the book
+     */
+    public String getBook()
+    {
+        return book;
+    }
+
+    /**
+     * @param book the book to set
+     */
+    public void setBook(String book)
+    {
+        this.book = book;
+    }
+
+    
+}

Propchange: incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/conversation/ShoppingCardBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/model/conversation/ConversationModel.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/model/conversation/ConversationModel.java?rev=758932&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/model/conversation/ConversationModel.java
(added)
+++ incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/model/conversation/ConversationModel.java
Thu Mar 26 23:55:07 2009
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.sample.model.conversation;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Named;
+import javax.context.ConversationScoped;
+
+@ConversationScoped
+@Named
+public class ConversationModel implements Serializable
+{
+    public List<String> list = new ArrayList<String>();
+    
+    public void addNewBook(String name)
+    {
+        list.add(name);
+    }
+
+    public List<String> getList()
+    {
+        return this.list;
+    }
+}

Propchange: incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/model/conversation/ConversationModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/openwebbeans/trunk/samples/guess/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/guess/src/main/resources/log4j.properties?rev=758932&r1=758931&r2=758932&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/samples/guess/src/main/resources/log4j.properties (original)
+++ incubator/openwebbeans/trunk/samples/guess/src/main/resources/log4j.properties Thu Mar
26 23:55:07 2009
@@ -33,4 +33,4 @@
 
 
 ### Main project logger to info
-log4j.logger.org.apache.webbeans=debug,stdout
\ No newline at end of file
+log4j.logger.org.apache.webbeans=debug
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/guess/src/main/webapp/WEB-INF/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Mar 26 23:55:07 2009
@@ -1,4 +1,5 @@
-.settings
-target
-.classpath
+.settings
+target
+.classpath
 .project
+geronimo-web.xml

Added: incubator/openwebbeans/trunk/samples/guess/src/main/webapp/conversation.xhtml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/guess/src/main/webapp/conversation.xhtml?rev=758932&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/guess/src/main/webapp/conversation.xhtml (added)
+++ incubator/openwebbeans/trunk/samples/guess/src/main/webapp/conversation.xhtml Thu Mar
26 23:55:07 2009
@@ -0,0 +1,63 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+	
+	Licensed to the Apache Software Foundation (ASF) under one or more
+	contributor license agreements. See the NOTICE file distributed with
+	this work for additional information regarding copyright ownership.
+	The ASF licenses this file to You under the Apache License, Version
+	2.0 (the "License"); you may not use this file except in compliance
+	with the License. You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+	applicable law or agreed to in writing, software distributed under the
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+	CONDITIONS OF ANY KIND, either express or implied. See the License for
+	the specific language governing permissions and limitations under the
+	License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:f="http://java.sun.com/jsf/core"
+    xmlns:h="http://java.sun.com/jsf/html"
+    xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+  <title>OpenWebBeans :: Examples :: Conversation</title>
+</head>
+
+<body>
+  
+  <div id="container">
+    <div id="content">
+		<h:messages globalOnly="false" showSummary="true" infoStyle="font-weight:bold;"></h:messages>
+		
+		<h:form id="form">
+			
+			<div align="center">
+				<h3>OpenWebBeans Conversation Example</h3>
+				<span style="color:red;">User name : admin, Password : admin</span>
+			</div>
+			
+			<div align="center" style="border:1px solid black;">
+			
+				<h:panelGrid columns="2">
+					
+					<h:outputLabel for="book">
+						<h:outputText value="Book Name : "></h:outputText>
+					</h:outputLabel>
+					<h:inputText id="book" value="#{shoppingCardBean.book}"></h:inputText>
+					
+					<h:panelGroup>					
+						<h:commandButton action="#{shoppingCardBean.startConversation}" value="Start Conversation"></h:commandButton>
+						<h:commandButton action="#{shoppingCardBean.endConversation}" value="End Conversation"></h:commandButton>
+					</h:panelGroup>
+					
+					<h:commandButton action="#{shoppingCardBean.addNewBook}" value="Add New Book"></h:commandButton>
+					
+				</h:panelGrid>
+			</div>
+		</h:form>
+	    </div>
+    
+  </div>
+</body>
+</html>
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/guess/src/main/webapp/conversation.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message