Changeset 5302 for openmrs-modules/addresshierarchy/web/src/org/openmrs/module/addresshierarchy/web/controller/LayoutPortletControlle.java
- Timestamp:
- 08/18/08 12:05:28 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs-modules/addresshierarchy/web/src/org/openmrs/module/addresshierarchy/web/controller/LayoutPortletControlle.java
r5288 r5302 15 15 16 16 import java.util.HashMap; 17 import java.util.List; 17 18 import java.util.Map; 19 import java.util.Vector; 18 20 19 21 import javax.servlet.http.HttpServletRequest; … … 22 24 import org.apache.commons.logging.LogFactory; 23 25 import org.openmrs.api.context.Context; 24 import org.openmrs. module.addresshierarchy.layout.web.LayoutSupport;25 import org.openmrs. module.addresshierarchy.layout.web.LayoutTemplate;26 import org.openmrs.layout.web.LayoutSupport; 27 import org.openmrs.layout.web.LayoutTemplate; 26 28 import org.openmrs.web.controller.PortletController; 29 import org.openmrs.web.controller.layout.LayoutPortletController; 27 30 28 31 public abstract class LayoutPortletControlle extends PortletController { 29 30 private static Log log = LogFactory.getLog(LayoutPortletControlle .class);32 33 private static Log log = LogFactory.getLog(LayoutPortletController.class); 31 34 32 35 protected void populateModel(HttpServletRequest request, Map<String, Object> model) { 33 36 // TODO: this only cached the first name or address template that comes through. I need to cache one of each. 34 37 String templateName = (String)model.get("layoutTemplateName"); 38 35 39 String thisLayoutName = getDefaultDivId() + "." + templateName; 36 40 if (!thisLayoutName.equals(model.get("cachedLayoutName"))) { 37 41 LayoutSupport layoutSupport = getLayoutSupportInstance(); 38 LayoutTemplate layoutTemplate = layoutSupport.get DefaultLayoutTemplate();42 LayoutTemplate layoutTemplate = layoutSupport.getLayoutTemplateByCodeName("us"); 39 43 40 44 if ( layoutTemplate == null ) { 41 45 log.debug("Could not get default LayoutTemplate from " + layoutSupport.getClass()); 46 System.out.println("not working"); 42 47 } 43 48 … … 80 85 model.put("layoutTemplateName", templateName); 81 86 model.put("cachedLayoutName", thisLayoutName); 82 Object chumma = model.get("layoutTemplate"); 83 System.out.println("here is the fucking model"+model); 87 88 List<List<Map<String,String>>> x = layoutTemplate.getLines(); 89 for(int i=0;i<x.size();i++){ 90 System.out.println(x.get(i)); 91 List<Map<String,String>> y = x.get(i); 92 for(int j=0;j<y.size();j++){ 93 System.out.println(y.get(i)); 94 } 95 } 96 97 String somethng = "{isToken=IS_NOT_ADDR_TOKEN, displayText=}, {isToken=IS_ADDR_TOKEN, displaySize=50, displayText=Location.address1, codeName=address1}"; 98 Map<String,String> y = new HashMap<String,String>(); 99 List<Map<String,String>> z =new Vector<Map<String,String>>(); 100 y.put("isToken", "IS_NOTADDR_TOKEN"); 101 y.put("displayText", ""); 102 z.add(0, y); 103 Map<String,String> yz = new HashMap<String,String>(); 104 yz.put("isToken", "IS_ADDR_TOKEN"); 105 yz.put("displaySize", "50"); 106 yz.put("displayText", "addresshierarchy.location.address1"); 107 yz.put("codeName", "address1"); 108 z.add(1, yz); 109 List<List<Map<String,String>>> xz = new Vector<List<Map<String,String>>>(); 110 xz.add(z); 111 yz.put("isToken", "IS_ADDR_TOKEN"); 112 yz.put("displaySize", "50"); 113 yz.put("displayText", "addresshierarchy.location.sublocation1"); 114 yz.put("codeName", "sublocation"); 115 z.add(1, yz); 116 //List<List<Map<String,String>>> xz = new Vector<List<Map<String,String>>>(); 117 xz.add(z); 118 model.put("addressHierarchyTemplate", xz); 119 84 120 } 85 121 } … … 94 130 95 131 protected abstract LayoutSupport getLayoutSupportInstance(); 96 97 } 132 }