package e4s.tutorial; import java.io.*; import java.util.*; import java.text.*; import java.net.*; import java.sql.*; import e4s.html.*; import e4s.html.input.extended.*; import e4s.servlet.*; /** * A simple class, that demonstrates the use of images. Define input fields in a form that * represent images which can be selected by a pickup from a directory on your server with * uploading capabilities. * * {@tutorial Example_ImageField} * * @see e4s.html.input.extended.IMAGEFIELD */ public class Example_ImageField extends E4ModuleImplementation { public static E4Method start = null; public static E4Method result = null; public void start( HTML html ) { FORM form = html.BODY().FORM(); form.setAction(result); E4Fieldset fieldset = form.FIELDSET(); TEXTFIELD client = fieldset.TEXTFIELD(new E4InputFieldName("CLIENT"),"Client",20); if (getApplObj() != null) client.setValue(getApplObj().getClient()); client.setReadOnly(true); // in this case, the relative path is hidden IMAGEFIELD image1 = fieldset.IMAGEFIELD(new E4InputFieldName("FIELD_A"),"Image-Field #1"); image1.setValue("images/butterfly.gif"); image1.setInitPath("images"); image1.setCanUploadFiles(true); image1.setMaxUploadSize(20000); // in this case, the relative path is visible IMAGEFIELD image2 = fieldset.IMAGEFIELD(new E4InputFieldName("FIELD_B"),"Image-Field #2"); image2.setValue("images/elephant.gif"); image2.setCanUploadFiles(false); image2.layoutToNextRow(false); IMAGEFIELD image3 = fieldset.IMAGEFIELD(new E4InputFieldName("FIELD_C"),"Image-Field #3"); image3.layoutToNextRow(false); form.FORM_Submit("Save"); } public void result( HTML html, E4CgiParams params ) { params.toTable(html.TABLE(TABLE.E4S_DEFAULT_TABLE())); } }