Search in sources :

Example 1 with RecordReaderTransferable

use of com.revolsys.swing.dnd.transferable.RecordReaderTransferable in project com.revolsys.open by revolsys.

the class AbstractRecordLayer method copyRecordsToClipboard.

public void copyRecordsToClipboard(final List<LayerRecord> records) {
    if (!records.isEmpty()) {
        final RecordDefinition recordDefinition = getRecordDefinition();
        final List<Record> copies = new ArrayList<>();
        for (final LayerRecord record : records) {
            final ArrayRecord recordCopy = new ArrayRecord(recordDefinition, record);
            copies.add(recordCopy);
        }
        final RecordReader reader = new ListRecordReader(recordDefinition, copies);
        final RecordReaderTransferable transferable = new RecordReaderTransferable(reader);
        ClipboardUtil.setContents(transferable);
    }
}
Also used : ListRecordReader(com.revolsys.record.io.ListRecordReader) RecordReaderTransferable(com.revolsys.swing.dnd.transferable.RecordReaderTransferable) ArrayRecord(com.revolsys.record.ArrayRecord) RecordReader(com.revolsys.record.io.RecordReader) ListRecordReader(com.revolsys.record.io.ListRecordReader) ArrayList(java.util.ArrayList) ArrayRecord(com.revolsys.record.ArrayRecord) Record(com.revolsys.record.Record) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Aggregations

ArrayRecord (com.revolsys.record.ArrayRecord)1 Record (com.revolsys.record.Record)1 ListRecordReader (com.revolsys.record.io.ListRecordReader)1 RecordReader (com.revolsys.record.io.RecordReader)1 RecordDefinition (com.revolsys.record.schema.RecordDefinition)1 RecordReaderTransferable (com.revolsys.swing.dnd.transferable.RecordReaderTransferable)1 ArrayList (java.util.ArrayList)1