private void createAddContactSubForm ( ) { add ( new WHeading ( HeadingLevel . H3 , "Add a new contact" ) ) ; WButton addBtn = new WButton ( "Add" ) ; addBtn . setAction ( new Action ( ) { @ Override public void execute ( final ActionEvent event ) { addNewContact ( ) ; } } ) ; addBtn . setImage ( "/image/address-book-new.png" ) ; newNameField . setDefaultSubmitButton ( addBtn ) ; WContainer container = new WContainer ( ) ; container . add ( newNameField ) ; container . add ( addBtn ) ; WFieldLayout layout = new WFieldLayout ( ) ; add ( layout ) ; layout . addField ( "New contact name" , container ) ; add ( new WAjaxControl ( addBtn , new AjaxTarget [ ] { repeater , newNameField } ) ) ; }
Create the UI artefacts for the Add contact sub form .