javax.swing.DefaultRowSorter的实例源码

项目:PasswordSafe    文件ZTable.java   
public void setRowFilter(final ZRowFilter f)
{
    DefaultRowSorter rs = (DefaultRowSorter)getRowSorter();
    rs.setRowFilter(new RowFilter<TableModel,Integer>()
    {
        public boolean include(RowFilter.Entry<? extends TableModel,? extends Integer> en)
        {
            if(f == null)
            {
                return true;
            }
            else
            {
                TableModel m = en.getModel();
                Integer ix = en.getIdentifier();
                return f.include(m,ix);
            }
        }
    });
}
项目:gameserver    文件MongoRowFilteraction.java   
@Override
    public void actionPerformed(ActionEvent e) {
        SwingUtilities.invokelater(new Runnable(){
            public void run() {
                DefaultRowSorter rowSorter = (DefaultRowSorter)parent.getTable().getRowSorter();
                String regex = parent.getFilterText();
                if ( regex == null || regex.length() == 0 ) {
//                  JOptionPane.showMessageDialog(parent,"请输入需要过滤的正则表达式",//                          "数据过滤",JOptionPane.informatION_MESSAGE);
                    rowSorter.setRowFilter(null);
                } else {
                    rowSorter.setRowFilter(RowFilter.regexFilter(regex));
//                  parent.getTable().setRowFilter(RowFilter.regexFilter(regex));
                }
            }
        });
    }
项目:incubator-netbeans    文件DataViewUI.java   
private void processKeyEvents() {
    ResultSetJXTable table = getDataViewTableuI();
    int[] rows = new int[table.getColumnCount()];
    for (int i = 0; i < table.getColumnCount(); i++) {
        rows[i] = i;
    }
    {
        multicolPatternFilter filterP = new multicolPatternFilter(rows);
        filterP.setFilterStr(matchBoxField.getText(),LIteraL_FIND);
        ((DefaultRowSorter) table.getRowSorter()).setRowFilter(filterP);
    }
}
项目:scelight    文件XTable.java   
@Override
public void setSortable( final boolean sortable ) {
    @SuppressWarnings( "unchecked" )
    final DefaultRowSorter< TableModel,Integer > rowSorter = (DefaultRowSorter< TableModel,Integer >) getRowSorter();
    for ( int i = tableModel.getColumnCount() - 1; i >= 0; i-- )
        rowSorter.setSortable( i,sortable );
}
项目:swingx    文件JTableIssues.java   
/**
     * Issue #1536-swingx: AIOOB on restoring selection with filter
     * 
     */
    @Test
    public void testSelectionWithFilterXTable() {
        DefaultTableModel model = new DefaultTableModel(0,1);
        // a model with 3 elements is the minimum where to demonstrate
        // the bug
        int last = 2;
        for (int i = 0; i <= last; i++) {
            model.addRow(new Object[]{i});
        }
        JTable table = new JXTable(model);
//        table.setautocreateRowSorter(true);
        // set selection at the end
        table.setRowSelectionInterval(last,last);
        // exclude rows based on identifier
        final RowFilter filter = new RowFilters.GeneralFilter() {

            List excludes = Arrays.asList(0);
            @Override
            protected boolean include(
                    Entry<? extends Object,? extends Object> entry,int index) {
                return !excludes.contains(entry.getIdentifier());
            }

        };
        ((DefaultRowSorter) table.getRowSorter()).setRowFilter(filter);
        // insertRow _before or at_ selected model index,such that
        // endindex (in event) > 1
        model.insertRow( 2,new Object[]{"x"});
    }
项目:swingx    文件JTableIssues.java   
/**
 * Issue #1536-swingx: AIOOB on restoring selection with filter
 * 
 */
