Example usage for org.apache.wicket.markup.html.navigation.paging PagingNavigation PagingNavigation

List of usage examples for org.apache.wicket.markup.html.navigation.paging PagingNavigation PagingNavigation

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.navigation.paging PagingNavigation PagingNavigation.

Prototype

public PagingNavigation(final String id, final IPageable pageable, final IPagingLabelProvider labelProvider) 

Source Link

Document

Constructor.

Usage

From source file:com.doculibre.constellio.wicket.paging.ConstellioPagingNavigator.java

License:Open Source License

@Override
protected PagingNavigation newNavigation(IPageable pageable, IPagingLabelProvider labelProvider) {
    PagingNavigation pagingNavigation = new PagingNavigation("navigation", pageable, labelProvider) {
        private static final long serialVersionUID = 1L;

        public boolean isEnabled() {
            return super.isEnabled() && ConstellioPagingNavigator.this.isEnabled()
                    && ConstellioPagingNavigator.this.isEnableAllowed();
        }/*from  w  w  w.  ja va2 s .c o m*/

        @Override
        protected Link newPagingNavigationLink(String id, IPageable pageable, int pageIndex) {
            return ConstellioPagingNavigator.this.newPagingNavigationLink(id, pageable, pageIndex);
        }

    };
    pagingNavigation.setViewSize(5);
    return pagingNavigation;
}

From source file:com.eltiland.ui.common.components.navigator.PagingNavigator.java

License:Apache License

/**
 * Create a new PagingNavigation. May be subclassed to make us of specialized PagingNavigation.
 *
 * @param id            The id of the navigation component
 * @param pageable      the pageable component
 * @param labelProvider The label provider for the link text.
 * @return the navigation object//  w w  w.  j ava2  s  .  co m
 */
protected PagingNavigation newNavigation(final String id, final IPageable pageable,
        final IPagingLabelProvider labelProvider) {
    return new PagingNavigation(id, pageable, labelProvider);
}

From source file:com.norconex.commons.wicket.bootstrap.table.BootstrapPagingNavigator.java

License:Apache License

@Override
protected PagingNavigation newNavigation(String id, IPageable pageable, IPagingLabelProvider labelProvider) {
    return new PagingNavigation(id, pageable, labelProvider) {
        private static final long serialVersionUID = -1041791124600426054L;

        @Override//from  w ww. ja  va 2 s. c  om
        protected LoopItem newItem(int iteration) {
            LoopItem item = super.newItem(iteration);

            // add css for enable/disable link
            long pageIndex = getStartIndex() + iteration;
            item.add(new AttributeModifier("class",
                    new BootstrapPageLinkCssModel(pageable, pageIndex, "active")));

            return item;
        }
    };
}

From source file:com.servoy.j2db.server.headlessclient.dataui.ServoySubmitPagingNavigator.java

License:Open Source License

/**
 * @see wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator#newNavigation(wicket.markup.html.navigation.paging.IPageable, wicket.markup.html.navigation.paging.IPagingLabelProvider)
 *///w ww  . j a  v a2s.co m
@Override
protected PagingNavigation newNavigation(IPageable pageable, IPagingLabelProvider labelProvider) {
    return new PagingNavigation("navigation", pageable, labelProvider) {
        private static final long serialVersionUID = 1L;

        /**
         * @see wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigation#newPagingNavigationLink(java.lang.String, wicket.markup.html.navigation.paging.IPageable, int)
         */
        @Override
        protected Link newPagingNavigationLink(String id, IPageable pageable, int pageIndex) {
            Link rez = new ServoySubmitPagingNavigationLink(id, pageable, pageIndex);
            TabIndexHelper.setUpTabIndexAttributeModifier(rez, tabIndex);
            return rez;
        }
    };
}

From source file:com.visural.wicket.datatable.toolbar.AjaxSubmittingNavigationToolbar.java

License:Apache License

@Override
protected PagingNavigator newPagingNavigator(String navigatorId, DataTable<?> table) {
    return new PagingNavigator(navigatorId, table) {
        @Override/*from w  w w.  j  av a  2 s  . co m*/
        protected AbstractLink newPagingNavigationLink(String id, IPageable pageable, int pageNumber) {
            return new PagingNavigationAjaxSubmitLink(id, pageable, pageNumber);
        }

        @Override
        protected AbstractLink newPagingNavigationIncrementLink(String id, IPageable pageable, int increment) {
            return new PagingNavigationAjaxSubmitLink(id, pageable, increment);
        }

        @Override
        protected PagingNavigation newNavigation(IPageable pageable, IPagingLabelProvider labelProvider) {
            return new PagingNavigation("navigation", pageable, labelProvider) {
                @Override
                protected AbstractLink newPagingNavigationLink(String id, IPageable pageable, int pageIndex) {
                    return new PagingNavigationAjaxSubmitLink(id, pageable, pageIndex);
                }
            };
        }
    };
}

