List of usage examples for com.google.gwt.dom.client TableRowElement scrollIntoView
@Override
public void scrollIntoView()
From source file:com.gafactory.core.client.ui.grids.BaseListGrid.java
License:Open Source License
public void scrollToSelected() { Scheduler.get().scheduleDeferred(new Command() { @Override//from w ww. j av a 2s . c o m public void execute() { int visibleSelectedIndex = getVisibleSelectedIndex(); if (visibleSelectedIndex != -1) { TableRowElement rowElement = dataGrid.getRowElement(visibleSelectedIndex); rowElement.scrollIntoView(); rowElement.focus(); } dataGrid.setFocus(true); } }); }
From source file:org.rstudio.core.client.files.filedialog.DirectoryContentsWidget.java
License:Open Source License
public void setSelectedRow(Integer row) { if (selectedRow_ != null) { table_.getRowFormatter().removeStyleName(selectedRow_.intValue(), "gwt-MenuItem-selected"); selectedRow_ = null;/*w w w . j a v a2 s . c o m*/ selectedValue_ = null; } if (row != null && row.intValue() >= 0 && row.intValue() < table_.getRowCount()) { selectedRow_ = row.intValue(); table_.getRowFormatter().addStyleName(selectedRow_, "gwt-MenuItem-selected"); selectedValue_ = table_.getText(row.intValue(), COL_NAME); TableRowElement rowEl = ((TableElement) table_.getElement().cast()).getRows().getItem(selectedRow_); int horizScroll = scrollPanel_.getHorizontalScrollPosition(); rowEl.scrollIntoView(); scrollPanel_.setHorizontalScrollPosition(horizScroll); } SelectionEvent.fire(DirectoryContentsWidget.this, getSelectedItem()); }
From source file:org.rstudio.core.client.files.filedialog.DirectoryContentsWidget.java
License:Open Source License
public void addDirectory(FileSystemItem directory) { int rowNum = addItem(directory, null, null); TableElement table = (TableElement) table_.getElement().cast(); TableRowElement row = table.getRows().getItem(rowNum); row.scrollIntoView(); scrollPanel_.setHorizontalScrollPosition(0); setSelectedRow(rowNum);// w w w. jav a 2 s. com }