litesoft
@ 965
litesoft / trunk / GWT_Sandbox / FormEngine / src / com / temp / foundation / client / widget / table / CustomDataTable.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 |
package com.temp.foundation.client.widget.table; import com.google.gwt.cell.client.*; import com.google.gwt.core.client.*; import com.google.gwt.dom.client.Style.*; import com.google.gwt.event.dom.client.*; import com.google.gwt.safehtml.shared.*; import com.google.gwt.user.cellview.client.*; import com.google.gwt.user.cellview.client.LoadingStateChangeEvent.*; import com.google.gwt.user.client.ui.*; import com.google.gwt.user.client.ui.DockPanel.*; import com.google.gwt.view.client.*; import com.temp.foundation.client.util.*; import com.temp.foundation.client.widget.table.column.*; import com.temp.foundation.client.widget.table.datatableadapter.*; import com.temp.common.shared.*; import com.temp.common.shared.utils.*; import java.util.*; /** * @param <R> the row type (e.g. MessageRow) * * @author paule */ public class CustomDataTable<R extends DataRow<F>, F> extends Composite implements LoadingProgressListener { public static final String NO_RESULTS_FOUND_MESSAGE = "No results found."; public static final String STYLE_NO_RESULTS_FOUND_MESSAGE = "DataTable-NoResults-message"; public static final String NO_RESULTS_FOUND_INITIAL_MESSAGE = ""; public static final String NO_RESULTS_FOUND_SUCCESS_MESSAGE = "No results found."; public static final String NO_RESULTS_FOUND_ERROR_MESSAGE = ""; public static final String STYLE_NO_RESULTS_FOUND_INITIAL_MESSAGE = "DataTable-NoResults-message"; public static final String STYLE_NO_RESULTS_FOUND_SUCCESS_MESSAGE = "DataTable-NoResultsOnSuccess-message"; public static final String STYLE_NO_RESULTS_FOUND_ERROR_MESSAGE = "DataTable-NoResultsOnFailure-message"; public static final int TEN = 10; public static final int TWENTY_FIVE = 25; public static final int DEFAULT_RESULTS_PER_PAGE = TEN; private static final String LINK_STYLE_NAME = "link-button"; private static final String INACTIVE_LINK_STYLE_NAME = "inactive-link-button"; private static final int ROW_NUMBER_COLUMN_WIDTH_PX = 35; private static final String DEFAULT_HEIGHT = "350px"; private static final String DEFAULT_WIDTH = "100%"; private static final String DATA_TABLE_TOP_WIDGET_PANEL_STYLE_NAME = "dataTable-top-widget-panel"; /** * The Sort Direction values to pass to EIS Service calls. */ public static enum SortDirection { ASC, DESC; } /** * Interface for data methods needed to update the data table. */ public static interface DataTableUpdater { /** * Should call dataTable.setData(dataList, nextPageMarker) with data to * populate the table. */ void updateDataTable(); /** * Should perform the action needed to download a file. Usually, * Window.open("download/url", "Download URL Title", false); * * @param event */ void onDataTableDownloadCSVButtonClick( ClickEvent event ); } private int defaultRowsPerPage; private int resultsPerPage; private LoadingProgressManagingDataTable dataTable; private PushButton nextPageLink; private Label pagingSeparatorLabel; private PushButton prevPageLink; private Label titleLabel; private ListDataProvider<R> dataProvider = new ListDataProvider<R>(); private DataTableUpdater tableUpdater; private Map<Column<?, ?>, String> columnFieldNames = new HashMap<Column<?, ?>, String>(); private String sortByField; private SortDirection sortDirection = SortDirection.DESC; private Stack<String> prevPageMarkerStack = new Stack<String>(); private String nextPageMarker; private String currPageMarker; private HorizontalPanel resultsPerPagePanel; private PushButton twentyFivePerPageLink; private PushButton tenPerPageLink; private VerticalPanel mainPanel; private final Image DOWNLOAD_BUTTON_UP_IMAGE = new Image( "images/downCSV.png" ); private final Image DOWNLOAD_BUTTON_DOWN_IMAGE = new Image( "images/downCSVPress.png" ); private PushButton downloadCSVButton; private static final String TABLE_HEADER_STYLE_NAME = "dataTable-table-header"; private static final String TABLE_HEADER_PANEL_STYLE_NAME = "dataTable-table-header-panel"; private static final String BOTTOM_PANEL_STYLE_NAME = "dataTable-bottom-panel"; public interface CustomDataTableResources extends EIS_DataTableResources { @Override @Source("CustomDataTable.css") public EIS_DataTableStyle dataGridStyle(); } /** * Constructor. * * @param title - the table title * @param dataTableUpdater - the table updater */ public CustomDataTable( String title, final DataTableUpdater dataTableUpdater ) { this( title, dataTableUpdater, null, null, true, true ); } /** * Constructor. * * @param title - the table title * @param dataTableUpdater - the table updater */ public CustomDataTable( String title, final DataTableUpdater dataTableUpdater, boolean includeTitleBar, boolean includeDownloadCSVButton ) { this( title, dataTableUpdater, null, null, includeTitleBar, includeDownloadCSVButton ); } /** * @param title - the table title * @param dataTableUpdater - the table updater * @param topWidget - optional widget at the top of the table * @param bottomWidget - optional widget at the bottom of the table * @param includeTitleBar - whether or not to include the title bar * @param includeDownloadCSVButton - whether or not to include the download CSV button * @param includePagingBar - whether or not to include the paging bar */ public CustomDataTable( String title, final DataTableUpdater dataTableUpdater, Widget topWidget, Widget bottomWidget, boolean includeTitleBar, boolean includeDownloadCSVButton ) { this( null, true, title, dataTableUpdater, topWidget, bottomWidget, includeTitleBar, includeDownloadCSVButton, true, DEFAULT_WIDTH, DEFAULT_HEIGHT ); } /** * @param title - the table title * @param dataTableUpdater - the table updater * @param topWidget - optional widget at the top of the table * @param bottomWidget - optional widget at the bottom of the table * @param includeTitleBar - whether or not to include the title bar * @param includeDownloadCSVButton - whether or not to include the download CSV button * @param includePagingBar - whether or not to include the paging bar * @param width - width of the table * @param height - height of the table, required to display properly in IE */ public CustomDataTable( Integer defaultRowsPerPage, boolean supportPaging, String title, final DataTableUpdater dataTableUpdater, Widget topWidget, Widget bottomWidget, boolean includeTitleBar, boolean includeDownloadCSVButton, boolean includeRowNumber, String width, String height ) { resultsPerPage = this.defaultRowsPerPage = (defaultRowsPerPage != null) ? defaultRowsPerPage : DEFAULT_RESULTS_PER_PAGE; tableUpdater = dataTableUpdater; VerticalPanel dataTableContainer = new VerticalPanel(); dataTableContainer.addStyleName( "dataTable-container" ); dataTableContainer.setWidth( width ); // title bar appendTo( dataTableContainer, createTableHeader( includeTitleBar, title, includeDownloadCSVButton ) ); // top widget appendTo( dataTableContainer, createTopWidgetWidget( topWidget ) ); boolean anyTopWidgets = (dataTableContainer.getWidgetCount() > 0); dataTableContainer.add( finiTable( dataTable = createTable( createTableStateLabel( "Loading...", "DataTable-Loading-message" ) ), width, height, includeRowNumber ) ); dataProvider.addDataDisplay( dataTable ); dataProvider.refresh(); Panel bottomPanel = createBottomPanel( width, // bottomWidget, // resultsPerPagePanel = createVerticallyCenteredHorizontalPanel( // tenPerPageLink = createPageSizeChangeButton( TEN ), // createPagingSeparator(), // twentyFivePerPageLink = createPageSizeChangeButton( TWENTY_FIVE ) ), // createVerticallyCenteredHorizontalPanel( // prevPageLink = createPrevPageLink(), // pagingSeparatorLabel = createPagingSeparator(), // nextPageLink = createNextPageLink() ) ); if ( supportPaging ) { dataTableContainer.add( bottomPanel ); hide( pagingSeparatorLabel ); hide( resultsPerPagePanel ); } mainPanel = new VerticalPanel(); mainPanel.addStyleName( "dataTableMainPanel" ); if ( !anyTopWidgets ) { mainPanel.addStyleName( "dataTableMainPanelNoTopWidgets" ); } mainPanel.setWidth( width ); mainPanel.add( dataTableContainer ); initWidget( mainPanel ); reset(); } private DockPanel createBottomPanel( String width, Widget bottomWidget, HorizontalPanel resultsPerPagePanel, HorizontalPanel pagerButtonsPanel ) { // bottom panel DockPanel bottomPanel = new DockPanel(); bottomPanel.setStylePrimaryName( BOTTOM_PANEL_STYLE_NAME ); bottomPanel.setWidth( width ); addSection( bottomPanel, (bottomWidget != null) ? bottomWidget : new Image( "images/empty.png" ), DockPanel.WEST, "40%" ); addSection( bottomPanel, resultsPerPagePanel, DockPanel.CENTER, "40%" ); addSection( bottomPanel, pagerButtonsPanel, DockPanel.EAST, "20%" ); return bottomPanel; } private void addSection( DockPanel panel, Widget widget, DockLayoutConstant section, String width ) { panel.add( widget, section ); panel.setCellWidth( widget, width ); panel.setCellVerticalAlignment( widget, HasVerticalAlignment.ALIGN_MIDDLE ); } private HorizontalPanel createVerticallyCenteredHorizontalPanel( Widget... widgets ) { HorizontalPanel panel = new HorizontalPanel(); panel.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE ); for ( Widget widget : widgets ) { panel.add( widget ); } return panel; } private PushButton createPageSizeChangeButton( final int newPageSize ) { return new PushButton( newPageSize + " at a time", new ClickHandler() { public void onClick( ClickEvent arg0 ) { setResultsPerPage( newPageSize ); resetPager(); updateTable(); } } ); } private Label createPagingSeparator() { Label label = new Label( "|" ); label.setWidth( "20px" ); label.setStylePrimaryName( INACTIVE_LINK_STYLE_NAME ); label.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER ); return label; } private PushButton createNextPageLink() { PushButton button = new PushButton( "Next", new ClickHandler() { public void onClick( ClickEvent event ) { prevPageMarkerStack.push( currPageMarker ); currPageMarker = nextPageMarker; updateTable(); } } ); button.setStylePrimaryName( LINK_STYLE_NAME ); hide( button ); return button; } private PushButton createPrevPageLink() { PushButton button = new PushButton( "Prev", new ClickHandler() { public void onClick( ClickEvent event ) { currPageMarker = prevPageMarkerStack.pop(); updateTable(); } } ); button.setStylePrimaryName( LINK_STYLE_NAME ); hide( button ); return button; } private LoadingProgressManagingDataTable createTable( Widget loadingIndicatorWidget ) { LoadingProgressManagingDataTable dataTable = new LoadingProgressManagingDataTable( resultsPerPage, loadingIndicatorWidget ); dataTable.addStyleName( "dataGridWidget" ); return dataTable; } private Widget finiTable( EIS_DataTable<R> dataTable, String width, String height, boolean includeRowNumber ) { dataTable.addColumnSortHandler( new ColumnSortEvent.Handler() { public void onColumnSort( ColumnSortEvent sortEvent ) { sortByField = columnFieldNames.get( sortEvent.getColumn() ); sortDirection = sortEvent.isSortAscending() ? SortDirection.ASC : SortDirection.DESC; resetPager(); updateTable(); } } ); if ( includeRowNumber ) { this.addColumn( new Column<R, String>( new TextCell() ) { public String getValue( R dataRow ) { return "" + dataRow.getRowNumber(); } }, "", "", ROW_NUMBER_COLUMN_WIDTH_PX, Unit.PX ); } ResizeLayoutPanel tablePanel = new ResizeLayoutPanel(); tablePanel.add( dataTable ); tablePanel.setWidth( width ); tablePanel.setHeight( height ); dataTable.setWidth( width ); dataTable.setHeight( height ); return tablePanel; } private HorizontalPanel createTopWidgetWidget( Widget topWidget ) { if ( topWidget == null ) { return null; } HorizontalPanel topWidgetPanel = new HorizontalPanel(); topWidgetPanel.add( topWidget ); topWidgetPanel.addStyleName( DATA_TABLE_TOP_WIDGET_PANEL_STYLE_NAME ); return topWidgetPanel; } private void appendTo( Panel dataTableContainer, Widget widget ) { if ( widget != null ) { dataTableContainer.add( widget ); } } public void reset() { setData( null, null ); resetPager(); setResultsPerPage( defaultRowsPerPage ); } public void setTitle( String title ) { titleLabel.setText( title ); } private Widget createTableHeader( boolean includeTitleBar, String title, boolean includeDownloadCSVButton ) { if ( !includeTitleBar ) { return null; } DockPanel tableHeader = new DockPanel(); tableHeader.setWidth( "100%" ); tableHeader.setStylePrimaryName( TABLE_HEADER_PANEL_STYLE_NAME ); titleLabel = new Label( title ); titleLabel.setStylePrimaryName( TABLE_HEADER_STYLE_NAME ); tableHeader.add( titleLabel, DockPanel.WEST ); tableHeader.setCellWidth( titleLabel, "85%" ); if ( includeDownloadCSVButton ) { downloadCSVButton = new PushButton( DOWNLOAD_BUTTON_UP_IMAGE, DOWNLOAD_BUTTON_DOWN_IMAGE, new ClickHandler() { public void onClick( ClickEvent clickEvent ) { if ( !CollectionsUtils.isEmpty( getData() ) ) { tableUpdater.onDataTableDownloadCSVButtonClick( clickEvent ); } } } ); tableHeader.add( downloadCSVButton, DockPanel.EAST ); tableHeader.setCellWidth( downloadCSVButton, "15%" ); } else { Label spacer = new Label( " " ); tableHeader.add( spacer, DockPanel.EAST ); tableHeader.setCellWidth( spacer, "15%" ); } HorizontalPanel tableHeaderPanel = new HorizontalPanel(); tableHeaderPanel.setWidth( "100%" ); tableHeaderPanel.addStyleName( "dataTableHeaderPanel" ); tableHeaderPanel.add( tableHeader ); return tableHeaderPanel; } private void setResultsPerPage( int _resultsPerPage ) { show( resultsPerPagePanel ); resultsPerPage = _resultsPerPage; if ( resultsPerPage == TWENTY_FIVE ) { setEnabled( twentyFivePerPageLink, false ); setEnabled( tenPerPageLink, true ); } else { setEnabled( twentyFivePerPageLink, true ); setEnabled( tenPerPageLink, false ); } dataTable.setPageSize( resultsPerPage ); } private void setEnabled( PushButton link, boolean enabled ) { String styleName = enabled ? LINK_STYLE_NAME : INACTIVE_LINK_STYLE_NAME; link.setStyleName( styleName ); link.setEnabled( enabled ); } public void redraw() { dataTable.redraw(); } /** * @return the number of results per page */ public int getResultsPerPage() { return resultsPerPage; } /** * Update the data in the table. * * @param dataList - the dataset */ public void setData( List<R> dataList, String nextPageMarker ) { setData( dataList, nextPageMarker, true ); } /** * Update the data in the table. * * @param dataList - the dataset */ public void setData( List<R> dataList, String nextPageMarker, Boolean clear ) { if ( Boolean.TRUE.equals( clear ) ) { dataProvider.getList().clear(); } if ( CollectionsUtils.isEmpty( dataList ) ) { dataProvider.refresh(); resetPager(); if ( downloadCSVButton != null ) { downloadCSVButton.setVisible( false ); } } else { int rowId = (prevPageMarkerStack.size() * resultsPerPage); for ( R data : dataList ) { data.setId( ++rowId ); } dataProvider.getList().addAll( dataList ); dataProvider.refresh(); if ( downloadCSVButton != null ) { downloadCSVButton.setVisible( true ); } if ( dataList.size() >= resultsPerPage ) { setNextPageMarker( nextPageMarker ); } else { setNextPageMarker( null ); } } } @Override public void loadingReset() { dataTable.loadingReset(); } @Override public void loadingStarted() { dataTable.loadingStarted(); } @Override public void loadingCompleted( boolean successfully ) { dataTable.loadingCompleted( successfully ); } /** * Get the contents of the table * * @return a list of the rows */ public List<R> getData() { return dataProvider.getList(); } /** * Refreshes the table. */ public void refreshTable() { resetPager(); setResultsPerPage( defaultRowsPerPage ); updateTable(); } /** * Returns the current page marker. * * @return */ public String getPageMarker() { return currPageMarker; } /** * @return - the sort by field. */ public String getSortByField() { return sortByField; } /** * @return the sort direction. */ public SortDirection getSortDirection() { return sortDirection; } /** * Adds a column * * @param fields - the column / "field" definitions */ public <FIELD extends DataRowField> void addColumns( FIELD... fields ) { if ( fields != null ) { for ( FIELD field : fields ) { addColumn( field ); } } } /** * Adds a column * * @param field - the column or "field" definition */ public <FIELD extends DataRowField> Column<R, ?> addColumn( FIELD field ) { if ( field == null ) { return null; } F fieldAsF = ObjectUtils.cast( field ); Column<R, ?> column = new TextDataColumn<R, F>( fieldAsF, field.isSortable(), field.isNumeric() ); addColumn( column, field ); return column; } /** * Adds a column * * @param column - the column * @param field - the column definition "field" */ public <FIELD extends DataRowField> Column<R, ?> addColumn( Column<R, ?> column, FIELD field ) { addTwoLineColumn( column, field.label(), field.name() ); setColumnWidth( column, field.getWidth(), field.getWidthUnit() ); return column; } /** * Adds a column * * @param column - the column * @param columnHeader - the column header */ public void addColumn( Column<R, ?> column, String columnHeader, String fieldName ) { addTwoLineColumn( column, columnHeader, fieldName ); } /** * Adds a column * * @param column - the column * @param columnHeader - the column header */ public void addColumn( Column<R, ?> column, String columnHeader, String fieldName, int width, Unit widthUnit ) { addTwoLineColumn( column, columnHeader, fieldName ); setColumnWidth( column, width, widthUnit ); } public void setColumnWidth( Column<R, ?> column, int width, Unit unit ) { if ( width > 0 ) { dataTable.setColumnWidth( column, width, (unit != null) ? unit : Unit.PX ); } } /** * Sets the selection model * * @param selectionModel - the selection model */ public void setSelectionModel( SelectionModel<? super R> selectionModel ) { dataTable.setSelectionModel( selectionModel, DefaultSelectionEventManager.<R>createCheckboxManager() ); } public SelectionModel<? super R> getSelectionModel() { return dataTable.getSelectionModel(); } // ============ PRIVATE METHODS ================ private void addTwoLineColumn( Column<R, ?> column, String columnHeader, String fieldName ) { String trustedTwoLineHeader = "<div style='display:inline;'>" + // "<table cellpadding='0' cellspacing='0'><tr><td valign='middle' class='dataGridHeaderText'>" + // SafeHtmlizer.getInstance().noEmpty( StringUtils.deNull( columnHeader ).trim().replace( ' ', '\n' ) ) + // "</td></tr></table></div>"; dataTable.addColumn( column, SafeHtmlUtils.fromTrustedString( trustedTwoLineHeader ) ); columnFieldNames.put( column, fieldName ); } private void updateTable() { dataProvider.getList().clear(); dataProvider.refresh(); tableUpdater.updateDataTable(); dataProvider.refresh(); } private void resetPager() { prevPageMarkerStack.clear(); currPageMarker = null; nextPageMarker = null; } public void setNextPageMarker( String nextPageMarker ) { this.nextPageMarker = nextPageMarker; boolean showNextPageLink = nextPageMarker != null; boolean showPrevPageLink = !prevPageMarkerStack.empty(); show( prevPageLink, showPrevPageLink ); show( nextPageLink, showNextPageLink ); show( pagingSeparatorLabel, showPrevPageLink && showNextPageLink ); } private void hide( Widget widget ) { CommonElementHelper.hide( widget.getElement() ); } private void show( Widget widget ) { CommonElementHelper.unhide( widget.getElement() ); } private void show( Widget widget, boolean visible ) { CommonElementHelper.setHidden( widget.getElement(), !visible ); } private static Label createTableStateLabel( String text, String styleClassname ) { Label label = new Label( text ); label.setStyleName( styleClassname ); label.getElement().getStyle().setMarginTop( 30.0, Unit.PX ); return label; } public static String determineState( LoadingState state ) { if ( state == LoadingState.LOADING ) { return "Loading"; } if ( state == LoadingState.LOADED ) { return "Loaded"; } if ( state == LoadingState.PARTIALLY_LOADED ) { return "Partial"; } return "????"; } private class LoadingProgressManagingDataTable extends EIS_DataTable<R> implements LoadingProgressListener { private LoadingState expectedState = null; private Label noTableResultsLabel = createTableStateLabel( NO_RESULTS_FOUND_MESSAGE, STYLE_NO_RESULTS_FOUND_MESSAGE ); public LoadingProgressManagingDataTable( int resultsPerPage, Widget loadingIndicatorWidget ) { super( resultsPerPage, // GWT.<CustomDataTableResources>create( CustomDataTableResources.class ), // null, loadingIndicatorWidget ); setEmptyTableWidget( noTableResultsLabel ); } @Override public void loadingReset() { noTableResultsLabel.setText( NO_RESULTS_FOUND_INITIAL_MESSAGE ); noTableResultsLabel.setStyleName( STYLE_NO_RESULTS_FOUND_INITIAL_MESSAGE ); } @Override public void loadingStarted() { // System.out.print("Started: "); onLoadingStateChanged( expectedState = LoadingState.LOADING ); } @Override public void loadingCompleted( boolean successfully ) { // System.out.print("Completed ("+successfully+")"); noTableResultsLabel.setText( successfully ? NO_RESULTS_FOUND_SUCCESS_MESSAGE : NO_RESULTS_FOUND_ERROR_MESSAGE ); noTableResultsLabel.setStyleName( successfully ? STYLE_NO_RESULTS_FOUND_SUCCESS_MESSAGE : STYLE_NO_RESULTS_FOUND_ERROR_MESSAGE ); expectedState = null; onLoadingStateChanged( LoadingState.LOADED ); } @Override public void onLoadingStateChanged( LoadingState state ) { if ( (expectedState == null) || (state == expectedState) ) { super.onLoadingStateChanged( state ); } // String expected = determineState( expectedState ); // String newState = determineState( state ); // System.out.println("TableState: " + expected + " | " + newState + " | " + getRowCount()); } } } |
Commits for litesoft/trunk/GWT_Sandbox/FormEngine/src/com/temp/foundation/client/widget/table/CustomDataTable.java
Revision | Author | Commited | Message |
---|---|---|---|
965 | GeorgeS | Fri 01 Aug, 2014 03:20:35 +0000 | ! |