當前位置: 首頁>>代碼示例>>Java>>正文


Java RowSorter.rowsUpdated方法代碼示例

本文整理匯總了Java中javax.swing.RowSorter.rowsUpdated方法的典型用法代碼示例。如果您正苦於以下問題:Java RowSorter.rowsUpdated方法的具體用法?Java RowSorter.rowsUpdated怎麽用?Java RowSorter.rowsUpdated使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.RowSorter的用法示例。


在下文中一共展示了RowSorter.rowsUpdated方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: treeColumnChanged

import javax.swing.RowSorter; //導入方法依賴的package包/類
@Override
public void treeColumnChanged(TreeColumnModelEvent e) {
    TreePath path = e.getTreePath();
    if (rowSorter != null) {
        RowSorter<?> sorter = path.getParentPath() != null ? rowSorter.getRowSorter(path.getParentPath().getLastPathComponent()): null;
        if (sorter != null && path.getParentPath() != null) {
            boolean isc = ignoreSortedChange;
            ignoreSortedChange = true;
            try {
                Object parent = path.getParentPath().getLastPathComponent();
                Object node = path.getLastPathComponent();
                int modelRow = treeModel.getIndexOfChild(parent, node);
                int viewRow = sorter.convertRowIndexToView(modelRow);
                sorter.rowsUpdated(modelRow, modelRow);
                if (sorter.convertRowIndexToView(modelRow) != viewRow) {
                    if (isExpanded(path)) {
                        updatePath(path, expandedDescendants(path));
                    } else {
                        fireTreeStructureChanged(path);
                    }
                    return;
                }
            } finally {
                ignoreSortedChange = isc;
            }
        }
    }

    int row = getRowForPath(path);
    if (row < 0)
        return;
    if (e.getColumn() == TreeColumnModelEvent.ALL_COLUMNS) {
        fireTableRowsUpdated(row, row);
    } else {
        fireTableCellUpdated(row, e.getColumn());
    }
    if (getRowHeight() <= 0) {
        invalidatePath(e.getTreePath());
        updateTableRowHeights(row, row+1);
    }
}
 
開發者ID:Sciss,項目名稱:TreeTable,代碼行數:42,代碼來源:TreeTable.java

示例2: processTreeNodesChanged

import javax.swing.RowSorter; //導入方法依賴的package包/類
private void processTreeNodesChanged(TreePath path, int[] childIndices, Object[] childNodes) {
    if (rowSorter != null) {
        RowSorter<?> sorter = rowSorter.getRowSorter(path.getLastPathComponent());
        if (sorter != null) {
            boolean isc = ignoreSortedChange;
            ignoreSortedChange = true;
            try {
                if (childIndices.length == 1) {
                    int row = childIndices[0];
                    int viewRow = sorter.convertRowIndexToView(row);
                    sorter.rowsUpdated(row, row);
                    childIndices[0] = sorter.convertRowIndexToView(row);
                    if (childIndices[0] == viewRow) {
                        if (viewRow >= 0)
                            fireTreeNodesChanged(path, childIndices, childNodes);
                        return;
                    }
                } else {
                    SorterHelper help = new SorterHelper(sorter, childIndices, childNodes);
                    int[] viewIndices = null;
                    Object[] viewNodes = null;
                    if (help.computeView()) {
                        viewIndices = help.viewIndices;
                        viewNodes = help.viewNodes;
                    }
                    sorter.rowsUpdated(childIndices[0], childIndices[childIndices.length-1]);
                    if (help.computeView()) {
                        if (Arrays.equals(viewIndices, help.viewIndices)
                                && Arrays.equals(viewNodes, help.viewNodes)) {
                            fireTreeNodesChanged(path, viewIndices, viewNodes);
                            return;
                        }
                    } else if (viewIndices == null) {
                        return;
                    }
                }
            } finally {
                ignoreSortedChange = isc;
            }
            updatePath(path, expandedDescendants(path));
            return;
        }
    }
    fireTreeNodesChanged(path, childIndices, childNodes);
}
 
開發者ID:Sciss,項目名稱:TreeTable,代碼行數:46,代碼來源:TreeTable.java


注:本文中的javax.swing.RowSorter.rowsUpdated方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。