| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
package net.sf.beanform; |
| 16 |
|
|
| 17 |
|
import net.sf.beanform.prop.BeanProperty; |
| 18 |
|
|
| 19 |
|
import org.apache.hivemind.ApplicationRuntimeException; |
| 20 |
|
import org.apache.tapestry.IRequestCycle; |
| 21 |
|
import org.apache.tapestry.components.Block; |
| 22 |
|
import org.apache.tapestry.form.IFormComponent; |
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
33 |
public abstract class BeanFormRowComponent extends BeanFormComponent { |
| 34 |
|
|
| 35 |
|
public Object getBean() { |
| 36 |
1 |
return this.getBeanFormRows().getBeanForm().getBeanSafely(); |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
public BeanProperty getProperty() { |
| 40 |
2 |
return this.getBeanFormRows().getProperty(); |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
public String getDisplayName() { |
| 44 |
1 |
String name = this.getProperty().getName(); |
| 45 |
1 |
return this.getPage().getMessages().getMessage( name ); |
| 46 |
|
} |
| 47 |
|
|
| 48 |
|
protected void addExtraBindings( IFormComponent field ) { |
| 49 |
0 |
this.getBeanFormRows().addExtraBindings( field ); |
| 50 |
0 |
} |
| 51 |
|
|
| 52 |
|
private BeanFormRows getBeanFormRows() { |
| 53 |
3 |
IRequestCycle cycle = this.getPage().getRequestCycle(); |
| 54 |
3 |
BeanFormRows rows = (BeanFormRows) cycle.getAttribute( BeanFormRows.BEAN_FORM_ROWS_ATTRIBUTE ); |
| 55 |
3 |
if( rows == null ) throw new ApplicationRuntimeException( BeanFormMessages.noBeanFormRows( this ) ); |
| 56 |
3 |
return rows; |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
public Block getCustomFieldBlock() { |
| 60 |
0 |
return this.getCustomFieldBlock( this.getProperty() ); |
| 61 |
|
} |
| 62 |
|
|
| 63 |
|
public IFormComponent getCustomField() { |
| 64 |
0 |
return this.getCustomField( this.getProperty() ); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
} |