javax.swing.DefaultListSelectionModel#getMinSelectionIndex ( )源码实例Demo

下面列出了javax.swing.DefaultListSelectionModel#getMinSelectionIndex ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk8u_jdk   文件: DefaultTreeSelectionModel.java
/**
 * Makes sure the currently selected <code>TreePath</code>s are valid
 * for the current selection mode.
 * If the selection mode is <code>CONTIGUOUS_TREE_SELECTION</code>
 * and a <code>RowMapper</code> exists, this will make sure all
 * the rows are contiguous, that is, when sorted all the rows are
 * in order with no gaps.
 * If the selection isn't contiguous, the selection is
 * reset to contain the first set, when sorted, of contiguous rows.
 * <p>
 * If the selection mode is <code>SINGLE_TREE_SELECTION</code> and
 * more than one TreePath is selected, the selection is reset to
 * contain the first path currently selected.
 */
protected void insureRowContinuity() {
    if(selectionMode == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION &&
       selection != null && rowMapper != null) {
        DefaultListSelectionModel lModel = listSelectionModel;
        int                       min = lModel.getMinSelectionIndex();

        if(min != -1) {
            for(int counter = min,
                    maxCounter = lModel.getMaxSelectionIndex();
                    counter <= maxCounter; counter++) {
                if(!lModel.isSelectedIndex(counter)) {
                    if(counter == min) {
                        clearSelection();
                    }
                    else {
                        TreePath[] newSel = new TreePath[counter - min];
                        int selectionIndex[] = rowMapper.getRowsForPaths(selection);
                        // find the actual selection pathes corresponded to the
                        // rows of the new selection
                        for (int i = 0; i < selectionIndex.length; i++) {
                            if (selectionIndex[i]<counter) {
                                newSel[selectionIndex[i]-min] = selection[i];
                            }
                        }
                        setSelectionPaths(newSel);
                        break;
                    }
                }
            }
        }
    }
    else if(selectionMode == TreeSelectionModel.SINGLE_TREE_SELECTION &&
            selection != null && selection.length > 1) {
        setSelectionPath(selection[0]);
    }
}
 
源代码2 项目: hottub   文件: DefaultTreeSelectionModel.java
/**
 * Makes sure the currently selected <code>TreePath</code>s are valid
 * for the current selection mode.
 * If the selection mode is <code>CONTIGUOUS_TREE_SELECTION</code>
 * and a <code>RowMapper</code> exists, this will make sure all
 * the rows are contiguous, that is, when sorted all the rows are
 * in order with no gaps.
 * If the selection isn't contiguous, the selection is
 * reset to contain the first set, when sorted, of contiguous rows.
 * <p>
 * If the selection mode is <code>SINGLE_TREE_SELECTION</code> and
 * more than one TreePath is selected, the selection is reset to
 * contain the first path currently selected.
 */
protected void insureRowContinuity() {
    if(selectionMode == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION &&
       selection != null && rowMapper != null) {
        DefaultListSelectionModel lModel = listSelectionModel;
        int                       min = lModel.getMinSelectionIndex();

        if(min != -1) {
            for(int counter = min,
                    maxCounter = lModel.getMaxSelectionIndex();
                    counter <= maxCounter; counter++) {
                if(!lModel.isSelectedIndex(counter)) {
                    if(counter == min) {
                        clearSelection();
                    }
                    else {
                        TreePath[] newSel = new TreePath[counter - min];
                        int selectionIndex[] = rowMapper.getRowsForPaths(selection);
                        // find the actual selection pathes corresponded to the
                        // rows of the new selection
                        for (int i = 0; i < selectionIndex.length; i++) {
                            if (selectionIndex[i]<counter) {
                                newSel[selectionIndex[i]-min] = selection[i];
                            }
                        }
                        setSelectionPaths(newSel);
                        break;
                    }
                }
            }
        }
    }
    else if(selectionMode == TreeSelectionModel.SINGLE_TREE_SELECTION &&
            selection != null && selection.length > 1) {
        setSelectionPath(selection[0]);
    }
}
 
源代码3 项目: TencentKona-8   文件: DefaultTreeSelectionModel.java
/**
 * Makes sure the currently selected <code>TreePath</code>s are valid
 * for the current selection mode.
 * If the selection mode is <code>CONTIGUOUS_TREE_SELECTION</code>
 * and a <code>RowMapper</code> exists, this will make sure all
 * the rows are contiguous, that is, when sorted all the rows are
 * in order with no gaps.
 * If the selection isn't contiguous, the selection is
 * reset to contain the first set, when sorted, of contiguous rows.
 * <p>
 * If the selection mode is <code>SINGLE_TREE_SELECTION</code> and
 * more than one TreePath is selected, the selection is reset to
 * contain the first path currently selected.
 */
