001: /*
002: * This file is part of the Echo Web Application Framework (hereinafter "Echo").
003: * Copyright (C) 2002-2005 NextApp, Inc.
004: *
005: * Version: MPL 1.1/GPL 2.0/LGPL 2.1
006: *
007: * The contents of this file are subject to the Mozilla Public License Version
008: * 1.1 (the "License"); you may not use this file except in compliance with
009: * the License. You may obtain a copy of the License at
010: * http://www.mozilla.org/MPL/
011: *
012: * Software distributed under the License is distributed on an "AS IS" basis,
013: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
014: * for the specific language governing rights and limitations under the
015: * License.
016: *
017: * Alternatively, the contents of this file may be used under the terms of
018: * either the GNU General Public License Version 2 or later (the "GPL"), or
019: * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
020: * in which case the provisions of the GPL or the LGPL are applicable instead
021: * of those above. If you wish to allow use of your version of this file only
022: * under the terms of either the GPL or the LGPL, and not to allow others to
023: * use your version of this file under the terms of the MPL, indicate your
024: * decision by deleting the provisions above and replace them with the notice
025: * and other provisions required by the GPL or the LGPL. If you do not delete
026: * the provisions above, a recipient may use your version of this file under
027: * the terms of any one of the MPL, the GPL or the LGPL.
028: */
029:
030: package nextapp.echo2.webcontainer;
031:
032: import org.w3c.dom.Document;
033: import org.w3c.dom.Element;
034:
035: import nextapp.echo2.webrender.ServerDelayMessage;
036: import nextapp.echo2.webrender.output.HtmlDocument;
037: import nextapp.echo2.webrender.output.XmlDocument;
038:
039: /**
040: * The default Web Container <code>ServerDelayMessage</code>.
041: */
042: public class DefaultServerDelayMessage extends ServerDelayMessage {
043:
044: /**
045: * Singleton instance.
046: */
047: public static final ServerDelayMessage INSTANCE = new DefaultServerDelayMessage(
048: "Please wait...");
049:
050: /**
051: * Message content.
052: */
053: private Element messageElement;
054:
055: /**
056: * Creates the <code>DefaultServerDelayMessage</code>
057: */
058: public DefaultServerDelayMessage(String messageText) {
059: XmlDocument xmlDocument = new XmlDocument("div", null, null,
060: HtmlDocument.XHTML_1_0_NAMESPACE_URI);
061: Document document = xmlDocument.getDocument();
062: Element divElement = document.getDocumentElement();
063: divElement.setAttribute("id", ELEMENT_ID_MESSAGE);
064: divElement
065: .setAttribute(
066: "style",
067: "position:absolute;top:0px;left:0px;width:100%;height:100%;cursor:wait;"
068: + "margin:0px;padding:0px;visibility:hidden;z-index:10000;");
069:
070: Element tableElement = document.createElement("table");
071: tableElement.setAttribute("style",
072: "width:100%;height:100%;border:0px;padding:0px;");
073: divElement.appendChild(tableElement);
074:
075: Element tbodyElement = document.createElement("tbody");
076: tableElement.appendChild(tbodyElement);
077:
078: Element trElement = document.createElement("tr");
079: tbodyElement.appendChild(trElement);
080:
081: Element tdElement = document.createElement("td");
082: trElement.appendChild(tdElement);
083:
084: Element longDivElement = document.createElement("div");
085: longDivElement.setAttribute("id", ELEMENT_ID_LONG_MESSAGE);
086: longDivElement
087: .setAttribute(
088: "style",
089: "margin-top:40px;margin-left:auto;margin-right:auto;background-color:#afafbf;"
090: + "color:#000000;padding:40px;width:200px;border:groove 2px #bfbfcf;"
091: + "font-family:verdana,arial,helvetica,sans-serif;font-size:10pt;text-align:center;");
092: longDivElement
093: .appendChild(document.createTextNode(messageText));
094: tdElement.appendChild(longDivElement);
095:
096: messageElement = divElement;
097: }
098:
099: /**
100: * @see nextapp.echo2.webrender.ServerDelayMessage#getMessage()
101: */
102: public Element getMessage() {
103: return messageElement;
104: }
105: }
|