1 19 package org.netbeans.modules.exceptions.web; 20 21 import java.io.IOException ; 22 import javax.servlet.jsp.tagext.*; 23 import javax.servlet.jsp.JspWriter ; 24 import javax.servlet.jsp.JspException ; 25 import org.netbeans.modules.exceptions.entity.Issue; 26 27 32 33 public class DuplicatesTagHandler extends SimpleTagSupport { 34 private static final int MAX_WIDTH = 60; 35 private static final String COLOR = "#EE6B00"; 36 37 41 private Issue issue; 42 43 47 public void doTag() throws JspException { 48 49 JspWriter out=getJspContext().getOut(); 50 51 try { 52 int dup = issue.getCommentCollection().size() - 1; 53 printBar(out, dup); 54 JspFragment f=getJspBody(); 55 if (f != null) f.invoke(out); 56 57 } catch (java.io.IOException ex) { 58 throw new JspException (ex.getMessage()); 59 } 60 61 } 62 63 public void setIssue(Issue issue) { 64 this.issue = issue; 65 } 66 67 private void printBar(JspWriter out, int d) throws IOException { 68 int width = d * MAX_WIDTH / 15; 69 if (width > MAX_WIDTH) width = MAX_WIDTH; 70 out.println("<div style='border-style:solid;" + 71 "border-color:" + COLOR + ";border-width:1px;width:" + MAX_WIDTH + "px;height:10px;z-index:2;'>"); 72 out.print("<div style='border-style:solid;border-color:" + COLOR + ";" + 73 "border-width:1px;background-color:" + COLOR + ";width:" + width + "px;height:8px;z-index:1;'/>"); 74 out.println("<div style='zindex:3;position:relative;top:-3px;'>" + d + "</div></div>"); } 76 } 77 | Popular Tags |