From source file:com.visural.wicket.datatable.toolbar.SubmittingNavigationToolbar.java

License:Apache License

@Override
protected PagingNavigator newPagingNavigator(String navigatorId, DataTable<?> table) {
    return new PagingNavigator(navigatorId, table) {

        @Override/*from   w w w.  j  a v  a 2  s.c  o m*/
        protected AbstractLink newPagingNavigationLink(String id, IPageable pageable, int pageNumber) {
            return new PagingNavigationSubmitLink(id, pageable, pageNumber);
        }

        @Override
        protected AbstractLink newPagingNavigationIncrementLink(String id, IPageable pageable, int increment) {
            return new PagingNavigationSubmitLink(id, pageable, increment);
        }

        @Override
        protected PagingNavigation newNavigation(IPageable pageable, IPagingLabelProvider labelProvider) {
            return new PagingNavigation("navigation", pageable, labelProvider) {

                @Override
                protected AbstractLink newPagingNavigationLink(String id, IPageable pageable, int pageIndex) {
                    return new PagingNavigationSubmitLink(id, pageable, pageIndex);
                }
            };
        }
    };
}

From source file:de.javakaffee.msm.bench.ListLightPage.java

License:Apache License

/**
 * Constructor that is invoked when page is invoked without a session.
 * //w ww . j a va  2s. co  m
 * @param parameters
 *            Page parameters
 */
public ListLightPage(final PageParameters parameters) {

    setStatelessHint(true);

    // Add the simplest type of label
    add(new Label("message",
            "Just a list of lightweight items. They're not stored directly in the session, but only their ids."));

    final int page = parameters.getInt("page", 1) - 1;
    final String sortProperty = parameters.getString("orderby", "firstName");
    final boolean ascending = parameters.getAsBoolean("asc", true);
    final SortableContactDataProvider dp = new SortableContactDataProvider(sortProperty, ascending);

    final DataView<Contact> dataView = new DataView<Contact>("sorting", dp) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(final Item<Contact> item) {
            final Contact contact = item.getModelObject();
            item.add(new ActionPanel("actions", item.getModel()));
            item.add(new Label("contactid", String.valueOf(contact.getId())));
            item.add(new Label("firstname", contact.getFirstName()));
            item.add(new Label("lastname", contact.getLastName()));
            item.add(new Label("homephone", contact.getHomePhone()));
            item.add(new Label("cellphone", contact.getCellPhone()));

            item.add(new AttributeModifier("class", true, new AbstractReadOnlyModel<String>() {
                private static final long serialVersionUID = 1L;

                @Override
                public String getObject() {
                    return (item.getIndex() % 2 == 1) ? "even" : "odd";
                }
            }));
        }
    };

    dataView.setItemsPerPage(8);

    dataView.setCurrentPage(page);

    add(new MyOrderByBorder("orderById", "id", dp));

    add(new MyOrderByBorder("orderByFirstName", "firstName", dp));

    add(new MyOrderByBorder("orderByLastName", "lastName", dp));

    add(dataView);

    add(new PagingNavigator("navigator", dataView) {
        private static final long serialVersionUID = 1L;

        /*
         * (non-Javadoc)
         * 
         * @see
         * org.apache.wicket.markup.html.navigation.paging.PagingNavigator
         * #newPagingNavigationIncrementLink(java.lang.String,
         * org.apache.wicket.markup.html.navigation.paging.IPageable, int)
         */
        @Override
        protected AbstractLink newPagingNavigationIncrementLink(final String id, final IPageable pageable,
                final int increment) {
            return new PagingNavigationIncrementLink<Void>(id, pageable, increment) {
                private static final long serialVersionUID = 1L;

                /*
                 * (non-Javadoc)
                 * 
                 * @seeorg.apache.wicket.markup.html.navigation.paging.
                 * PagingNavigationIncrementLink#onClick()
                 */
                @Override
                public void onClick() {
                    throw new UnsupportedOperationException("OnClick not supported by bookmarkable link");
                }

                /*
                 * (non-Javadoc)
                 * 
                 * @see org.apache.wicket.markup.html.link.Link#getURL()
                 */
                @Override
                protected CharSequence getURL() {
                    final PageParameters params = new PageParameters();
                    final SortParam sort = dp.getSort();
                    params.add("page", String.valueOf(getPageNumber() + 1));
                    params.add("orderby", sort.getProperty());
                    params.add("asc", String.valueOf(sort.isAscending()));

                    return urlFor(ListLightPage.class, params);
                }

                /*
                 * (non-Javadoc)
                 * 
                 * @see
                 * org.apache.wicket.markup.html.link.Link#getStatelessHint
                 * ()
                 */
                @Override
                protected boolean getStatelessHint() {
                    return true;
                }

            };
        }

        /*
         * (non-Javadoc)
         * 
         * @see
         * org.apache.wicket.markup.html.navigation.paging.PagingNavigator
         * #newPagingNavigationLink(java.lang.String,
         * org.apache.wicket.markup.html.navigation.paging.IPageable, int)
         */
        @Override
        protected AbstractLink newPagingNavigationLink(final String id, final IPageable pageable,
                final int pageNumber) {
            return new MyPagingNavigationLink<Void>(id, pageable, pageNumber, dp);
        }

        /*
         * (non-Javadoc)
         * 
         * @see
         * org.apache.wicket.markup.html.navigation.paging.PagingNavigator
         * #newNavigation
         * (org.apache.wicket.markup.html.navigation.paging.IPageable,
         * org.apache
         * .wicket.markup.html.navigation.paging.IPagingLabelProvider)
         */
        @Override
        protected PagingNavigation newNavigation(final IPageable pageable,
                final IPagingLabelProvider labelProvider) {
            return new PagingNavigation("navigation", pageable, labelProvider) {
                private static final long serialVersionUID = 1L;

                /*
                 * (non-Javadoc)
                 * 
                 * @seeorg.apache.wicket.markup.html.navigation.paging.
                 * PagingNavigation
                 * #newPagingNavigationLink(java.lang.String,
                 * org.apache.wicket
                 * .markup.html.navigation.paging.IPageable, int)
                 */
                @Override
                protected AbstractLink newPagingNavigationLink(final String id, final IPageable pageable,
                        final int pageIndex) {
                    return new MyPagingNavigationLink<Void>(id, pageable, pageIndex, dp);
                }

            };
        }

    });
}

