API Overview API Index Package Overview Direct link to this page
JavaOnTracks 0.1.2
  net.jot.web.forms. JOTCRUDForm View Source
Author(s)
thibautc
Since
Version
Serial
Hierarchy
 Object
      JOTViewBlock
          JOTViewTag
              JOTForm
                  JOTCRUDForm
Implements
 JOTGeneratedFormInterface
Subclasses
Description
publicabstract abstract class JOTCRUDForm
  This form helps into automatically generating/parsing an HTMl from a Database Table It allows editing of the whole table(or a subset) and add/delete rows etc..
See also:   
Constructors
public JOTCRUDForm ()
Methods
Hide/Show inherited methods
public void addCategory (String catId, JOTFormCategory category)
  catId: a unique id for that category
protected void addColumn (JOTFormField field)
  Add a column to be displayed on the page Notes: value will be ignored (replaced by actual value in model), except for new entries If filed is set as disabled, then the column won't be shown
public void addSubmitButton (String buttonId, JOTFormSubmitButton button)
  buttonId: a unique id for that button
publicabstract void defineColumns (JOTFlowRequest request)
  Ovveride and make call to addColumn() to define which columns will be displayed.
public void defineField (String name, int type) [Inherited From JOTForm]
  Define a field of the form (name/field type) You should define all the types you want to use / see in the html form Typically you make calls to this method from within init()
public JOTFormElement get (String name) [Inherited From JOTForm]
  Return an element (by name)
public Hashtable getAll () [Inherited From JOTForm]
Return all the form fields Hastable of {name:JOTFormElement}
public String getContent () [Inherited From JOTViewBlock]
protected String getCss ()
  Ovveride this to change the form CSS It's probably best to have this css into your template and have this return an empty string.
public Hashtable getErrors () [Inherited From JOTForm]
public Hashtable getFlags () [Inherited From JOTViewTag]
protected String getFormBowells (JOTFlowRequest request) throws Exception
Generates HTMl for the inside of the form, ovveride for cutom html
public String getHtml (JOTFlowRequest request) throws Exception [Specified in JOTGeneratedFormInterface]
protected String getJavascript ()
Ovveride this if you want custom javascript
public String getResult () [Inherited From JOTForm]
  Result of the form processing: ie: success, validationFailure etc...
public Hashtable getTagProperties () [Inherited From JOTViewTag]
public boolean hasValidated () [Inherited From JOTForm]
public void init (JOTFlowRequest request) throws Exception [Specified in JOTForm]
protectedabstract boolean isNewEntryValid (JOTModel model)
  When there are fields to enter a new DB entry, the created db model will be passed to this method and you can check if you want to save it or not.
public boolean isVisible () [Inherited From JOTViewBlock]
public void preValidate () [Inherited From JOTForm]
Override this function if you want to do things before validation runs
public void removeFlag (String flag) [Inherited From JOTViewTag]
  Remove a flag from the HTML (if found)
public void reparseForm (JOTFlowRequest request) [Inherited From JOTForm]
  if new values are found in the request, this is going to be called to parse the new values
public void save (JOTFlowRequest request) throws Exception [Specified in JOTForm]
public void setAllowDelete (boolean allowDelete)
public void setContent (String newContent) [Inherited From JOTViewBlock]
  If a content is defined(not null), then the "HTML element" block content will be replaced by the value of newConetnt.
public void setErrors (Hashtable errors) [Inherited From JOTForm]
public void setFlag (String flag) [Inherited From JOTViewTag]
  Used to set a FLAG on an html element.
public void setHasValidated (boolean hasValidated) [Inherited From JOTForm]
public void setNbNewLines (int nbNewLines)
public void setResult (String result) [Inherited From JOTForm]
public void setTagProperty (String name, String value) [Inherited From JOTViewTag]
  This allows to redefine (or add new) HTML tags to the block.
public void setVisible (boolean visible) [Inherited From JOTViewBlock]
  If set to false, the elemnt will be hidden "removed" from the generated HTML.
public void unsetTagProperty (String name) [Inherited From JOTViewTag]
  Unset a tag property, so that it will be left alone.
publicabstract void updateModel (JOTFlowRequest request) throws Exception
this should set modelClass and dataEntries(from a DB query)
protected JOTModel updateModelFromRequest (JOTModel model, Vector items, JOTFlowRequest request) throws Exception [Inherited From JOTForm]
  Update a model's values using the request params.
publicfinal Hashtable validate (JOTFlowRequest request) throws Exception [Specified in JOTForm]
publicabstract Hashtable validateForm (JOTFlowRequest request) throws Exception
publicabstract boolean validatePermissions (JOTFlowRequest request) [Inherited From JOTForm]
  Implement this and return true if user is authorized to use this form
Fields
public String action
set in subclass
public boolean allowDelete
protected String content [Inherited From JOTViewBlock]
public Vector dataEntries
The entries to list / edit (results of a db query)
publicfinalstatic String JOT_GENERATED_FORM_ID = "JOT_GENERATED_FORM_ID"
ID for JOT form
publicfinalstatic String JOT_GENERATED_FORM_MODEL_CLASS = "JOT_GENERATED_FORM_MODEL_CLASS"
stores the form/model java class
publicfinalstatic String JOT_GENERATED_FORM_TOKEN = "JOT_GENERATED_FORM_TOKEN"
The token is here for security reasons, so that somebody can't fake the form request and change a different DB entry than the one he is suppose to be editing
public Class modelClass
You should set those value in your implementation in upatemodel()
public int nbNewLines
0 = none / disallow new
publicfinalstatic String REQUEST_ID = "__JOT__SUBMITTED_FORM" [Inherited From JOTForm]
public String title
protected boolean visible [Inherited From JOTViewBlock]
Nested Classes
  JOTCRUDForm.Column
Inner utility class
Generated By: JavaOnTracks Doclet 0.1.5     ©Thibaut Colar