Java Code Examples for javax.swing.SortOrder#UNSORTED

The following examples show how to use javax.swing.SortOrder#UNSORTED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultRowSorter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private boolean isUnsorted() {
    List<? extends SortKey> keys = getSortKeys();
    int keySize = keys.size();
    return (keySize == 0 || keys.get(0).getSortOrder() ==
            SortOrder.UNSORTED);
}
 
Example 2
Source File: DefaultRowSorter.java    From Java8CN with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private int compare(int model1, int model2) {
    int column;
    SortOrder sortOrder;
    Object v1, v2;
    int result;

    for (int counter = 0; counter < cachedSortKeys.length; counter++) {
        column = cachedSortKeys[counter].getColumn();
        sortOrder = cachedSortKeys[counter].getSortOrder();
        if (sortOrder == SortOrder.UNSORTED) {
            result = model1 - model2;
        } else {
            // v1 != null && v2 != null
            if (useToString[column]) {
                v1 = getModelWrapper().getStringValueAt(model1, column);
                v2 = getModelWrapper().getStringValueAt(model2, column);
            } else {
                v1 = getModelWrapper().getValueAt(model1, column);
                v2 = getModelWrapper().getValueAt(model2, column);
            }
            // Treat nulls as < then non-null
            if (v1 == null) {
                if (v2 == null) {
                    result = 0;
                } else {
                    result = -1;
                }
            } else if (v2 == null) {
                result = 1;
            } else {
                result = sortComparators[counter].compare(v1, v2);
            }
            if (sortOrder == SortOrder.DESCENDING) {
                result *= -1;
            }
        }
        if (result != 0) {
            return result;
        }
    }
    // If we get here, they're equal. Fallback to model order.
    return model1 - model2;
}
 
Example 3
Source File: DefaultRowSorter.java    From Java8CN with Apache License 2.0 4 votes vote down vote up
private boolean isUnsorted() {
    List<? extends SortKey> keys = getSortKeys();
    int keySize = keys.size();
    return (keySize == 0 || keys.get(0).getSortOrder() ==
            SortOrder.UNSORTED);
}
 
Example 4
Source File: DefaultRowSorter.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private int compare(int model1, int model2) {
    int column;
    SortOrder sortOrder;
    Object v1, v2;
    int result;

    for (int counter = 0; counter < cachedSortKeys.length; counter++) {
        column = cachedSortKeys[counter].getColumn();
        sortOrder = cachedSortKeys[counter].getSortOrder();
        if (sortOrder == SortOrder.UNSORTED) {
            result = model1 - model2;
        } else {
            // v1 != null && v2 != null
            if (useToString[column]) {
                v1 = getModelWrapper().getStringValueAt(model1, column);
                v2 = getModelWrapper().getStringValueAt(model2, column);
            } else {
                v1 = getModelWrapper().getValueAt(model1, column);
                v2 = getModelWrapper().getValueAt(model2, column);
            }
            // Treat nulls as < then non-null
            if (v1 == null) {
                if (v2 == null) {
                    result = 0;
                } else {
                    result = -1;
                }
            } else if (v2 == null) {
                result = 1;
            } else {
                result = sortComparators[counter].compare(v1, v2);
            }
            if (sortOrder == SortOrder.DESCENDING) {
                result *= -1;
            }
        }
        if (result != 0) {
            return result;
        }
    }
    // If we get here, they're equal. Fallback to model order.
    return model1 - model2;
}
 
Example 5
Source File: DefaultRowSorter.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private boolean isUnsorted() {
    List<? extends SortKey> keys = getSortKeys();
    int keySize = keys.size();
    return (keySize == 0 || keys.get(0).getSortOrder() ==
            SortOrder.UNSORTED);
}
 
