wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marino <mar...@di.unito.it>
Subject Re: updating a page when external event occurs
Date Mon, 01 Dec 2008 12:51:01 GMT

Excerpts from the listener class

// RemoteEventListener is an Interface of the GigaSpaces middleware

// the class is very similar to the example UserProvider , and holds a list
of user calendars;
// I omit here details

public class UserProvider extends SortableDataProvider implements
RemoteEventListener{

DataTablePage  compo = null;  // the page containing the DataTable
.........
  
// this is the event listener method itself, called from the Gigaspaces
library
// when some eventon their space is detected

    public void notify(RemoteEvent theEvent) throws UnknownEventException,
RemoteException {
        System.out.println("In notify!!"); 
        
        Contact cc = new Contact(new Name("abc", "def"));
        userList.add(cc)
         
       // replace the previous defaultdatatable  with this one, containing
one more user
          compo.replaceTable(this);
         
          System.out.println("\n\AFTER REPLACE\n\n");  
    }

// now the wicket page class   
public class DataTablePage extends WebPage {
// similar  to the example with this method added
.....
 public void replaceTable(UserProvider userProvider){
          List userList = userProvider.getUsers();
        List columns = new  ArrayList();
        Iterator it = userList.iterator();
        int i =0;
        while (it.hasNext()) {
            Contact s = (Contact) it.next();
        columns.add( new PropertyColumn(new Model(s.getName().getFirst()),
"index"));
        }
        
// THE NEXT LINE causes the error
        table.replaceWith(new DefaultDataTable("datatable", columns,
userProvider, 10));
}

-- 
View this message in context: http://www.nabble.com/updating-a-page-when-external-event-occurs-tp20770960p20771378.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message