package e4s.tutorial;
import e4s.html.*;
import e4s.servlet.*;
import e4s.util.E4Images;
/**
* A simple class, that demonstrates the use of popup elements in HTML pages.
*
* {@tutorial Example_Popup}
*/
public class Example_Popup extends E4ModuleImplementation
{
public static E4Method start = null;
public static E4Method nextFunction = null;
public void start( HTML html )
throws Exception
{
BODY body = html.BODY();
// first, we must prepare the BODY element for popup support
A_Popup.prepare(body);
A_Popup hrefA = body.A_Popup("This text will go into popup");
hrefA.print("This text will be displayed, try move the mouse on it");
body.P();
A_Popup hrefB = body.A_Popup(nextFunction,"This text will also go into popup");
hrefB.print("This text will be displayed and you can click on it,");
hrefB.print("you also can try to move the mouse on it");
body.P();
// now we crate an element for a popup
TABLE table = new TABLE(E4ID(),TABLE.E4S_DEFAULT_TABLE());
table.TR().TD().print("Date and Time");
table.TR().TD().print(new java.util.Date());
A_Popup hrefC = body.A_Popup(table,getServlet());
hrefC.print("This text will be displayed, try move the mouse on it and view the table");
body.P();
A_Popup hrefD = body.A_Popup(nextFunction,table,getServlet());
hrefD.print("This text will be displayed, try move the mouse on it and view the table");
hrefD.BR();
hrefD.print("but you also can click on it");
// optionally, add a parameter
hrefD.addParameter("ARGUMENT","Hello");
body.P();
}
public void nextFunction( HTML html, E4CgiParams params )
{
String argument = params.get("ARGUMENT");
html.println("You clicked, and " + (isok(argument) ? "\"" + argument + "\"" : "no argument") + " was passed");
html.P();
html.A(start).print("back");
}
}