Search in sources :

Example 1 with TableRowSWTChildController

use of com.biglybt.ui.swt.views.table.TableRowSWTChildController 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)

Aggregations

TableRowCore (com.biglybt.ui.common.table.TableRowCore)1 TableRowSWTChildController (com.biglybt.ui.swt.views.table.TableRowSWTChildController)1