Search in sources :

Example 1 with RowMover

use of com.ramussoft.database.common.RowMover in project ramus by Vitaliy-Yakovchuk.

the class RowTreeTable method importData.

@SuppressWarnings("unchecked")
public boolean importData(final Transferable t, final boolean on, final int index) {
    if (index < 0)
        return false;
    if (canImport(t.getTransferDataFlavors())) {
        try {
            final ArrayList<Integer> list = (ArrayList<Integer>) t.getTransferData(localListFlavor);
            final int[] sels = new int[list.size()];
            for (int i = 0; i < sels.length; i++) sels[i] = list.get(i);
            final RowMover mover = getRowMover(sels);
            try {
                if (on)
                    mover.on(index);
                else
                    mover.insert(index);
            } catch (final Exception e) {
                e.printStackTrace();
            }
            return true;
        } catch (final UnsupportedFlavorException e) {
            e.printStackTrace();
        } catch (final IOException e) {
            e.printStackTrace();
        }
    }
    return false;
}
Also used : RowMover(com.ramussoft.database.common.RowMover) ArrayList(java.util.ArrayList) IOException(java.io.IOException) UnsupportedFlavorException(java.awt.datatransfer.UnsupportedFlavorException) UnsupportedFlavorException(java.awt.datatransfer.UnsupportedFlavorException) IOException(java.io.IOException)

Example 2 with RowMover

use of com.ramussoft.database.common.RowMover in project ramus by Vitaliy-Yakovchuk.

the class RowTreeTable method getRowMover.

private RowMover getRowMover(final int[] sels) {
    final Row[] group = getShownRows();
    final RowMover mover = new RowMover(rowSet.getRoot(), group, sels, accessRules, rowSet);
    return mover;
}
Also used : RowMover(com.ramussoft.database.common.RowMover) Row(com.ramussoft.database.common.Row)

Aggregations

RowMover (com.ramussoft.database.common.RowMover)2 Row (com.ramussoft.database.common.Row)1 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1