List of usage examples for com.google.gwt.gen2.table.client PagingScrollTable getPageCount
public int getPageCount()
From source file:com.qualogy.qafe.gwt.client.component.QPagingOptions.java
License:Apache License
/** * Constructor.//from w w w .j a va 2s .c o m * * @param table * the table being affected * @param images * the images to use */ public QPagingOptions(PagingScrollTable<?> table, PagingOptionsImages images) { this.table = table; if (this.table instanceof QPagingScrollTable) { ((QPagingScrollTable) this.table).setPagingOptions(this); } // Create the main widget HorizontalPanel hPanel = new HorizontalPanel(); initWidget(hPanel); hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); setStyleName(DEFAULT_STYLENAME); // Create the paging image buttons createPageButtons(images); // Create the current page box createCurPageBox(); // Create the page count label numPagesLabel = new HTML(); // Create the loading image loadingImage = new Image(GWT.getModuleBaseURL() + "scrollTableLoading.gif"); loadingImage.setVisible(false); // Create the error label errorLabel = new HTML(); errorLabel.setStylePrimaryName("errorMessage"); // Add the widgets to the panel hPanel.add(createSpacer()); hPanel.add(firstImage); hPanel.add(createSpacer()); hPanel.add(prevImage); hPanel.add(createSpacer()); hPanel.add(curPageBox); hPanel.add(createSpacer()); hPanel.add(numPagesLabel); hPanel.add(createSpacer()); hPanel.add(nextImage); hPanel.add(createSpacer()); hPanel.add(lastImage); hPanel.add(createSpacer()); hPanel.add(loadingImage); hPanel.add(errorLabel); // Add handlers to the table table.addPageLoadHandler(new PageLoadHandler() { public void onPageLoad(PageLoadEvent event) { loadingImage.setVisible(false); errorLabel.setHTML(""); } }); table.addPageChangeHandler(new PageChangeHandler() { public void onPageChange(PageChangeEvent event) { curPageBox.setText((event.getNewPage() + 1) + ""); loadingImage.setVisible(true); errorLabel.setHTML(""); } }); table.addPagingFailureHandler(new PagingFailureHandler() { public void onPagingFailure(PagingFailureEvent event) { loadingImage.setVisible(false); errorLabel.setHTML(event.getException().getMessage()); } }); table.addPageCountChangeHandler(new PageCountChangeHandler() { public void onPageCountChange(PageCountChangeEvent event) { setPageCount(event.getNewPageCount()); } }); setPageCount(table.getPageCount()); }
From source file:edu.caltech.ipac.firefly.ui.table.PagingPanel.java
License:Apache License
/** * Constructor./*w w w . ja v a 2 s .co m*/ * * @param table the table being affected * @param images the images to use */ public PagingPanel(PagingScrollTable<?> table, PagingOptions.PagingOptionsImages images) { this.table = table; // Create the main widget HorizontalPanel hPanel = new HorizontalPanel(); initWidget(hPanel); hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); setStyleName(DEFAULT_STYLENAME); // Create the paging image buttons createPageButtons(images); // Create the current page box createCurPageBox(); // Create the page count label numPagesLabel = new HTML(); // Create the loading image loadingImage = new Image(GWT.getModuleBaseURL() + "scrollTableLoading.gif"); loadingImage.setVisible(false); // Create the error label errorLabel = new HTML(); errorLabel.setStylePrimaryName("errorMessage"); // display status status = new Label(); status.addStyleName("status"); status.setWordWrap(false); // Add the widgets to the panel hPanel.add(createSpacer()); hPanel.add(firstImage); hPanel.add(createSpacer()); hPanel.add(prevImage); hPanel.add(createSpacer()); hPanel.add(curPageBox); hPanel.add(createSpacer()); hPanel.add(numPagesLabel); hPanel.add(createSpacer()); hPanel.add(nextImage); hPanel.add(createSpacer()); hPanel.add(lastImage); hPanel.add(createSpacer()); hPanel.add(status); hPanel.add(createSpacer()); hPanel.add(loadingImage); hPanel.add(errorLabel); // Add handlers to the table table.addPageLoadHandler(new PageLoadHandler() { public void onPageLoad(PageLoadEvent event) { setIsLoading(false); } }); table.addPageChangeHandler(new PageChangeHandler() { public void onPageChange(PageChangeEvent event) { curPageBox.setText((event.getNewPage() + 1) + ""); setIsLoading(true); } }); table.addPagingFailureHandler(new PagingFailureHandler() { public void onPagingFailure(PagingFailureEvent event) { loadingImage.setVisible(false); errorLabel.setHTML(event.getException().getMessage()); } }); table.addPageCountChangeHandler(new PageCountChangeHandler() { public void onPageCountChange(PageCountChangeEvent event) { setPageCount(event.getNewPageCount()); } }); setPageCount(table.getPageCount()); }