From source file:jp.xet.uncommons.wicket.gp.BookmarkableNavigator.java

License:Apache License

@Override
protected PagingNavigation newNavigation(String id, IPageable pageable, IPagingLabelProvider labelProvider) {
    return new PagingNavigation(id, pageable, labelProvider) {

        @Override//www.jav  a  2 s .  c o m
        protected AbstractLink newPagingNavigationLink(String id, IPageable pageable, int pageIndex) {
            return new BookmarkableNavigationLink(id, getPage().getClass(), pageable, pageIndex);
        }
    };
}

From source file:jp.xet.uncommons.wicket.gp.SimplePagingNavigator.java

License:Apache License

@Override
protected PagingNavigation newNavigation(String id, IPageable pageable, IPagingLabelProvider labelProvider) {
    PagingNavigation pg = new PagingNavigation("navigation", pageable, labelProvider) {

        @Override/* w w w . j a  va2 s.  c  o m*/
        protected Link<Void> newPagingNavigationLink(String id, IPageable pageable, int pageIndex) {
            @SuppressWarnings("unchecked")
            Link<Void> lnk = (Link<Void>) super.newPagingNavigationLink(id, pageable, pageIndex);
            if (isAnchorSelf()) {
                lnk.setAnchor(SimplePagingNavigator.this);
            }
            return lnk;
        }
    };
    pg.setViewSize(getViewsize());
    return pg;
}

From source file:jp.xet.uncommons.wicket.gp.StatelessSimplePagingNavigator.java

License:Apache License

@Override
protected PagingNavigation newNavigation(String id, IPageable pageable, IPagingLabelProvider labelProvider) {
    PagingNavigation pn = new PagingNavigation(id, pageable, labelProvider) {

        @Override//  w  w  w  . jav  a  2  s.  com
        protected Link<Void> newPagingNavigationLink(String id, IPageable pageable, final int pageIndex) {
            PageParameters pp = newPageParameters();
            pp.set(pageKeyName, String.valueOf(pageIndex + 1));
            BookmarkablePageLink<Void> lnk = new BookmarkablePageLink<Void>(id, clazz, pp) {

                @Override
                public boolean isEnabled() {
                    return currentPage != pageIndex;
                }

                @Override
                protected void onComponentTag(ComponentTag tag) {
                    super.onComponentTag(tag);
                    if (anchor != null && tag.getAttribute("href") != null) {
                        String href = tag.getAttribute("href");
                        String atag = anchor.contains("#") ? anchor : "#" + anchor;
                        tag.put("href", href + atag);
                    }
                }
            };
            if (isAnchorSelf()) {
                lnk.setAnchor(StatelessSimplePagingNavigator.this);
            }
            return lnk;
        }
    };
    pn.setViewSize(getViewsize());
    return pn;
}