I am using the below code in my application. But the data provider makes a
call to my service wrapper asking for all the entries. For example: if total
size of the list of 750, the first - 0 and count - 750. This is not
different from using list view. How can I make sure that this data view
loads (for example 100 entries) at a time. And when user scroll down the
list, we load more entries. Is it possible?
        
class UsersProvider implements IDataProvider
        {
            private static final long serialVersionUID = 1L;
            public Iterator iterator(int first, int count)
            {
                Iterator<SerializableWorkflowInstancePartial> iterator =
null;
                try {
                    iterator =
WorkflowServiceWrapper.listOpenActiveWorkflowInstances(
                            category, first, count);
                } catch (DependencyFailureException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                return iterator;
            }

            public int size()
            {
                return getProblemsCount();
            }

            public IModel model(final Object object)
            {
                return new LoadableDetachableModel() {
                    private static final long serialVersionUID = 1L;
                    protected Object load() {
                        return object;
                    }
                };
            }

            @Override
            public void detach() {
                LOGGER.info("coming to detach");
                // TODO Auto-generated method stub
            }
        }

        DataView<SerializableWorkflowInstancePartial> dataview =
            new DataView<SerializableWorkflowInstancePartial>("problems",
new UsersProvider()) {
            private static final long serialVersionUID = 1L;

            @Override
            protected void populateItem(final Item item) {
                Label blockedImage = new Label("blockedImage","");
                if(((SerializableWorkflowInstancePartial)
item.getModelObject()).isBlocking()) {

                //do something and add all ui compoenents
            }
        };
        add(container);
        container.add(dataview);





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Loadable-detachable-model-for-ListView-tp4621232p4622002.html
Sent from the Users forum mailing list archive at Nabble.com.

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

Reply via email to