Example 6
Source File: DefaultRowSorter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private int compare(int model1, int model2) {
    int column;
    SortOrder sortOrder;
    Object v1, v2;
    int result;

    for (int counter = 0; counter < cachedSortKeys.length; counter++) {
        column = cachedSortKeys[counter].getColumn();
        sortOrder = cachedSortKeys[counter].getSortOrder();
        if (sortOrder == SortOrder.UNSORTED) {
            result = model1 - model2;
        } else {
            // v1 != null && v2 != null
            if (useToString[column]) {
                v1 = getModelWrapper().getStringValueAt(model1, column);
                v2 = getModelWrapper().getStringValueAt(model2, column);
            } else {
                v1 = getModelWrapper().getValueAt(model1, column);
                v2 = getModelWrapper().getValueAt(model2, column);
            }
            // Treat nulls as < then non-null
            if (v1 == null) {
                if (v2 == null) {
                    result = 0;
                } else {
                    result = -1;
                }
            } else if (v2 == null) {
                result = 1;
            } else {
                result = sortComparators[counter].compare(v1, v2);
            }
            if (sortOrder == SortOrder.DESCENDING) {
                result *= -1;
            }
        }
        if (result != 0) {
            return result;
        }
    }
    // If we get here, they're equal. Fallback to model order.
    return model1 - model2;
}
 
Example 7
Source File: DefaultRowSorter.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
private boolean isUnsorted() {
    List<? extends SortKey> keys = getSortKeys();
    int keySize = keys.size();
    return (keySize == 0 || keys.get(0).getSortOrder() ==
            SortOrder.UNSORTED);
}
 
Example 8
Source File: DefaultRowSorter.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private int compare(int model1, int model2) {
    int column;
    SortOrder sortOrder;
    Object v1, v2;
    int result;

    for (int counter = 0; counter < cachedSortKeys.length; counter++) {
        column = cachedSortKeys[counter].getColumn();
        sortOrder = cachedSortKeys[counter].getSortOrder();
        if (sortOrder == SortOrder.UNSORTED) {
            result = model1 - model2;
        } else {
            // v1 != null && v2 != null
            if (useToString[column]) {
                v1 = getModelWrapper().getStringValueAt(model1, column);
                v2 = getModelWrapper().getStringValueAt(model2, column);
            } else {
                v1 = getModelWrapper().getValueAt(model1, column);
                v2 = getModelWrapper().getValueAt(model2, column);
            }
            // Treat nulls as < then non-null
            if (v1 == null) {
                if (v2 == null) {
                    result = 0;
                } else {
                    result = -1;
                }
            } else if (v2 == null) {
                result = 1;
            } else {
                result = sortComparators[counter].compare(v1, v2);
            }
            if (sortOrder == SortOrder.DESCENDING) {
                result *= -1;
            }
        }
        if (result != 0) {
            return result;
        }
    }
    // If we get here, they're equal. Fallback to model order.
    return model1 - model2;
}
 
Example 9
Source File: DefaultRowSorter.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private int compare(int model1, int model2) {
    int column;
    SortOrder sortOrder;
    Object v1, v2;
    int result;

    for (int counter = 0; counter < cachedSortKeys.length; counter++) {
        column = cachedSortKeys[counter].getColumn();
        sortOrder = cachedSortKeys[counter].getSortOrder();
        if (sortOrder == SortOrder.UNSORTED) {
            result = model1 - model2;
        } else {
            // v1 != null && v2 != null
            if (useToString[column]) {
                v1 = getModelWrapper().getStringValueAt(model1, column);
                v2 = getModelWrapper().getStringValueAt(model2, column);
            } else {
                v1 = getModelWrapper().getValueAt(model1, column);
                v2 = getModelWrapper().getValueAt(model2, column);
            }
            // Treat nulls as < then non-null
            if (v1 == null) {
                if (v2 == null) {
                    result = 0;
                } else {
                    result = -1;
                }
            } else if (v2 == null) {
                result = 1;
            } else {
                result = sortComparators[counter].compare(v1, v2);
            }
            if (sortOrder == SortOrder.DESCENDING) {
                result *= -1;
            }
        }
        if (result != 0) {
            return result;
        }
    }
    // If we get here, they're equal. Fallback to model order.
    return model1 - model2;
}
 