protected void insureRowContinuity() {
    if(selectionMode == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION &&
       selection != null && rowMapper != null) {
        DefaultListSelectionModel lModel = listSelectionModel;
        int                       min = lModel.getMinSelectionIndex();

        if(min != -1) {
            for(int counter = min,
                    maxCounter = lModel.getMaxSelectionIndex();
                    counter <= maxCounter; counter++) {
                if(!lModel.isSelectedIndex(counter)) {
                    if(counter == min) {
                        clearSelection();
                    }
                    else {
                        TreePath[] newSel = new TreePath[counter - min];
                        int selectionIndex[] = rowMapper.getRowsForPaths(selection);
                        // find the actual selection pathes corresponded to the
                        // rows of the new selection
                        for (int i = 0; i < selectionIndex.length; i++) {
                            if (selectionIndex[i]<counter) {
                                newSel[selectionIndex[i]-min] = selection[i];
                            }
                        }
                        setSelectionPaths(newSel);
                        break;
                    }
                }
            }
        }
    }
    else if(selectionMode == TreeSelectionModel.SINGLE_TREE_SELECTION &&
            selection != null && selection.length > 1) {
        setSelectionPath(selection[0]);
    }
}
 
/**
 * Makes sure the currently selected <code>TreePath</code>s are valid
 * for the current selection mode.
 * If the selection mode is <code>CONTIGUOUS_TREE_SELECTION</code>
 * and a <code>RowMapper</code> exists, this will make sure all
 * the rows are contiguous, that is, when sorted all the rows are
 * in order with no gaps.
 * If the selection isn't contiguous, the selection is
 * reset to contain the first set, when sorted, of contiguous rows.
 * <p>
 * If the selection mode is <code>SINGLE_TREE_SELECTION</code> and
 * more than one TreePath is selected, the selection is reset to
 * contain the first path currently selected.
 */
protected void insureRowContinuity() {
    if(selectionMode == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION &&
       selection != null && rowMapper != null) {
        DefaultListSelectionModel lModel = listSelectionModel;
        int                       min = lModel.getMinSelectionIndex();

        if(min != -1) {
            for(int counter = min,
                    maxCounter = lModel.getMaxSelectionIndex();
                    counter <= maxCounter; counter++) {
                if(!lModel.isSelectedIndex(counter)) {
                    if(counter == min) {
                        clearSelection();
                    }
                    else {
                        TreePath[] newSel = new TreePath[counter - min];
                        int selectionIndex[] = rowMapper.getRowsForPaths(selection);
                        // find the actual selection pathes corresponded to the
                        // rows of the new selection
                        for (int i = 0; i < selectionIndex.length; i++) {
                            if (selectionIndex[i]<counter) {
                                newSel[selectionIndex[i]-min] = selection[i];
                            }
                        }
                        setSelectionPaths(newSel);
                        break;
                    }
                }
            }
        }
    }
    else if(selectionMode == TreeSelectionModel.SINGLE_TREE_SELECTION &&
            selection != null && selection.length > 1) {
        setSelectionPath(selection[0]);
    }
}
 
源代码5 项目: jdk8u-dev-jdk   文件: DefaultTreeSelectionModel.java
/**
 * Makes sure the currently selected <code>TreePath</code>s are valid
 * for the current selection mode.
 * If the selection mode is <code>CONTIGUOUS_TREE_SELECTION</code>
 * and a <code>RowMapper</code> exists, this will make sure all
 * the rows are contiguous, that is, when sorted all the rows are
 * in order with no gaps.
 * If the selection isn't contiguous, the selection is
 * reset to contain the first set, when sorted, of contiguous rows.
 * <p>
 * If the selection mode is <code>SINGLE_TREE_SELECTION</code> and
 * more than one TreePath is selected, the selection is reset to
 * contain the first path currently selected.
 */
protected void insureRowContinuity() {
    if(selectionMode == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION &&
       selection != null && rowMapper != null) {
        DefaultListSelectionModel lModel = listSelectionModel;
        int                       min = lModel.getMinSelectionIndex();

        if(min != -1) {
            for(int counter = min,
                    maxCounter = lModel.getMaxSelectionIndex();
                    counter <= maxCounter; counter++) {
                if(!lModel.isSelectedIndex(counter)) {
                    if(counter == min) {
                        clearSelection();
                    }
                    else {
                        TreePath[] newSel = new TreePath[counter - min];
                        int selectionIndex[] = rowMapper.getRowsForPaths(selection);
                        // find the actual selection pathes corresponded to the
                        // rows of the new selection
                        for (int i = 0; i < selectionIndex.length; i++) {
                            if (selectionIndex[i]<counter) {
                                newSel[selectionIndex[i]-min] = selection[i];
                            }
                        }
                        setSelectionPaths(newSel);
                        break;
                    }
                }
            }
        }
    }
    else if(selectionMode == TreeSelectionModel.SINGLE_TREE_SELECTION &&
            selection != null && selection.length > 1) {
        setSelectionPath(selection[0]);
    }
}
 
