@Override public void setLocale(Locale locale) { super.setLocale(locale); // Local has changed, update the Previous/Next link text. setLinkText( previousLink, Resources.getText(Resources.PaginationRenderer_previous, getLocale())); setLinkText(nextLink, Resources.getText(Resources.PaginationRenderer_next, getLocale())); resultLabel.setText(PaginationHelper.getResultsText(getController(), getLocale())); }
/* * (non-Javadoc) * * @see org.eclipse.nebula.widgets.pagination.PageChangedListener# * totalElementsChanged(long, long, * org.eclipse.nebula.widgets.pagination.PaginationController) */ public void totalElementsChanged( long oldTotalElements, long newTotalElements, PageableController controller) { // 1) Compute page indexes int[] indexes = PaginationHelper.getPageIndexes( controller.getCurrentPage(), controller.getTotalPages(), 10); // Update the GC navigation page with page indexes and selected page. pageLinks.setText(rebuildLinks(indexes, 0)); refreshEnabled(controller); }
/* * (non-Javadoc) * * @see * org.eclipse.nebula.widgets.pagination.PageChangedListener#pageIndexChanged * (int, int, org.eclipse.nebula.widgets.pagination.PaginationController) */ public void pageIndexChanged( int oldPageNumber, int newPageNumber, PageableController controller) { int[] indexes = PaginationHelper.getPageIndexes( controller.getCurrentPage(), controller.getTotalPages(), 10); // Update SWT page links with the string links pageLinks.setText(rebuildLinks(indexes, newPageNumber)); // Update Previous/Next links refreshEnabled(controller); }
/** * Update the enabled Next/Previous links + update the result label. * * @param controller */ private void refreshEnabled(PageableController controller) { resultLabel.setText(PaginationHelper.getResultsText(controller, getLocale())); nextLink.setEnabled(controller.hasNextPage()); previousLink.setEnabled(controller.hasPreviousPage()); }