Example 10
Source File: DefaultRowSorter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private int compare(int model1, int model2) {
    int column;
    SortOrder sortOrder;
    Object v1, v2;
    int result;

    for (int counter = 0; counter < cachedSortKeys.length; counter++) {
        column = cachedSortKeys[counter].getColumn();
        sortOrder = cachedSortKeys[counter].getSortOrder();
        if (sortOrder == SortOrder.UNSORTED) {
            result = model1 - model2;
        } else {
            // v1 != null && v2 != null
            if (useToString[column]) {
                v1 = getModelWrapper().getStringValueAt(model1, column);
                v2 = getModelWrapper().getStringValueAt(model2, column);
            } else {
                v1 = getModelWrapper().getValueAt(model1, column);
                v2 = getModelWrapper().getValueAt(model2, column);
            }
            // Treat nulls as < then non-null
            if (v1 == null) {
                if (v2 == null) {
                    result = 0;
                } else {
                    result = -1;
                }
            } else if (v2 == null) {
                result = 1;
            } else {
                result = sortComparators[counter].compare(v1, v2);
            }
            if (sortOrder == SortOrder.DESCENDING) {
                result *= -1;
            }
        }
        if (result != 0) {
            return result;
        }
    }
    // If we get here, they're equal. Fallback to model order.
    return model1 - model2;
}
 
Example 11
Source File: DefaultRowSorter.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
private boolean isUnsorted() {
    List<? extends SortKey> keys = getSortKeys();
    int keySize = keys.size();
    return (keySize == 0 || keys.get(0).getSortOrder() ==
            SortOrder.UNSORTED);
}
 
Example 12
Source File: DefaultRowSorter.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
@SuppressWarnings("unchecked")
private int compare(int model1, int model2) {
    int column;
    SortOrder sortOrder;
    Object v1, v2;
    int result;

    for (int counter = 0; counter < cachedSortKeys.length; counter++) {
        column = cachedSortKeys[counter].getColumn();
        sortOrder = cachedSortKeys[counter].getSortOrder();
        if (sortOrder == SortOrder.UNSORTED) {
            result = model1 - model2;
        } else {
            // v1 != null && v2 != null
            if (useToString[column]) {
                v1 = getModelWrapper().getStringValueAt(model1, column);
                v2 = getModelWrapper().getStringValueAt(model2, column);
            } else {
                v1 = getModelWrapper().getValueAt(model1, column);
                v2 = getModelWrapper().getValueAt(model2, column);
            }
            // Treat nulls as < then non-null
            if (v1 == null) {
                if (v2 == null) {
                    result = 0;
                } else {
                    result = -1;
                }
            } else if (v2 == null) {
                result = 1;
            } else {
                result = sortComparators[counter].compare(v1, v2);
            }
            if (sortOrder == SortOrder.DESCENDING) {
                result *= -1;
            }
        }
        if (result != 0) {
            return result;
        }
    }
    // If we get here, they're equal. Fallback to model order.
    return model1 - model2;
}
 
Example 13
Source File: DefaultRowSorter.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private int compare(int model1, int model2) {
    int column;
    SortOrder sortOrder;
    Object v1, v2;
    int result;

    for (int counter = 0; counter < cachedSortKeys.length; counter++) {
        column = cachedSortKeys[counter].getColumn();
        sortOrder = cachedSortKeys[counter].getSortOrder();
        if (sortOrder == SortOrder.UNSORTED) {
            result = model1 - model2;
        } else {
            // v1 != null && v2 != null
            if (useToString[column]) {
                v1 = getModelWrapper().getStringValueAt(model1, column);
                v2 = getModelWrapper().getStringValueAt(model2, column);
            } else {
                v1 = getModelWrapper().getValueAt(model1, column);
                v2 = getModelWrapper().getValueAt(model2, column);
            }
            // Treat nulls as < then non-null
            if (v1 == null) {
                if (v2 == null) {
                    result = 0;
                } else {
                    result = -1;
                }
            } else if (v2 == null) {
                result = 1;
            } else {
                result = sortComparators[counter].compare(v1, v2);
            }
            if (sortOrder == SortOrder.DESCENDING) {
                result *= -1;
            }
        }
        if (result != 0) {
            return result;
        }
    }
    // If we get here, they're equal. Fallback to model order.
    return model1 - model2;
}
 
