package com.agilecontrol.nea.core.web.bean; import com.agilecontrol.nea.core.schema.Table; import com.agilecontrol.nea.core.web.bean.Util; import com.agilecontrol.nea.util.StringUtils; import java.io.IOException; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; public class Button { protected String name; protected String value; protected Map attributes; protected String type; protected String attributesText; public Button() { } public Button(String name, String value, String action, String title) { this.name = name; this.value = value; this.attributes = new HashMap(); this.attributes.put("onclick", action); if(title != null) { this.attributes.put("title", title); } } public String toHREF(String cssClass) { StringBuilder sb = new StringBuilder(); String onclick = (String)this.attributes.get("onclick"); if(onclick != null) { onclick = "javascript:" + onclick; } else { onclick = "#"; } sb.append("").append(this.value).append(""); return sb.toString(); } public String toHTML() throws IOException { StringBuilder sb = new StringBuilder(); sb.append(""); return sb.toString(); } public String toMenuItem() throws IOException { StringBuilder sb = new StringBuilder(); sb.append("
  • ").append(this.value).append("
  • "); return sb.toString(); } public String getAttributesText() { return this.attributesText; } public void setAttributesText(String attributesText) { this.attributesText = attributesText; } public Map getAttributes() { return this.attributes; } public void setAttributes(Map attributes) { this.attributes = attributes; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getType() { return this.type == null?"button":this.type; } public void setType(String type) { this.type = type; } public String getValue() { return this.value; } public void setValue(String value) { this.value = value; } public boolean isValid(int objectId, Table mainTable, HttpServletRequest req) throws Exception { return true; } }