源代码6 项目: jdk8u-jdk   文件: DefaultTreeSelectionModel.java
/**
 * Makes sure the currently selected <code>TreePath</code>s are valid
 * for the current selection mode.
 * If the selection mode is <code>CONTIGUOUS_TREE_SELECTION</code>
 * and a <code>RowMapper</code> exists, this will make sure all
 * the rows are contiguous, that is, when sorted all the rows are
 * in order with no gaps.
 * If the selection isn't contiguous, the selection is
 * reset to contain the first set, when sorted, of contiguous rows.
 * <p>
 * If the selection mode is <code>SINGLE_TREE_SELECTION</code> and
 * more than one TreePath is selected, the selection is reset to
 * contain the first path currently selected.
 */
protected void insureRowContinuity() {
    if(selectionMode == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION &&
       selection != null && rowMapper != null) {
        DefaultListSelectionModel lModel = listSelectionModel;
        int                       min = lModel.getMinSelectionIndex();

        if(min != -1) {
            for(int counter = min,
                    maxCounter = lModel.getMaxSelectionIndex();
                    counter <= maxCounter; counter++) {
                if(!lModel.isSelectedIndex(counter)) {
                    if(counter == min) {
                        clearSelection();
                    }
                    else {
                        TreePath[] newSel = new TreePath[counter - min];
                        int selectionIndex[] = rowMapper.getRowsForPaths(selection);
                        // find the actual selection pathes corresponded to the
                        // rows of the new selection
                        for (int i = 0; i < selectionIndex.length; i++) {
                            if (selectionIndex[i]<counter) {
                                newSel[selectionIndex[i]-min] = selection[i];
                            }
                        }
                        setSelectionPaths(newSel);
                        break;
                    }
                }
            }
        }
    }
    else if(selectionMode == TreeSelectionModel.SINGLE_TREE_SELECTION &&
            selection != null && selection.length > 1) {
        setSelectionPath(selection[0]);
    }
}
 
源代码7 项目: Java8CN   文件: DefaultTreeSelectionModel.java
/**
 * Makes sure the currently selected <code>TreePath</code>s are valid
 * for the current selection mode.
 * If the selection mode is <code>CONTIGUOUS_TREE_SELECTION</code>
 * and a <code>RowMapper</code> exists, this will make sure all
 * the rows are contiguous, that is, when sorted all the rows are
 * in order with no gaps.
 * If the selection isn't contiguous, the selection is
 * reset to contain the first set, when sorted, of contiguous rows.
 * <p>
 * If the selection mode is <code>SINGLE_TREE_SELECTION</code> and
 * more than one TreePath is selected, the selection is reset to
 * contain the first path currently selected.
 */
protected void insureRowContinuity() {
    if(selectionMode == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION &&
       selection != null && rowMapper != null) {
        DefaultListSelectionModel lModel = listSelectionModel;
        int                       min = lModel.getMinSelectionIndex();

        if(min != -1) {
            for(int counter = min,
                    maxCounter = lModel.getMaxSelectionIndex();
                    counter <= maxCounter; counter++) {
                if(!lModel.isSelectedIndex(counter)) {
                    if(counter == min) {
                        clearSelection();
                    }
                    else {
                        TreePath[] newSel = new TreePath[counter - min];
                        int selectionIndex[] = rowMapper.getRowsForPaths(selection);
                        // find the actual selection pathes corresponded to the
                        // rows of the new selection
                        for (int i = 0; i < selectionIndex.length; i++) {
                            if (selectionIndex[i]<counter) {
                                newSel[selectionIndex[i]-min] = selection[i];
                            }
                        }
                        setSelectionPaths(newSel);
                        break;
                    }
                }
            }
        }
    }
    else if(selectionMode == TreeSelectionModel.SINGLE_TREE_SELECTION &&
            selection != null && selection.length > 1) {
        setSelectionPath(selection[0]);
    }
}
 
/**
 * Makes sure the currently selected <code>TreePath</code>s are valid
 * for the current selection mode.
 * If the selection mode is <code>CONTIGUOUS_TREE_SELECTION</code>
 * and a <code>RowMapper</code> exists, this will make sure all
 * the rows are contiguous, that is, when sorted all the rows are
 * in order with no gaps.
 * If the selection isn't contiguous, the selection is
 * reset to contain the first set, when sorted, of contiguous rows.
 * <p>
 * If the selection mode is <code>SINGLE_TREE_SELECTION</code> and
 * more than one TreePath is selected, the selection is reset to
 * contain the first path currently selected.
 */
