Subversion Repository Public Repository

litesoft

Diff Revisions 150 vs 151 for /trunk/Java/GWT/Client/src/org/litesoft/GWT/client/widgets/datatables/Table.java

Diff revisions: vs.
  @@ -79,30 +79,30 @@
79 79 }
80 80
81 81 @Override
82 - protected int getCellIndex(com.google.gwt.user.client.Element pRowElement, com.google.gwt.user.client.Element pCellElement)
82 + protected int getCellIndex( com.google.gwt.user.client.Element pRowElement, com.google.gwt.user.client.Element pCellElement )
83 83 {
84 - return mDataTable.getCellIndex(pRowElement, pCellElement);
84 + return mDataTable.getCellIndex( pRowElement, pCellElement );
85 85 }
86 86 };
87 87 mDataTable.addClickHandler( new TableHelper.GridClickHandler<RowType>( 0, gridHelper, colDefs )
88 88 {
89 89 @Override
90 - public void onClick(ClickEvent pEvent)
90 + public void onClick( ClickEvent pEvent )
91 91 {
92 - super.onClick(pEvent);
92 + super.onClick( pEvent );
93 93 boolean checkBox = mSelectionPolicy == RowSelectionPolicy.CHECKBOX;
94 94 boolean radio = mSelectionPolicy == RowSelectionPolicy.RADIO;
95 - if (checkBox || radio)
95 + if ( checkBox || radio )
96 96 {
97 - TableHelper.Cell cell = gridHelper.getCellForEvent(Event.as(pEvent.getNativeEvent()));
98 - if (cell != null)
97 + TableHelper.Cell cell = gridHelper.getCellForEvent( Event.as( pEvent.getNativeEvent() ) );
98 + if ( cell != null )
99 99 {
100 100 /*
101 101 * ctrlKey = false for RADIO to workaround table bug
102 102 * where deselection of old row does not update UI
103 103 */
104 104 boolean ctrlKey = !radio;
105 - mDataTable.selectRow(cell.getRow(), ctrlKey, false);
105 + mDataTable.selectRow( cell.getRow(), ctrlKey, false );
106 106 }
107 107 }
108 108 }
  @@ -156,7 +156,7 @@
156 156
157 157 public void setSelectionPolicy( RowSelectionPolicy pSelectionPolicy )
158 158 {
159 - if (mSelectionPolicy != pSelectionPolicy)
159 + if ( mSelectionPolicy != pSelectionPolicy )
160 160 {
161 161 mSelectionPolicy = pSelectionPolicy;
162 162 SelectionPolicy oldSelectionPolicy = mDataTable.getSelectionPolicy();
  @@ -182,7 +182,7 @@
182 182 Element colGroup = mHeaderTable.getElement().getFirstChildElement();
183 183 colGroup.insertBefore( Document.get().createColElement(), colGroup.getFirstChildElement() );
184 184 mHeaderTable.insertCell( 0, 0 );
185 - mHeaderTable.getCellFormatter().getElement(0, 0).getStyle().setProperty("textAlign", HasHorizontalAlignment.ALIGN_CENTER.getTextAlignString());
185 + mHeaderTable.getCellFormatter().getElement( 0, 0 ).getStyle().setProperty( "textAlign", HasHorizontalAlignment.ALIGN_CENTER.getTextAlignString() );
186 186 mHeaderTable.setColumnWidth( 0, mDataTable.getInputColumnWidth() );
187 187 }
188 188 if ( needsSelectionColumn )
  @@ -194,7 +194,7 @@
194 194 * If no selection col label is specified, set a "select all"
195 195 * checkbox in the header.
196 196 */
197 - if (colLabel == null && pSelectionPolicy.getType() == Type.CheckBox)
197 + if ( colLabel == null && pSelectionPolicy.getType() == Type.CheckBox )
198 198 {
199 199 colLabel = mSelectAllCheckBox = new SelectAllCheckBox();
200 200 }
  @@ -243,9 +243,9 @@
243 243 *
244 244 * @throws IllegalStateException if called after {@link #loadData()}
245 245 */
246 - public void setScrollVertically(boolean pScrollVertically)
246 + public void setScrollVertically( boolean pScrollVertically )
247 247 {
248 - mTable.setScrollVertically(pScrollVertically);
248 + mTable.setScrollVertically( pScrollVertically );
249 249 }
250 250
251 251 public TableRowCountCallback getRowCountCallback()
  @@ -253,9 +253,9 @@
253 253 return mTable.getRowCountCallback();
254 254 }
255 255
256 - public void setRowCountCallback(TableRowCountCallback pRowCountCallback)
256 + public void setRowCountCallback( TableRowCountCallback pRowCountCallback )
257 257 {
258 - mTable.setRowCountCallback(pRowCountCallback);
258 + mTable.setRowCountCallback( pRowCountCallback );
259 259 }
260 260
261 261 public boolean isHeaderVisible()
  @@ -296,20 +296,20 @@
296 296 } );
297 297 }
298 298
299 - public void simulateUserClickHeader(int pCol, KeyboardKeyModifier pModifiers)
299 + public void simulateUserClickHeader( int pCol, KeyboardKeyModifier pModifiers )
300 300 {
301 - pModifiers = KeyboardKeyModifier.deNull(pModifiers);
302 - NativeEvent event = Document.get().createClickEvent(0, 0, 0, 0, 0, pModifiers.isCtrl(), pModifiers.isAlt(), pModifiers.isShift(), pModifiers.isMeta());
301 + pModifiers = KeyboardKeyModifier.deNull( pModifiers );
302 + NativeEvent event = Document.get().createClickEvent( 0, 0, 0, 0, 0, pModifiers.isCtrl(), pModifiers.isAlt(), pModifiers.isShift(), pModifiers.isMeta() );
303 303 com.google.gwt.user.client.Element zElement = mHeaderTable.getCellFormatter().getElement( 0, pCol );
304 - zElement.dispatchEvent(event);
304 + zElement.dispatchEvent( event );
305 305 }
306 306
307 - public void simulateUserClickDataGrid(int pRow, int pCol, KeyboardKeyModifier pModifiers)
307 + public void simulateUserClickDataGrid( int pRow, int pCol, KeyboardKeyModifier pModifiers )
308 308 {
309 - pModifiers = KeyboardKeyModifier.deNull(pModifiers);
310 - NativeEvent event = Document.get().createClickEvent(0, 0, 0, 0, 0, pModifiers.isCtrl(), pModifiers.isAlt(), pModifiers.isShift(), pModifiers.isMeta());
309 + pModifiers = KeyboardKeyModifier.deNull( pModifiers );
310 + NativeEvent event = Document.get().createClickEvent( 0, 0, 0, 0, 0, pModifiers.isCtrl(), pModifiers.isAlt(), pModifiers.isShift(), pModifiers.isMeta() );
311 311 com.google.gwt.user.client.Element zElement = mDataTable.getCellFormatter().getElement( pRow, pCol );
312 - zElement.dispatchEvent(event);
312 + zElement.dispatchEvent( event );
313 313 }
314 314
315 315 private static class TableImpl<RowType> extends PagingScrollTable<RowType>
  @@ -351,25 +351,25 @@
