Search in sources :

Example 1 with TableRowCore

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

the class TableCellPainted method getDataSource.

/* (non-Javadoc)
	 * @see com.biglybt.pif.ui.tables.TableCell#getDataSource()
	 */
@Override
public Object getDataSource() {
    // remove this because if a disposal-listener needs to get its hands on teh datasource to clean up
    // properly we need to return it to them! (happens with the peers view PiecesItem for example)
    // if (isDisposed()) {
    // return null;
    // }
    TableRowCore row = tableRow;
    TableColumnCore col = tableColumn;
    if (row == null || col == null) {
        return (null);
    }
    return row.getDataSource(col.getUseCoreDataSource());
}
Also used : TableRowCore(com.biglybt.ui.common.table.TableRowCore) TableColumnCore(com.biglybt.ui.common.table.TableColumnCore)

Example 2 with TableRowCore

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

the class TableRowPainted method setExpanded.

private void setExpanded(boolean b, boolean triggerHeightChange) {
    if (canExpand()) {
        int oldHeight = getFullHeight();
        super.setExpanded(b);
        synchronized (subRows_sync) {
            TableRowPainted[] newSubRows = null;
            if (b && (subRows == null || subRows.length != numSubItems) && subDataSources != null && subDataSources.length == numSubItems) {
                if (DEBUG_SUBS) {
                    debug("building subrows " + numSubItems);
                }
                deleteExistingSubRows();
                newSubRows = new TableRowPainted[numSubItems];
                TableViewPainted tv = getViewPainted();
                int h = 0;
                for (int i = 0; i < newSubRows.length; i++) {
                    newSubRows[i] = new TableRowPainted(this, tv, subDataSources[i], false);
                    newSubRows[i].setTableItem(i, false);
                    h += newSubRows[i].getFullHeight();
                }
                setSubRowsHeight(h);
                subRows = newSubRows;
            }
            int newHeight = getFullHeight();
            TableRowCore row = getParentRowCore();
            if (row instanceof TableRowPainted) {
                ((TableRowPainted) row).subRowHeightChanged(oldHeight, newHeight);
            }
            if (triggerHeightChange) {
                getViewPainted().rowHeightChanged(this, oldHeight, newHeight);
            }
            if (newSubRows != null) {
                getViewPainted().triggerListenerRowAdded(newSubRows);
            }
        }
        Object ds = getDataSource(true);
        if (ds instanceof TableRowSWTChildController) {
            ((TableRowSWTChildController) ds).setExpanded(b);
        }
        TableViewPainted tvp = getViewPainted();
        if (triggerHeightChange) {
            tvp.tableMutated();
        }
        if (isVisible()) {
            tvp.visibleRowsChanged();
            tvp.redrawTable();
        }
    }
}
Also used : TableRowCore(com.biglybt.ui.common.table.TableRowCore) TableRowSWTChildController(com.biglybt.ui.swt.views.table.TableRowSWTChildController)

Example 3 with TableRowCore

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

the class TableRowPainted method subRowHeightChanged.

protected void subRowHeightChanged(int oldHeight, int newHeight) {
    int old = subRowsHeightUseAccessors;
    subRowsHeightUseAccessors += (newHeight - oldHeight);
    if (old != subRowsHeightUseAccessors && isExpanded()) {
        TableRowCore row = getParentRowCore();
        if (row instanceof TableRowPainted) {
            ((TableRowPainted) row).subRowHeightChanged(old, subRowsHeightUseAccessors);
        }
    }
}
Also used : TableRowCore(com.biglybt.ui.common.table.TableRowCore)

Example 4 with TableRowCore

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

the class TableRowPainted method setSubItemCount.

private void setSubItemCount(int length, boolean triggerHeightListener) {
    numSubItems = length;
    if (isExpanded() && subDataSources.length == length) {
        if (DEBUG_SUBS) {
            debug("setSubItemCount to " + length);
        }
        deleteExistingSubRows();
        TableRowPainted[] newSubRows = new TableRowPainted[length];
        TableViewPainted tv = getViewPainted();
        int h = 0;
        for (int i = 0; i < newSubRows.length; i++) {
            newSubRows[i] = new TableRowPainted(this, tv, subDataSources[i], false);
            newSubRows[i].setTableItem(i, false);
            h += newSubRows[i].getFullHeight();
        }
        int oldHeight = getFullHeight();
        setSubRowsHeight(h);
        int newHeight = getFullHeight();
        TableRowCore row = getParentRowCore();
        if (row instanceof TableRowPainted) {
            ((TableRowPainted) row).subRowHeightChanged(oldHeight, newHeight);
        }
        TableViewPainted tvp = getViewPainted();
        if (triggerHeightListener) {
            tvp.rowHeightChanged(this, oldHeight, newHeight);
        }
        tvp.triggerListenerRowAdded(newSubRows);
        subRows = newSubRows;
    }
}
Also used : TableRowCore(com.biglybt.ui.common.table.TableRowCore)

Example 5 with TableRowCore

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

the class TableRowPainted method setHeight.

/* (non-Javadoc)
	 * @see TableRowCore#setHeight(int)
	 */
@Override
public boolean setHeight(int newHeight) {
    TableRowCore parentRowCore = getParentRowCore();
    boolean trigger = parentRowCore == null || parentRowCore.isExpanded();
    return setHeight(newHeight, trigger);
}
Also used : TableRowCore(com.biglybt.ui.common.table.TableRowCore)

Aggregations

TableRowCore (com.biglybt.ui.common.table.TableRowCore)29 DiskManagerFileInfo (com.biglybt.core.disk.DiskManagerFileInfo)7 DownloadManager (com.biglybt.core.download.DownloadManager)6 TableCellCore (com.biglybt.ui.common.table.TableCellCore)6 Point (org.eclipse.swt.graphics.Point)6 Rectangle (org.eclipse.swt.graphics.Rectangle)6 TableColumnCore (com.biglybt.ui.common.table.TableColumnCore)4 TableColumnCreationListener (com.biglybt.pif.ui.tables.TableColumnCreationListener)3 FilesView (com.biglybt.ui.swt.views.FilesView)3 List (java.util.List)3 CoreRunningListener (com.biglybt.core.CoreRunningListener)2 PEPeerTransport (com.biglybt.core.peer.impl.PEPeerTransport)2 PeerItem (com.biglybt.core.peermanager.peerdb.PeerItem)2 TOTorrent (com.biglybt.core.torrent.TOTorrent)2 MenuItem (com.biglybt.pif.ui.menus.MenuItem)2 TableColumn (com.biglybt.pif.ui.tables.TableColumn)2 TableSelectionListener (com.biglybt.ui.common.table.TableSelectionListener)2 TableColumnManager (com.biglybt.ui.common.table.impl.TableColumnManager)2 Color (org.eclipse.swt.graphics.Color)2 Image (org.eclipse.swt.graphics.Image)2