本文整理匯總了Java中javax.swing.RowFilter.andFilter方法的典型用法代碼示例。如果您正苦於以下問題:Java RowFilter.andFilter方法的具體用法?Java RowFilter.andFilter怎麽用?Java RowFilter.andFilter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.RowFilter
的用法示例。
在下文中一共展示了RowFilter.andFilter方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configureFilters
import javax.swing.RowFilter; //導入方法依賴的package包/類
protected void configureFilters() {
if (showOnlyWinners && hasFilterString()) {
List<RowFilter<OscarTableModel, Integer>> filters =
new ArrayList<RowFilter<OscarTableModel, Integer>>(2);
filters.add(winnerFilter);
filters.add(searchFilter);
RowFilter<OscarTableModel, Integer> comboFilter = RowFilter.andFilter(filters);
sorter.setRowFilter(comboFilter);
} else if (showOnlyWinners) {
sorter.setRowFilter(winnerFilter);
} else if (hasFilterString()) {
sorter.setRowFilter(searchFilter);
} else {
sorter.setRowFilter(null);
}
tableStatus.setText((hasFilterString() ? searchLabelString : statusLabelString)
+ oscarTable.getRowCount());
}
示例2: filterTable
import javax.swing.RowFilter; //導入方法依賴的package包/類
/**
* gestisce filtri diversi su campi diversi sulla tabella
*
* @since 1.7
*
* @param table tabella
* @param text testi cercati
* @param idxs elenco degli id dei campi dove cercare
*/
public static void filterTable(JTable table, String text[], int idxs[]) {
TableRowSorter<TableModel> sorter = (TableRowSorter<TableModel>) table.getRowSorter();
List<RowFilter<TableModel, Integer>> filters = new ArrayList<>(idxs.length);
if (text != null && text.length > 0) {
for (int i = 0; i < idxs.length; i++) {
if (text[i] != null && text[i].length() > 0) {
LogGui.info("Aggiungo filtro " + text[i] + " su colonna "
+ idxs[i]);
table.getColumnModel().getColumn(idxs[i]).setCellRenderer(new JTableCellRender(text[i]));
RowFilter<TableModel, Integer> filterC1 = RowFilter.regexFilter("(?i)" + text[i], idxs[i]);
filters.add(filterC1);
}
}
RowFilter<TableModel, Integer> filter = RowFilter.andFilter(filters);
sorter.setRowFilter(filter);
} else {
sorter.setRowFilter(null);
}
table.setRowSorter(sorter);
}
示例3: configureFilters
import javax.swing.RowFilter; //導入方法依賴的package包/類
protected void configureFilters() {
if (showOnlyWinners && hasFilterString()) {
List<RowFilter<OscarTableModel, Integer>> filters = new ArrayList<RowFilter<OscarTableModel, Integer>>(
2);
filters.add(winnerFilter);
filters.add(searchFilter);
// RowFilter<Object, Object> comboFilter =
// RowFilter.andFilter(filters);
RowFilter<OscarTableModel, Integer> comboFilter = RowFilter
.<OscarTableModel, Integer> andFilter(filters);
sorter.setRowFilter(comboFilter);
} else if (showOnlyWinners) {
sorter.setRowFilter(winnerFilter);
} else if (hasFilterString()) {
sorter.setRowFilter(searchFilter);
} else {
sorter.setRowFilter(null);
}
tableStatus.setText((hasFilterString() ? searchLabelString
: statusLabelString) + oscarTable.getRowCount());
}
示例4: updateFilters
import javax.swing.RowFilter; //導入方法依賴的package包/類
private void updateFilters() {
// <snip> Filter control
// set the filters to the table
if ((searchFilter != null) && (winnerFilter != null)) {
List<RowFilter<Object, Object>> filters =
new ArrayList<RowFilter<Object, Object>>(2);
filters.add(winnerFilter);
filters.add(searchFilter);
RowFilter<Object, Object> comboFilter = RowFilter.andFilter(filters);
oscarTable.setRowFilter(comboFilter);
} else if (searchFilter != null) {
oscarTable.setRowFilter(searchFilter);
} else {
oscarTable.setRowFilter(winnerFilter);
}
// </snip>
}
示例5: newFilter
import javax.swing.RowFilter; //導入方法依賴的package包/類
private void newFilter() { //Filter the mods in Download Mods based off mod tags and search filter
String regex = "";
String comboText = "";
if(!txtFilterText.getText().equals("Filter Text")){
regex = "(?i)" + Pattern.quote(txtFilterText.getText().toLowerCase());
}
if(!comboBox.getSelectedItem().toString().equals("No tag filter")){
comboText = "(?i)" + Pattern.quote(comboBox.getSelectedItem().toString());
}
List<RowFilter<Object,Object>> rfs = new ArrayList<RowFilter<Object,Object>>(2);
rfs.add(RowFilter.regexFilter(regex, 0,1,2));
rfs.add(RowFilter.regexFilter(comboText, 3));
RowFilter<DefaultTableModel, Object> rf = null;
//If current expression doesn't parse, don't update.
try {
//rf = RowFilter.regexFilter(regex,0,1,2,3);
rf = RowFilter.andFilter(rfs);
} catch (java.util.regex.PatternSyntaxException e) {
return;
}
tSorter.setRowFilter(rf);
}
示例6: filterUserTable
import javax.swing.RowFilter; //導入方法依賴的package包/類
protected void filterUserTable() {
@SuppressWarnings("unchecked")
TableRowSorter<UserTableModel> sorterUsers = (TableRowSorter<UserTableModel>) userTable.getRowSorter();
RowFilter<UserTableModel, Object> finalFilterUser = null;
try {
finalFilterUser = RowFilter.regexFilter(".*");
ArrayList<RowFilter<UserTableModel, Object>> filtersUsers = new ArrayList<RowFilter<UserTableModel, Object>>(0);
// Nehme Suchfeld als Filter dazu
RowFilter<UserTableModel, Object> searchFilter = RowFilter.regexFilter(getWildcardRegex(userSearchTextField.getText()));
filtersUsers.add(searchFilter);
finalFilterUser = RowFilter.andFilter(filtersUsers);
} catch (java.util.regex.PatternSyntaxException ex) {
return;
}
sorterUsers.setRowFilter(finalFilterUser);
}
示例7: filterTransactionTable
import javax.swing.RowFilter; //導入方法依賴的package包/類
protected void filterTransactionTable() {
@SuppressWarnings("unchecked")
TableRowSorter<TransactionTableModel> sorterTransactions = (TableRowSorter<TransactionTableModel>) transactionTable.getRowSorter();
RowFilter<TransactionTableModel, Object> finalFilterTransaction = null;
try {
finalFilterTransaction = RowFilter.regexFilter(".*");
ArrayList<RowFilter<TransactionTableModel, Object>> filtersTransactions = new ArrayList<RowFilter<TransactionTableModel, Object>>(0);
// Nehme Suchfeld als Filter dazu
RowFilter<TransactionTableModel, Object> searchFilter = RowFilter.regexFilter(getWildcardRegex(transactionSearchTextField.getText()));
filtersTransactions.add(searchFilter);
// nehme Checkbox "inkl. Bestellungen" als Filer dazu
if (checkboxInclOrderings.isSelected()) {
RowFilter<TransactionTableModel, Object> availableFilterLoan = RowFilter.regexFilter("^0$", 3);
filtersTransactions.add(availableFilterLoan);
}
finalFilterTransaction = RowFilter.andFilter(filtersTransactions);
} catch (java.util.regex.PatternSyntaxException ex) {
return;
}
sorterTransactions.setRowFilter(finalFilterTransaction);
}
示例8: filterOrderingTable
import javax.swing.RowFilter; //導入方法依賴的package包/類
protected void filterOrderingTable() {
@SuppressWarnings("unchecked")
TableRowSorter<OrderingTableModel> sorterOrdering = (TableRowSorter<OrderingTableModel>) orderingTable.getRowSorter();
RowFilter<OrderingTableModel, Object> finalFilterOrdering = null;
try {
finalFilterOrdering = RowFilter.regexFilter(".*");
ArrayList<RowFilter<OrderingTableModel, Object>> filtersOrdering = new ArrayList<RowFilter<OrderingTableModel, Object>>(0);
// Nehme Suchfeld als Filter dazu
RowFilter<OrderingTableModel, Object> searchFilter = RowFilter.regexFilter(getWildcardRegex(orderingSearchTextField.getText()));
filtersOrdering.add(searchFilter);
finalFilterOrdering = RowFilter.andFilter(filtersOrdering);
} catch (java.util.regex.PatternSyntaxException ex) {
return;
}
sorterOrdering.setRowFilter(finalFilterOrdering);
}
示例9: filterKitchenTable
import javax.swing.RowFilter; //導入方法依賴的package包/類
protected void filterKitchenTable() {
@SuppressWarnings("unchecked")
TableRowSorter<KitchenTableModel> sorterKitchen = (TableRowSorter<KitchenTableModel>) kitchenTable.getRowSorter();
RowFilter<KitchenTableModel, Object> finalFilterKitchen = null;
try {
finalFilterKitchen = RowFilter.regexFilter(".*");
ArrayList<RowFilter<KitchenTableModel, Object>> filtersKitchen = new ArrayList<RowFilter<KitchenTableModel, Object>>(0);
// Nehme Suchfeld als Filter dazu
RowFilter<KitchenTableModel, Object> searchFilter = RowFilter.regexFilter(getWildcardRegex(kitchenSearchTextField.getText()));
filtersKitchen.add(searchFilter);
finalFilterKitchen = RowFilter.andFilter(filtersKitchen);
} catch (java.util.regex.PatternSyntaxException ex) {
return;
}
sorterKitchen.setRowFilter(finalFilterKitchen);
}
示例10: filterAvailMeas
import javax.swing.RowFilter; //導入方法依賴的package包/類
/**
* Update the filter used to remove series from the list which don't match
* the requested criteria. The filter works on the list returned from the
* search and is used for simple filtering to stop the need for extra
* requests to the webservice.
*/
private void filterAvailMeas() {
List<RowFilter<ElementListTableModel, Object>> filters = new ArrayList<RowFilter<ElementListTableModel, Object>>(2);
RowFilter<ElementListTableModel, Object> seriesTypeFilter = null;
RowFilter<ElementListTableModel, Object> authorFilter = null;
RowFilter<ElementListTableModel, Object> versionFilter = null;
// Series Type
if (cboSeriesType.getSelectedIndex()==1){
seriesTypeFilter = RowFilter.regexFilter("Raw", 3);
} else if (cboSeriesType.getSelectedIndex()==2){
seriesTypeFilter = RowFilter.regexFilter("Raw", 3);
seriesTypeFilter = RowFilter.notFilter(seriesTypeFilter);
} else {
seriesTypeFilter = RowFilter.regexFilter("", 3);
}
// Author Filter
if (btnTogByMe.isSelected()){
authorFilter = RowFilter.regexFilter(App.currentUser.getFirstName() + " " + App.currentUser.getLastName(), 2);
} else {
authorFilter = RowFilter.regexFilter("", 2);
}
if (this.btnTogMostRecent.isSelected()){
versionFilter = RowFilter.regexFilter("true", 11);
} else {
versionFilter = RowFilter.regexFilter("", 11);
}
// Add all filters together
filters.add(seriesTypeFilter);
filters.add(authorFilter);
filters.add(versionFilter);
RowFilter<ElementListTableModel,Object> allFilters = RowFilter.andFilter(filters);
// Apply filters
rowFilter.setRowFilter(allFilters);
}
示例11: newFilter
import javax.swing.RowFilter; //導入方法依賴的package包/類
private void newFilter() {
RowFilter<AddProjectTableModel, Object> rf = null;
try {
String[] texts = jTextFieldFilter.getText().split(" ");
List<RowFilter<Object,Object>> filters = new ArrayList<RowFilter<Object,Object>>(2);
for(String text:texts) {
final String key = text;
RowFilter<Object, Object> containsKeywordFilter = new RowFilter<Object, Object>() {
private String keyword = key.toLowerCase();
public boolean include(Entry<? extends Object, ? extends Object> entry) {
String value = entry.getStringValue(projectListTableModel.COL_PROJECT_NAME);
if(value==null)
return false;
value = value.toLowerCase();
if(value.contains(keyword))
return true;
return false;
}
};
filters.add(containsKeywordFilter);
}
rf = RowFilter.andFilter(filters);
} catch (java.util.regex.PatternSyntaxException e) {
log.warn(e);
return;
}
sorter.setRowFilter(rf);
}
示例12: filterTable
import javax.swing.RowFilter; //導入方法依賴的package包/類
private void filterTable(String text)
{
String filterString = text;
ArrayList<RowFilter<TableModel, Object>> andFilter = new ArrayList<RowFilter<TableModel, Object>>(1); //split.length);
ArrayList<RowFilter<TableModel, Object>> subFilter;
RowFilter<TableModel, Object> rf;
RowFilter<TableModel, Object> rf0;
try
{
subFilter = new ArrayList<RowFilter<TableModel, Object>>(1); //split.length);
for (Integer i = 0; i < model.getColumnCount(); i++)
{
rf0 = RowFilter.regexFilter("^(?i)" + filterString, i);
subFilter.add(rf0);
}
rf = RowFilter.orFilter(subFilter);
andFilter.add(rf);
}
catch (PatternSyntaxException pse)
{
Log.error(pse);
}
RowFilter<TableModel, Object> rowf = RowFilter.andFilter(andFilter);
sorter.setRowFilter(rowf);
}
示例13: if
import javax.swing.RowFilter; //導入方法依賴的package包/類
private RowFilter<MatchedInfoTableModel, Object> getRowFilterForStringSearchLicense
(String stringSearchLicense, FileSummary fileSummary) {
RowFilter<MatchedInfoTableModel, Object> rowFilter = null;
for(CodeMatchInfo codeMatchInfo: fileSummary.getCodeMatchInfoList()) {
if(codeMatchInfo.getIdentifiedInfo() != null)
return null;
}
if(stringSearchLicense == null || stringSearchLicense.length() == 0)
return null;
boolean isFilterNeeded = false;
for(CodeMatchInfo tmpCodeMatchUnit: fileSummary.getCodeMatchInfoList()) {
if(stringSearchLicense.equals(tmpCodeMatchUnit.getLicenseName())
&& tmpCodeMatchUnit.getPercentage() == 100
) {
isFilterNeeded = true;
break;
}
}
if(isFilterNeeded == false)
return null;
try {
List<RowFilter<Object,Object>> filters = new ArrayList<RowFilter<Object,Object>>(2);
final String key = stringSearchLicense;
RowFilter<Object, Object> containsKeywordFilter = new RowFilter<Object, Object>() {
private String keyword = key.toLowerCase();
public boolean include(Entry<? extends Object, ? extends Object> entry) {
String value = entry.getStringValue(TableModelForCMFile.COL_LICENSE_NAME);
if(value==null)
return false;
value = value.toLowerCase();
if(value.contains(keyword))
return true;
return false;
}
};
filters.add(containsKeywordFilter);
rowFilter = RowFilter.andFilter(filters);
} catch (java.util.regex.PatternSyntaxException e) {
log.warn(e);
return null;
}
return rowFilter;
}