protected void insureRowContinuity() {
    if(selectionMode == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION &&
       selection != null && rowMapper != null) {
        DefaultListSelectionModel lModel = listSelectionModel;
        int                       min = lModel.getMinSelectionIndex();

        if(min != -1) {
            for(int counter = min,
                    maxCounter = lModel.getMaxSelectionIndex();
                    counter <= maxCounter; counter++) {
                if(!lModel.isSelectedIndex(counter)) {
                    if(counter == min) {
                        clearSelection();
                    }
                    else {
                        TreePath[] newSel = new TreePath[counter - min];
                        int selectionIndex[] = rowMapper.getRowsForPaths(selection);
                        // find the actual selection pathes corresponded to the
                        // rows of the new selection
                        for (int i = 0; i < selectionIndex.length; i++) {
                            if (selectionIndex[i]<counter) {
                                newSel[selectionIndex[i]-min] = selection[i];
                            }
                        }
                        setSelectionPaths(newSel);
                        break;
                    }
                }
            }
        }
    }
    else if(selectionMode == TreeSelectionModel.SINGLE_TREE_SELECTION &&
            selection != null && selection.length > 1) {
        setSelectionPath(selection[0]);
    }
}
 
源代码9 项目: Bytecoder   文件: DefaultTreeSelectionModel.java
/**
 * Makes sure the currently selected <code>TreePath</code>s are valid
 * for the current selection mode.
 * If the selection mode is <code>CONTIGUOUS_TREE_SELECTION</code>
 * and a <code>RowMapper</code> exists, this will make sure all
 * the rows are contiguous, that is, when sorted all the rows are
 * in order with no gaps.
 * If the selection isn't contiguous, the selection is
 * reset to contain the first set, when sorted, of contiguous rows.
 * <p>
 * If the selection mode is <code>SINGLE_TREE_SELECTION</code> and
 * more than one TreePath is selected, the selection is reset to
 * contain the first path currently selected.
 */
protected void insureRowContinuity() {
    if(selectionMode == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION &&
       selection != null && rowMapper != null) {
        DefaultListSelectionModel lModel = listSelectionModel;
        int                       min = lModel.getMinSelectionIndex();

        if(min != -1) {
            for(int counter = min,
                    maxCounter = lModel.getMaxSelectionIndex();
                    counter <= maxCounter; counter++) {
                if(!lModel.isSelectedIndex(counter)) {
                    if(counter == min) {
                        clearSelection();
                    }
                    else {
                        TreePath[] newSel = new TreePath[counter - min];
                        int[] selectionIndex = rowMapper.getRowsForPaths(selection);
                        // find the actual selection pathes corresponded to the
                        // rows of the new selection
                        for (int i = 0; i < selectionIndex.length; i++) {
                            if (selectionIndex[i]<counter) {
                                newSel[selectionIndex[i]-min] = selection[i];
                            }
                        }
                        setSelectionPaths(newSel);
                        break;
                    }
                }
            }
        }
    }
    else if(selectionMode == TreeSelectionModel.SINGLE_TREE_SELECTION &&
            selection != null && selection.length > 1) {
        setSelectionPath(selection[0]);
    }
}
 
源代码10 项目: openjdk-8   文件: DefaultTreeSelectionModel.java
/**
 * Makes sure the currently selected <code>TreePath</code>s are valid
 * for the current selection mode.
 * If the selection mode is <code>CONTIGUOUS_TREE_SELECTION</code>
 * and a <code>RowMapper</code> exists, this will make sure all
 * the rows are contiguous, that is, when sorted all the rows are
 * in order with no gaps.
 * If the selection isn't contiguous, the selection is
 * reset to contain the first set, when sorted, of contiguous rows.
 * <p>
 * If the selection mode is <code>SINGLE_TREE_SELECTION</code> and
 * more than one TreePath is selected, the selection is reset to
 * contain the first path currently selected.
 */
protected void insureRowContinuity() {
    if(selectionMode == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION &&
       selection != null && rowMapper != null) {
        DefaultListSelectionModel lModel = listSelectionModel;
        int                       min = lModel.getMinSelectionIndex();

        if(min != -1) {
            for(int counter = min,
                    maxCounter = lModel.getMaxSelectionIndex();
                    counter <= maxCounter; counter++) {
                if(!lModel.isSelectedIndex(counter)) {
                    if(counter == min) {
                        clearSelection();
                    }
                    else {
                        TreePath[] newSel = new TreePath[counter - min];
                        int selectionIndex[] = rowMapper.getRowsForPaths(selection);
                        // find the actual selection pathes corresponded to the
                        // rows of the new selection
                        for (int i = 0; i < selectionIndex.length; i++) {
                            if (selectionIndex[i]<counter) {
                                newSel[selectionIndex[i]-min] = selection[i];
                            }
                        }
                        setSelectionPaths(newSel);
                        break;
                    }
                }
            }
        }
    }
    else if(selectionMode == TreeSelectionModel.SINGLE_TREE_SELECTION &&
            selection != null && selection.length > 1) {
        setSelectionPath(selection[0]);
    }
}
 
