com.nfwork.dbfound.web.ui.Div Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dbfound Show documentation
Show all versions of dbfound Show documentation
dbfound development platform
package com.nfwork.dbfound.web.ui;
import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagSupport;
import com.nfwork.dbfound.util.LogUtil;
import com.nfwork.dbfound.util.UUIDUtil;
public class Div extends TagSupport {
private static final long serialVersionUID = 1L;
private String id;
private String style = "";
public int doStartTag() throws JspTagException {
if (id == null || "".equals(id)) {
id = "DIV" + UUIDUtil.getRandomString(5);
}
style = "display:none;" + style;
String div = "";
Tag t = findAncestorWithClass(this, Panel.class);
if (t != null) {
Panel parent = (Panel) t;
parent.html += div;
}
try {
pageContext.getOut().print(
"");
} catch (IOException e) {
LogUtil.error(e.getMessage(), e);
}
return EVAL_BODY_INCLUDE;
}
public int doEndTag() throws JspException {
try {
pageContext.getOut().print("");
String script = "";
Tag t = findAncestorWithClass(this, Panel.class);
if (t != null) {
Panel parent = (Panel) t;
parent.content.append(script);
}
} catch (IOException e) {
LogUtil.error(e.getMessage(), e);
}
reset(); //重置属性
return EVAL_PAGE;
}
public void reset() {
id = null;
style = "";
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getStyle() {
return style;
}
public void setStyle(String style) {
this.style = style;
}
}