MyFaces Html5 Demo : Changed sport teams with Apache Projects
git-svn-id: https://svn.apache.org/repos/asf/myfaces/html5/trunk@1081233 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/bean/DndBean.java b/myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/bean/DndBean.java
index 0982c53..d02b105 100644
--- a/myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/bean/DndBean.java
+++ b/myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/bean/DndBean.java
@@ -30,8 +30,8 @@
import javax.faces.bean.ViewScoped;
import javax.faces.event.AbortProcessingException;
-import org.apache.myfaces.html5.demo.model.SportsTeam;
-import org.apache.myfaces.html5.demo.model.SportsTeamType;
+import org.apache.myfaces.html5.demo.model.ApacheProject;
+import org.apache.myfaces.html5.demo.model.ApacheProjectLanguage;
import org.apache.myfaces.html5.event.DropEvent;
@ManagedBean(name = "dndBean")
@@ -42,7 +42,7 @@
private String simpleDndOutput = "Nothing dropped yet";
private String dragAnythingOutput = "Nothing dropped yet";
- private String teamDropOutput = "Nothing dropped yet";
+ private String projectDropOutput = "Nothing dropped yet";
public void processSimpleDnd(DropEvent event) throws AbortProcessingException
{
@@ -77,146 +77,146 @@
return dragAnythingOutput;
}
- private List<SportsTeam> teams;
- private List<SportsTeam> footballTeams;
- private List<SportsTeam> basketballTeams;
+ private List<ApacheProject> projects;
+ private List<ApacheProject> cProjects;
+ private List<ApacheProject> javaProjects;
public DndBean()
{
- initTeams();
+ initProjects();
}
- public String initTeams()
+ public String initProjects()
{
- teams = new ArrayList<SportsTeam>();
- footballTeams = new ArrayList<SportsTeam>();
- basketballTeams = new ArrayList<SportsTeam>();
- teams.add(new SportsTeam("fcb", "FC Barcelona", SportsTeamType.FOOTBALL));
- teams.add(new SportsTeam("rma", "Real Madrid", SportsTeamType.FOOTBALL));
- teams.add(new SportsTeam("lal", "LA Lakers", SportsTeamType.BASKETBALL));
- teams.add(new SportsTeam("boc", "Boston Celtics", SportsTeamType.BASKETBALL));
+ projects = new ArrayList<ApacheProject>();
+ cProjects = new ArrayList<ApacheProject>();
+ javaProjects = new ArrayList<ApacheProject>();
+ projects.add(new ApacheProject("spamassassin", "SpamAssasin", ApacheProjectLanguage.C));
+ projects.add(new ApacheProject("subversion", "Subversion", ApacheProjectLanguage.C));
+ projects.add(new ApacheProject("myfaces", "MyFaces", ApacheProjectLanguage.JAVA));
+ projects.add(new ApacheProject("tomcat", "Tomcat", ApacheProjectLanguage.JAVA));
this.simpleDndOutput = "Nothing dropped yet";
this.dragAnythingOutput = "Nothing dropped yet";
- this.teamDropOutput = "Nothing dropped yet";
+ this.projectDropOutput = "Nothing dropped yet";
return null;
}
- public List<SportsTeam> getTeams()
+ public List<ApacheProject> getProjects()
{
- return teams;
+ return projects;
}
// TODO: reuse the code!
- public void processFootballTeamDrop(DropEvent event) throws AbortProcessingException
+ public void processJavaProjectDrop(DropEvent event) throws AbortProcessingException
{
String param = event.getParam();
if (param == null || param.isEmpty())
return;
- SportsTeam droppedTeam = null;
- for (SportsTeam team : this.teams)
+ ApacheProject droppedProject = null;
+ for (ApacheProject project : this.projects)
{
- if (team.getId().equals(param))
+ if (project.getId().equals(param))
{
- droppedTeam = team;
+ droppedProject = project;
break;
}
}
- if (droppedTeam == null)
+ if (droppedProject == null)
{
- teamDropOutput = "No team or already dropped team is dropped.";
+ projectDropOutput = "No project or already dropped project is dropped.";
return;
}
- teams.remove(droppedTeam);
- footballTeams.add(droppedTeam);
+ projects.remove(droppedProject);
+ javaProjects.add(droppedProject);
- teamDropOutput = droppedTeam.getName() + " is moved.";
+ projectDropOutput = droppedProject.getName() + " is moved.";
}
- public void processBasketballTeamDrop(DropEvent event) throws AbortProcessingException
+ public void processCProjectDrop(DropEvent event) throws AbortProcessingException
{
String param = event.getParam();
if (param == null || param.isEmpty())
return;
- SportsTeam droppedTeam = null;
- for (SportsTeam team : this.teams)
+ ApacheProject droppedProject = null;
+ for (ApacheProject project : this.projects)
{
- if (team.getId().equals(param))
+ if (project.getId().equals(param))
{
- droppedTeam = team;
+ droppedProject = project;
break;
}
}
- if (droppedTeam == null)
+ if (droppedProject == null)
{
- teamDropOutput = "No team or already dropped team is dropped.";
+ projectDropOutput = "No project or already dropped project is dropped.";
return;
}
- teams.remove(droppedTeam);
- basketballTeams.add(droppedTeam);
+ projects.remove(droppedProject);
+ cProjects.add(droppedProject);
- teamDropOutput = droppedTeam.getName() + " is moved.";
+ projectDropOutput = droppedProject.getName() + " is moved.";
}
- public void processTeamDrop(DropEvent event) throws AbortProcessingException
+ public void processProjectDrop(DropEvent event) throws AbortProcessingException
{
String param = event.getParam();
if (param == null || param.isEmpty())
return;
- SportsTeam droppedTeam = null;
- for (SportsTeam team : this.footballTeams)
+ ApacheProject droppedProject = null;
+ for (ApacheProject project : this.javaProjects)
{
- if (team.getId().equals(param))
+ if (project.getId().equals(param))
{
- droppedTeam = team;
- this.footballTeams.remove(team);
+ droppedProject = project;
+ this.javaProjects.remove(project);
break;
}
}
- if (droppedTeam == null)
+ if (droppedProject == null)
{
- for (SportsTeam team : this.basketballTeams)
+ for (ApacheProject project : this.cProjects)
{
- if (team.getId().equals(param))
+ if (project.getId().equals(param))
{
- droppedTeam = team;
- this.basketballTeams.remove(team);
+ droppedProject = project;
+ this.cProjects.remove(project);
break;
}
}
}
- if (droppedTeam == null)
+ if (droppedProject == null)
{
- teamDropOutput = "No team or already dropped team is dropped.";
+ projectDropOutput = "No project or already dropped project is dropped.";
return;
}
- teams.add(droppedTeam);
+ projects.add(droppedProject);
- teamDropOutput = droppedTeam.getName() + " is moved.";
+ projectDropOutput = droppedProject.getName() + " is moved.";
}
- public String getTeamDropOutput()
+ public String getProjectDropOutput()
{
- return teamDropOutput;
+ return projectDropOutput;
}
- public List<SportsTeam> getFootballTeams()
+ public List<ApacheProject> getJavaProjects()
{
- return footballTeams;
+ return javaProjects;
}
- public List<SportsTeam> getBasketballTeams()
+ public List<ApacheProject> getCProjects()
{
- return basketballTeams;
+ return cProjects;
}
}
diff --git a/myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/model/SportsTeam.java b/myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/model/ApacheProject.java
similarity index 81%
rename from myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/model/SportsTeam.java
rename to myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/model/ApacheProject.java
index ba93ae6..517cb31 100644
--- a/myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/model/SportsTeam.java
+++ b/myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/model/ApacheProject.java
@@ -19,19 +19,17 @@
package org.apache.myfaces.html5.demo.model;
-import org.apache.myfaces.html5.demo.model.SportsTeamType;
-
import java.io.Serializable;
-public class SportsTeam implements Serializable
+public class ApacheProject implements Serializable
{
private static final long serialVersionUID = 1L;
private String id;
private String name;
- private SportsTeamType type;
+ private ApacheProjectLanguage type;
- public SportsTeam(String id, String name, SportsTeamType type)
+ public ApacheProject(String id, String name, ApacheProjectLanguage type)
{
this.id = id;
this.name = name;
@@ -58,12 +56,12 @@
this.name = name;
}
- public SportsTeamType getType()
+ public ApacheProjectLanguage getType()
{
return type;
}
- public void setType(SportsTeamType type)
+ public void setType(ApacheProjectLanguage type)
{
this.type = type;
}
@@ -71,9 +69,9 @@
@Override
public boolean equals(Object obj)
{
- if (obj instanceof SportsTeam)
+ if (obj instanceof ApacheProject)
{
- SportsTeam other = (SportsTeam) obj;
+ ApacheProject other = (ApacheProject) obj;
if(other.getId().equals(this.id))
return true;
}
diff --git a/myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/model/SportsTeamType.java b/myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/model/ApacheProjectLanguage.java
similarity index 90%
rename from myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/model/SportsTeamType.java
rename to myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/model/ApacheProjectLanguage.java
index fe070cb..9894744 100644
--- a/myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/model/SportsTeamType.java
+++ b/myfaces-html5-demo/src/main/java/org/apache/myfaces/html5/demo/model/ApacheProjectLanguage.java
@@ -21,14 +21,14 @@
-public enum SportsTeamType
+public enum ApacheProjectLanguage
{
- FOOTBALL("F"), BASKETBALL("B");
+ JAVA("J"), C("C");
private final String code;
- private SportsTeamType(String code)
+ private ApacheProjectLanguage(String code)
{
this.code = code;
}
diff --git a/myfaces-html5-demo/src/main/webapp/resources/image/apache-project/myfaces.png b/myfaces-html5-demo/src/main/webapp/resources/image/apache-project/myfaces.png
new file mode 100644
index 0000000..923ef5d
--- /dev/null
+++ b/myfaces-html5-demo/src/main/webapp/resources/image/apache-project/myfaces.png
Binary files differ
diff --git a/myfaces-html5-demo/src/main/webapp/resources/image/apache-project/spamassassin.png b/myfaces-html5-demo/src/main/webapp/resources/image/apache-project/spamassassin.png
new file mode 100644
index 0000000..7978868
--- /dev/null
+++ b/myfaces-html5-demo/src/main/webapp/resources/image/apache-project/spamassassin.png
Binary files differ
diff --git a/myfaces-html5-demo/src/main/webapp/resources/image/apache-project/subversion.png b/myfaces-html5-demo/src/main/webapp/resources/image/apache-project/subversion.png
new file mode 100644
index 0000000..888d171
--- /dev/null
+++ b/myfaces-html5-demo/src/main/webapp/resources/image/apache-project/subversion.png
Binary files differ
diff --git a/myfaces-html5-demo/src/main/webapp/resources/image/apache-project/tomcat.png b/myfaces-html5-demo/src/main/webapp/resources/image/apache-project/tomcat.png
new file mode 100644
index 0000000..7098c7d
--- /dev/null
+++ b/myfaces-html5-demo/src/main/webapp/resources/image/apache-project/tomcat.png
Binary files differ
diff --git a/myfaces-html5-demo/src/main/webapp/resources/image/team/boc.png b/myfaces-html5-demo/src/main/webapp/resources/image/team/boc.png
deleted file mode 100644
index 2accda5..0000000
--- a/myfaces-html5-demo/src/main/webapp/resources/image/team/boc.png
+++ /dev/null
Binary files differ
diff --git a/myfaces-html5-demo/src/main/webapp/resources/image/team/fb.png b/myfaces-html5-demo/src/main/webapp/resources/image/team/fb.png
deleted file mode 100644
index 2748e5a..0000000
--- a/myfaces-html5-demo/src/main/webapp/resources/image/team/fb.png
+++ /dev/null
Binary files differ
diff --git a/myfaces-html5-demo/src/main/webapp/resources/image/team/fcb.png b/myfaces-html5-demo/src/main/webapp/resources/image/team/fcb.png
deleted file mode 100644
index 6a72285..0000000
--- a/myfaces-html5-demo/src/main/webapp/resources/image/team/fcb.png
+++ /dev/null
Binary files differ
diff --git a/myfaces-html5-demo/src/main/webapp/resources/image/team/gs.png b/myfaces-html5-demo/src/main/webapp/resources/image/team/gs.png
deleted file mode 100644
index 8b10f4d..0000000
--- a/myfaces-html5-demo/src/main/webapp/resources/image/team/gs.png
+++ /dev/null
Binary files differ
diff --git a/myfaces-html5-demo/src/main/webapp/resources/image/team/lal.png b/myfaces-html5-demo/src/main/webapp/resources/image/team/lal.png
deleted file mode 100644
index 2150866..0000000
--- a/myfaces-html5-demo/src/main/webapp/resources/image/team/lal.png
+++ /dev/null
Binary files differ
diff --git a/myfaces-html5-demo/src/main/webapp/resources/image/team/rma.png b/myfaces-html5-demo/src/main/webapp/resources/image/team/rma.png
deleted file mode 100644
index cc115b3..0000000
--- a/myfaces-html5-demo/src/main/webapp/resources/image/team/rma.png
+++ /dev/null
Binary files differ
diff --git a/myfaces-html5-demo/src/main/webapp/sections/dnd01.xhtml b/myfaces-html5-demo/src/main/webapp/sections/dnd01.xhtml
index 1d8bc70..5142dcf 100644
--- a/myfaces-html5-demo/src/main/webapp/sections/dnd01.xhtml
+++ b/myfaces-html5-demo/src/main/webapp/sections/dnd01.xhtml
@@ -58,8 +58,6 @@
.dragStarted { border: 2px solid yellow;}
.dragEntered { border: 4px dashed green; background-color: #88FF00;}
-
- .team { width: 250px; height: 80px; color:darkGray; border: 1px solid gray; font-size: 20px;}
</h:outputStylesheet>
<p class="sectionManual">
diff --git a/myfaces-html5-demo/src/main/webapp/sections/dnd02.xhtml b/myfaces-html5-demo/src/main/webapp/sections/dnd02.xhtml
index 987d038..e00f3af 100644
--- a/myfaces-html5-demo/src/main/webapp/sections/dnd02.xhtml
+++ b/myfaces-html5-demo/src/main/webapp/sections/dnd02.xhtml
@@ -58,8 +58,6 @@
.dragStarted { border: 2px solid yellow;}
.dragEntered { border: 4px dashed green; background-color: #88FF00;}
-
- .team { width: 250px; height: 80px; color:darkGray; border: 1px solid gray; font-size: 20px;}
</h:outputStylesheet>
<p class="sectionManual">
diff --git a/myfaces-html5-demo/src/main/webapp/sections/dnd03.xhtml b/myfaces-html5-demo/src/main/webapp/sections/dnd03.xhtml
index c3b760f..323f532 100644
--- a/myfaces-html5-demo/src/main/webapp/sections/dnd03.xhtml
+++ b/myfaces-html5-demo/src/main/webapp/sections/dnd03.xhtml
@@ -54,7 +54,7 @@
.dragStarted { border: 2px solid yellow;}
.dragEntered { border: 4px dashed green; background-color: #88FF00;}
- .team {
+ .project {
width: 200px;
height: 38px;
color:gray;
@@ -62,7 +62,7 @@
font-size: 17px;
text-shadow: 0 3px 5px rgba(100, 100, 100, 0.5);
}
- .team img {
+ .project img {
width: 35px;
}
@@ -78,72 +78,72 @@
<table width="100%">
<tr>
<td align="left">
- <hx:div id="teamDropZone" styleClass="dropZone03">
+ <hx:div id="projectDropZone" styleClass="dropZone03">
<fx:effects event="dragenter" additionalStyleClassToActivate="dragEntered" duration="0.5"/>
<fx:animations event="drop" duration="1s" iteration="5">
<fx:animationShake rotation="15" />
</fx:animations>
- <fx:dropTarget dropListener="#{dndBean.processTeamDrop}" rerender="dynamicDnDContainer" types="F,B"/>
+ <fx:dropTarget dropListener="#{dndBean.processProjectDrop}" rerender="dynamicDnDContainer" types="C,J"/>
<div style="padding:5px; text-align: center;">
- <h:outputText value="All Teams" />
+ <h:outputText value="All Projects" />
</div>
- <h:dataTable value="#{dndBean.teams}" var="team">
+ <h:dataTable value="#{dndBean.projects}" var="project">
<h:column>
- <hx:div styleClass="team">
+ <hx:div styleClass="project">
<fx:effects event="dragstart" additionalStyleClassToActivate="dragStarted" duration="0.5"/>
- <fx:dragSource action="move" param="#{team.id}" dropTargetTypes="#{team.type.code}" />
- <img src="#{request.contextPath}/resources/image/team/#{team.id}.png" draggable="false" />
- <h:outputText value="#{team.name}" draggable="false"/>
+ <fx:dragSource action="move" param="#{project.id}" dropTargetTypes="#{project.type.code}" />
+ <img src="#{request.contextPath}/resources/image/apache-project/#{project.id}.png" draggable="false" />
+ <h:outputText value="#{project.name}" draggable="false"/>
</hx:div>
</h:column>
</h:dataTable>
</hx:div>
</td>
<td align="center">
- <hx:div id="basketballTeamDropZone" styleClass="dropZone03">
+ <hx:div id="cProjectDropZone" styleClass="dropZone03">
<fx:effects event="dragenter" additionalStyleClassToActivate="dragEntered" duration="0.5"/>
<fx:animations event="drop" duration="1s" iteration="5">
<fx:animationShake rotation="15" />
</fx:animations>
- <fx:dropTarget dropListener="#{dndBean.processBasketballTeamDrop}" rerender="dynamicDnDContainer" types="B"/>
+ <fx:dropTarget dropListener="#{dndBean.processCProjectDrop}" rerender="dynamicDnDContainer" types="C"/>
<div style="padding:5px; text-align: center;">
- <h:outputText value="Basketball Teams" />
+ <h:outputText value="C Projects" />
</div>
- <h:dataTable value="#{dndBean.basketballTeams}" var="team">
+ <h:dataTable value="#{dndBean.CProjects}" var="project">
<h:column>
- <hx:div styleClass="team">
+ <hx:div styleClass="project">
<fx:effects event="dragstart" additionalStyleClassToActivate="dragStarted" duration="0.5"/>
- <fx:dragSource action="move" param="#{team.id}" dropTargetTypes="#{team.type.code}" />
- <img src="#{request.contextPath}/resources/image/team/#{team.id}.png" draggable="false" />
- <h:outputText value="#{team.name}" draggable="false"/>
+ <fx:dragSource action="move" param="#{project.id}" dropTargetTypes="#{project.type.code}" />
+ <img src="#{request.contextPath}/resources/image/apache-project/#{project.id}.png" draggable="false" />
+ <h:outputText value="#{project.name}" draggable="false"/>
</hx:div>
</h:column>
</h:dataTable>
</hx:div>
</td>
<td align="right">
- <hx:div id="footballTeamDropZone" styleClass="dropZone03">
+ <hx:div id="javaProjectDropZone" styleClass="dropZone03">
<fx:effects event="dragenter" additionalStyleClassToActivate="dragEntered" duration="0.5"/>
<fx:animations event="drop" duration="1s" iteration="5">
<fx:animationShake rotation="15" />
</fx:animations>
- <fx:dropTarget dropListener="#{dndBean.processFootballTeamDrop}" rerender="dynamicDnDContainer" types="F"/>
+ <fx:dropTarget dropListener="#{dndBean.processJavaProjectDrop}" rerender="dynamicDnDContainer" types="J"/>
<div style="padding:5px; text-align: center;">
- <h:outputText value="Football Teams" />
+ <h:outputText value="Java Projects" />
</div>
- <h:dataTable value="#{dndBean.footballTeams}" var="team">
+ <h:dataTable value="#{dndBean.javaProjects}" var="project">
<h:column>
- <hx:div styleClass="team">
+ <hx:div styleClass="project">
<fx:effects event="dragstart" additionalStyleClassToActivate="dragStarted" duration="0.5"/>
- <fx:dragSource action="move" param="#{team.id}" dropTargetTypes="#{team.type.code}" />
- <img src="#{request.contextPath}/resources/image/team/#{team.id}.png" draggable="false" />
- <h:outputText value="#{team.name}" draggable="false"/>
+ <fx:dragSource action="move" param="#{project.id}" dropTargetTypes="#{project.type.code}" />
+ <img src="#{request.contextPath}/resources/image/apache-project/#{project.id}.png" draggable="false" />
+ <h:outputText value="#{project.name}" draggable="false"/>
</hx:div>
</h:column>
</h:dataTable>
@@ -152,13 +152,13 @@
</tr>
<tr>
<td colspan="1" align="center">
- <h:commandButton action="#{dndBean.initTeams}" value="Refresh Teams">
+ <h:commandButton action="#{dndBean.initProjects}" value="Refresh Projects">
<f:ajax render="@form"/>
</h:commandButton>
</td>
<td colspan="2" align="center">
<span>Output of drop listener : </span>
- <h:outputText value="#{dndBean.teamDropOutput}" id="teamDropOutput" escape="false" style="color:green; font-size:medium;"/>
+ <h:outputText value="#{dndBean.projectDropOutput}" id="projectDropOutput" escape="false" style="color:green; font-size:medium;"/>
</td>
</tr>
</table>
@@ -168,23 +168,23 @@
<tr>
<td>
<sh:sh><![CDATA[
-<h:dataTable value="#_{dndBean.teams}" var="team">
+<h:dataTable value="#_{dndBean.projects}" var="project">
<h:column>
<hx:div ...>
- <fx:dragSource param="#_{team.id}" dropTargetTypes="#_{team.type.code}" />
+ <fx:dragSource param="#_{project.id}" dropTargetTypes="#_{project.type.code}" />
...
</hx:div>
</h:column>
</h:dataTable>
...
-<hx:div id="basketballTeamDropZone" ...>
- <fx:dropTarget dropListener="#_{dndBean.processBasketballTeamDrop}"
+<hx:div id="cProjectDropZone" ...>
+ <fx:dropTarget dropListener="#_{dndBean.processCProjectDrop}"
rerender="@form" types="B"/>...
- <!-- List dropped basketball teams into this target -->
- <h:dataTable value="#_{dndBean.basketballTeams}" var="team">
+ <!-- List dropped C projects into this target -->
+ <h:dataTable value="#_{dndBean.CProjects}" var="project">
<h:column>
- <hx:div styleClass="team">...
- <h:outputText value="#_{team.name}" .../>
+ <hx:div styleClass="project">...
+ <h:outputText value="#_{project.name}" .../>
</hx:div>
</h:column>
</h:dataTable>
@@ -193,20 +193,20 @@
</td>
<td>
<sh:sh><![CDATA[
-<hx:div id="footbalTeamDropZone" ...>...
+<hx:div id="javaProjectDropZone" ...>...
<fx:dropTarget ... types="F"/>
</hx:div>
]]></sh:sh>
<sh:sh lang="java"><![CDATA[
-public void processBasketballTeamDrop(DropEvent event)
+public void processCProjectDrop(DropEvent event)
throws AbortProcessingException{
- String teamId = event.getParam();
+ String projectId = event.getParam();
...
- SportsTeam droppedTeam = getTeam(
- this.basketballTeamsList, teamId);
+ ApacheProject droppedProject = getProject(
+ this.cProjectsList, projectId);
...
- teams.remove(droppedTeam);
- basketballTeams.add(droppedTeam);
+ projects.remove(droppedProject);
+ cProjects.add(droppedProject);
}
]]></sh:sh>
</td>