1 package fr.improve.struts.taglib.layout.util; 2 3 import javax.servlet.jsp.JspException ; 4 import javax.servlet.jsp.PageContext ; 5 import javax.servlet.jsp.tagext.TagSupport ; 6 7 import fr.improve.struts.taglib.layout.collection.CollectionTag; 8 ; 9 10 15 public class BasicCollection2 extends BasicPanel implements CollectionInterface { 16 CollectionTag collectionTag; 17 PageContext pageContext; 18 21 public void doPrintEmptyCollection(StringBuffer out_buffer, String in_message) { 22 out_buffer.append("<tr><td><span class=\""); 23 out_buffer.append(styleClass); 24 out_buffer.append("\"> "); 25 out_buffer.append(in_message); 26 out_buffer.append("</span></td></tr>"); 27 } 28 31 public void doPrintTitle(StringBuffer buffer, String title) { 32 if (title!=null) { 33 if (isNested) { 34 buffer.append("<td colspan=\""); 35 buffer.append(LayoutUtils.getSkin(pageContext.getSession()).getFieldInterface().getColumnNumber()); 36 buffer.append("\">"); 37 } 38 if (styleClass!=null) { 39 buffer.append("<p class=\""); 40 buffer.append(styleClass); 41 buffer.append("\">"); 42 } 43 buffer.append(title); 44 if (styleClass!=null) { 45 buffer.append("</p>"); 46 } 47 if (isNested) { 48 buffer.append("</td></tr><tr align=\"center\">"); 49 } 50 } 51 } 52 55 private void doPrintSeparator(StringBuffer out_buffer) { 56 out_buffer.append("<tr>"); 57 out_buffer.append("<td colspan=\""); 58 out_buffer.append(2 * collectionTag.getNbOfColumns() - 1); 59 out_buffer.append("\" class=\"tableborder\"><img SRC=\""); 60 out_buffer.append(LayoutUtils.getSkin(pageContext.getSession()).getImageDirectory(pageContext.getRequest())); 61 out_buffer.append("shim.gif\" width=\"1\" height=\"1\"></td>"); 62 out_buffer.append("</tr>\n"); 63 } 64 67 public void doStartPanel(StringBuffer out_buffer, String in_align, String in_width) { 68 out_buffer.append("<td colspan=\""); 69 out_buffer.append(LayoutUtils.getSkin(pageContext.getSession()).getFieldInterface().getColumnNumber()); 70 out_buffer.append("\">\n"); 71 out_buffer.append("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\""); 72 if (in_align!=null) { 73 out_buffer.append(" align=\""); 74 out_buffer.append(in_align); 75 out_buffer.append("\""); 76 } 77 if (in_width!=null) { 78 out_buffer.append(" width=\""); 79 out_buffer.append(in_width); 80 out_buffer.append("\""); 81 } 82 out_buffer.append(">"); 83 } 84 87 public void doEndPanel(StringBuffer out_buffer) { 88 doPrintSeparator(out_buffer); 89 out_buffer.append("</table>"); 90 out_buffer.append("</td>\n"); 91 } 92 95 public void doStartHeaders(StringBuffer out_buffer) { 96 doPrintSeparator(out_buffer); 97 out_buffer.append("<tr>"); 98 } 99 102 public void doPrintHeader(StringBuffer out_buffer, String in_header, String in_width, String in_sortUrl) { 103 if (collectionTag.getColumn()!=0) { 104 out_buffer.append("<td class=\"tableborder\" width=\"1\"><div class=\"SHIMARRAY\" width=\"1\" height=\"23\"></div></td>"); 105 } 106 out_buffer.append("<th class=\"tableentete\">"); 107 out_buffer.append(in_header); 108 out_buffer.append("</th>"); 109 } 110 113 public void doEndHeaders(StringBuffer out_buffer) { 114 out_buffer.append("</tr>"); 115 } 116 119 public void doStartItems(StringBuffer out_buffer) { 120 doPrintSeparator(out_buffer); 121 out_buffer.append("<tr>"); 122 } 123 126 public void doPrintItem(StringBuffer out_buffer, String in_item, String [] in_styleClass, String in_id) { 127 if (collectionTag.getColumn()!=0) { 128 out_buffer.append("<td class=\"tableborder\" width=\"1\"><div class=\"SHIMARRAY\" width=\"1\" height=\"23\"></div></td>"); 129 } 130 out_buffer.append("<td"); 131 out_buffer.append(" class=\""); 133 out_buffer.append("tabletexte"); 135 out_buffer.append("\""); 136 if (in_id!=null) { 138 out_buffer.append(" id=\""); 139 out_buffer.append(in_id); 140 out_buffer.append("\""); 141 } 142 out_buffer.append(">"); 143 144 out_buffer.append(in_item); 145 146 out_buffer.append("</td>"); 147 } 148 151 public void doEndItems(StringBuffer out_buffer) { 152 out_buffer.append("</tr>"); 153 } 154 157 public void init(PageContext pg, String in_styleClass, TagSupport in_panel) throws JspException { 158 super.init(pg, in_styleClass, in_panel); 159 collectionTag = (CollectionTag) in_panel; 160 pageContext = pg; 161 } 162 } | Popular Tags |