类javax.swing.DefaultRowSorter源码实例Demo

下面列出了怎么用javax.swing.DefaultRowSorter的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: 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));
				}
			}
		});
	}
 
源代码2 项目: 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);
    }
}
 
源代码3 项目: 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 );
}
 
源代码4 项目: rapidminer-studio   文件: PasswordManager.java
public PasswordManager() {

		super(ApplicationFrame.getApplicationFrame(), "password_manager", ModalityType.MODELESS, new Object[0]);
		this.clone = new Wallet(Wallet.getInstance());

		credentialsModel = new CredentialsTableModel(clone);
		final JTable table = new JTable(credentialsModel);
		table.setAutoCreateRowSorter(true);
		((DefaultRowSorter<?, ?>) table.getRowSorter()).setMaxSortKeys(1);
		JScrollPane scrollPane = new ExtendedJScrollPane(table);
		scrollPane.setBorder(null);
		JPanel main = new JPanel(new BorderLayout());
		main.add(scrollPane, BorderLayout.CENTER);

		ResourceAction removePasswordAction = new ResourceAction("password_manager_remove_row") {

			private static final long serialVersionUID = 1L;

			@Override
			public void loggedActionPerformed(ActionEvent e) {
				int[] selectedTableRows = table.getSelectedRows();
				ArrayList<Integer> modelRows = new ArrayList<>(selectedTableRows.length);
				for (int i = 0; i <= selectedTableRows.length - 1; i++) {
					modelRows.add(table.getRowSorter().convertRowIndexToModel(selectedTableRows[i]));
				}
				Collections.sort(modelRows);
				for (int i = modelRows.size() - 1; i >= 0; i--) {
					credentialsModel.removeRow(modelRows.get(i));
				}
			}
		};

		JPanel buttonPanel = new JPanel(new BorderLayout());
		buttonPanel.add(makeButtonPanel(new JButton(removePasswordAction), makeOkButton("password_manager_save"),
				makeCancelButton()), BorderLayout.EAST);
		layoutDefault(main, buttonPanel, LARGE);
	}
 
源代码5 项目: MobyDroid   文件: JPanel_FileBrowser.java
public TableRowSorterModelWrapper(DefaultRowSorter.ModelWrapper modelWrapperImplementation) {
    this.modelWrapperImplementation = modelWrapperImplementation;
}
 
源代码6 项目: MobyDroid   文件: JPanel_AppInstaller.java
public TableRowSorterModelWrapper(DefaultRowSorter.ModelWrapper modelWrapperImplementation) {
    this.modelWrapperImplementation = modelWrapperImplementation;
}
 
源代码7 项目: MobyDroid   文件: JPanel_AppManager.java
public TableRowSorterModelWrapper(DefaultRowSorter.ModelWrapper modelWrapperImplementation) {
    this.modelWrapperImplementation = modelWrapperImplementation;
}
 
源代码8 项目: MobyDroid   文件: JPanel_TaskManager.java
public TableRowSorterModelWrapper(DefaultRowSorter.ModelWrapper modelWrapperImplementation) {
    this.modelWrapperImplementation = modelWrapperImplementation;
}
 
源代码9 项目: megamek   文件: UnitSelectorDialog.java
public void run() {
    // Loading mechs can take a while, so it will have its own thread.
    // This prevents the UI from freezing, and allows the
    // "Please wait..." dialog to behave properly on various Java VMs.
    MechSummaryCache mscInstance = MechSummaryCache.getInstance();
    mechs = mscInstance.getAllMechs();

    // break out if there are no units to filter
    if (mechs == null) {
        System.err.println("No units to filter!");
    } else {
        unitModel.setData(mechs);
    }
    filterUnits();

    //initialize with the units sorted alphabetically by chassis
    ArrayList<SortKey> sortlist = new ArrayList<>();
    sortlist.add(new SortKey(MechTableModel.COL_CHASSIS,SortOrder.ASCENDING));
    //sortlist.add(new RowSorter.SortKey(MechTableModel.COL_MODEL,SortOrder.ASCENDING));
    tableUnits.getRowSorter().setSortKeys(sortlist);
    ((DefaultRowSorter<?, ?>)tableUnits.getRowSorter()).sort();

    tableUnits.invalidate(); // force re-layout of window
    pack();
    //setLocation(computeDesiredLocation());

    unitLoadingDialog.setVisible(false);

    // In some cases, it's possible to get here without an initialized
    // instance (loading a saved game without a cache).  In these cases,
    // we dn't care about the failed loads.
    if (mscInstance.isInitialized() && !useAlternate)
    {
        final Map<String, String> hFailedFiles =
            MechSummaryCache.getInstance().getFailedFiles();
        if ((hFailedFiles != null) && (hFailedFiles.size() > 0)) {
            // self-showing dialog
            new UnitFailureDialog(frame, hFailedFiles);
        }
    }
    GUIPreferences guip = GUIPreferences.getInstance();
    int width = guip.getMechSelectorSizeWidth();
    int height = guip.getMechSelectorSizeHeight();
    setSize(width,height);
}
 
 类所在包
 类方法
 同包方法