Merge pull request #1329 from millmanorama/scroll_to_tile_infinite_loop_fix

use ui thread model for scrolling
This commit is contained in:
Richard Cordovano 2015-06-09 15:16:18 -04:00
commit a54a17eb75

View File

@ -85,7 +85,6 @@ import javafx.scene.paint.Color;
import javafx.util.Duration; import javafx.util.Duration;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import static org.apache.commons.lang3.StringUtils.defaultIfBlank;
import org.controlsfx.control.GridCell; import org.controlsfx.control.GridCell;
import org.controlsfx.control.GridView; import org.controlsfx.control.GridView;
import org.controlsfx.control.SegmentedButton; import org.controlsfx.control.SegmentedButton;
@ -499,13 +498,13 @@ public class GroupPane extends BorderPane implements GroupView {
setViewState(controller.viewState().get()); setViewState(controller.viewState().get());
} }
@ThreadConfined(type = ThreadType.UI) @ThreadConfined(type = ThreadType.JFX)
private void scrollToFileID(final Long newFileID) { private void scrollToFileID(final Long newFileID) {
if (newFileID == null) { if (newFileID == null) {
return; //scrolling to no file doesn't make sense, so abort. return; //scrolling to no file doesn't make sense, so abort.
} }
final ObservableList<Long> fileIds = getGrouping().fileIds(); final ObservableList<Long> fileIds = gridView.getItems();
int selectedIndex = fileIds.indexOf(newFileID); int selectedIndex = fileIds.indexOf(newFileID);
if (selectedIndex == -1) { if (selectedIndex == -1) {
//somehow we got passed a file id that isn't in the curent group. //somehow we got passed a file id that isn't in the curent group.