351 351 mGridRow = mockTableResult.mPrototypeRow;
352 352 getElement().insertBefore( mockTableResult.mTable, getElement().getFirstChild() );
353 353
354 - ResizableWidgetCollection.get().add(new ResizableWidgetAdaptor(this, getDataWrapper())
354 + ResizableWidgetCollection.get().add( new ResizableWidgetAdaptor( this, getDataWrapper() )
355 355 {
356 356 @Override
357 - public void onResize(int pViewportWidth, int pViewportHeight)
357 + public void onResize( int pViewportWidth, int pViewportHeight )
358 358 {
359 359 mViewportHeight = pViewportHeight;
360 360 updateMaxVisibleRows();
361 361 }
362 - });
362 + } );
363 363
364 - ResizableWidgetCollection.get().add(new TemporaryResizableWidgetAdaptor(this, mGridRow.<com.google.gwt.user.client.Element>cast())
364 + ResizableWidgetCollection.get().add( new TemporaryResizableWidgetAdaptor( this, mGridRow.<com.google.gwt.user.client.Element>cast() )
365 365 {
366 366 @Override
367 - protected void onSizeInitialized(int pRowWidth, int pRowHeight)
367 + protected void onSizeInitialized( int pRowWidth, int pRowHeight )
368 368 {
369 369 mPrototypeRowHeight = pRowHeight;
370 370 updateMaxVisibleRows();
371 371 }
372 - });
372 + } );
373 373 }
374 374
375 375 public boolean isScrollVertically()
  @@ -383,16 +383,18 @@
