1 29 30 package nextapp.echo2.webcontainer; 31 32 import org.w3c.dom.Document ; 33 import org.w3c.dom.Element ; 34 35 import nextapp.echo2.webrender.ServerDelayMessage; 36 import nextapp.echo2.webrender.output.HtmlDocument; 37 import nextapp.echo2.webrender.output.XmlDocument; 38 39 42 public class DefaultServerDelayMessage extends ServerDelayMessage { 43 44 47 public static final ServerDelayMessage INSTANCE = new DefaultServerDelayMessage("Please wait..."); 48 49 52 private Element messageElement; 53 54 57 public DefaultServerDelayMessage(String messageText) { 58 XmlDocument xmlDocument = new XmlDocument("div", null, null, HtmlDocument.XHTML_1_0_NAMESPACE_URI); 59 Document document = xmlDocument.getDocument(); 60 Element divElement = document.getDocumentElement(); 61 divElement.setAttribute("id", ELEMENT_ID_MESSAGE); 62 divElement.setAttribute("style", "position:absolute;top:0px;left:0px;width:100%;height:100%;cursor:wait;" 63 + "margin:0px;padding:0px;visibility:hidden;z-index:10000;"); 64 65 Element tableElement = document.createElement("table"); 66 tableElement.setAttribute("style", "width:100%;height:100%;border:0px;padding:0px;"); 67 divElement.appendChild(tableElement); 68 69 Element tbodyElement = document.createElement("tbody"); 70 tableElement.appendChild(tbodyElement); 71 72 Element trElement = document.createElement("tr"); 73 tbodyElement.appendChild(trElement); 74 75 Element tdElement = document.createElement("td"); 76 trElement.appendChild(tdElement); 77 78 Element longDivElement = document.createElement("div"); 79 longDivElement.setAttribute("id", ELEMENT_ID_LONG_MESSAGE); 80 longDivElement.setAttribute("style", "margin-top:40px;margin-left:auto;margin-right:auto;background-color:#afafbf;" 81 + "color:#000000;padding:40px;width:200px;border:groove 2px #bfbfcf;" 82 + "font-family:verdana,arial,helvetica,sans-serif;font-size:10pt;text-align:center;"); 83 longDivElement.appendChild(document.createTextNode(messageText)); 84 tdElement.appendChild(longDivElement); 85 86 messageElement = divElement; 87 } 88 89 92 public Element getMessage() { 93 return messageElement; 94 } 95 } | Popular Tags |