Assume the following...
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
@Entity
@Table(name = "user", catalog = "blah")
public class User implements java.io.Serializable {
private Long id;
private String name;
// getters/setters for both
}
public interface IUserDAO {
// public void save/delete/findAll/etc
}
public class UserDAO implements IUserDAO {
private EntityManager getEntityManager() {
return EntityManagerHelper.getEntityManager();
}
public void save(User entity) {
EntityManagerHelper.log("saving User instance", Level.INFO,
null);
try {
getEntityManager().persist(entity);
EntityManagerHelper.log("save successful", Level.INFO,
null);
} catch (RuntimeException re) {
EntityManagerHelper.log("save failed", Level.SEVERE,
re);
throw re;
}
}
//etc
}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If I want to display the Users in a table contained in a re-usable
Panel(), should I be able to do something like...
public final class UserListPanel extends Panel {
public UserListPanel(String id) {
super(id);
// Create a detachable model
IModel users = new LoadableDetachableModel() {
@SpringBean
UserDAO dao;
@Override protected Object load() {
return dao.findAll();
}
return users;
};
IColumn[] columns = { new PropertyColumn(new Model("ID"),
"id"),
new PropertyColumn(new Model("Name"),
"name") };
SomeTableType dataTable = new SomeTableType(users);
add(dataTable);
}
}
Part of my confusion comes from trying to work in a
SortableDataProvider to use with a DefaultDataTable with columns
sortable by header (<th/>) links.
-David
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]