1 package ecar.taglib.util;
2
3 import java.util.List;
4
5 import javax.servlet.jsp.JspException;
6 import javax.servlet.jsp.JspWriter;
7 import javax.servlet.jsp.tagext.TagSupport;
8
9 import org.apache.log4j.Logger;
10
11 import ecar.pojo.Email;
12
13 public class BarraAcoesEmailTag extends TagSupport {
14
15
16
17
18 private static final long serialVersionUID = 1L;
19 private String codEmail;
20 private List lista;
21
22 @Override
23 public int doStartTag() throws JspException {
24 StringBuffer s = new StringBuffer();
25 JspWriter writer = this.pageContext.getOut();
26 try {
27 if(lista.size() > 0){
28 s.append("<div id=\"nav\"> <input type=\"button\" class=\"btnemail\" name=\"btnApagar\" onclick=\"javascript:apagar();\" value=\"");
29 s.append(("".equals(codEmail))?"Apagar Selecionados\"":"Apagar Email\"");
30 s.append("> ");
31 if("".equals(codEmail)){
32 s.append("<br><br> Selecionar: ");
33 s.append("<a class=\"link\" href=\"#\" onclick=\"javascript:marcar(" + Email.MARCA_LIDO + ");\">Marcar como lida</a>, ");
34 s.append("<a class=\"link\" href=\"#\" onclick=\"javascript:marcar(" + Email.MARCA_NLIDO + ");\">Marcar como não lida</a>");
35 }
36 s.append("</div>");
37 writer.print(s.toString());
38 }
39 } catch (Exception e) {
40 Logger.getLogger(this.getClass()).error(e);
41 e.printStackTrace();
42 }
43 return super.doStartTag();
44 }
45
46 public void setCodEmail(String codEmail) {
47 this.codEmail = codEmail;
48 }
49
50
51
52
53 @Override
54 public int doEndTag() throws JspException {
55
56 return super.doEndTag();
57 }
58
59 public void setLista(List lista) {
60 this.lista = lista;
61 }
62
63 }