Example usage for javafx.collections ObservableList toArray

List of usage examples for javafx.collections ObservableList toArray

Introduction

In this page you can find the example usage for javafx.collections ObservableList toArray.

Prototype

<T> T[] toArray(T[] a);

Source Link

Document

Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.

Usage

From source file:org.eclipse.jubula.rc.javafx.tester.adapter.ListViewAdapter.java

/** {@inheritDoc} **/
public int[] getSelectedIndices() {
    return EventThreadQueuerJavaFXImpl.invokeAndWait("getSelectedIndices", //$NON-NLS-1$
            new Callable<int[]>() {
                /** {@inheritDoc} **/
                public int[] call() throws Exception {
                    ObservableList<Integer> sIndices = getRealComponent().getSelectionModel()
                            .getSelectedIndices();
                    return ArrayUtils.toPrimitive(sIndices.toArray(new Integer[0]));
                }/*from   w ww . j  a  va2  s  . co m*/
            });
}

From source file:org.pdfsam.ui.selection.multiple.SelectionTable.java

@EventListener
public void onMoveSelected(final MoveSelectedEvent event) {
    getSortOrder().clear();//from  ww w.  j  a  v a2 s .c o m
    ObservableList<Integer> selectedIndices = getSelectionModel().getSelectedIndices();
    Integer[] selected = selectedIndices.toArray(new Integer[selectedIndices.size()]);
    int focus = getFocusModel().getFocusedIndex();
    getSelectionModel().clearSelection();
    SelectionAndFocus newSelection = event.getType().move(selected, getItems(), focus);
    if (!SelectionAndFocus.NULL.equals(newSelection)) {
        LOG.trace("Changing selection to {}", newSelection);
        getSelectionModel().selectIndices(newSelection.getRow(), newSelection.getRows());
        getFocusModel().focus(newSelection.getFocus());
        scrollTo(newSelection.getFocus());
    }
}