當前位置: 首頁>>代碼示例>>Java>>正文


Java RowFilter.include方法代碼示例

本文整理匯總了Java中javax.swing.RowFilter.include方法的典型用法代碼示例。如果您正苦於以下問題:Java RowFilter.include方法的具體用法?Java RowFilter.include怎麽用?Java RowFilter.include使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.RowFilter的用法示例。


在下文中一共展示了RowFilter.include方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: EDACCFilter

import javax.swing.RowFilter; //導入方法依賴的package包/類
/**
 * Creates new form EDACCFilter. If the table has no instance of TableRowSorter a IllegalArgumentException is thrown.
 * @param parent The parent for this dialog
 * @param modal
 * @param table the table to be used for this filter
 * @param autoUpdateFilterTypes if this is set to true, the filter will updated the classes of the columns on each setVisible(true)
 */
public EDACCFilter(java.awt.Frame parent, boolean modal, JTable table, boolean autoUpdateFilterTypes) {
    this(parent, modal);
    if (!(table.getRowSorter() instanceof TableRowSorter)) {
        throw new IllegalArgumentException("Expected TableRowSorter.");
    }
    this.table = table;
    rowSorter = (TableRowSorter<? extends TableModel>) table.getRowSorter();
    final RowFilter oldRowFilter = rowSorter.getRowFilter();
    rowFilter = new RowFilter<Object, Object>() {

        @Override
        public boolean include(Entry<? extends Object, ? extends Object> entry) {
            return (oldRowFilter == null || oldRowFilter.include(entry)) && EDACCFilter.this.include(entry);
        }
    };
    rowSorter.setRowFilter(rowFilter);
    this.updateFilterTypes = autoUpdateFilterTypes;
}
 
開發者ID:EDACC,項目名稱:edacc_gui,代碼行數:26,代碼來源:EDACCFilter.java

示例2: EDACCGenerateJobsFilter

import javax.swing.RowFilter; //導入方法依賴的package包/類
/** Creates new form EDACCGenerateJobsFilter */
public EDACCGenerateJobsFilter(java.awt.Frame parent, boolean modal, JTable table, GenerateJobsTableModel model) {
    super(parent, modal);
    initComponents();

    this.table = table;
    this.model = model;
    TableRowSorter<? extends TableModel> rowSorter = (TableRowSorter<? extends TableModel>) table.getRowSorter();
    final RowFilter oldRowFilter = rowSorter.getRowFilter();
    RowFilter rowFilter = new RowFilter<Object, Object>() {

        @Override
        public boolean include(Entry<? extends Object, ? extends Object> entry) {
            return (oldRowFilter == null || oldRowFilter.include(entry)) && EDACCGenerateJobsFilter.this.include(entry);
        }
    };
    rowSorter.setRowFilter(rowFilter);
    instanceRegex = ".*";
    solverConfigRegex = ".*";
}
 
開發者ID:EDACC,項目名稱:edacc_gui,代碼行數:21,代碼來源:EDACCGenerateJobsFilter.java

示例3: include

import javax.swing.RowFilter; //導入方法依賴的package包/類
/**
 * Returns true if the specified row should be included.
 */
private boolean include(int row) {
	RowFilter<? super M, ? super I> filter = getRowFilter();
	if (filter != null) {
		return filter.include(getFilterEntry(row));
	}
	// null filter, always include the row.
	return true;
}
 
開發者ID:jedwards1211,項目名稱:breakout,代碼行數:12,代碼來源:AnnotatingRowSorter.java

示例4: annotate

import javax.swing.RowFilter; //導入方法依賴的package包/類
@Override
public RowFilter<M, I> annotate(Entry<? extends M, ? extends I> entry) {
	int resultCount = 0;

	for (RowFilter<M, I> filter : filters) {
		if (filter.include(entry)) {
			return filter;
		}
	}

	return null;
}
 
開發者ID:jedwards1211,項目名稱:breakout,代碼行數:13,代碼來源:RowAnnotator.java

示例5: recompute

import javax.swing.RowFilter; //導入方法依賴的package包/類
private void recompute(TableModel model) {
	if (model != currentModel) {
		if (currentModel != null) {
			currentModel.removeTableModelListener(this);
		}
		currentModel = model;
		currentModel.addTableModelListener(this);
	}
	// filterResults = null;
	filterResults = new boolean[model.getRowCount()];
	filterCount = 0;

	Entry<TableModel, Integer> fakeEntry = new Entry<TableModel, Integer>() {
		@Override
		public Integer getIdentifier() {
			return row;
		}

		@Override
		public TableModel getModel() {
			return model;
		}

		@Override
		public Object getValue(int index) {
			return model.getValueAt(row, index);
		}

		@Override
		public int getValueCount() {
			return model.getColumnCount();
		}
	};

	for (RowFilter<TableModel, Integer> filter : filters) {
		// boolean[] results = new boolean[model.getRowCount()];
		int count = 0;
		// continue condition stops when this filter can't possibly do
		// better
		// than the current best
		for (row = 0; row < model.getRowCount() && count + model.getRowCount() - row - 1 > filterCount; row++) {
			filterResults[row] |= filter.include(fakeEntry);
			// if (results[row] = filter.include(fakeEntry)) {
			// count++;
			// }
		}
		// if (filterResults == null || count > filterCount) {
		// filterResults = results;
		// filterCount = count;
		// }
	}
}
 
開發者ID:jedwards1211,項目名稱:breakout,代碼行數:53,代碼來源:SmartComboTableRowFilter.java


注:本文中的javax.swing.RowFilter.include方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。