Example usage for javax.swing DefaultRowSorter setComparator

List of usage examples for javax.swing DefaultRowSorter setComparator

Introduction

In this page you can find the example usage for javax.swing DefaultRowSorter setComparator.

Prototype

public void setComparator(int column, Comparator<?> comparator) 

Source Link

Document

Sets the Comparator to use when sorting the specified column.

Usage

From source file:com.net2plan.gui.utils.viewEditTopolTables.specificTables.AdvancedJTable_layer.java

public void setColumnRowSortingFixedAndNonFixedTable() {
    final Set<Integer> columnsWithDoubleAndThenParenthesis = Sets.newHashSet();
    final DefaultRowSorter rowSorter = ((DefaultRowSorter) getRowSorter());
    for (int col = 0; col <= COLUMN_ATTRIBUTES; col++)
        rowSorter.setComparator(col, new AdvancedJTable_NetworkElement.ColumnComparator(rowSorter,
                columnsWithDoubleAndThenParenthesis.contains(col)));
}

From source file:com.net2plan.gui.utils.viewEditTopolTables.specificTables.AdvancedJTable_multicastDemand.java

@Override
public void setColumnRowSortingFixedAndNonFixedTable() {
    setAutoCreateRowSorter(true);/*ww w. ja  v  a  2 s. c om*/
    final Set<Integer> columnsWithDoubleAndThenParenthesis = Sets.newHashSet(COLUMN_INGRESSNODE,
            COLUMN_EGRESSNODES, COLUMN_NUMTREES);
    DefaultRowSorter rowSorter = ((DefaultRowSorter) getRowSorter());
    for (int col = 0; col <= COLUMN_ATTRIBUTES; col++)
        rowSorter.setComparator(col, new AdvancedJTable_NetworkElement.ColumnComparator(rowSorter,
                columnsWithDoubleAndThenParenthesis.contains(col)));
    fixedTable.setAutoCreateRowSorter(true);
    fixedTable.setRowSorter(this.getRowSorter());
    rowSorter = ((DefaultRowSorter) fixedTable.getRowSorter());
    for (int col = 0; col <= COLUMN_ATTRIBUTES; col++)
        rowSorter.setComparator(col, new AdvancedJTable_NetworkElement.ColumnComparator(rowSorter,
                columnsWithDoubleAndThenParenthesis.contains(col)));
}

From source file:com.net2plan.gui.utils.viewEditTopolTables.specificTables.AdvancedJTable_node.java

@Override
public void setColumnRowSortingFixedAndNonFixedTable() {
    setAutoCreateRowSorter(true);//from w w w. ja  v  a  2s .  c  om
    final Set<Integer> columnsWithDoubleAndThenParenthesis = Sets.newHashSet(COLUMN_OUTLINKS, COLUMN_INLINKS,
            COLUMN_INGRESSTRAFFIC, COLUMN_EGRESSTRAFFIC, COLUMN_INGRESSMULTICASTTRAFFIC,
            COLUMN_EGRESSMULTICASTTRAFFIC);
    DefaultRowSorter rowSorter = ((DefaultRowSorter) getRowSorter());
    for (int col = 0; col <= COLUMN_ATTRIBUTES; col++)
        rowSorter.setComparator(col, new AdvancedJTable_NetworkElement.ColumnComparator(rowSorter,
                columnsWithDoubleAndThenParenthesis.contains(col)));
    fixedTable.setAutoCreateRowSorter(true);
    fixedTable.setRowSorter(this.getRowSorter());
    rowSorter = ((DefaultRowSorter) fixedTable.getRowSorter());
    for (int col = 0; col <= COLUMN_ATTRIBUTES; col++)
        rowSorter.setComparator(col, new AdvancedJTable_NetworkElement.ColumnComparator(rowSorter,
                columnsWithDoubleAndThenParenthesis.contains(col)));
}

From source file:com.net2plan.gui.utils.viewEditTopolTables.specificTables.AdvancedJTable_demand.java

@Override
public void setColumnRowSortingFixedAndNonFixedTable() {
    setAutoCreateRowSorter(true);//from w  ww.  j  a v  a 2 s  .  c o m
    final Set<Integer> columnsWithDoubleAndThenParenthesis = Sets.newHashSet(COLUMN_INGRESSNODE,
            COLUMN_EGRESSNODE, COLUMN_NUMROUTES);
    DefaultRowSorter rowSorter = ((DefaultRowSorter) getRowSorter());
    for (int col = 0; col <= COLUMN_ATTRIBUTES; col++)
        rowSorter.setComparator(col, new AdvancedJTable_NetworkElement.ColumnComparator(rowSorter,
                columnsWithDoubleAndThenParenthesis.contains(col)));
    fixedTable.setAutoCreateRowSorter(true);
    fixedTable.setRowSorter(this.getRowSorter());
    rowSorter = ((DefaultRowSorter) fixedTable.getRowSorter());
    for (int col = 0; col <= COLUMN_ATTRIBUTES; col++)
        rowSorter.setComparator(col, new AdvancedJTable_NetworkElement.ColumnComparator(rowSorter,
                columnsWithDoubleAndThenParenthesis.contains(col)));
}

From source file:com.net2plan.gui.utils.viewEditTopolTables.specificTables.AdvancedJTable_link.java

@Override
public void setColumnRowSortingFixedAndNonFixedTable() {
    setAutoCreateRowSorter(true);//from  w  w w .  j  a v a2  s. com
    final Set<Integer> columnsWithDoubleAndThenParenthesis = Sets.newHashSet(COLUMN_ORIGINNODE, COLUMN_DESTNODE,
            COLUMN_NUMROUTES, COLUMN_NUMSEGMENTS, COLUMN_NUMFORWRULES, COLUMN_NUMTREES);
    DefaultRowSorter rowSorter = ((DefaultRowSorter) getRowSorter());
    for (int col = 0; col <= COLUMN_ATTRIBUTES; col++)
        rowSorter.setComparator(col, new AdvancedJTable_NetworkElement.ColumnComparator(rowSorter,
                columnsWithDoubleAndThenParenthesis.contains(col)));
    fixedTable.setAutoCreateRowSorter(true);
    fixedTable.setRowSorter(this.getRowSorter());
    rowSorter = ((DefaultRowSorter) fixedTable.getRowSorter());
    for (int col = 0; col <= COLUMN_ATTRIBUTES; col++)
        rowSorter.setComparator(col, new AdvancedJTable_NetworkElement.ColumnComparator(rowSorter,
                columnsWithDoubleAndThenParenthesis.contains(col)));
}