源代码11 项目: jdk8u-jdk   文件: DefaultTreeSelectionModel.java
/**
 * Makes sure the currently selected <code>TreePath</code>s are valid
 * for the current selection mode.
 * If the selection mode is <code>CONTIGUOUS_TREE_SELECTION</code>
 * and a <code>RowMapper</code> exists, this will make sure all
 * the rows are contiguous, that is, when sorted all the rows are
 * in order with no gaps.
 * If the selection isn't contiguous, the selection is
 * reset to contain the first set, when sorted, of contiguous rows.
 * <p>
 * If the selection mode is <code>SINGLE_TREE_SELECTION</code> and
 * more than one TreePath is selected, the selection is reset to
 * contain the first path currently selected.
 */
protected void insureRowContinuity() {
    if(selectionMode == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION &&
       selection != null && rowMapper != null) {
        DefaultListSelectionModel lModel = listSelectionModel;
        int                       min = lModel.getMinSelectionIndex();

        if(min != -1) {
            for(int counter = min,
                    maxCounter = lModel.getMaxSelectionIndex();
                    counter <= maxCounter; counter++) {
                if(!lModel.isSelectedIndex(counter)) {
                    if(counter == min) {
                        clearSelection();
                    }
                    else {
                        TreePath[] newSel = new TreePath[counter - min];
                        int selectionIndex[] = rowMapper.getRowsForPaths(selection);
                        // find the actual selection pathes corresponded to the
                        // rows of the new selection
                        for (int i = 0; i < selectionIndex.length; i++) {
                            if (selectionIndex[i]<counter) {
                                newSel[selectionIndex[i]-min] = selection[i];
                            }
                        }
                        setSelectionPaths(newSel);
                        break;
                    }
                }
            }
        }
    }
    else if(selectionMode == TreeSelectionModel.SINGLE_TREE_SELECTION &&
            selection != null && selection.length > 1) {
        setSelectionPath(selection[0]);
    }
}
 
源代码12 项目: hottub   文件: DefaultTreeSelectionModel.java
/**
 * Used to test if a particular set of <code>TreePath</code>s can
 * be added. This will return true if <code>paths</code> is null (or
 * empty), or this object has no RowMapper, or nothing is currently selected,
 * or the selection mode is <code>DISCONTIGUOUS_TREE_SELECTION</code>, or
 * adding the paths to the current selection still results in a
 * contiguous set of <code>TreePath</code>s.
 */
protected boolean canPathsBeAdded(TreePath[] paths) {
    if(paths == null || paths.length == 0 || rowMapper == null ||
       selection == null || selectionMode ==
       TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)
        return true;
    else {
        BitSet                       bitSet = new BitSet();
        DefaultListSelectionModel    lModel = listSelectionModel;
        int                          anIndex;
        int                          counter;
        int                          min = lModel.getMinSelectionIndex();
        int                          max = lModel.getMaxSelectionIndex();
        TreePath[]                   tempPath = new TreePath[1];

        if(min != -1) {
            for(counter = min; counter <= max; counter++) {
                if(lModel.isSelectedIndex(counter))
                    bitSet.set(counter);
            }
        }
        else {
            tempPath[0] = paths[0];
            min = max = rowMapper.getRowsForPaths(tempPath)[0];
        }
        for(counter = paths.length - 1; counter >= 0; counter--) {
            if(paths[counter] != null) {
                tempPath[0] = paths[counter];
                int[]   rows = rowMapper.getRowsForPaths(tempPath);
                if (rows == null) {
                    return false;
                }
                anIndex = rows[0];
                min = Math.min(anIndex, min);
                max = Math.max(anIndex, max);
                if(anIndex == -1)
                    return false;
                bitSet.set(anIndex);
            }
        }
        for(counter = min; counter <= max; counter++)
            if(!bitSet.get(counter))
                return false;
    }
    return true;
}
 
/**
 * Used to test if a particular set of <code>TreePath</code>s can
 * be added. This will return true if <code>paths</code> is null (or
 * empty), or this object has no RowMapper, or nothing is currently selected,
 * or the selection mode is <code>DISCONTIGUOUS_TREE_SELECTION</code>, or
 * adding the paths to the current selection still results in a
 * contiguous set of <code>TreePath</code>s.
 */
