Another question for this..... How do I get the detached model to use when
submitting the form?

public class AttributePage extends BaseAdministrationPage {
        
        private se.edgesoft.hairless.entities.item.Item item;
        public AttributePage(  se.edgesoft.hairless.entities.item.Item item ){
                this.item = item;
                
                
                final IModel subItemsModel = new LoadableDetachableModel(){
                        private static final long serialVersionUID = 1L;
                        protected Object load(){
                                List<Element> elems =
getCategoryDao().getElements(getItem().getSubCategory() ); 
                                List<SubItem> subItems = new 
LinkedList<SubItem>();
                                for( int i = 0; i < 10; i++ ){
                                        SubItem subItem = new SubItem();
                                        subItem.setItem(getItem());
                                        subItems.add( subItem );
                                        subItem.setSortOrder(i);
                                        List<Attribute> attributes = new 
LinkedList<Attribute>();
                                        for( Element elem : elems ){
                                                Attribute attribute = new 
Attribute();
                                                attribute.setData( null );
                                                attribute.setElement( elem  );
                                                attribute.setSubItem(subItem);
                                                attributes.add( attribute );
                                                
subItem.setAttributes(attributes);
                                        }
                                }
                                
                                return subItems;
                        }
                };
                
                
                Form attributeForm = new Form( "attributeForm" ){
                        private static final long serialVersionUID = 1L;

                        @Override
                        protected void onSubmit()
                {
                                
                }
                };
                
                attributeForm.add(new ListView("subItems",subItemsModel){

                        private static final long serialVersionUID = 1L;

                        @Override
                        protected void populateItem(ListItem listItem ) {
                                
                                final SubItem subItem = (SubItem) 
listItem.getModelObject();
                                
                                listItem.add(new TextField("sortOrder", new 
PropertyModel( subItem,
"sortOrder" )));
                                listItem.add(new TextField("balance", new 
PropertyModel( subItem,
"balance" )));

                                listItem.add( new ListView( "attributes" , 
subItem.getAttributes()){

                                        private static final long 
serialVersionUID = 1L;

                                        @Override
                                        protected void populateItem(ListItem 
attributeItem ) {
                                                Attribute attribute = 
(Attribute) attributeItem.getModelObject();
                                                attributeItem.add( new 
TextField( "attribute", new
PropertyModel(attribute, "data" ) ) );
                                        }
                                        
                                });
                        }

                
                        
                });
                
                add( attributeForm );
                
        }
        
        public  se.edgesoft.hairless.entities.item.Item getItem(){
                return item;
        }
}
-- 
View this message in context: 
http://www.nabble.com/Markup-with-unknown-name-for-TextField-tp17058594p17064031.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to