Search in sources :

Example 16 with TableCellCore

use of com.biglybt.ui.common.table.TableCellCore in project BiglyBT by BiglySoftware.

the class FileHashItemBase method cellMouseTrigger.

@Override
public void cellMouseTrigger(TableCellMouseEvent event) {
    DiskManagerFileInfo file = (DiskManagerFileInfo) event.cell.getDataSource();
    if (file == null) {
        return;
    }
    TableCellCore core_cell = (TableCellCore) event.cell;
    if (!event.cell.getText().startsWith("<")) {
        core_cell.setCursorID(SWT.CURSOR_ARROW);
        core_cell.setToolTip(null);
        return;
    }
    if (event.eventType == TableRowMouseEvent.EVENT_MOUSEENTER) {
        core_cell.setCursorID(SWT.CURSOR_HAND);
        core_cell.setToolTip(MessageText.getString("FilesView.click.info"));
    } else if (event.eventType == TableRowMouseEvent.EVENT_MOUSEEXIT) {
        core_cell.setCursorID(SWT.CURSOR_ARROW);
        core_cell.setToolTip(null);
    }
    if (event.eventType != TableCellMouseEvent.EVENT_MOUSEUP) {
        return;
    }
    if (event.button != 1) {
        return;
    }
    event.skipCoreFunctionality = true;
    updateHash(hash_type, file);
}
Also used : DiskManagerFileInfo(com.biglybt.core.disk.DiskManagerFileInfo) TableCellCore(com.biglybt.ui.common.table.TableCellCore)

Example 17 with TableCellCore

use of com.biglybt.ui.common.table.TableCellCore in project BiglyBT by BiglySoftware.

the class NameItem method cellMouseTrigger.

@Override
public void cellMouseTrigger(TableCellMouseEvent event) {
    if (event.eventType == TableCellMouseEvent.EVENT_MOUSEMOVE || event.eventType == TableRowMouseEvent.EVENT_MOUSEDOWN) {
        TableRow row = event.cell.getTableRow();
        if (row == null) {
            return;
        }
        boolean inArea = false;
        Object data = row.getData(ID_EXPANDOHITAREA);
        if (data instanceof Rectangle) {
            Rectangle hitArea = (Rectangle) data;
            boolean inExpando = hitArea.contains(event.x, event.y);
            if (inExpando) {
                inArea = true;
                if (event.eventType == TableCellMouseEvent.EVENT_MOUSEDOWN) {
                    if (row instanceof TableRowCore) {
                        TableRowCore rowCore = (TableRowCore) row;
                        rowCore.setExpanded(!rowCore.isExpanded());
                    }
                }
            }
        }
        data = row.getData(ID_CHECKHITAREA);
        if (data instanceof Rectangle) {
            Rectangle hitArea = (Rectangle) data;
            boolean inCheck = hitArea.contains(event.x, event.y);
            if (inCheck) {
                inArea = true;
                if (event.eventType == TableCellMouseEvent.EVENT_MOUSEDOWN) {
                    if (row instanceof TableRowCore) {
                        TableRowCore rowCore = (TableRowCore) row;
                        if (rowCore != null) {
                            final DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) event.cell.getDataSource();
                            if (fileInfo instanceof FilesView.FilesViewTreeNode) {
                                FilesView.FilesViewTreeNode node = (FilesView.FilesViewTreeNode) fileInfo;
                                if (!node.isLeaf()) {
                                    int old_skipped = node.getSkippedState();
                                    boolean new_skipped;
                                    if (old_skipped == 0) {
                                        new_skipped = false;
                                    } else if (old_skipped == 1) {
                                        new_skipped = true;
                                    } else {
                                        new_skipped = true;
                                    }
                                    node.setSkipped(new_skipped);
                                    return;
                                }
                            }
                            fileInfo.setSkipped(!fileInfo.isSkipped());
                        }
                    }
                }
            }
        }
        if (event.eventType == TableCellMouseEvent.EVENT_MOUSEMOVE) {
            ((TableCellCore) event.cell).setCursorID(inArea ? SWT.CURSOR_HAND : SWT.CURSOR_ARROW);
        }
    }
}
Also used : TableRowCore(com.biglybt.ui.common.table.TableRowCore) DiskManagerFileInfo(com.biglybt.core.disk.DiskManagerFileInfo) FilesView(com.biglybt.ui.swt.views.FilesView) Rectangle(org.eclipse.swt.graphics.Rectangle) TableCellCore(com.biglybt.ui.common.table.TableCellCore) Point(org.eclipse.swt.graphics.Point)

Example 18 with TableCellCore

use of com.biglybt.ui.common.table.TableCellCore in project BiglyBT by BiglySoftware.

the class TableRowSWTBase method setShown.

/* (non-Javadoc)
	 * @see com.biglybt.ui.swt.views.table.TableRowSWT#setShown(boolean, boolean)
	 */
@Override
public boolean setShown(boolean b, boolean force) {
    if (bDisposed) {
        return false;
    }
    if (b == wasShown && !force) {
        return false;
    }
    wasShown = b;
    Collection<TableCellCore> lTableCells = null;
    synchronized (lock) {
        if (mTableCells != null) {
            lTableCells = new ArrayList<>(mTableCells.values());
        }
    }
    if (lTableCells != null) {
        for (TableCellCore cell : lTableCells) {
            if (cell != null) {
                cell.invokeVisibilityListeners(b ? TableCellVisibilityListener.VISIBILITY_SHOWN : TableCellVisibilityListener.VISIBILITY_HIDDEN, true);
            }
        }
    }
    return true;
/* Don't need to refresh; paintItem will trigger a refresh on
		 * !cell.isUpToDate()
		 *
		if (b) {
			refresh(b, true);
		}
		/**/
}
Also used : TableCellCore(com.biglybt.ui.common.table.TableCellCore)

Aggregations

TableCellCore (com.biglybt.ui.common.table.TableCellCore)18 TableRowCore (com.biglybt.ui.common.table.TableRowCore)6 Rectangle (org.eclipse.swt.graphics.Rectangle)4 TableColumnCore (com.biglybt.ui.common.table.TableColumnCore)3 Point (org.eclipse.swt.graphics.Point)3 DiskManagerFileInfo (com.biglybt.core.disk.DiskManagerFileInfo)2 DownloadManager (com.biglybt.core.download.DownloadManager)2 TableColumn (com.biglybt.pif.ui.tables.TableColumn)2 FilesView (com.biglybt.ui.swt.views.FilesView)2 DownloadManagerState (com.biglybt.core.download.DownloadManagerState)1 TOTorrent (com.biglybt.core.torrent.TOTorrent)1 MenuItem (com.biglybt.pif.ui.menus.MenuItem)1 TableCell (com.biglybt.pif.ui.tables.TableCell)1 TableSelectedRowsListener (com.biglybt.ui.swt.views.table.TableSelectedRowsListener)1 TableCellSWTBase (com.biglybt.ui.swt.views.table.impl.TableCellSWTBase)1 File (java.io.File)1 CLabel (org.eclipse.swt.custom.CLabel)1 Clipboard (org.eclipse.swt.dnd.Clipboard)1 TextTransfer (org.eclipse.swt.dnd.TextTransfer)1 Transfer (org.eclipse.swt.dnd.Transfer)1