当前位置: 首页>>代码示例>>Java>>正文


Java DefaultRowSorter类代码示例

本文整理汇总了Java中javax.swing.DefaultRowSorter的典型用法代码示例。如果您正苦于以下问题:Java DefaultRowSorter类的具体用法?Java DefaultRowSorter怎么用?Java DefaultRowSorter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DefaultRowSorter类属于javax.swing包,在下文中一共展示了DefaultRowSorter类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setRowFilter

import javax.swing.DefaultRowSorter; //导入依赖的package包/类
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);
			}
		}
	});
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:21,代码来源:ZTable.java

示例2: actionPerformed

import javax.swing.DefaultRowSorter; //导入依赖的package包/类
@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));
				}
			}
		});
	}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:18,代码来源:MongoRowFilterAction.java

示例3: processKeyEvents

import javax.swing.DefaultRowSorter; //导入依赖的package包/类
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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:DataViewUI.java

示例4: setSortable

import javax.swing.DefaultRowSorter; //导入依赖的package包/类
@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 );
}
 
开发者ID:icza,项目名称:scelight,代码行数:8,代码来源:XTable.java

示例5: testSelectionWithFilterXTable

import javax.swing.DefaultRowSorter; //导入依赖的package包/类
/**
     * 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"});
    }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:35,代码来源:JTableIssues.java

示例6: testSelectionWithFilterTable

import javax.swing.DefaultRowSorter; //导入依赖的package包/类
/**
 * 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, ? 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"});
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:35,代码来源:JTableIssues.java

示例7: sortByColumn

import javax.swing.DefaultRowSorter; //导入依赖的package包/类
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();
}
 
开发者ID:markkohdev,项目名称:oStorybook,代码行数:8,代码来源:AbstractTable.java

示例8: setSortableColumns

import javax.swing.DefaultRowSorter; //导入依赖的package包/类
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]));
		}
	}
}
 
开发者ID:BrunoEberhard,项目名称:minimal-j,代码行数:13,代码来源:SwingTable.java

示例9: configureTableSorting

import javax.swing.DefaultRowSorter; //导入依赖的package包/类
public static void configureTableSorting(JTable theTable) {
    DefaultRowSorter rs = (DefaultRowSorter) theTable.getRowSorter();
    
    for (Column c : Column.values()) {
        rs.setComparator(c.ordinal(), c.getComparator());
    }
}
 
开发者ID:kurtraschke,项目名称:gtfsview,代码行数:8,代码来源:ShapePointsTableModel.java

示例10: configureTableSorting

import javax.swing.DefaultRowSorter; //导入依赖的package包/类
public static void configureTableSorting(JTable theTable) {
    DefaultRowSorter rs = (DefaultRowSorter) theTable.getRowSorter();

    for (Column c : Column.values()) {
        rs.setComparator(c.ordinal(), c.getComparator());
    }
}
 
开发者ID:kurtraschke,项目名称:gtfsview,代码行数:8,代码来源:StopTimesTableModel.java

示例11: update

import javax.swing.DefaultRowSorter; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:jefflward,项目名称:First-Fruits,代码行数:16,代码来源:RecordsTable.java

示例12: sortTable

import javax.swing.DefaultRowSorter; //导入依赖的package包/类
public static void sortTable( JTable table, int index ) {
    table.setAutoCreateRowSorter(true);
    DefaultRowSorter<?,?> sorter = (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();
}
 
开发者ID:CoEIA,项目名称:DEM,代码行数:11,代码来源:JTableUtil.java

示例13: JDBCDriverTable

import javax.swing.DefaultRowSorter; //导入依赖的package包/类
public JDBCDriverTable(DriverInfo[] driverInfos) {
    this.setModel(new JDBCDriverTableModel(driverInfos));
    this.setRowHeight(this.getRowHeight() + 4 + 4);
    this.setAutoCreateRowSorter(true);
    ((DefaultRowSorter)this.getRowSorter()).setMaxSortKeys(1);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:7,代码来源:JDBCDriverTable.java

示例14: ExperimentResultsBrowserModelWrapper

import javax.swing.DefaultRowSorter; //导入依赖的package包/类
public ExperimentResultsBrowserModelWrapper(DefaultRowSorter.ModelWrapper<M, Integer> delegate) {
    this.delegate = delegate;
}
 
开发者ID:EDACC,项目名称:edacc_gui,代码行数:4,代码来源:ResultsBrowserTableRowSorter.java


注:本文中的javax.swing.DefaultRowSorter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。