Hi,

the following looks strange to me:

     public void refresh( List list ) {
        list.clear( );
        list.addAll( abcManager.getAllGaps( ) );
    }

Isn't there a "this" missing?

Sven

On 03/22/2011 07:50 PM, sonoerin wrote:
Hello everyone,

So I feel there is something I am overlooking in all my work on this.  I
have a Wicket 1.4/Spring2.5.6/hibernate 3.2/ app that I cannot get quite
right.  I have a SortableDataProvider that I am trying to populate by:

public class ABCTablePanel extends Panel {

   public ABCTablePanel (String id) {
     super(id);
     ABCProvider abcProvider = new ABCProvider();
     DefaultDataTable table = new DefaultDataTable("abctable", getColumns(),
abcProvider , 10);

     add(table);
   }

private List<IColumn<Abc>>  getColumns() {
       List<IColumn<Abc>>  result = new
ArrayList<IColumn<Abc>>();
       result.add( new PropertyColumn(new Model("Abc Description"),
"AbcDescription",
  "AbcDescription" ));
        result.add( new DatePropertyColumn(new Model("Abc Date"), AbcDate",
  "AbcDate" ));
...
  }

}


Then my provider:
public class AbcProvider extends SortableDataProvider {

private List list = new ArrayList( );
     private SortableDataProviderComparator comparator = new
SortableDataProviderComparator( );
     @SpringBean
     private AbcManager abcManager = null;

     public AbcProvider( ) {
         // The default sorting
         setSort( "abc.abcDescription", true );
     }

      public void refresh( List list ) {
         list.clear( );
         list.addAll( abcManager.getAllGaps( ) );
     }

     @Override
     public Iterator iterator( int first, int count ) {
         getAllAbcs( );  // method that calls a  manager, calling hibernate,
and populates "list"
         List newList = new ArrayList( list );

         // Sort the data
         Collections.sort( newList, comparator );

         // Return the data for the current page - this can be determined
only after sorting
         return newList.subList( first, first + count ).iterator( );

     }
     @Override
     public IModel model( final Abc object ) {
         return new AbstractReadOnlyModel( ) {
             @Override
             public AbcgetObject( ) {
                 return (Abc) object;
             }
         };
     }


When I run this all appears well, except the call is never made to populate
the table. I just get "No Records Found" beneath my column names, and the
debug points are never hit when I refresh or load the page.

Thank you in advance for any help you can offer.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-populate-SortableDataProvider-tp3397372p3397372.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to