package e4s.tutorial;
import e4s.html.E4Method;
import e4s.html.HTML;
import e4s.html.input.extended.*;
import e4s.html.input.inlineedit.E4InlineEditCached;
import e4s.servlet.E4ModuleImplementation;
import e4s.servlet.E4ServletImplementation_Intf;
/**
* Multiple input lines based on simple input elements (only one row per time available for editing)
*/
public class Example_LineInput extends E4ModuleImplementation
{
public static E4Method start = null;
public static class InputLine extends E4InlineEditCached
{
final E4InputFieldName PARAM_TITLE = new E4InputFieldName("TITLE");
final E4InputFieldName PARAM_URL = new E4InputFieldName("URL");
public InputLine(E4ServletImplementation_Intf servlet)
throws Exception
{
super("TEST",servlet);
setField(new TEXTFIELD(PARAM_TITLE,"Title",20,40));
setField(new TEXTFIELD(PARAM_URL,"URL",20,60));
setAddOnInit();
//setDisplayLabels(false);
//setDisplayRowcount(true);
setData(0,PARAM_TITLE,"Searchengine");
setData(0,PARAM_URL,"www.google.com");
setData(1,PARAM_TITLE,"Television");
setData(1,PARAM_URL,"www.nbc.com");
}
public void dataChanged(int row)
throws Exception
{
// now, we know that row has been changed, all we need to right here is to
// get the data using getData(row,fieldname) and store it e.g. in our database
}
public void dataDeleted(int row)
throws Exception
{
// now, we know that row has been deleted, all we need to right here is to
// delete it e.g. in our database
}
}
public void start(HTML html)
throws Exception
{
html.B().println("Please enter your favorite sites:");
html.BR();
html.SMALL().println("(You can enter more lines)");
html.P();
InputLine lines = new InputLine(getServlet());
html.addElement(lines);
}
}