org.mmbase.util
Class HTMLFormGenerator

java.lang.Object
  extended by org.mmbase.util.HTMLFormGenerator

public class HTMLFormGenerator
extends Object

Generates from the MACRO Strings a HTML FORM.
input Macro Vector of Strings, Proc Processor.
output HTML FORM Element(String).

How should a macro look like in your HTML file?
<MACRO ELEMENT NAME VALUE [TAG(S)]>
The "MACRO" word will be stripped in de servscan Servlet and does not enters this object.
ELEMENT: (if you are fimiliar with HTML FORMs this should be known stuff
TEXTAREA, SELECT, PASSWORD, RADIO, CHECKBOX
NAME:
The name of this HTML Element
VALUE:
This can do 2 things:
1. if the PROC TAG is present, this value will be sent to the processor
2. else ( no PROC TAG) this will be the VALUE of the HTML Element
TAG(S)
there can be more TAGS (some TYPES does support them and some don't ...)
some need an argument some don't (some can handle both :-)

 TAG                     WHAT DOES IT?                                                 SUPPORTED BY WHICH ELEMENT?
 
ROWS= The number of ROWS TEXTAREA COLS= The number of COLS TEXTAREA SIZE= The SIZE of this ELEMENT SELECT TEXT PASSWORD MULTIPLE We want MULTIPLE selection SELECT CHECKED(=)/SELECTED(=) The SELECTED element (if there is no PROC tag you don't need an argument) SELECT RADIO CHECKBOX EXCLUDE= The EXCLUDED element (only use with PROC) SELECT RADIO CHECKBOX VERTICAL Add a <BR> after a item SELECT RADIO CHECKBOX HORIZONTAL Don't add a <BR> after a item SELECT RADIO CHECKBOX EMPTY Add an EMPTY element SELECT PROC Use the processor to get a list (Vector) of values (Strings) TEXTAREA TEXT and PASSWORD (only the first of the Vector will be used) SELECT RADIO CHECKBOX DOUBLE Tell the processor to get a paired list of values SELECT RADIO CHECKBOX
example: SELECT name ProcessorTag SELECTED="selected_item" MULTIPLE SIZE=10 PROC VERTICAL.
This generates a SELECT HTML FORM with NAME=name the OPTIONs are filled with
the list which is received from the Processor.getList("ProcessorTag") call
If the "selected_item" is presend in the list it is "<OPTION SELECTED>" item"
The SIZE is the number of displayed items and MULTIPLE tells that multiple
selections are posible.
VERTICAL tells that you want a <BR> after every <OPTION>

Generated from example:
<SELECT NAME=name SIZE=10 MULTIPLE>
<OPTION> item1 <BR>
<OPTION SELECTED> sleceted_item <BR>
<OPTION> item3 <BR>
</SELECT>

Version:
$Id: HTMLFormGenerator.java 35335 2009-05-21 08:14:41Z michiel $
Author:
Jan van Oosterom
Application:
SCAN

Field Summary
protected  HTMLElementCheckBox checkBox
          CHECKBOX Element
protected  HTMLElementPassword password
          PASSWORD
protected  HTMLElementRadio radio
          RADIO Element
protected  HTMLElementSelect select
          SELECT Element
protected  HTMLElementText text
          TEXT
protected  HTMLElementTextArea textArea
          TEXTAREA Element
 
Constructor Summary
HTMLFormGenerator()
          Contructs the HTMLElements
 
Method Summary
protected  String getFirstElement(Vector vector)
           
 String getHTMLElement(scanpage sp, ProcessorModule proc, Vector macro)
          Gets the first element of the Vector and selects the correspondending HTMLElement to handle this element, and passes the tail elements to that Element.
protected  Vector getTailElements(Vector vector)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

textArea

protected HTMLElementTextArea textArea
TEXTAREA Element


radio

protected HTMLElementRadio radio
RADIO Element


select

protected HTMLElementSelect select
SELECT Element


checkBox

protected HTMLElementCheckBox checkBox
CHECKBOX Element


text

protected HTMLElementText text
TEXT


password

protected HTMLElementPassword password
PASSWORD

Constructor Detail

HTMLFormGenerator

public HTMLFormGenerator()
Contructs the HTMLElements

Method Detail

getHTMLElement

public String getHTMLElement(scanpage sp,
                             ProcessorModule proc,
                             Vector macro)
Gets the first element of the Vector and selects the correspondending HTMLElement to handle this element, and passes the tail elements to that Element.
Output String: HTML FORM Element (TEXTAREA, RADIO, SELECT, CHECKBOX, TEXT or PASSWORD).

Parameters:
proc - The Processor to handle the getList (2nd Element from the Vector marco)
macro - The Vector with Strings

getTailElements

protected Vector getTailElements(Vector vector)

getFirstElement

protected String getFirstElement(Vector vector)


MMBase 2.0-SNAPSHOT - null