surangakas

Untitled

Jun 3rd, 2011
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. obsAttribute.tag
  2.  
  3. -------------------------------
  4.  
  5. <%@tag import="org.openmrs.web.attribute.handler.FieldGenAttributeHandler"%>
  6. <%@tag import="java.util.Map"%>
  7. <%@tag import="org.openmrs.api.context.Context"%>
  8. <%@tag import="org.openmrs.ConceptComplex"%>
  9. <%@tag import="org.apache.commons.logging.Log" %>
  10. <%@tag import="org.apache.commons.logging.LogFactory" %>
  11.  
  12. <%@ include file="/WEB-INF/template/include.jsp" %>
  13. <%--
  14. You must specify either attributeType or handler.
  15. You must specify formFieldName
  16. --%>
  17. <%@ attribute name="concept" required="true" type="org.openmrs.Concept" %>
  18. <%@ attribute name="formFieldName" required="true" type="java.lang.String" %>
  19.  
  20. <%
  21. ConceptComplex conceptComplex = Context.getConceptService().getConceptComplex(concept.getConceptId());
  22. String handler = conceptComplex.getHandler();
  23. final Log log = LogFactory.getLog(getClass());
  24. log.info("Test within obs attributes");
  25. %>
  26. <% if (true) {
  27.    // FieldGenAttributeHandler<?> h = (FieldGenAttributeHandler) handler;
  28.     String widgetName = "org.openmrs.Patient";
  29.     String formFieldName ="valueComplex";
  30.     /* Map<String, Object> widgetConfig = h.getWidgetConfiguration(); */
  31. %>
  32.     <openmrs:fieldGen
  33.         formFieldName="${ formFieldName }"
  34.         type="<%= widgetName %>"
  35.         val="${ org.openmrs.Patient }"/>
  36.    
  37. <% } else {
  38.     String valueAsString = "";
  39.     if (value != null)
  40.         valueAsString = value.getSerializedValue();
  41. %>
  42.     <input type="text" name="${ formFieldName }" value="<%= valueAsString %>"/>
  43. <% } %>
  44.  
  45. ===========================
  46.  
  47. in this tag , i'm aiming to generate an fieldGen tag to be displayed on the ObsForm.jsp page.
  48.  
  49. As a start, I've hard coded values
  50.  
  51.     String widgetName = "org.openmrs.Patient";
  52.     String formFieldName ="valueComplex";
  53.  
  54. in the tag, and am merely passing them into the appropriate place. ( see code)
  55.  
  56. my problem is, in order to make the tag display an auto complete box of patient instances, what do I pass in as the 'value' of the field Gen tag class ?
  57.  
  58.  should this be a list of all patient instances ? am rather stumped here....
Advertisement
Add Comment
Please, Sign In to add comment