com.primix.tapestry.form
Class ListEdit

java.lang.Object
  |
  +--com.primix.tapestry.AbstractComponent
        |
        +--com.primix.tapestry.form.ListEdit
All Implemented Interfaces:
IComponent, IRender

public class ListEdit
extends AbstractComponent

A specialized Form component used to edit a list of items within a form; it is similar to a Foreach but leverages hidden inputs within the <form> to store the items in the list.
Parameter Type Read / Write Required Default Description
source Object[] or List R yes   The list of values to be editted within the form. This list is only read when the component renders; it records hidden input fields in the form to guide things when the form is submitted.

The source can contain objects of any type, though they should be serializable. Ideally, the objects should be String or wrapper types such as Integer. In other words, the source should be a list of primary keys of the objects being editted.

value any R / W yes   The value for each iteration through the list (during render or rewind).
index int W no   The index (starting at zero) for each iteration through the list.
element String R no   If specified, then a tag for the specified element is placed around the content on each iteration. This emulates the Any component. Most often the element specified is "tr" when the ListEdit is part of a table. Any informal parameters are applied to the element.

Informal parameters are allowed. A body is allowed (and expected).

An instance of DataSqueezer is used to convert arbitrary objects into Strings and then back into objects. However, for best efficiency, the list should be simple Strings or numeric types, typically a primary key or other identifier from which the rest of an object may be retrieved or constructed.

Since:
1.0.2
Version:
$Id: ListEdit.java,v 1.4 2001/08/28 20:33:41 hship Exp $
Author:
Howard Ship

Fields inherited from class com.primix.tapestry.AbstractComponent
id, page, specification, wrapped, wrappedCount
 
Constructor Summary
ListEdit()
           
 
Method Summary
 IBinding getElementBinding()
           
 IBinding getIndexBinding()
           
 IBinding getSourceBinding()
           
 IBinding getValueBinding()
           
 void render(IResponseWriter writer, IRequestCycle cycle)
          The principal rendering/rewinding method.
 void setElementBinding(IBinding value)
           
 void setIndexBinding(IBinding value)
           
 void setSourceBinding(IBinding value)
           
 void setValueBinding(IBinding value)
           
 
Methods inherited from class com.primix.tapestry.AbstractComponent
addAsset, addComponent, addWrapped, cleanupAfterRender, cleanupComponent, finishLoad, finishLoad, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, generateAttributes, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getChangeObserver, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getListeners, getPage, getSpecification, prepareForRender, renderWrapped, reset, setBinding, setContainer, setId, setPage, setSpecification, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListEdit

public ListEdit()
Method Detail

setSourceBinding

public void setSourceBinding(IBinding value)

getSourceBinding

public IBinding getSourceBinding()

setValueBinding

public void setValueBinding(IBinding value)

getValueBinding

public IBinding getValueBinding()

setIndexBinding

public void setIndexBinding(IBinding value)

getIndexBinding

public IBinding getIndexBinding()

setElementBinding

public void setElementBinding(IBinding value)
Since:
1.0.4

getElementBinding

public IBinding getElementBinding()
Since:
1.0.4

render

public void render(IResponseWriter writer,
                   IRequestCycle cycle)
            throws RequestCycleException
Description copied from interface: IRender
The principal rendering/rewinding method. This will cause the receiving component to render its top level elements (HTML text and components).

Renderring and rewinding are the exact same process. The same code that renders must be able to restore state by going through the exact same operations (even though the output is discarded).