protected boolean canPathsBeAdded(TreePath[] paths) {
    if(paths == null || paths.length == 0 || rowMapper == null ||
       selection == null || selectionMode ==
       TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)
        return true;
    else {
        BitSet                       bitSet = new BitSet();
        DefaultListSelectionModel    lModel = listSelectionModel;
        int                          anIndex;
        int                          counter;
        int                          min = lModel.getMinSelectionIndex();
        int                          max = lModel.getMaxSelectionIndex();
        TreePath[]                   tempPath = new TreePath[1];

        if(min != -1) {
            for(counter = min; counter <= max; counter++) {
                if(lModel.isSelectedIndex(counter))
                    bitSet.set(counter);
            }
        }
        else {
            tempPath[0] = paths[0];
            min = max = rowMapper.getRowsForPaths(tempPath)[0];
        }
        for(counter = paths.length - 1; counter >= 0; counter--) {
            if(paths[counter] != null) {
                tempPath[0] = paths[counter];
                int[]   rows = rowMapper.getRowsForPaths(tempPath);
                if (rows == null) {
                    return false;
                }
                anIndex = rows[0];
                min = Math.min(anIndex, min);
                max = Math.max(anIndex, max);
                if(anIndex == -1)
                    return false;
                bitSet.set(anIndex);
            }
        }
        for(counter = min; counter <= max; counter++)
            if(!bitSet.get(counter))
                return false;
    }
    return true;
}
 
源代码14 项目: TencentKona-8   文件: DefaultTreeSelectionModel.java
/**
 * Used to test if a particular set of <code>TreePath</code>s can
 * be added. This will return true if <code>paths</code> is null (or
 * empty), or this object has no RowMapper, or nothing is currently selected,
 * or the selection mode is <code>DISCONTIGUOUS_TREE_SELECTION</code>, or
 * adding the paths to the current selection still results in a
 * contiguous set of <code>TreePath</code>s.
 */
protected boolean canPathsBeAdded(TreePath[] paths) {
    if(paths == null || paths.length == 0 || rowMapper == null ||
       selection == null || selectionMode ==
       TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)
        return true;
    else {
        BitSet                       bitSet = new BitSet();
        DefaultListSelectionModel    lModel = listSelectionModel;
        int                          anIndex;
        int                          counter;
        int                          min = lModel.getMinSelectionIndex();
        int                          max = lModel.getMaxSelectionIndex();
        TreePath[]                   tempPath = new TreePath[1];

        if(min != -1) {
            for(counter = min; counter <= max; counter++) {
                if(lModel.isSelectedIndex(counter))
                    bitSet.set(counter);
            }
        }
        else {
            tempPath[0] = paths[0];
            min = max = rowMapper.getRowsForPaths(tempPath)[0];
        }
        for(counter = paths.length - 1; counter >= 0; counter--) {
            if(paths[counter] != null) {
                tempPath[0] = paths[counter];
                int[]   rows = rowMapper.getRowsForPaths(tempPath);
                if (rows == null) {
                    return false;
                }
                anIndex = rows[0];
                min = Math.min(anIndex, min);
                max = Math.max(anIndex, max);
                if(anIndex == -1)
                    return false;
                bitSet.set(anIndex);
            }
        }
        for(counter = min; counter <= max; counter++)
            if(!bitSet.get(counter))
                return false;
    }
    return true;
}
 
源代码15 项目: jdk8u-dev-jdk   文件: DefaultTreeSelectionModel.java
/**
 * Used to test if a particular set of <code>TreePath</code>s can
 * be added. This will return true if <code>paths</code> is null (or
 * empty), or this object has no RowMapper, or nothing is currently selected,
 * or the selection mode is <code>DISCONTIGUOUS_TREE_SELECTION</code>, or
 * adding the paths to the current selection still results in a
 * contiguous set of <code>TreePath</code>s.
 */
protected boolean canPathsBeAdded(TreePath[] paths) {
    if(paths == null || paths.length == 0 || rowMapper == null ||
       selection == null || selectionMode ==
       TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)
        return true;
    else {
        BitSet                       bitSet = new BitSet();
        DefaultListSelectionModel    lModel = listSelectionModel;
        int                          anIndex;
        int                          counter;
        int                          min = lModel.getMinSelectionIndex();
        int                          max = lModel.getMaxSelectionIndex();
        TreePath[]                   tempPath = new TreePath[1];

        if(min != -1) {
            for(counter = min; counter <= max; counter++) {
                if(lModel.isSelectedIndex(counter))
                    bitSet.set(counter);
            }
        }
        else {
            tempPath[0] = paths[0];
            min = max = rowMapper.getRowsForPaths(tempPath)[0];
        }
        for(counter = paths.length - 1; counter >= 0; counter--) {
            if(paths[counter] != null) {
                tempPath[0] = paths[counter];
                int[]   rows = rowMapper.getRowsForPaths(tempPath);
                if (rows == null) {
                    return false;
                }
                anIndex = rows[0];
                min = Math.min(anIndex, min);
                max = Math.max(anIndex, max);
                if(anIndex == -1)
                    return false;
                bitSet.set(anIndex);
            }
        }
        for(counter = min; counter <= max; counter++)
            if(!bitSet.get(counter))
                return false;
    }
    return true;
}
 
