You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2017/04/04 14:17:34 UTC

svn commit: r1790126 - in /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main: java/org/apache/myfaces/tobago/example/demo/ resources/org/apache/myfaces/tobago/example/demo/ webapp/content/30-concept/15-conversation/ webapp/content/40-tes...

Author: hnoeth
Date: Tue Apr  4 14:17:33 2017
New Revision: 1790126

URL: http://svn.apache.org/viewvc?rev=1790126&view=rev
Log:
improve demo
* add simple ConversationScope example
* add a test for labelLayout

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ConversationController.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/15-conversation/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/15-conversation/conversation.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/labelLayout.xhtml
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/resources/org/apache/myfaces/tobago/example/demo/Demo.xml

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ConversationController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ConversationController.java?rev=1790126&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ConversationController.java (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ConversationController.java Tue Apr  4 14:17:33 2017
@@ -0,0 +1,60 @@
+/*
+ * 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.myfaces.tobago.example.demo;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.Serializable;
+
+@ConversationScoped
+@Named
+public class ConversationController implements Serializable {
+
+  private static final Logger LOG = LoggerFactory.getLogger(ConversationController.class);
+
+  @Inject
+  Conversation conversation;
+  private int count = 0;
+
+  public String getConversationStatus() {
+    return conversation != null && !conversation.isTransient() ? "started" : "stopped";
+  }
+
+  public void beginConversation() {
+    conversation.begin();
+  }
+
+  public void endConversation() {
+    conversation.end();
+  }
+
+  public int getCount() {
+    return count;
+  }
+
+  public void countUp() {
+    count++;
+  }
+}

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/resources/org/apache/myfaces/tobago/example/demo/Demo.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/resources/org/apache/myfaces/tobago/example/demo/Demo.xml?rev=1790126&r1=1790125&r2=1790126&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/resources/org/apache/myfaces/tobago/example/demo/Demo.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/resources/org/apache/myfaces/tobago/example/demo/Demo.xml Tue Apr  4 14:17:33 2017
@@ -123,6 +123,7 @@
   <entry key="form_required">Required Forms</entry>
   <entry key="form_ajax">Ajax Forms</entry>
   <entry key="theme">Themes</entry>
+  <entry key="conversation">Conversation Scope</entry>
   <entry key="layout">Layout</entry>
   <entry key="flow_layout">FlowLayout</entry>
   <entry key="flex_layout">FlexLayout</entry>

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/15-conversation/conversation.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/15-conversation/conversation.xhtml?rev=1790126&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/15-conversation/conversation.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/15-conversation/conversation.xhtml Tue Apr  4 14:17:33 2017
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * 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.
+-->
+
+<ui:composition template="/main.xhtml"
+                xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:ui="http://java.sun.com/jsf/facelets">
+  <ui:param name="title" value="#{demoBundle.conversation}"/>
+  <p>This page show a simple example for the <code>@ConversationScoped</code> annotation.
+    The <b>Conversationscope</b> is needed for situations when the controller must live longer than a single request,
+    but don't need to live the whole session.</p>
+  <p>A <code>@Inject Conversation conversation;</code> must be injected.
+    After that a conversation can be started with <code>conversation.begin()</code> and stopped with
+    <code>conversation.end()</code>.</p>
+
+  <tc:box label="Example">
+    <p>Counting up greater than '1' is only possible when a conversation is started.</p>
+    <tc:out label="Conversation" value="#{conversationController.conversationStatus}"/>
+    <tc:buttons>
+      <tc:button label="Start Conversation" action="#{conversationController.beginConversation}"/>
+      <tc:button label="Stop Conversation" action="#{conversationController.endConversation}"/>
+    </tc:buttons>
+    <tc:separator/>
+    <tc:out label="Count" value="#{conversationController.count}"/>
+    <tc:button label="Count Up" action="#{conversationController.countUp}"/>
+  </tc:box>
+</ui:composition>

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/labelLayout.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/labelLayout.xhtml?rev=1790126&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/labelLayout.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/labelLayout.xhtml Tue Apr  4 14:17:33 2017
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * 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.
+-->
+
+<ui:composition template="/main.xhtml"
+                xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:f="http://java.sun.com/jsf/core"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:ui="http://java.sun.com/jsf/facelets">
+  <ui:param name="title" value="labelLayout"/>
+
+  <tc:box label="&lt;tc:date>">
+    <tc:date id="date"/>
+    <tc:date id="dateSkip" label="Date" labelLayout="skip"/>
+    <tc:date id="dateNone" label="Date" labelLayout="none"/>
+  </tc:box>
+  <tc:box label="&lt;tc:file>">
+    <tc:file id="file"/>
+    <tc:file id="fileSkip" label="File" labelLayout="skip"/>
+    <tc:file id="fileNone" label="File" labelLayout="none"/>
+  </tc:box>
+  <tc:box label="&lt;tc:in>">
+    <tc:in id="in"/>
+    <tc:in id="inSkip" label="In" labelLayout="skip"/>
+    <tc:in id="inNone" label="In" labelLayout="none"/>
+    <tc:separator/>
+    <tc:in id="inGroup">
+      <f:facet name="before">Input Group</f:facet>
+    </tc:in>
+    <tc:in id="inGroupSkip" label="Input Group" labelLayout="skip">
+      <f:facet name="before">Input Group</f:facet>
+    </tc:in>
+    <tc:in id="inGroupNone" label="Input Group" labelLayout="none">
+      <f:facet name="before">Input Group</f:facet>
+    </tc:in>
+  </tc:box>
+  <tc:box label="&lt;tc:out>">
+    <tc:out id="out" value="123"/>
+    <tc:out id="outSkip" label="Out" labelLayout="skip" value="123"/>
+    <tc:out id="outNone" label="Out " labelLayout="none" value="123"/>
+  </tc:box>
+  <tc:box label="&lt;tc:selectBooleanCheckbox>">
+    <tc:selectBooleanCheckbox id="selectBooleanCheckbox"/>
+    <tc:selectBooleanCheckbox id="selectBooleanCheckboxSkip" label="SelectBooleanCheckbox" labelLayout="skip"/>
+    <tc:selectBooleanCheckbox id="selectBooleanCheckboxNone" label="SelectBooleanCheckbox" labelLayout="none"/>
+  </tc:box>
+  <tc:box label="&lt;tc:selectManyCheckbox>">
+    <tc:selectManyCheckbox id="selectManyCheckboxNorm">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectManyCheckbox>
+    <tc:selectManyCheckbox id="selectManyCheckboxSkip" label="SelectManyCheckbox" labelLayout="skip">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectManyCheckbox>
+    <tc:selectManyCheckbox id="selectManyCheckboxNone" label="SelectManyCheckbox" labelLayout="none">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectManyCheckbox>
+  </tc:box>
+  <tc:box label="&lt;selectManyListbox>">
+    <tc:selectManyListbox id="selectManyListbox">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectManyListbox>
+    <tc:selectManyListbox id="selectManyListboxSkip" label="SelectManyListbox" labelLayout="skip">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectManyListbox>
+    <tc:selectManyListbox id="selectManyListboxNone" label="SelectManyListbox" labelLayout="none">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectManyListbox>
+  </tc:box>
+  <tc:box label="&lt;selectManyShuttle>">
+    <tc:selectManyShuttle id="SelectManyShuttle">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectManyShuttle>
+    <tc:selectManyShuttle id="SelectManyShuttleSkip" label="SelectManyShuttle" labelLayout="skip">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectManyShuttle>
+    <tc:selectManyShuttle id="SelectManyShuttleNone" label="SelectManyShuttle" labelLayout="none">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectManyShuttle>
+  </tc:box>
+  <tc:box label="&lt;selectOneChoice>">
+    <tc:selectOneChoice id="selectOneChoice">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectOneChoice>
+    <tc:selectOneChoice id="selectOneChoiceSkip" label="SelectOneChoice" labelLayout="skip">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectOneChoice>
+    <tc:selectOneChoice id="selectOneChoiceNone" label="SelectOneChoice" labelLayout="none">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectOneChoice>
+  </tc:box>
+  <tc:box label="&lt;selectOneListbox>">
+    <tc:selectOneListbox id="selectOneListbox">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectOneListbox>
+    <tc:selectOneListbox id="selectOneListboxSkip" label="SelectOneListbox" labelLayout="skip">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectOneListbox>
+    <tc:selectOneListbox id="selectOneListboxNone" label="SelectOneListbox" labelLayout="none">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectOneListbox>
+  </tc:box>
+  <tc:box label="&lt;selectOneRadio>">
+    <tc:selectOneRadio id="selectOneRadio">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectOneRadio>
+    <tc:selectOneRadio id="selectOneRadioSkip" label="SelectOneRadio" labelLayout="skip">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectOneRadio>
+    <tc:selectOneRadio id="selectOneRadioNone" label="SelectOneRadio" labelLayout="none">
+      <tc:selectItem itemValue="Item"/>
+    </tc:selectOneRadio>
+  </tc:box>
+  <tc:box label="&lt;tc:textarea>">
+    <tc:textarea id="textarea"/>
+    <tc:textarea id="textareaSkip" label="Textarea" labelLayout="skip"/>
+    <tc:textarea id="textareaNone" label="Textarea" labelLayout="none"/>
+  </tc:box>
+</ui:composition>