HTML and CSS Reference
In-Depth Information
Listing 9-12. processDrop Method of RightCountry Managed Bean
public void processDrop(DropEvent event) {
Place place = (Place) event.getDragValue();
String dropValue = (String) event.getDropValue();
switch (dropValue) {
case "Egypt":
if (places.size() == 0) {
new FacesMessage("Congratulations! You are done."));
You may notice that after all of the elements in the drag source panel are consumed (dropped to their
corresponding suitable targets), a Faces message is created to show the user "Congratulations! you are
done." and the page information is reset using initialize() method; this Faces message will be displayed by
<rich:notifyMessages> , which is shown in Listing 9-13.
Like the Egypt drop target, the other drop targets for Germany and Brazil work the same way. Listing 9-13 shows
the complete code of the Right Country application page.
Listing 9-13. Right Country Application Page
<html xmlns=" "
xmlns:rich=" "
xmlns:a4j=" "
xmlns:f=" "
xmlns:h=" " >
<title>Welcome to the Right Country application</title>
<h:outputStylesheet library="css" name="rightCountry.css" />
<rich:dragIndicator id="ind" acceptClass="accept" rejectClass="reject"
Drag the place to the right country
<h:form id="form">
<h2>Drag the places to the right country</h2>
<h:panelGrid columnClasses="column" columns="4"
<rich:panel styleClass="dropSourcePanel">
Search WWH ::

Custom Search