You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2007/03/02 22:00:31 UTC
svn commit: r513947 - in /myfaces/fusion/trunk/examples/src/main:
java/org/apache/myfaces/examples/ballot/backings/
java/org/apache/myfaces/examples/ballot/dao/
java/org/apache/myfaces/examples/ballot/model/
java/org/apache/myfaces/examples/lib/ webapp...
Author: imario
Date: Fri Mar 2 13:00:29 2007
New Revision: 513947
URL: http://svn.apache.org/viewvc?view=rev&rev=513947
Log:
vote application
Added:
myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotVoteTopic.java
- copied, changed from r513847, myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotTopic.java
myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/dao/ItemDao.java
- copied, changed from r513847, myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/dao/TopicDao.java
myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/dao/VoteDao.java
myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesUtils.java
- copied, changed from r513847, myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java
myfaces/fusion/trunk/examples/src/main/webapp/ballot/VoteTopic.jsp
- copied, changed from r513847, myfaces/fusion/trunk/examples/src/main/webapp/ballot/Topic.jsp
myfaces/fusion/trunk/examples/src/main/webapp/configurator/index.jsp
- copied, changed from r513847, myfaces/fusion/trunk/examples/src/main/webapp/ballot/index.jsp
Modified:
myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotHall.java
myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotTopic.java
myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Vote.java
myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java
myfaces/fusion/trunk/examples/src/main/webapp/WEB-INF/applicationContext.xml
myfaces/fusion/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml
myfaces/fusion/trunk/examples/src/main/webapp/ballot/Hall.jsp
myfaces/fusion/trunk/examples/src/main/webapp/ballot/Topic.jsp
myfaces/fusion/trunk/examples/src/main/webapp/header.jspf
Modified: myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotHall.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotHall.java?view=diff&rev=513947&r1=513946&r2=513947
==============================================================================
--- myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotHall.java (original)
+++ myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotHall.java Fri Mar 2 13:00:29 2007
@@ -21,10 +21,10 @@
import org.apache.myfaces.examples.ballot.dao.TopicDao;
import org.apache.myfaces.examples.ballot.model.Topic;
import org.apache.myfaces.examples.lib.FacesConst;
-import org.apache.myfaces.fusion.conversation.Conversation;
+import org.springframework.transaction.annotation.Transactional;
-import java.util.List;
import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
public class BallotHall
@@ -65,6 +65,7 @@
this.topicDao = topicDao;
}
+ @Transactional(readOnly = true)
public List<TopicInfo> getTopics()
{
if (topicInfos != null)
@@ -87,13 +88,11 @@
public String showItemsAction()
{
- Conversation.getCurrentInstance().invalidate();
return FacesConst.SUCCESS;
}
public String newTopicAction()
{
- Conversation.getCurrentInstance().invalidate();
return FacesConst.SUCCESS;
}
}
Modified: myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotTopic.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotTopic.java?view=diff&rev=513947&r1=513946&r2=513947
==============================================================================
--- myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotTopic.java (original)
+++ myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotTopic.java Fri Mar 2 13:00:29 2007
@@ -21,6 +21,7 @@
import org.apache.commons.lang.StringUtils;
import org.apache.myfaces.examples.ballot.dao.TopicDao;
+import org.apache.myfaces.examples.ballot.dao.ItemDao;
import org.apache.myfaces.examples.ballot.model.Item;
import org.apache.myfaces.examples.ballot.model.Topic;
import org.apache.myfaces.examples.lib.FacesConst;
@@ -32,6 +33,7 @@
public class BallotTopic
{
private TopicDao topicDao;
+ private ItemDao itemDao;
private Topic topic;
@@ -48,12 +50,22 @@
this.topicDao = topicDao;
}
+ public ItemDao getItemDao()
+ {
+ return itemDao;
+ }
+
+ public void setItemDao(ItemDao itemDao)
+ {
+ this.itemDao = itemDao;
+ }
+
public void initView()
{
if (topic == null)
{
String topicId = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("topicId");
- if (topicId != null)
+ if (!StringUtils.isEmpty(topicId))
{
initTopic(Long.valueOf(topicId, 10));
}
@@ -89,6 +101,7 @@
if (topic.getItems() != null)
{
topic.getItems().remove(getSelectedItem());
+ itemDao.remove(getSelectedItem());
}
return null;
}
@@ -101,6 +114,13 @@
return null;
}
+ public String newAction()
+ {
+ Conversation.getCurrentInstance().invalidate();
+
+ return FacesConst.SUCCESS;
+ }
+
@Transactional
public String saveAction()
{
Copied: myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotVoteTopic.java (from r513847, myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotTopic.java)
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotVoteTopic.java?view=diff&rev=513947&p1=myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotTopic.java&r1=513847&p2=myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotVoteTopic.java&r2=513947
==============================================================================
--- myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotTopic.java (original)
+++ myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/backings/BallotVoteTopic.java Fri Mar 2 13:00:29 2007
@@ -1,4 +1,8 @@
/*
+ * Copyright (c) 2007, Your Corporation. All Rights Reserved.
+ */
+
+/*
* 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
@@ -21,22 +25,42 @@
import org.apache.commons.lang.StringUtils;
import org.apache.myfaces.examples.ballot.dao.TopicDao;
+import org.apache.myfaces.examples.ballot.dao.VoteDao;
import org.apache.myfaces.examples.ballot.model.Item;
import org.apache.myfaces.examples.ballot.model.Topic;
+import org.apache.myfaces.examples.ballot.model.Vote;
import org.apache.myfaces.examples.lib.FacesConst;
import org.apache.myfaces.fusion.conversation.Conversation;
+import org.apache.myfaces.fusion.conversation.jsf.JsfConversationUtils;
import org.springframework.transaction.annotation.Transactional;
import javax.faces.context.FacesContext;
+import java.util.ArrayList;
+import java.util.List;
-public class BallotTopic
+public class BallotVoteTopic
{
private TopicDao topicDao;
+ private VoteDao voteDao;
private Topic topic;
- private Item selectedItem;
- private Item newItem = new Item();
+ private List<ItemInfo> itemInfos;
+
+ public static class ItemInfo
+ {
+ private final Item item;
+
+ protected ItemInfo(Item item)
+ {
+ this.item = item;
+ }
+
+ public Item getItem()
+ {
+ return item;
+ }
+ }
public TopicDao getTopicDao()
{
@@ -48,79 +72,65 @@
this.topicDao = topicDao;
}
+ public VoteDao getVoteDao()
+ {
+ return voteDao;
+ }
+
+ public void setVoteDao(VoteDao voteDao)
+ {
+ this.voteDao = voteDao;
+ }
+
public void initView()
{
if (topic == null)
{
String topicId = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("topicId");
- if (topicId != null)
+ if (!StringUtils.isEmpty(topicId))
{
initTopic(Long.valueOf(topicId, 10));
}
else
{
- topic = new Topic();
+ JsfConversationUtils.ensureConversation("ballotVoteTopic", "ballotHall");
}
}
}
- public Topic getTopic()
+ public void initTopic(Long id)
{
- return topic;
+ topic = topicDao.getByKey(id);
}
-
- public Item getNewItem()
+
+ public Topic getTopic()
{
- return newItem;
+ return topic;
}
- public Item getSelectedItem()
+ public List<ItemInfo> getItems()
{
- return selectedItem;
- }
+ if (itemInfos != null)
+ {
+ return itemInfos;
+ }
- public void setSelectedItem(Item selectedItem)
- {
- this.selectedItem = selectedItem;
- }
+ itemInfos = new ArrayList<ItemInfo>();
- public String removeItemAction()
- {
- if (topic.getItems() != null)
+ List<Vote> votes = voteDao.getVotesForVoter(/* todo */ null);
+ for (Item item : getTopic().getItems())
{
- topic.getItems().remove(getSelectedItem());
+ itemInfos.add(new ItemInfo(item));
}
- return null;
- }
-
- public String addItemAction()
- {
- topic.addItem(getNewItem());
- newItem = new Item();
-
- return null;
+
+ return itemInfos;
}
@Transactional
public String saveAction()
{
- if (!StringUtils.isEmpty(getNewItem().getContent()))
- {
- addItemAction();
- }
-
- topicDao.save(topic);
-
Conversation.getCurrentInstance().invalidate();
-
-// BallotTopic newBean = (BallotTopic) ConversationUtils.invalidateAndRestart(Conversation.getCurrentInstance());
-// newBean.initTopic(getTopic().getId());
return FacesConst.SUCCESS;
- }
-
- public void initTopic(Long id)
- {
- topic = topicDao.getByKey(id);
}
}
Copied: myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/dao/ItemDao.java (from r513847, myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/dao/TopicDao.java)
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/dao/ItemDao.java?view=diff&rev=513947&p1=myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/dao/TopicDao.java&r1=513847&p2=myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/dao/ItemDao.java&r2=513947
==============================================================================
--- myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/dao/TopicDao.java (original)
+++ myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/dao/ItemDao.java Fri Mar 2 13:00:29 2007
@@ -1,4 +1,8 @@
/*
+ * Copyright (c) 2007, Your Corporation. All Rights Reserved.
+ */
+
+/*
* 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
@@ -19,16 +23,12 @@
package org.apache.myfaces.examples.ballot.dao;
-import org.apache.myfaces.examples.ballot.model.Topic;
+import org.apache.myfaces.examples.ballot.model.Item;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
-import javax.persistence.Query;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-public class TopicDao
+public class ItemDao
{
@PersistenceContext
private EntityManager entityManager;
@@ -43,38 +43,8 @@
this.entityManager = entityManager;
}
- public List<Topic> getTopics()
- {
- Query query = entityManager.createQuery("select topic from Topic topic");
- return query.getResultList();
- }
-
- public Map<Long, Integer> getTopicVotes()
- {
- Map<Long, Integer> ret = new TreeMap<Long, Integer>();
-
- Query query = entityManager.createNamedQuery("getVotes");
- List votes = query.getResultList();
- for (Object vote : votes)
- {
- Object[] columns = (Object[]) vote;
-
- Long id = (Long) columns[0];
- Integer voteCount = (Integer) columns[1];
-
- ret.put(id, voteCount);
- }
-
- return ret;
- }
-
- public Topic getByKey(Long key)
- {
- return entityManager.find(Topic.class, key);
- }
-
- public void save(Topic topic)
+ public void remove(Item item)
{
- entityManager.persist(topic);
+ entityManager.remove(item);
}
-}
+}
\ No newline at end of file
Added: myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/dao/VoteDao.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/dao/VoteDao.java?view=auto&rev=513947
==============================================================================
--- myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/dao/VoteDao.java (added)
+++ myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/dao/VoteDao.java Fri Mar 2 13:00:29 2007
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2007, Your Corporation. All Rights Reserved.
+ */
+
+/*
+ * 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.examples.ballot.dao;
+
+import org.apache.myfaces.examples.ballot.model.Vote;
+import org.apache.myfaces.examples.ballot.model.Voter;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import java.util.List;
+
+public class VoteDao
+{
+ @PersistenceContext
+ private EntityManager entityManager;
+
+ public EntityManager getEntityManager()
+ {
+ return entityManager;
+ }
+
+ public void setEntityManager(EntityManager entityManager)
+ {
+ this.entityManager = entityManager;
+ }
+
+ public List<Vote> getVotesForVoter(Voter voter)
+ {
+ Query query = entityManager.createNamedQuery("getVotesForVoter");
+ query.setParameter("voter", voter);
+ return query.getResultList();
+ }
+}
\ No newline at end of file
Modified: myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Vote.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Vote.java?view=diff&rev=513947&r1=513946&r2=513947
==============================================================================
--- myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Vote.java (original)
+++ myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Vote.java Fri Mar 2 13:00:29 2007
@@ -29,7 +29,12 @@
import javax.persistence.JoinColumn;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
+import javax.persistence.NamedQuery;
+@NamedQuery(
+ name="getVotesForVoter",
+ query="select vote from Vote vote where vote.voter = :voter"
+)
@Entity
public class Vote
{
Modified: myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java?view=diff&rev=513947&r1=513946&r2=513947
==============================================================================
--- myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java (original)
+++ myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java Fri Mar 2 13:00:29 2007
@@ -19,8 +19,12 @@
package org.apache.myfaces.examples.lib;
-public class FacesConst
+public final class FacesConst
{
+ private FacesConst()
+ {
+ }
+
public final static String SUCCESS = "success";
public final static String FAILURE = "failure";
}
Copied: myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesUtils.java (from r513847, myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java)
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesUtils.java?view=diff&rev=513947&p1=myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java&r1=513847&p2=myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesUtils.java&r2=513947
==============================================================================
--- myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java (original)
+++ myfaces/fusion/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesUtils.java Fri Mar 2 13:00:29 2007
@@ -19,8 +19,18 @@
package org.apache.myfaces.examples.lib;
-public class FacesConst
+import javax.faces.context.FacesContext;
+import javax.faces.application.FacesMessage;
+
+public final class FacesUtils
{
- public final static String SUCCESS = "success";
- public final static String FAILURE = "failure";
-}
+ private FacesUtils()
+ {
+ }
+
+ public void addErrorMessage(String message)
+ {
+ FacesContext.getCurrentInstance().addMessage(null,
+ new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message));
+ }
+}
\ No newline at end of file
Modified: myfaces/fusion/trunk/examples/src/main/webapp/WEB-INF/applicationContext.xml
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/examples/src/main/webapp/WEB-INF/applicationContext.xml?view=diff&rev=513947&r1=513946&r2=513947
==============================================================================
--- myfaces/fusion/trunk/examples/src/main/webapp/WEB-INF/applicationContext.xml (original)
+++ myfaces/fusion/trunk/examples/src/main/webapp/WEB-INF/applicationContext.xml Fri Mar 2 13:00:29 2007
@@ -151,20 +151,32 @@
name="topicDao"
class="org.apache.myfaces.examples.ballot.dao.TopicDao">
</bean>
+ <bean
+ name="itemDao"
+ class="org.apache.myfaces.examples.ballot.dao.ItemDao">
+ </bean>
<bean
name="ballotHall"
class="org.apache.myfaces.examples.ballot.backings.BallotHall"
- scope="conversation"
+ scope="request"
autowire="byName">
- <aop:scoped-proxy/>
-
</bean>
<bean
name="ballotTopic"
class="org.apache.myfaces.examples.ballot.backings.BallotTopic"
+ scope="conversation"
+ autowire="byName">
+
+ <aop:scoped-proxy/>
+
+ </bean>
+
+ <bean
+ name="ballotVoteTopic"
+ class="org.apache.myfaces.examples.ballot.backings.BallotVoteTopic"
scope="conversation"
autowire="byName">
Modified: myfaces/fusion/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml?view=diff&rev=513947&r1=513946&r2=513947
==============================================================================
--- myfaces/fusion/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/fusion/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml Fri Mar 2 13:00:29 2007
@@ -22,6 +22,8 @@
<application>
<variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
+ <navigation-handler>org.apache.myfaces.fusion.urlParamNav.UrlParameterNavigationHandler</navigation-handler>
+ <view-handler>org.apache.myfaces.fusion.urlParamNav.UrlParameterViewHandler</view-handler>
</application>
<navigation-rule>
@@ -77,9 +79,27 @@
<navigation-rule>
<description>show items for topic</description>
<navigation-case>
- <from-action>#{ballotTopic.showItemsAction}</from-action>
+ <from-action>#{ballotHall.showItemsAction}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/ballot/Topic.jsp?topicId=#{param.topicId}</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </navigation-rule>
+
+ <navigation-rule>
+ <description>vote on topic</description>
+ <navigation-case>
+ <from-outcome>voteOnTopic</from-outcome>
+ <to-view-id>/ballot/VoteTopic.jsp?topicId=#{param.topicId}</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </navigation-rule>
+
+ <navigation-rule>
+ <description>various main navigations</description>
+ <navigation-case>
+ <from-outcome>ballotHall</from-outcome>
+ <to-view-id>/ballot/Hall.jsp</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
Modified: myfaces/fusion/trunk/examples/src/main/webapp/ballot/Hall.jsp
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/examples/src/main/webapp/ballot/Hall.jsp?view=diff&rev=513947&r1=513946&r2=513947
==============================================================================
--- myfaces/fusion/trunk/examples/src/main/webapp/ballot/Hall.jsp (original)
+++ myfaces/fusion/trunk/examples/src/main/webapp/ballot/Hall.jsp Fri Mar 2 13:00:29 2007
@@ -79,7 +79,17 @@
<h:commandLink
value="Show items"
- action="#{ballotHall.showItemsAction}">
+ action="#{ballotHall.showItemsAction}"
+ rendered="#{!topicInfo.topic.started}">
+
+ <f:param name="topicId" value="#{topicInfo.topic.id}" />
+
+ </h:commandLink>
+
+ <h:commandLink
+ value="Vote"
+ action="voteOnTopic"
+ rendered="#{topicInfo.topic.started}">
<f:param name="topicId" value="#{topicInfo.topic.id}" />
Modified: myfaces/fusion/trunk/examples/src/main/webapp/ballot/Topic.jsp
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/examples/src/main/webapp/ballot/Topic.jsp?view=diff&rev=513947&r1=513946&r2=513947
==============================================================================
--- myfaces/fusion/trunk/examples/src/main/webapp/ballot/Topic.jsp (original)
+++ myfaces/fusion/trunk/examples/src/main/webapp/ballot/Topic.jsp Fri Mar 2 13:00:29 2007
@@ -33,7 +33,9 @@
</t:htmlTag>
<h:panelGrid
- columns="1">
+ columns="1"
+ width="100%">
+
<f:facet name="footer">
<h:panelGrid columns="2">
@@ -43,27 +45,34 @@
<h:commandButton
value="Save"
- action="#{ballotTopic.saveAction}"/>
+ action="#{ballotTopic.saveAction}"
+ rendered="#{!ballotTopic.topic.started}"/>
</h:panelGrid>
</f:facet>
<h:panelGrid
columns="2"
- rowClasses="TR1, TR2">
+ rowClasses="TR1, TR2"
+ width="40%">
<f:facet name="header">
- <h:outputText value="Topic Data"/>
+ <h:outputText value="Topic"/>
</f:facet>
<h:outputLabel
for="name"
value="Name"/>
+
<h:inputText
id="name"
value="#{ballotTopic.topic.name}"
size="80"
- maxlength="200"/>
+ maxlength="200"
+ rendered="#{!ballotTopic.topic.started}"/>
+ <h:outputText
+ value="#{ballotTopic.topic.name}"
+ rendered="#{ballotTopic.topic.started}"/>
<h:outputLabel
for="description"
@@ -71,10 +80,15 @@
<h:inputTextarea
id="description"
value="#{ballotTopic.topic.description}"
- cols="40">
+ cols="40"
+ rendered="#{!ballotTopic.topic.started}">
<f:validateLength maximum="1024" />
</h:inputTextarea>
+ <h:outputText
+ value="#{ballotTopic.topic.description}"
+ rendered="#{ballotTopic.topic.started}"/>
+
<h:outputLabel
for="started"
value="Started"/>
@@ -85,54 +99,55 @@
</h:panelGrid>
+ <t:dataTable
+ styleClass="inputTable"
+ var="item"
+ value="#{ballotTopic.topic.items}"
+ rowClasses="TR1,TR2"
+ columnClasses="nowrap,nowrap"
+ width="40%">
- <s:subForm>
- <t:dataTable
- styleClass="inputTable"
- var="item"
- value="#{ballotTopic.topic.items}"
- rowClasses="TR1,TR2"
- columnClasses="nowrap,nowrap"
- width="40%">
-
- <f:facet name="footer">
- <h:panelGroup>
- <h:commandLink value="Add Item" action="#{ballotTopic.addItemAction}"/>
- </h:panelGroup>
+ <f:facet name="header">
+ <h:outputText value="Items"/>
+ </f:facet>
+
+ <t:column>
+ <f:facet name="header">
+ <h:outputText value="content"/>
</f:facet>
+ <h:outputText value="#{item.content}"/>
+ </t:column>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Action"/>
+ </f:facet>
+
+ <h:commandLink
+ value="Remove item"
+ action="#{ballotTopic.removeItemAction}"
+ rendered="#{!ballotTopic.topic.started}">
+
+ <t:updateActionListener property="#{ballotTopic.selectedItem}" value="#{item}" />
+
+ </h:commandLink>
+ </h:column>
+
+ </t:dataTable>
+
+ <h:panelGroup
+ rendered="#{!ballotTopic.topic.started}">
+ <s:subForm>
+ <h:inputText
+ value="#{ballotTopic.newItem.content}"
+ size="80"
+ maxlength="200"
+ required="true"/>
+
+ <h:commandLink value="Add Item" action="#{ballotTopic.addItemAction}"/>
+ </s:subForm>
+ </h:panelGroup>
- <t:column>
- <f:facet name="header">
- <h:outputText value="content"/>
- </f:facet>
- <f:facet name="footer">
- <h:inputText
- value="#{ballotTopic.newItem.content}"
- size="80"
- maxlength="200"
- required="true"/>
- </f:facet>
- <h:outputText value="#{item.content}"/>
- </t:column>
-
- <h:column>
- <f:facet name="header">
- <h:outputText value="Action"/>
- </f:facet>
-
- <h:commandLink
- value="Remove item"
- action="#{ballotTopic.removeItemAction}"
- rendered="#{!ballotTopic.topic.started}">
-
- <t:updateActionListener property="#{ballotTopic.selectedItem}" value="#{item}" />
-
- </h:commandLink>
- </h:column>
-
- </t:dataTable>
- </s:subForm>
-
</h:panelGrid>
</h:form>
Copied: myfaces/fusion/trunk/examples/src/main/webapp/ballot/VoteTopic.jsp (from r513847, myfaces/fusion/trunk/examples/src/main/webapp/ballot/Topic.jsp)
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/examples/src/main/webapp/ballot/VoteTopic.jsp?view=diff&rev=513947&p1=myfaces/fusion/trunk/examples/src/main/webapp/ballot/Topic.jsp&r1=513847&p2=myfaces/fusion/trunk/examples/src/main/webapp/ballot/VoteTopic.jsp&r2=513947
==============================================================================
--- myfaces/fusion/trunk/examples/src/main/webapp/ballot/Topic.jsp (original)
+++ myfaces/fusion/trunk/examples/src/main/webapp/ballot/VoteTopic.jsp Fri Mar 2 13:00:29 2007
@@ -29,110 +29,84 @@
<h:form>
<t:htmlTag value="h3">
- <h:outputText value="Ballot Topic"/>
+ <h:outputText value="Ballot Vote on Topic"/>
</t:htmlTag>
<h:panelGrid
- columns="1">
+ columns="1"
+ width="100%">
+
<f:facet name="footer">
<h:panelGrid columns="2">
<h:commandButton
- value="Cancel & New"
- action="#{ballotTopic.newAction}"/>
-
- <h:commandButton
value="Save"
- action="#{ballotTopic.saveAction}"/>
+ action="#{ballotVoteTopic.saveAction}"/>
</h:panelGrid>
</f:facet>
<h:panelGrid
columns="2"
- rowClasses="TR1, TR2">
+ rowClasses="TR1, TR2"
+ width="40%">
<f:facet name="header">
- <h:outputText value="Topic Data"/>
+ <h:outputText value="Topic"/>
</f:facet>
- <h:outputLabel
- for="name"
+ <h:outputText
value="Name"/>
- <h:inputText
- id="name"
- value="#{ballotTopic.topic.name}"
- size="80"
- maxlength="200"/>
- <h:outputLabel
- for="description"
+ <h:outputText
+ value="#{ballotVoteTopic.topic.name}"/>
+
+ <h:outputText
value="Description"/>
- <h:inputTextarea
- id="description"
- value="#{ballotTopic.topic.description}"
- cols="40">
- <f:validateLength maximum="1024" />
- </h:inputTextarea>
+ <h:outputText
+ value="#{ballotVoteTopic.topic.description}"/>
<h:outputLabel
for="started"
value="Started"/>
<h:selectBooleanCheckbox
id="started"
- value="#{ballotTopic.topic.started}"
- readonly="#{ballotTopic.topic.started}" />
+ value="#{ballotVoteTopic.topic.started}"
+ readonly="true" />
</h:panelGrid>
+ <t:dataTable
+ styleClass="inputTable"
+ var="itemInfo"
+ value="#{ballotVoteTopic.items}"
+ rowClasses="TR1,TR2"
+ columnClasses="nowrap,nowrap"
+ width="40%">
+
+ <f:facet name="header">
+ <h:outputText value="Items"/>
+ </f:facet>
+
+ <t:column>
+ <f:facet name="header">
+ <h:outputText value="content"/>
+ </f:facet>
+ <h:outputText value="#{itemInfo.ite.content}"/>
+ </t:column>
- <s:subForm>
- <t:dataTable
- styleClass="inputTable"
- var="item"
- value="#{ballotTopic.topic.items}"
- rowClasses="TR1,TR2"
- columnClasses="nowrap,nowrap"
- width="40%">
-
- <f:facet name="footer">
- <h:panelGroup>
- <h:commandLink value="Add Item" action="#{ballotTopic.addItemAction}"/>
- </h:panelGroup>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Vote"/>
</f:facet>
- <t:column>
- <f:facet name="header">
- <h:outputText value="content"/>
- </f:facet>
- <f:facet name="footer">
- <h:inputText
- value="#{ballotTopic.newItem.content}"
- size="80"
- maxlength="200"
- required="true"/>
- </f:facet>
- <h:outputText value="#{item.content}"/>
- </t:column>
-
- <h:column>
- <f:facet name="header">
- <h:outputText value="Action"/>
- </f:facet>
-
- <h:commandLink
- value="Remove item"
- action="#{ballotTopic.removeItemAction}"
- rendered="#{!ballotTopic.topic.started}">
-
- <t:updateActionListener property="#{ballotTopic.selectedItem}" value="#{item}" />
-
- </h:commandLink>
- </h:column>
-
- </t:dataTable>
- </s:subForm>
-
+ <h:selectOneRadio value="#{item.vote}">
+
+ </h:selectOneRadio>
+ </h:column>
+
+ </t:dataTable>
+
</h:panelGrid>
</h:form>
Copied: myfaces/fusion/trunk/examples/src/main/webapp/configurator/index.jsp (from r513847, myfaces/fusion/trunk/examples/src/main/webapp/ballot/index.jsp)
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/examples/src/main/webapp/configurator/index.jsp?view=diff&rev=513947&p1=myfaces/fusion/trunk/examples/src/main/webapp/ballot/index.jsp&r1=513847&p2=myfaces/fusion/trunk/examples/src/main/webapp/configurator/index.jsp&r2=513947
==============================================================================
--- myfaces/fusion/trunk/examples/src/main/webapp/ballot/index.jsp (original)
+++ myfaces/fusion/trunk/examples/src/main/webapp/configurator/index.jsp Fri Mar 2 13:00:29 2007
@@ -1,4 +1,8 @@
<%--
+ Copyright (c) 2007, Your Corporation. All Rights Reserved.
+ --%>
+
+<%--
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
@@ -18,4 +22,4 @@
--%>
<%@ page pageEncoding="UTF-8" %>
-<% response.sendRedirect("Hall.faces"); %>
\ No newline at end of file
+<% response.sendRedirect("ComponentSelection.faces"); %>
\ No newline at end of file
Modified: myfaces/fusion/trunk/examples/src/main/webapp/header.jspf
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/examples/src/main/webapp/header.jspf?view=diff&rev=513947&r1=513946&r2=513947
==============================================================================
--- myfaces/fusion/trunk/examples/src/main/webapp/header.jspf (original)
+++ myfaces/fusion/trunk/examples/src/main/webapp/header.jspf Fri Mar 2 13:00:29 2007
@@ -45,7 +45,9 @@
<h:form styleClass="navigation">
<t:htmlTag value="ul">
<t:htmlTag value="li">
- <h:commandLink action="home" value="Home" />
+ <h:outputLink value="/">
+ <h:outputText value="Home" />
+ </h:outputLink>
</t:htmlTag>
</t:htmlTag>
</h:form>