源代码16 项目: jdk8u60   文件: DefaultTreeSelectionModel.java
/**
 * Used to test if a particular set of <code>TreePath</code>s can
 * be added. This will return true if <code>paths</code> is null (or
 * empty), or this object has no RowMapper, or nothing is currently selected,
 * or the selection mode is <code>DISCONTIGUOUS_TREE_SELECTION</code>, or
 * adding the paths to the current selection still results in a
 * contiguous set of <code>TreePath</code>s.
 */
protected boolean canPathsBeAdded(TreePath[] paths) {
    if(paths == null || paths.length == 0 || rowMapper == null ||
       selection == null || selectionMode ==
       TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)
        return true;
    else {
        BitSet                       bitSet = new BitSet();
        DefaultListSelectionModel    lModel = listSelectionModel;
        int                          anIndex;
        int                          counter;
        int                          min = lModel.getMinSelectionIndex();
        int                          max = lModel.getMaxSelectionIndex();
        TreePath[]                   tempPath = new TreePath[1];

        if(min != -1) {
            for(counter = min; counter <= max; counter++) {
                if(lModel.isSelectedIndex(counter))
                    bitSet.set(counter);
            }
        }
        else {
            tempPath[0] = paths[0];
            min = max = rowMapper.getRowsForPaths(tempPath)[0];
        }
        for(counter = paths.length - 1; counter >= 0; counter--) {
            if(paths[counter] != null) {
                tempPath[0] = paths[counter];
                int[]   rows = rowMapper.getRowsForPaths(tempPath);
                if (rows == null) {
                    return false;
                }
                anIndex = rows[0];
                min = Math.min(anIndex, min);
                max = Math.max(anIndex, max);
                if(anIndex == -1)
                    return false;
                bitSet.set(anIndex);
            }
        }
        for(counter = min; counter <= max; counter++)
            if(!bitSet.get(counter))
                return false;
    }
    return true;
}
 
源代码17 项目: openjdk-8   文件: DefaultTreeSelectionModel.java
/**
 * Used to test if a particular set of <code>TreePath</code>s can
 * be added. This will return true if <code>paths</code> is null (or
 * empty), or this object has no RowMapper, or nothing is currently selected,
 * or the selection mode is <code>DISCONTIGUOUS_TREE_SELECTION</code>, or
 * adding the paths to the current selection still results in a
 * contiguous set of <code>TreePath</code>s.
 */
protected boolean canPathsBeAdded(TreePath[] paths) {
    if(paths == null || paths.length == 0 || rowMapper == null ||
       selection == null || selectionMode ==
       TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)
        return true;
    else {
        BitSet                       bitSet = new BitSet();
        DefaultListSelectionModel    lModel = listSelectionModel;
        int                          anIndex;
        int                          counter;
        int                          min = lModel.getMinSelectionIndex();
        int                          max = lModel.getMaxSelectionIndex();
        TreePath[]                   tempPath = new TreePath[1];

        if(min != -1) {
            for(counter = min; counter <= max; counter++) {
                if(lModel.isSelectedIndex(counter))
                    bitSet.set(counter);
            }
        }
        else {
            tempPath[0] = paths[0];
            min = max = rowMapper.getRowsForPaths(tempPath)[0];
        }
        for(counter = paths.length - 1; counter >= 0; counter--) {
            if(paths[counter] != null) {
                tempPath[0] = paths[counter];
                int[]   rows = rowMapper.getRowsForPaths(tempPath);
                if (rows == null) {
                    return false;
                }
                anIndex = rows[0];
                min = Math.min(anIndex, min);
                max = Math.max(anIndex, max);
                if(anIndex == -1)
                    return false;
                bitSet.set(anIndex);
            }
        }
        for(counter = min; counter <= max; counter++)
            if(!bitSet.get(counter))
                return false;
    }
    return true;
}
 
源代码18 项目: jdk8u_jdk   文件: DefaultTreeSelectionModel.java
/**
 * Used to test if a particular set of <code>TreePath</code>s can
 * be added. This will return true if <code>paths</code> is null (or
 * empty), or this object has no RowMapper, or nothing is currently selected,
 * or the selection mode is <code>DISCONTIGUOUS_TREE_SELECTION</code>, or
 * adding the paths to the current selection still results in a
 * contiguous set of <code>TreePath</code>s.
 */
