You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2005/05/16 23:09:26 UTC
svn commit: r170448 [2/2] - in /incubator/beehive/trunk/samples/netui-jsf:
./ WEB-INF/ WEB-INF/lib/ WEB-INF/src/ WEB-INF/src/bundles/ WEB-INF/src/jsf/
WEB-INF/src/jsf/data/ WEB-INF/src/jsf/physician/
WEB-INF/src/jsf/physiciansFlow/ WEB-INF/src/shared/ jsf/
jsf/physiciansFlow/ resources/ resources/template/
Added: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/Controller.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/Controller.java?rev=170448&view=auto
==============================================================================
--- incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/Controller.java (added)
+++ incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/Controller.java Mon May 16 14:09:24 2005
@@ -0,0 +1,230 @@
+package jsf.physiciansFlow;
+
+import javax.faces.model.DataModel;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.beehive.netui.pageflow.FormData;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import org.apache.beehive.netui.util.type.TypeUtils;
+
+import jsf.physician.Physician;
+import jsf.physician.PhysicianSession;
+
+/**
+ * This page flow controller for the physicians page flow.
+ */
+@Jpf.Controller(
+ sharedFlowRefs={
+ @Jpf.SharedFlowRef(name="shared", type=jsf.SharedFlow.class)
+ }
+)
+public class Controller
+ extends PageFlowController
+{
+ //
+ // Data Retrieval
+ //
+
+ // this object retrieves the data
+ private transient PhysicianSession physicianSession = null;
+
+ // the data model is used across pages so it is kept in the
+ // page flow rather than passed via an Action Output on the request
+ private transient DataModel results = null;
+
+ public DataModel getResults() {
+ return results;
+ }
+
+ void setResults(DataModel value) {
+ results = value;
+ }
+
+ /**
+ * find physicians based on criteria
+ */
+ protected void searchPhysicians(Physician criteria)
+ {
+ physicianSession.setSearchCriteria(criteria);
+ results = physicianSession.getSortedPhysiciansModel();
+ }
+
+ public void sortByGender()
+ {
+ // change the sort key
+ physicianSession.setSortByGender();
+ results = physicianSession.getSortedPhysiciansModel();
+ }
+
+ public void sortByLastName()
+ {
+ // change the sort key
+ physicianSession.setSortByLastName();
+ results = physicianSession.getSortedPhysiciansModel();
+ }
+
+ //
+ // Page Flow Lifecycle
+ //
+
+ /**
+ * Callback that is invoked when this controller instance is created.
+ */
+ protected void onCreate()
+ {
+ this.physicianSession = new PhysicianSession();
+ }
+
+ /**
+ * Callback that is invoked when this controller instance is destroyed.
+ */
+ protected void onDestroy(HttpSession session)
+ {
+ }
+
+ //
+ // Page Flow Actions
+ //
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(name = "success", path = "physicianSearch.do")}
+ )
+ protected Forward begin()
+ {
+ return new Forward("success");
+ }
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(name = "success", path = "search.faces")}
+ )
+ protected Forward physicianSearch()
+ {
+ return new Forward("success");
+ }
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(name = "success", navigateTo = Jpf.NavigateTo.previousPage)}
+ )
+ protected Forward returnToPreviousPage()
+ {
+ return new Forward("success");
+ }
+
+ @Jpf.Action(forwards = {
+ @Jpf.Forward(name = "success",
+ path = "physicianDetail.faces",
+ actionOutputs = {
+ @Jpf.ActionOutput(name = "physicianDetail",
+ type = Physician.class,
+ required = false)
+ })
+ })
+ protected Forward physicianDetail()
+ {
+ Forward success = new Forward("success");
+
+ String paramValue = getRequest().getParameter("physicianId");
+ int id = TypeUtils.convertToInt(paramValue);
+ Physician physicianDetail = physicianSession.getPhysician(id);
+ success.addActionOutput("physicianDetail", physicianDetail);
+ return success;
+ }
+
+
+ @Jpf.Action(forwards = {
+ @Jpf.Forward(name = "success",
+ path = "physicianDetail.faces",
+ actionOutputs = {
+ @Jpf.ActionOutput(name = "physicianDetail",
+ type = Physician.class,
+ required = false)
+ })
+ })
+ /*
+ * This action is equivalent to the "physicianDetail" action above
+ * but the row data (physician) is gotten directly from the JSF DataModel.
+ */
+ protected Forward physicianDetailJSFStyle()
+ {
+ Forward success = new Forward("success");
+
+ assert(this.results != null);
+ Physician physicianDetail = (Physician)results.getRowData();
+ success.addActionOutput("physicianDetail", physicianDetail);
+ return success;
+ }
+
+ @Jpf.Action(forwards = {
+ @Jpf.Forward(name = "success",
+ navigateTo = Jpf.NavigateTo.currentPage)
+ })
+ protected Forward displayPhysiciansAbbreviated(PhysicianSearchForm form)
+ {
+ Forward success = new Forward("success");
+ searchPhysicians(form.getSearchCriteria());
+ return success;
+ }
+
+ @Jpf.Action(forwards = {
+ @Jpf.Forward(name = "success",
+ path = "physicianResultsWithDetail.faces")
+ })
+ protected Forward displayPhysiciansWithDetail(PhysicianSearchForm form)
+ {
+ Forward success = new Forward("success");
+ searchPhysicians(form.getSearchCriteria());
+ return success;
+ }
+
+ @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(name = "success", path="confirmMailSent.faces")
+ }
+ )
+ protected Forward submitMailMessage(MailMessageForm form)
+ {
+ Forward success = new Forward("success");
+ success.addActionOutput("mailMessage", form.getMessage());
+ success.addActionOutput("firstName", getRequest().getParameter("firstName"));
+ success.addActionOutput("lastName", getRequest().getParameter("lastName"));
+ return success;
+ }
+
+ //
+ // Form Beans
+ //
+ public static class MailMessageForm extends FormData
+ {
+ private String message;
+
+ public void setMessage(String message)
+ {
+ this.message = message;
+ }
+
+ public String getMessage()
+ {
+ return this.message;
+ }
+ }
+
+ public static class PhysicianSearchForm extends FormData
+ {
+ private Physician searchCriteria;
+
+ public void setSearchCriteria(Physician criteria)
+ {
+ this.searchCriteria = criteria;
+ }
+
+ public Physician getSearchCriteria()
+ {
+ return this.searchCriteria;
+ }
+ }
+}
Propchange: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/confirmMailSent.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/confirmMailSent.jsp?rev=170448&view=auto
==============================================================================
--- incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/confirmMailSent.jsp (added)
+++ incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/confirmMailSent.jsp Mon May 16 14:09:24 2005
@@ -0,0 +1,69 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
+<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+<netui-data:declarePageInput name="mailMessage" type="String" />
+<netui-data:declarePageInput name="firstName" type="String" />
+<netui-data:declarePageInput name="lastName" type="String" />
+
+<html>
+ <head>
+ <title>Mail Confirmation</title>
+ <link rel="stylesheet" type="text/css" href="../style.css">
+ </head>
+ <body>
+ <f:view>
+ <f:loadBundle var="msgs" basename="jsf.physiciansFlow.messages" />
+ <h:form>
+ <!-- navigation links -->
+ <table align="center" cellspacing="0" cellpadding="0" width="90%" style="margin-bottom: 30; padding-bottom: 5px; border-bottom: 2px solid blue" >
+ <tr>
+ <td align="left" >
+ <h:commandLink action="shared.home" value="Home" />
+ </td>
+ </tr>
+ </table>
+
+ <!-- message to user -->
+ <table align="center" style="margin-bottom: 15" width="90%" >
+ <tr>
+ <td align="left">
+ <h:outputFormat value="#{msgs.mailConfirmation}">
+ <f:param value="#{pageInput.firstName}"/>
+ <f:param value="#{pageInput.lastName}"/>
+ </h:outputFormat>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" >
+ <h:commandLink action="returnToPreviousPage" value="Return to Physician Details" />
+
+ <h:commandLink action="physicianSearch" value="Return to Search" />
+ </td>
+ </tr>
+ </table>
+ </h:form>
+
+ <!-- explanatory comment block -->
+ <c:if test="${sharedFlow.shared.commentsPreference}">
+ <table align="center" width="90%" style="background-color: #EEF3FB; margin-bottom: 30; border:1px solid blue;">
+ <tr>
+ <td>
+ <h:outputText value="#{msgs.commentsHeading}" rendered="#{sharedFlow.shared.commentsPreference}" style="font-weight: bold" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <blockquote>
+ <h:outputText value="#{msgs.mailConfirmationPageCommentOne}" rendered="#{sharedFlow.shared.commentsPreference}" />
+ </blockquote>
+ </td>
+ </tr>
+ </table>
+ </c:if>
+ </f:view>
+ </body>
+</html>
+
+
Propchange: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/confirmMailSent.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianDetail.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianDetail.java?rev=170448&view=auto
==============================================================================
--- incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianDetail.java (added)
+++ incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianDetail.java Mon May 16 14:09:24 2005
@@ -0,0 +1,25 @@
+package jsf.physiciansFlow;
+
+import org.apache.beehive.netui.pageflow.FacesBackingBean;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import jsf.physiciansFlow.Controller.MailMessageForm;
+
+/**
+ * This is the backing bean for JSF page "physicianDetail.faces" (physicianDetail.jsp).
+ */
+@Jpf.FacesBacking
+public class physicianDetail extends FacesBackingBean
+{
+ private MailMessageForm mailForm = new MailMessageForm();
+
+ public void setMailForm(MailMessageForm form)
+ {
+ mailForm = form;
+ }
+
+ public MailMessageForm getMailForm()
+ {
+ return mailForm;
+ }
+}
Propchange: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianDetail.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianDetail.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianDetail.jsp?rev=170448&view=auto
==============================================================================
--- incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianDetail.jsp (added)
+++ incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianDetail.jsp Mon May 16 14:09:24 2005
@@ -0,0 +1,121 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
+<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+<netui-data:declarePageInput name="physicianDetail" type="physician.Physician" />
+
+<html>
+ <head>
+ <title>Physician Detail</title>
+ <link rel="stylesheet" type="text/css" href="../style.css" >
+ </head>
+ <body>
+ <f:view>
+ <f:loadBundle var="msgs" basename="jsf.physiciansFlow.messages" />
+ <h:form>
+ <!-- navigation links -->
+ <table align="center" cellspacing="0" cellpadding="0" width="90%" style="margin-bottom: 30; padding-bottom: 5px; border-bottom: 2px solid blue" >
+ <tr>
+ <td align="left" >
+ <h:commandLink action="shared.home" value="Home" />
+ </td>
+ <td align="right" >
+ <h:commandLink action="physicianSearch" value="Return to Search" />
+ </td>
+ </tr>
+ </table>
+
+ <!-- physician details -->
+ <table align="center" style="background-color: #EEF3FB; border:solid 1px blue; margin-bottom: 30" >
+ <tr>
+ <td>
+ <h:panelGrid columns="2" cellpadding="7" >
+ <f:facet name="header" >
+ <h:outputText value="Dr. #{pageInput.physicianDetail.firstName} #{pageInput.physicianDetail.lastName}" />
+ </f:facet>
+ <h:outputText value="#{msgs.specialtyColumnLabel}: " />
+ <h:outputText value="#{pageInput.physicianDetail.specialty}" />
+ <h:outputText value="#{msgs.genderColumnLabel}: " />
+ <h:outputText value="#{pageInput.physicianDetail.gender}" />
+ <h:outputText value="#{msgs.cityColumnLabel}: " />
+ <h:outputText value="#{pageInput.physicianDetail.city}" />
+ <h:outputText value="#{msgs.schoolColumnLabel}: " />
+ <h:outputText value="#{pageInput.physicianDetail.school}" />
+ <h:outputText value="#{msgs.hospitalsColumnLabel}: " />
+ <h:panelGroup>
+ <c:forEach items="${pageInput.physicianDetail.hospitalAffiliations}" var="hospital" >
+ <f:verbatim>
+ <c:out value="${hospital}" />
+ <br>
+ </f:verbatim>
+ </c:forEach>
+ </h:panelGroup>
+ </h:panelGrid>
+ </td>
+ <td>
+ <h:panelGrid columns="1" cellpadding="7" >
+ <f:facet name="header" >
+ <h:outputText value="#{msgs.bioHeading}" />
+ </f:facet>
+ <!-- disabled because this is for output text only -->
+ <h:inputTextarea value="#{pageInput.physicianDetail.bio}" cols="40" rows="10" disabled="true" />
+ </h:panelGrid>
+ </td>
+ </tr>
+ </table>
+
+ <!-- mail form -->
+ <table height="130" align = "center" >
+ <tr>
+ <td colspan = "2" >
+ <h:inputTextarea value="#{backing.mailForm.message}" rows="6" cols="80" rendered="true" />
+ </td>
+ </tr>
+ <tr>
+ <td align="right" >
+ <h:commandLink action="submitMailMessage" value="Send Mail" tabindex="1" >
+ <f:attribute name="submitFormBean" value="backing.mailForm" />
+ <f:param name="firstName" value="#{pageInput.physicianDetail.firstName}" />
+ <f:param name="lastName" value="#{pageInput.physicianDetail.lastName}" />
+ </h:commandLink>
+ </td>
+ </tr>
+ </table>
+ </h:form>
+
+ <!-- explanatory comment block -->
+ <c:if test="${sharedFlow.shared.commentsPreference}">
+ <table align="center" width="90%" style="background-color: #EEF3FB; margin-bottom: 30; border:1px solid blue;" >
+ <tr>
+ <td>
+ <h:outputText value="#{msgs.commentsHeading}" rendered="#{sharedFlow.shared.commentsPreference}" style="font-weight: bold" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <blockquote>
+ <h:outputText value="#{msgs.physicianDetailPageCommentOne}" rendered="#{sharedFlow.shared.commentsPreference}" />
+ </blockquote>
+ <blockquote>
+ <h:outputText value="#{msgs.physicianDetailPageCommentTwo}" rendered="#{sharedFlow.shared.commentsPreference}" />
+ </blockquote>
+ <pre>
+ <h:commandLink action="submitMailMessage" value="Send Mail" tabindex="1" />
+ <f:attribute name="submitFormBean" value="backing.mailForm" />
+ <f:param name="firstName" value="#{pageInput.physicianDetail.firstName}" />
+ <f:param name="lastName" value="#{pageInput.physicianDetail.lastName}" />
+ </h:commandLink>
+ </pre>
+ <blockquote>
+ <h:outputText value="#{msgs.physicianDetailPageCommentThree}" rendered="#{sharedFlow.shared.commentsPreference}" />
+ </blockquote>
+ </td>
+ </tr>
+ </table>
+ </c:if>
+ </f:view>
+ </body>
+</html>
+
+
Propchange: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianDetail.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianResultsWithDetail.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianResultsWithDetail.java?rev=170448&view=auto
==============================================================================
--- incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianResultsWithDetail.java (added)
+++ incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianResultsWithDetail.java Mon May 16 14:09:24 2005
@@ -0,0 +1,12 @@
+package jsf.physiciansFlow;
+
+import org.apache.beehive.netui.pageflow.FacesBackingBean;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ * This is the backing bean for JSF page "physicianResultsWithDetail.faces" (physicianResultsWithDetail.faces).
+ */
+@Jpf.FacesBacking
+public class physicianResultsWithDetail extends FacesBackingBean
+{
+}
Propchange: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianResultsWithDetail.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianResultsWithDetail.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianResultsWithDetail.jsp?rev=170448&view=auto
==============================================================================
--- incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianResultsWithDetail.jsp (added)
+++ incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianResultsWithDetail.jsp Mon May 16 14:09:24 2005
@@ -0,0 +1,96 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
+<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+<html>
+ <head>
+ <title>Physician Results with Details</title>
+ <link rel="stylesheet" type="text/css" href="../style.css">
+ </head>
+ <body>
+ <f:view>
+ <f:loadBundle var="msgs" basename="jsf.physiciansFlow.messages" />
+ <h:form>
+ <!-- navigation links -->
+ <table align="center" cellspacing="0" cellpadding="0" width="90%" style="margin-bottom: 30; padding-bottom: 5px; border-bottom: 2px solid blue" >
+ <tr>
+ <td align="left" >
+ <h:commandLink action="shared.home" value="Home" />
+ </td>
+ <td align="right" >
+ <h:commandLink action="physicianSearch" value="Return to Search" />
+ </td>
+ </tr>
+ </table>
+
+ <!-- message to user -->
+ <table align="center" style="margin-bottom: 15" >
+ <tr>
+ <td>
+ <h:outputText value="#{msgs.detailedResults}" styleClass="infoMessage" />
+ </td>
+ </tr>
+ </table>
+ </h:form>
+
+ <!-- detailed search results -->
+ <h:dataTable value="#{pageFlow.results}" var="physician" rendered="#{pageFlow.results != null}" styleClass="resultsTable" rowClasses="oddRow, evenRow" id="searchResults" cellpadding="7px" style="margin-bottom: 30">
+ <h:column>
+ <h:panelGrid columns="2" cellpadding="7">
+ <f:facet name="header">
+ <h:outputText value="Dr. #{physician.firstName} #{physician.lastName}" />
+ </f:facet>
+ <h:outputText value="#{msgs.specialtyColumnLabel}: " />
+ <h:outputText value="#{physician.specialty}" />
+ <h:outputText value="#{msgs.genderColumnLabel}: " />
+ <h:outputText value="#{physician.gender}" />
+ <h:outputText value="#{msgs.cityColumnLabel}: " />
+ <h:outputText value="#{physician.city}" />
+ <h:outputText value="#{msgs.schoolColumnLabel}: " />
+ <h:outputText value="#{physician.school}" />
+ <h:outputText value="#{msgs.hospitalsColumnLabel}: " />
+ <h:panelGroup>
+ <c:forEach items="${physician.hospitalAffiliations}" var="hospital">
+ <f:verbatim>
+ <c:out value="${hospital}" />
+ <br>
+ </f:verbatim>
+ </c:forEach>
+ </h:panelGroup>
+ </h:panelGrid>
+ </h:column>
+ <h:column>
+ <h:panelGrid columns="1" cellpadding="7">
+ <f:facet name="header">
+ <h:outputText value="#{msgs.bioHeading}" />
+ </f:facet>
+ <!-- disabled because this is for output text only -->
+ <h:inputTextarea value="#{physician.bio}" cols="40" rows="10" disabled="false"/>
+ </h:panelGrid>
+ </h:column>
+ </h:dataTable>
+
+ <!-- explanatory comment block -->
+ <c:if test="${sharedFlow.shared.commentsPreference}">
+ <table align="center" width="90%" style="background-color: #EEF3FB; margin-bottom: 30; border:1px solid blue;">
+ <tr>
+ <td>
+ <h:outputText value="#{msgs.commentsHeading}" rendered="#{sharedFlow.shared.commentsPreference}" style="font-weight: bold" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <blockquote>
+ <h:outputText value="#{msgs.detailedResultsPageCommentOne}" rendered="#{sharedFlow.shared.commentsPreference}" />
+ </blockquote>
+
+ </td>
+ </tr>
+ </table>
+ </c:if>
+ </f:view>
+ </body>
+</html>
+
+
Propchange: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/physicianResultsWithDetail.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/search.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/search.java?rev=170448&view=auto
==============================================================================
--- incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/search.java (added)
+++ incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/search.java Mon May 16 14:09:24 2005
@@ -0,0 +1,216 @@
+package jsf.physiciansFlow;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlCommandButton;
+import javax.faces.component.html.HtmlSelectOneMenu;
+import javax.faces.component.html.HtmlSelectOneRadio;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import javax.faces.model.SelectItem;
+
+import org.apache.beehive.netui.pageflow.FacesBackingBean;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import jsf.physician.Physician;
+import jsf.physiciansFlow.Controller.PhysicianSearchForm;
+
+/**
+ * This is the backing bean for JSF page "search.faces" (search.jsp).
+ */
+@Jpf.FacesBacking
+public class search extends FacesBackingBean
+{
+ @Jpf.PageFlowField
+ Controller pageFlow;
+
+ // page flow action form containing search criteria
+ // will be passed to page flow action
+ public PhysicianSearchForm searchForm = new PhysicianSearchForm();
+
+ // a bean to hold the search criteria input by the user
+ private Physician criteria;
+
+ // The type of physician - see "types" below
+ private String physicianType = Physician.FAMILY;
+
+ // start with the specialist choices disabled
+ private boolean specialistsDisabled = true;
+
+ // default setting is abbreviated results
+ private boolean showDetailedResults = false;
+
+ // The type of physician - see "types" below
+ private String resultFormatType = "shortFormat";
+
+ // Physician types
+ private SelectItem[] physicianTypes = {
+ new SelectItem(Physician.FAMILY, "Family Doctor"),
+ new SelectItem(Physician.SPECIALIST, "Specialist")
+ };
+
+ // Specialist types
+ private SelectItem[] specialistTypes = {
+ new SelectItem("ear", "ear"),
+ new SelectItem("nose", "nose"),
+ new SelectItem("throat", "throat")
+ };
+
+ // city options
+ private SelectItem[] cities = {
+ new SelectItem("Boulder", "Boulder"),
+ new SelectItem("Denver", "Denver")
+ };
+
+ // result format types (minimal info or lots of info)
+ private SelectItem[] resultFormatTypes = {
+ new SelectItem("shortFormat", "Abbreviated Physician Information"),
+ new SelectItem("detailedFormat", "Detailed Physician Information"),
+ };
+
+ protected FacesContext getFacesContext() {
+ return FacesContext.getCurrentInstance();
+ }
+
+ // get the current commentsPreference
+ protected void onCreate()
+ {
+ criteria = new Physician();
+ criteria.setSpecialty(Physician.FAMILY);
+ }
+
+ protected void onDestroy()
+ {
+
+ }
+
+ /*
+ * getter for the "form" bean
+ */
+ public Physician getCriteria()
+ {
+ return this.criteria;
+ }
+
+ //
+ // Getters and setters for component values used in the search form
+ //
+ public String getPhysicianType()
+ {
+ return this.physicianType;
+ }
+
+ public void setPhysicianType(String type)
+ {
+ this.physicianType = type;
+ }
+
+ public String getResultFormatType()
+ {
+ return this.resultFormatType;
+ }
+
+ public void setResultFormatType(String type)
+ {
+ this.resultFormatType = type;
+ }
+
+ /**
+ * the specialist menu is enabled when the user chooses
+ * specialist from the physician type selector
+ */
+ public boolean getSpecialistsDisabled()
+ {
+ return this.specialistsDisabled;
+ }
+
+ private void setSpecialistsDisabled(boolean value)
+ {
+ this.specialistsDisabled = value;
+ }
+
+ //
+ // getters for all the selector components
+ //
+ public SelectItem[] getPhysicianTypes()
+ {
+ return this.physicianTypes;
+ }
+
+ public SelectItem[] getSpecialistTypes()
+ {
+ return this.specialistTypes;
+ }
+
+ public SelectItem[] getCities()
+ {
+ return this.cities;
+ }
+
+ public SelectItem[] getResultFormatTypes()
+ {
+ return this.resultFormatTypes;
+ }
+
+ // handler for selector interactions
+ public void physicianTypeChange(javax.faces.event.ValueChangeEvent vce)
+ {
+ // get the new value from the component
+ if (vce.getNewValue().equals(Physician.FAMILY))
+ {
+ setSpecialistsDisabled(true);
+ }
+ else
+ {
+ setSpecialistsDisabled(false);
+ }
+
+ // bypass validation of other components by jumping to render response
+ getFacesContext().renderResponse();
+ }
+
+ /**
+ * Action handler for the search command
+ * Pass the search form to one of two Page Flow actions,
+ * based on the users choice of results format
+ */
+ @Jpf.CommandHandler(
+ raiseActions = {
+ @Jpf.RaiseAction(action="displayPhysiciansWithDetail", outputFormBean="searchForm"),
+ @Jpf.RaiseAction(action="displayPhysiciansAbbreviated", outputFormBean="searchForm")
+ }
+ )
+ public String execute()
+ {
+ // if the physician type is set to "Family Practicioner" ignore the value of specialty
+ if (physicianType.equals(Physician.FAMILY))
+ criteria.setSpecialty(Physician.FAMILY);
+
+ // put the criteria into the form that is passed to the page flow actions
+ searchForm.setSearchCriteria(criteria);
+
+ // If the user wants the detail format for results
+ // we use a different page to present the results
+ if (resultFormatType.equals("detailedFormat"))
+ {
+ return "displayPhysiciansWithDetail";
+ }
+ else // abbreviated results
+ {
+ return "displayPhysiciansAbbreviated";
+ }
+ }
+
+ public String sortByLastName()
+ {
+ pageFlow.sortByLastName();
+ return null; // stay on the page
+ }
+
+ public String sortByGender()
+ {
+ pageFlow.sortByGender();
+ return null; // stay on the page
+ }
+}
Propchange: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/search.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/search.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/search.jsp?rev=170448&view=auto
==============================================================================
--- incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/search.jsp (added)
+++ incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/search.jsp Mon May 16 14:09:24 2005
@@ -0,0 +1,175 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<html>
+ <head>
+ <title>Physician Search</title>
+ <link rel="stylesheet" type="text/css" href="../style.css" >
+ </head>
+ <body>
+ <f:view>
+ <f:loadBundle var="msgs" basename="jsf.physiciansFlow.messages" />
+ <h:form>
+ <!-- navigation links -->
+ <table align="center" cellspacing="0" cellpadding="0" width="90%" style="margin-bottom: 30; padding-bottom: 5px; border-bottom: 2px solid blue" >
+ <tr>
+ <td align="left" >
+ <h:commandLink action="shared.home" value="Home" />
+ </td>
+ </tr>
+ </table>
+
+ <!-- the search form -->
+ <table width="470" height="130" align="center" cellpadding="7" style="margin-bottom: 30; border: solid 1px blue" >
+ <tr>
+ <td>
+ <h:outputLabel value="#{msgs.physicianTypeLabel}" for="physicianType" styleClass="widgetLabel" />
+ <h:selectOneRadio value="#{backing.physicianType}" id="physicianType" immediate="true" valueChangeListener="#{backing.physicianTypeChange}" onclick="onChange=this.form.submit();" layout="pageDirection" >
+ <f:selectItems value="#{backing.physicianTypes}" id="physicianTypes" />
+ </h:selectOneRadio>
+ </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>
+ <h:outputLabel value="#{msgs.specialistTypeLabel}" for="specialistType "styleClass="widgetLabel" />
+ <h:selectOneMenu value="#{backing.criteria.specialty}" disabled="#{backing.specialistsDisabled}" id="specialistType" styleClass="selectMenu" >
+ <f:selectItems value="#{backing.specialistTypes}" id="specialistTypes" />
+ </h:selectOneMenu>
+ </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>
+ <h:outputLabel value="#{msgs.cityLabel}" for="city" styleClass="widgetLabel" />
+ <h:selectOneMenu value="#{backing.criteria.city}" id="city" required="true" styleClass="selectMenu" >
+ <f:selectItems value="#{backing.cities}" id="cities" />
+ </h:selectOneMenu>
+ </td>
+ <td>
+
+ <h:message for="city" styleClass="validationMessage" style="color:#ff0000;" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <h:outputLabel value="#{msgs.resultsFormatTypeLabel}" for="resultFormatType" styleClass="widgetLabel" />
+ <h:selectOneRadio value="#{backing.resultFormatType}" id="resultFormatType" layout="pageDirection" >
+ <f:selectItems value="#{backing.resultFormatTypes}" id="resultFormatTypes" />
+ </h:selectOneRadio>
+ </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <!-- here we submit a form to an action handler in the backing file -->
+ <td>
+ <h:commandButton action="#{backing.execute}" styleClass="submitButton" id="searchButton" value="Search" />
+ </td>
+ <td> </td>
+ </tr>
+ </table>
+
+ <!-- message to user -->
+ <table align="center" style="margin-bottom: 15" >
+ <tr>
+ <td>
+ <h:outputText value="#{msgs.searchResultsYes}" styleClass="infoMessage" rendered="#{pageFlow.results.rowCount > 0}" />
+ <h:outputText value="#{msgs.searchResultsNo}" styleClass="infoMessage" rendered="#{pageFlow.results.rowCount == 0}" />
+ </td>
+ </tr>
+ </table>
+
+ <!-- search results -->
+ <h:dataTable value="#{pageFlow.results}" var="physician" rendered="#{pageFlow.results != null}" styleClass="resultsTable" rowClasses="oddRow, evenRow" id="searchResults" cellpadding="7px" >
+ <h:column>
+ <f:facet name="header" >
+ <h:outputText value="#{msgs.specialtyColumnLabel}" />
+ </f:facet>
+ <h:outputText value="#{physician.specialty}" />
+ </h:column>
+ <h:column>
+ <f:facet name="header" >
+ <h:outputText value="#{msgs.firstNameColumnLabel}" />
+ </f:facet>
+ <h:outputText value="#{physician.firstName}" />
+ </h:column>
+ <h:column>
+ <f:facet name="header" >
+ <h:commandLink action="#{backing.sortByLastName}" immediate="true" >
+ <h:outputText value="#{msgs.lastNameColumnLabel}" />
+ </h:commandLink>
+ </f:facet>
+ <h:outputText value="#{physician.lastName}" />
+ </h:column>
+ <h:column>
+ <f:facet name="header" >
+ <h:commandLink action="#{backing.sortByGender}" immediate="true" >
+ <h:outputText value="#{msgs.genderColumnLabel}" />
+ </h:commandLink>
+ </f:facet>
+ <h:outputText value="#{physician.gender}" />
+ </h:column>
+ <h:column>
+ <f:facet name="header" >
+ <h:outputText value="#{msgs.cityColumnLabel}" />
+ </f:facet>
+ <h:outputText value="#{physician.city}" />
+ </h:column>
+ <h:column>
+ <f:facet name="header" >
+ <h:outputText value="#{msgs.detailsColumnLabel}" />
+ </f:facet>
+ <!-- Here we call a page flow action directly -->
+ <h:commandLink value="#{msgs.detailLabel}" action="physicianDetail" >
+ <f:param name="physicianId" value="#{physician.id}" />
+ </h:commandLink>
+ </h:column>
+ </h:dataTable>
+ </h:form>
+
+ <!-- explanatory comment block -->
+ <c:if test="${sharedFlow.shared.commentsPreference}">
+ <table align="center" width="90%" style="background-color: #EEF3FB; margin-bottom: 30; border:1px solid blue;">
+ <tr>
+ <td>
+ <h:outputText value="#{msgs.commentsHeading}" rendered="#{sharedFlow.shared.commentsPreference}" style="font-weight: bold" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <blockquote>
+ <h:outputText value="#{msgs.searchPageCommentOne}" rendered="#{sharedFlow.shared.commentsPreference}" />
+ </blockquote>
+ <pre>
+ @Jpf.CommandHandler(
+ raiseActions = {
+ @Jpf.RaiseAction(action="displayPhysiciansWithDetail", outputFormBean="searchForm"),
+ @Jpf.RaiseAction(action="displayPhysiciansAbbreviated", outputFormBean="searchForm")
+ }
+ )
+ </pre>
+ <blockquote>
+ <h:outputText value="#{msgs.searchPageCommentTwo}" rendered="#{sharedFlow.shared.commentsPreference}" />
+ </blockquote>
+ <pre>
+ <h:commandLink value="#{msgs.detailLabel} #{physician.id}" action="physicianDetail" >
+ <f:param name="physicianId" value="#{physician.id}" />
+ </h:commandLink>
+ </pre>
+ <blockquote>
+ <h:outputText value="#{msgs.searchPageCommentThree}" rendered="#{sharedFlow.shared.commentsPreference}" />
+ </blockquote>
+ <blockquote>
+ <h:outputText value="#{msgs.searchPageCommentFour}" rendered="#{sharedFlow.shared.commentsPreference}" />
+ </blockquote>
+ <blockquote>
+ <h:outputText value="#{msgs.searchPageCommentFive}" rendered="#{sharedFlow.shared.commentsPreference}" />
+ </blockquote>
+ </td>
+ </tr>
+ </table>
+ </c:if>
+ </f:view>
+ </body>
+</html>
Propchange: incubator/beehive/trunk/samples/netui-jsf/jsf/physiciansFlow/search.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/beehive/trunk/samples/netui-jsf/jsf/style.css
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-jsf/jsf/style.css?rev=170448&view=auto
==============================================================================
--- incubator/beehive/trunk/samples/netui-jsf/jsf/style.css (added)
+++ incubator/beehive/trunk/samples/netui-jsf/jsf/style.css Mon May 16 14:09:24 2005
@@ -0,0 +1,76 @@
+
+
+body
+{
+background-color: #ffffff;
+background-repeat: no-repeat;
+font-family: Arial, Verdana;
+font-size: 14px;
+font-style: normal;
+font-weight: normal;
+/* color: #333333; */
+/* margin-top: 10px; */
+/* margin-left: 10px; */
+/* margin-right: 10px; */
+/* margin-bottom: 10px; */
+}
+
+/* Used for prompts in generated pages */
+.prompt
+{
+color: #993333;
+font-style: italic;
+}
+
+A:link, A:visited, A:active {
+color: #7777AA;
+text-decoration: underline;
+}
+
+A:hover {
+color: #9999FF;
+background: transparent;
+text-decoration: underline;
+}
+
+.resultsTable {
+ margin-right: auto;
+ margin-left: auto;
+ background-color: #EEF3FB;
+ border: solid 1px blue;
+}
+
+.oddRow {
+ background-color: #FFFFFF;
+}
+
+.evenRow {
+ background-color: #EEF3FB;
+}
+
+.widgetLabel {
+ font-size: 14px;
+ text-align: left;
+ font-weight: bold;
+}
+
+.validationMessage {
+ font-size: 12px;
+ text-align: left;
+ font-color: #ff0000;
+}
+
+.infoMessage {
+ font-size: 18px;
+ font-color: #ffffff;
+ font-weight: bold;
+}
+
+.selectMenu {
+ font-size: 14px;
+}
+
+.submitButton {
+ position: relative;
+ left: 50px;
+}
\ No newline at end of file
Propchange: incubator/beehive/trunk/samples/netui-jsf/jsf/style.css
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/beehive/trunk/samples/netui-jsf/resources/template/template.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/netui-jsf/resources/template/template.jsp?rev=170448&view=auto
==============================================================================
--- incubator/beehive/trunk/samples/netui-jsf/resources/template/template.jsp (added)
+++ incubator/beehive/trunk/samples/netui-jsf/resources/template/template.jsp Mon May 16 14:09:24 2005
@@ -0,0 +1,57 @@
+<%--
+ Copyright 2004-2005 The Apache Software Foundation.
+
+ Licensed 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.
+
+ $Header:$
+--%>
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0" prefix="netui-data"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<%@ taglib prefix="beehive-petstore" tagdir="/WEB-INF/tags/beehive/petstore" %>
+
+<netui-data:declareBundle bundlePath="bundles.site" name="site"/>
+
+<netui:html>
+ <head>
+ <title>
+ ${bundle.site.browserTitle}
+ </title>
+ <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/style.css" type="text/css"/>
+ </head>
+ <netui:body>
+ <div>
+ <div id="header">
+ <table style="background-color:#FFE87C;width:100%;">
+ <tr>
+ <td style="font-size:x-large;">Page Flow Feature Samples: <netui-template:attribute name="samTitle"/></td>
+ <td style="text-align:right;"><a href="${pageContext.request.contextPath}" target="_top">Samples Home</a></td>
+ </tr>
+ </table><br/>
+ </div>
+ <div id="main">
+ <netui-template:includeSection name="main"/>
+ </div>
+ <div id="footer">
+ <table style="background-color:#FFE87C;width:100%;">
+ <tr>
+ <td> </td>
+ <td style="text-align:right;"><a href="${pageContext.request.contextPath}">Samples Home</a></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </netui:body>
+</netui:html>
Propchange: incubator/beehive/trunk/samples/netui-jsf/resources/template/template.jsp
------------------------------------------------------------------------------
svn:eol-style = native