@Test
public void testSelectionWithFilterTable() {
    DefaultTableModel model = new DefaultTableModel(0,1);
    // a model with 3 elements is the minimum where to demonstrate
    // the bug
    int last = 2;
    for (int i = 0; i <= last; i++) {
        model.addRow(new Object[]{i});
    }
    JTable table = new JTable(model);
    table.setautocreateRowSorter(true);
    // set selection at the end
    table.setRowSelectionInterval(last,last);
    // exclude rows based on identifier
    final RowFilter filter = new RowFilters.GeneralFilter() {

        List excludes = Arrays.asList(0);
        @Override
        protected boolean include(
                Entry<? extends Object,int index) {
            return !excludes.contains(entry.getIdentifier());
        }

    };
    ((DefaultRowSorter) table.getRowSorter()).setRowFilter(filter);
    // insertRow _before or at_ selected model index,such that
    // endindex (in event) > 1
    model.insertRow( 2,new Object[]{"x"});
}
项目:oStorybook    文件AbstractTable.java   
protected void sortByColumn(int col) {
    DefaultRowSorter<?,?> sorter = ((DefaultRowSorter<?,?>) table.getRowSorter());
    ArrayList<SortKey> list = new ArrayList<>();
    list.add(new RowSorter.sortKey(col,SortOrder.ASCENDING));
    sorter.setSortKeys(list);
    sorter.sort();
}
项目:SE-410-Project    文件AbstractTable.java   
protected void sortByColumn(int col) {
    DefaultRowSorter<?,SortOrder.ASCENDING));
    sorter.setSortKeys(list);
    sorter.sort();
}
项目:minimal-j    文件SwingTable.java   
private void setSortableColumns(List<T> list) {
    if (table.getRowSorter() instanceof DefaultRowSorter) {
        DefaultRowSorter<?,?> sorter = (DefaultRowSorter<?,?>) table.getRowSorter();
        Sortable sortable = null;
        if (list instanceof Sortable) {
            sortable = (Sortable) list;
        }
        for (int i = 0; i < keys.length; i++) {
            sorter.setSortable(i,sortable != null && sortable.canSortBy(keys[i]));
        }
    }
}
项目:gtfsview    文件ShapePointsTableModel.java   
public static void configureTableSorting(JTable theTable) {
    DefaultRowSorter rs = (DefaultRowSorter) theTable.getRowSorter();

    for (Column c : Column.values()) {
        rs.setComparator(c.ordinal(),c.getComparator());
    }
}
项目:gtfsview    文件StopTimesTableModel.java   
public static void configureTableSorting(JTable theTable) {
    DefaultRowSorter rs = (DefaultRowSorter) theTable.getRowSorter();

    for (Column c : Column.values()) {
        rs.setComparator(c.ordinal(),c.getComparator());
    }
}
项目:First-Fruits    文件RecordsTable.java   
@Override
public void update(Observable o,Object value)
{
    if (value instanceof GivingRecord) {
        int selection = convertRowIndexToModel(getSelectedRow());
        model.fireTableRowsUpdated(selection,selection);
        clearSelection();
    } else if (value instanceof List) {
        model.setRecords(RecordManager.getInstance().getRecords());
        ((DefaultRowSorter<?,?>)getRowSorter()).sort();
    } else if (value instanceof RecordFilter) {
        model.setRecords(RecordManager.getInstance().getRecords());
        ((DefaultRowSorter<?,?>)getRowSorter()).sort();
    }
}
项目:DEM    文件JTableutil.java   
public static void sortTable( JTable table,int index ) {
    table.setautocreateRowSorter(true);
    DefaultRowSorter<?,?>) table.getRowSorter();

    List<SortKey> list = new ArrayList<SortKey>();
    SortKey sort = new RowSorter.sortKey(index,SortOrder.ASCENDING) ;
    list.add( sort );
    sorter.setSortKeys(list);
    sorter.sort();
}
项目:rapidminer    文件JDBCDriverTable.java   
public JDBCDriverTable(DriverInfo[] driverInfos) {
    this.setModel(new JDBCDriverTableModel(driverInfos));
    this.setRowHeight(this.getRowHeight() + 4 + 4);
    this.setautocreateRowSorter(true);
    ((DefaultRowSorter)this.getRowSorter()).setMaxSortKeys(1);
}
项目:edacc_gui    文件Resultsbrowsertablerowsorter.java   
public ExperimentResultsbrowserModelWrapper(DefaultRowSorter.ModelWrapper<M,Integer> delegate) {
    this.delegate = delegate;
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...