private WFieldLayout recursiveFieldLayout ( final int curr , final int startAt ) { WFieldLayout innerLayout = new WFieldLayout ( ) ; innerLayout . setLabelWidth ( 20 ) ; if ( curr == 0 && startAt == 0 ) { innerLayout . setMargin ( new Margin ( Size . LARGE , null , null , null ) ) ; } innerLayout . setOrdered ( true ) ; if ( startAt > 1 ) { innerLayout . setOrderedOffset ( startAt ) ; } innerLayout . addField ( "Test " + String . valueOf ( startAt > 1 ? startAt : 1 ) , new WTextField ( ) ) ; innerLayout . addField ( "Test " + String . valueOf ( startAt > 1 ? startAt + 1 : 2 ) , new WTextField ( ) ) ; innerLayout . addField ( "Test " + String . valueOf ( startAt > 1 ? startAt + 2 : 2 ) , new WTextField ( ) ) ; if ( curr < 4 ) { int next = curr + 1 ; innerLayout . addField ( "indent level " + String . valueOf ( next ) , recursiveFieldLayout ( next , 0 ) ) ; } innerLayout . addField ( "Test after nest" , new WTextField ( ) ) ; return innerLayout ; }
Create a recursive field layout .