Search in sources :

Example 1 with TextTransferObject

use of org.eclipse.scout.rt.client.ui.dnd.TextTransferObject in project scout.rt by eclipse.

the class AbstractTable method execCopy.

/**
 * Called by a <code>CTRL-C</code> event on the table to copy the given rows into the clipboard.
 * <p>
 * Subclasses can override this method. The default creates a {@link TextTransferObject} of the table content (HTML
 * table).
 *
 * @param rows
 *          The selected table rows to copy.
 * @return A transferable object representing the given rows or null to not populate the clipboard.
 */
@ConfigOperation
@Order(30)
protected TransferObject execCopy(List<? extends ITableRow> rows) {
    if (!CollectionUtility.hasElements(rows)) {
        return null;
    }
    StringBuilder plainText = new StringBuilder();
    List<IColumn<?>> columns = getColumnSet().getVisibleColumns();
    boolean firstRow = true;
    for (ITableRow row : rows) {
        appendCopyTextForRow(plainText, row, firstRow, columns);
        firstRow = false;
    }
    TextTransferObject transferObject = new TextTransferObject(plainText.toString());
    return transferObject;
}
Also used : TextTransferObject(org.eclipse.scout.rt.client.ui.dnd.TextTransferObject) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) Order(org.eclipse.scout.rt.platform.Order) ConfigOperation(org.eclipse.scout.rt.platform.annotations.ConfigOperation)

Aggregations

IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)1 TextTransferObject (org.eclipse.scout.rt.client.ui.dnd.TextTransferObject)1 Order (org.eclipse.scout.rt.platform.Order)1 ConfigOperation (org.eclipse.scout.rt.platform.annotations.ConfigOperation)1