protected boolean canPathsBeAdded(TreePath[] paths) {
    if(paths == null || paths.length == 0 || rowMapper == null ||
       selection == null || selectionMode ==
       TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)
        return true;
    else {
        BitSet                       bitSet = new BitSet();
        DefaultListSelectionModel    lModel = listSelectionModel;
        int                          anIndex;
        int                          counter;
        int                          min = lModel.getMinSelectionIndex();
        int                          max = lModel.getMaxSelectionIndex();
        TreePath[]                   tempPath = new TreePath[1];

        if(min != -1) {
            for(counter = min; counter <= max; counter++) {
                if(lModel.isSelectedIndex(counter))
                    bitSet.set(counter);
            }
        }
        else {
            tempPath[0] = paths[0];
            min = max = rowMapper.getRowsForPaths(tempPath)[0];
        }
        for(counter = paths.length - 1; counter >= 0; counter--) {
            if(paths[counter] != null) {
                tempPath[0] = paths[counter];
                int[]   rows = rowMapper.getRowsForPaths(tempPath);
                if (rows == null) {
                    return false;
                }
                anIndex = rows[0];
                min = Math.min(anIndex, min);
                max = Math.max(anIndex, max);
                if(anIndex == -1)
                    return false;
                bitSet.set(anIndex);
            }
        }
        for(counter = min; counter <= max; counter++)
            if(!bitSet.get(counter))
                return false;
    }
    return true;
}
 
/**
 * Used to test if a particular set of <code>TreePath</code>s can
 * be added. This will return true if <code>paths</code> is null (or
 * empty), or this object has no RowMapper, or nothing is currently selected,
 * or the selection mode is <code>DISCONTIGUOUS_TREE_SELECTION</code>, or
 * adding the paths to the current selection still results in a
 * contiguous set of <code>TreePath</code>s.
 */
protected boolean canPathsBeAdded(TreePath[] paths) {
    if(paths == null || paths.length == 0 || rowMapper == null ||
       selection == null || selectionMode ==
       TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)
        return true;
    else {
        BitSet                       bitSet = new BitSet();
        DefaultListSelectionModel    lModel = listSelectionModel;
        int                          anIndex;
        int                          counter;
        int                          min = lModel.getMinSelectionIndex();
        int                          max = lModel.getMaxSelectionIndex();
        TreePath[]                   tempPath = new TreePath[1];

        if(min != -1) {
            for(counter = min; counter <= max; counter++) {
                if(lModel.isSelectedIndex(counter))
                    bitSet.set(counter);
            }
        }
        else {
            tempPath[0] = paths[0];
            min = max = rowMapper.getRowsForPaths(tempPath)[0];
        }
        for(counter = paths.length - 1; counter >= 0; counter--) {
            if(paths[counter] != null) {
                tempPath[0] = paths[counter];
                int[]   rows = rowMapper.getRowsForPaths(tempPath);
                if (rows == null) {
                    return false;
                }
                anIndex = rows[0];
                min = Math.min(anIndex, min);
                max = Math.max(anIndex, max);
                if(anIndex == -1)
                    return false;
                bitSet.set(anIndex);
            }
        }
        for(counter = min; counter <= max; counter++)
            if(!bitSet.get(counter))
                return false;
    }
    return true;
}
 
源代码20 项目: jdk8u-jdk   文件: DefaultTreeSelectionModel.java
/**
 * Used to test if a particular set of <code>TreePath</code>s can
 * be added. This will return true if <code>paths</code> is null (or
 * empty), or this object has no RowMapper, or nothing is currently selected,
 * or the selection mode is <code>DISCONTIGUOUS_TREE_SELECTION</code>, or
 * adding the paths to the current selection still results in a
 * contiguous set of <code>TreePath</code>s.
 */
protected boolean canPathsBeAdded(TreePath[] paths) {
    if(paths == null || paths.length == 0 || rowMapper == null ||
       selection == null || selectionMode ==
       TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)
        return true;
    else {
        BitSet                       bitSet = new BitSet();
        DefaultListSelectionModel    lModel = listSelectionModel;
        int                          anIndex;
        int                          counter;
        int                          min = lModel.getMinSelectionIndex();
        int                          max = lModel.getMaxSelectionIndex();
        TreePath[]                   tempPath = new TreePath[1];

        if(min != -1) {
            for(counter = min; counter <= max; counter++) {
                if(lModel.isSelectedIndex(counter))
                    bitSet.set(counter);
            }
        }
        else {
            tempPath[0] = paths[0];
            min = max = rowMapper.getRowsForPaths(tempPath)[0];
        }
        for(counter = paths.length - 1; counter >= 0; counter--) {
            if(paths[counter] != null) {
                tempPath[0] = paths[counter];
                int[]   rows = rowMapper.getRowsForPaths(tempPath);
                if (rows == null) {
                    return false;
                }
                anIndex = rows[0];
                min = Math.min(anIndex, min);
                max = Math.max(anIndex, max);
                if(anIndex == -1)
                    return false;
                bitSet.set(anIndex);
            }
        }
        for(counter = min; counter <= max; counter++)
            if(!bitSet.get(counter))
                return false;
    }
    return true;
}