| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
package net.sf.beanform; |
| 16 |
|
|
| 17 |
|
import java.util.List; |
| 18 |
|
import java.util.Map; |
| 19 |
|
|
| 20 |
|
import net.sf.beanform.binding.DualBinding; |
| 21 |
|
import net.sf.beanform.prop.BeanProperty; |
| 22 |
|
|
| 23 |
|
import org.apache.tapestry.IBinding; |
| 24 |
|
import org.apache.tapestry.IMarkupWriter; |
| 25 |
|
import org.apache.tapestry.IRequestCycle; |
| 26 |
|
import org.apache.tapestry.form.IFormComponent; |
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
9 |
public abstract class BeanFormRows extends BeanFormComponent { |
| 35 |
|
|
| 36 |
1 |
public final static String BEAN_FORM_ROWS_ATTRIBUTE = BeanFormRows.class.getName(); |
| 37 |
|
|
| 38 |
|
private BeanProperty property; |
| 39 |
|
private Map<String, IBinding> fieldBindings; |
| 40 |
|
|
| 41 |
|
public BeanProperty getProperty() { |
| 42 |
5 |
return this.property; |
| 43 |
|
} |
| 44 |
|
|
| 45 |
|
public void setProperty( BeanProperty property ) { |
| 46 |
1 |
this.property = property; |
| 47 |
1 |
this.fieldBindings = this.getBeanForm().getFieldBindingsFor( property ); |
| 48 |
1 |
} |
| 49 |
|
|
| 50 |
|
public List<BeanProperty> getProperties() { |
| 51 |
0 |
return this.getBeanForm().getBeanProperties(); |
| 52 |
|
} |
| 53 |
|
|
| 54 |
|
@Override |
| 55 |
|
protected void renderComponent( IMarkupWriter writer, IRequestCycle cycle ) { |
| 56 |
1 |
Object old = cycle.getAttribute( BEAN_FORM_ROWS_ATTRIBUTE ); |
| 57 |
1 |
cycle.setAttribute( BEAN_FORM_ROWS_ATTRIBUTE, this ); |
| 58 |
1 |
super.renderComponent( writer, cycle ); |
| 59 |
1 |
cycle.setAttribute( BEAN_FORM_ROWS_ATTRIBUTE, old ); |
| 60 |
1 |
} |
| 61 |
|
|
| 62 |
|
protected void addExtraBindings( IFormComponent field ) { |
| 63 |
1 |
DualBinding.addCustomBindings( field, this.fieldBindings, true ); |
| 64 |
1 |
} |
| 65 |
|
|
| 66 |
|
} |