Example 14
Source File: DefaultRowSorter.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private boolean isUnsorted() {
    List<? extends SortKey> keys = getSortKeys();
    int keySize = keys.size();
    return (keySize == 0 || keys.get(0).getSortOrder() ==
            SortOrder.UNSORTED);
}
 
Example 15
Source File: DefaultRowSorter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private boolean isUnsorted() {
    List<? extends SortKey> keys = getSortKeys();
    int keySize = keys.size();
    return (keySize == 0 || keys.get(0).getSortOrder() ==
            SortOrder.UNSORTED);
}
 
Example 16
Source File: DefaultRowSorter.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private int compare(int model1, int model2) {
    int column;
    SortOrder sortOrder;
    Object v1, v2;
    int result;

    for (int counter = 0; counter < cachedSortKeys.length; counter++) {
        column = cachedSortKeys[counter].getColumn();
        sortOrder = cachedSortKeys[counter].getSortOrder();
        if (sortOrder == SortOrder.UNSORTED) {
            result = model1 - model2;
        } else {
            // v1 != null && v2 != null
            if (useToString[column]) {
                v1 = getModelWrapper().getStringValueAt(model1, column);
                v2 = getModelWrapper().getStringValueAt(model2, column);
            } else {
                v1 = getModelWrapper().getValueAt(model1, column);
                v2 = getModelWrapper().getValueAt(model2, column);
            }
            // Treat nulls as < then non-null
            if (v1 == null) {
                if (v2 == null) {
                    result = 0;
                } else {
                    result = -1;
                }
            } else if (v2 == null) {
                result = 1;
            } else {
                result = sortComparators[counter].compare(v1, v2);
            }
            if (sortOrder == SortOrder.DESCENDING) {
                result *= -1;
            }
        }
        if (result != 0) {
            return result;
        }
    }
    // If we get here, they're equal. Fallback to model order.
    return model1 - model2;
}
 
Example 17
Source File: DefaultRowSorter.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private boolean isUnsorted() {
    List<? extends SortKey> keys = getSortKeys();
    int keySize = keys.size();
    return (keySize == 0 || keys.get(0).getSortOrder() ==
            SortOrder.UNSORTED);
}
 
Example 18
Source File: DefaultRowSorter.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private int compare(int model1, int model2) {
    int column;
    SortOrder sortOrder;
    Object v1, v2;
    int result;

    for (int counter = 0; counter < cachedSortKeys.length; counter++) {
        column = cachedSortKeys[counter].getColumn();
        sortOrder = cachedSortKeys[counter].getSortOrder();
        if (sortOrder == SortOrder.UNSORTED) {
            result = model1 - model2;
        } else {
            // v1 != null && v2 != null
            if (useToString[column]) {
                v1 = getModelWrapper().getStringValueAt(model1, column);
                v2 = getModelWrapper().getStringValueAt(model2, column);
            } else {
                v1 = getModelWrapper().getValueAt(model1, column);
                v2 = getModelWrapper().getValueAt(model2, column);
            }
            // Treat nulls as < then non-null
            if (v1 == null) {
                if (v2 == null) {
                    result = 0;
                } else {
                    result = -1;
                }
            } else if (v2 == null) {
                result = 1;
            } else {
                result = sortComparators[counter].compare(v1, v2);
            }
            if (sortOrder == SortOrder.DESCENDING) {
                result *= -1;
            }
        }
        if (result != 0) {
            return result;
        }
    }
    // If we get here, they're equal. Fallback to model order.
    return model1 - model2;
}
 
Example 19
Source File: ProfilerRowSorter.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
SortOrder getSortOrder() {
    RowSorter.SortKey key = getSortKey();
    return key == null ? SortOrder.UNSORTED : key.getSortOrder();
}
 
Example 20
Source File: DefaultRowSorter.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private boolean isUnsorted() {
    List<? extends SortKey> keys = getSortKeys();
    int keySize = keys.size();
    return (keySize == 0 || keys.get(0).getSortOrder() ==
            SortOrder.UNSORTED);
}