383 383 *
384 384 * @throws IllegalStateException if called after {@link #loadData()}
385 385 */
386 - public void setScrollVertically(boolean pScrollVertically)
386 + public void setScrollVertically( boolean pScrollVertically )
387 387 {
388 - if (mLoadPageCalled)
389 - throw new IllegalStateException("Table: must call set setScrollVertically() before loadData()");
388 + if ( mLoadPageCalled )
389 + {
390 + throw new IllegalStateException( "Table: must call set setScrollVertically() before loadData()" );
391 + }
390 392
391 393 mScrollVertically = pScrollVertically;
392 394 }
393 395
394 396 @Override
395 - public void setScrollPolicy(ScrollPolicy pScrollPolicy)
397 + public void setScrollPolicy( ScrollPolicy pScrollPolicy )
396 398 {
397 399 throw new UnsupportedOperationException();
398 400 }
  @@ -400,9 +402,9 @@
400 402 public void loadPage()
401 403 {
402 404 mLoadPageCalled = true;
403 - if (isSizeInitialized())
405 + if ( isSizeInitialized() )
404 406 {
405 - gotoPage(0, true);
407 + gotoPage( 0, true );
406 408 }
407 409 else
408 410 {
  @@ -415,7 +417,7 @@
415 417 return mRowCountCallback;
416 418 }
417 419
418 - public void setRowCountCallback(TableRowCountCallback pRowCountCallback)
420 + public void setRowCountCallback( TableRowCountCallback pRowCountCallback )
419 421 {
420 422 mRowCountCallback = pRowCountCallback;
421 423 }
  @@ -461,11 +463,11 @@
461 463 * Called by superclass after {@link TableModel} calls callback w/ data.
462 464 */
463 465 @Override
464 - protected void setData(int pFirstRow, Iterator<RowType> pRows)
466 + protected void setData( int pFirstRow, Iterator<RowType> pRows )
465 467 {
466 - super.setData(pFirstRow, (mScrollVertically) ? pRows : new LimitingIteratorWrapper<RowType>(pRows, mMaxVisibleRows));
468 + super.setData( pFirstRow, (mScrollVertically) ? pRows : new LimitingIteratorWrapper<RowType>( pRows, mMaxVisibleRows ) );
467 469 int rowCount = getTableModel().getRowCount();
468 - if (mRowCount != rowCount)
470 + if ( mRowCount != rowCount )
469 471 {
470 472 mRowCount = rowCount;
471 473 fireRowCountChanged();
  @@ -473,9 +475,9 @@
473 475 }
474 476
475 477 @Override
476 - public void onResize(int pTableWidth, int pTableHeight)
478 + public void onResize( int pTableWidth, int pTableHeight )
477 479 {
478 - super.onResize(pTableWidth, pTableHeight);
480 + super.onResize( pTableWidth, pTableHeight );
479 481 updateMaxVisibleRows();
480 482 }
481 483
  @@ -486,7 +488,7 @@
486 488
487 489 private void updateMaxVisibleRows()
488 490 {
489 - if (isSizeInitialized())
491 + if ( isSizeInitialized() )
490 492 {
491 493 /*
492 494 * Require a minimum of 1 row. Otherwise outer element
  @@ -494,12 +496,12 @@
494 496 * size and will not expand to show rows when more space becomes
495 497 * available.
496 498 */
497 - int maxVisibleRows = Math.max(1, mViewportHeight / mPrototypeRowHeight);
498 - if (mMaxVisibleRows != maxVisibleRows)
499 + int maxVisibleRows = Math.max( 1, mViewportHeight / mPrototypeRowHeight );
500 + if ( mMaxVisibleRows != maxVisibleRows )
499 501 {
500 502 mMaxVisibleRows = maxVisibleRows;
501 - setPageSize(mMaxVisibleRows);
502 - if (mFetchDataWaitingForSize)
503 + setPageSize( mMaxVisibleRows );
504 + if ( mFetchDataWaitingForSize )
503 505 {
504 506 mFetchDataWaitingForSize = false;
505 507 super.gotoFirstPage();
  @@ -514,10 +516,10 @@
514 516
515 517 private void fireRowCountChanged()
516 518 {
517 - if (mRowCountCallback != null)
519 + if ( mRowCountCallback != null )
518 520 {
519 - int visibleRows = Math.min(mRowCount, mMaxVisibleRows);
520 - mRowCountCallback.rowCountChanged(visibleRows, mRowCount, mMaxVisibleRows);
521 + int visibleRows = Math.min( mRowCount, mMaxVisibleRows );
522 + mRowCountCallback.rowCountChanged( visibleRows, mRowCount, mMaxVisibleRows );
521 523 }
522 524 }
523 525 }
  @@ -551,9 +553,9 @@
551 553 * Override to gain access
552 554 */
553 555 @Override
554 - protected int getCellIndex(com.google.gwt.user.client.Element pRowElem, com.google.gwt.user.client.Element pCellElem)
556 + protected int getCellIndex( com.google.gwt.user.client.Element pRowElem, com.google.gwt.user.client.Element pCellElem )
555 557 {
556 - return super.getCellIndex(pRowElem, pCellElem);
558 + return super.getCellIndex( pRowElem, pCellElem );
557 559 }
558 560
559 561 @Override
  @@ -574,12 +576,12 @@
574 576
575 577 public SelectAllCheckBox()
576 578 {
577 - addValueChangeHandler(new ValueChangeHandler<Boolean>()
579 + addValueChangeHandler( new ValueChangeHandler<Boolean>()
578 580 {
579 581 @Override
580 - public void onValueChange(ValueChangeEvent<Boolean> pEvent)
582 + public void onValueChange( ValueChangeEvent<Boolean> pEvent )
581 583 {
582 - if (pEvent.getValue())
584 + if ( pEvent.getValue() )
583 585 {
584 586 selectAll();
585 587 }
  @@ -588,28 +590,28 @@
588 590 deselectAll();
589 591 }
590 592 }
591 - });
593 + } );
592 594 update();
593 595 }
594 596
595 597 public void update()
596 598 {
597 599 int selectionCount = getSelectedValues().size();
598 - setValue(selectionCount > 0 && getSelectedValues().size() == getModel().getRowCount());
600 + setValue( selectionCount > 0 && getSelectedValues().size() == getModel().getRowCount() );
599 601 }
600 602
601 603 @Override
602 604 protected void onLoad()
603 605 {
604 606 super.onLoad();
605 - mSelectionHandlerRegistration = addSelectionHandler(new SelectionHandler<RowType>()
607 + mSelectionHandlerRegistration = addSelectionHandler( new SelectionHandler<RowType>()
606 608 {
607 609 @Override
608 - public void onSelection(SelectionEvent<RowType> pEvent)
610 + public void onSelection( SelectionEvent<RowType> pEvent )
609 611 {
610 612 update();
611 613 }
612 - });
614 + } );
613 615 }
614 616
615 617 @Override