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


Java RowFilter.regexFilter方法代碼示例

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


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

示例1: updateFilter

import javax.swing.RowFilter; //導入方法依賴的package包/類
private void updateFilter(String filterText) 
{
	filterText = "(?i)" + filterText;
	@SuppressWarnings({ "rawtypes", "unchecked" })
	TableRowSorter<TopLevelTableModel> sorter = (TableRowSorter) table.getRowSorter();
	if (filterText.length() == 0) {
		sorter.setRowFilter(null);
	} else {
		try {
			RowFilter<TopLevelTableModel, Object> rf = RowFilter.regexFilter(filterText, 0, 1);
			sorter.setRowFilter(rf);
		} catch (java.util.regex.PatternSyntaxException e) {
			sorter.setRowFilter(null);
		}
	}

	tableLabel.setText("Matching parts (" + sorter.getViewRowCount() + ")");
}
 
開發者ID:MyersResearchGroup,項目名稱:iBioSim,代碼行數:19,代碼來源:SBOLInputDialog.java

示例2: filterTable

import javax.swing.RowFilter; //導入方法依賴的package包/類
/**
 * gestisce filtri multicampo sulla tabella
 *
 * @param table tabella
 * @param text testo cercato
 * @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 idx : idxs) {
            table.getColumnModel().getColumn(idx).setCellRenderer(new JTableCellRender(text));
            RowFilter<TableModel, Integer> filterC1 = RowFilter.regexFilter("(?i)" + text, idx);
            filters.add(filterC1);
        }
        RowFilter<TableModel, Integer> filter = RowFilter.orFilter(filters);
        sorter.setRowFilter(filter);
    } else {
        sorter.setRowFilter(null);
    }

    table.setRowSorter(sorter);
}
 
開發者ID:fiohol,項目名稱:theSemProject,代碼行數:26,代碼來源:GuiUtils.java

示例3: updateFilter

import javax.swing.RowFilter; //導入方法依賴的package包/類
private void updateFilter(String filterText) {
	filterText = "(?i)" + filterText;
	@SuppressWarnings({ "rawtypes", "unchecked" })
	TableRowSorter<ComponentDefinitionTableModel> sorter = (TableRowSorter) table.getRowSorter();
	if (filterText.length() == 0) {
		sorter.setRowFilter(null);
	} else {
		try {
			RowFilter<ComponentDefinitionTableModel, Object> rf = RowFilter.regexFilter(filterText, 0, 1);
			sorter.setRowFilter(rf);
		} catch (java.util.regex.PatternSyntaxException e) {
			sorter.setRowFilter(null);
		}
	}

	tableLabel.setText("Matching parts (" + sorter.getViewRowCount() + ")");
}
 
開發者ID:SynBioDex,項目名稱:SBOLDesigner,代碼行數:18,代碼來源:PartInputDialog.java

示例4: updateFilter

import javax.swing.RowFilter; //導入方法依賴的package包/類
private void updateFilter(String filterText) {
	filterText = "(?i)" + filterText;
	@SuppressWarnings({ "rawtypes", "unchecked" })
	TableRowSorter<SequenceTableModel> sorter = (TableRowSorter) table.getRowSorter();
	if (filterText.length() == 0) {
		sorter.setRowFilter(null);
	} else {
		try {
			RowFilter<SequenceTableModel, Object> rf = RowFilter.regexFilter(filterText, 0, 1);
			sorter.setRowFilter(rf);
		} catch (java.util.regex.PatternSyntaxException e) {
			sorter.setRowFilter(null);
		}
	}

	tableLabel.setText("Matching sequences (" + sorter.getViewRowCount() + ")");
}
 
開發者ID:SynBioDex,項目名稱:SBOLDesigner,代碼行數:18,代碼來源:SequenceInputDialog.java

示例5: interactiveRevalidateOnUpdateWithFilter

import javax.swing.RowFilter; //導入方法依賴的package包/類
/**
 * Issue #1254-swingx: JXTable not revalidated on update if filter.
 * 
 * Core JTable issue 
 * Problem is that the update might change the visible row count.
 */
public void interactiveRevalidateOnUpdateWithFilter() {
    String data[][] = { { "satuAA", "Satu", "SATU", "1" },
            { "duaAAB", "Dua", "DUA", "2" },
            { "tigaBAA", "Tiga", "TIGA", "3" },
            { "empatBBA", "Empat", "EMPAT", "4" } };
    String cols[] = { "col1", "col2", "col3", "col4" };

    final JXTable table = new JXTable(data, cols);
    RowFilter<TableModel, Integer> tm = RowFilter.regexFilter(
            ".*AA.*", 0);
    table.setRowFilter(tm);
    JXFrame frame = wrapWithScrollingInFrame(table, "Update with RowFilter");
    Action action = new AbstractAction("filter first row") {
        
        boolean hasAA = true;
        @Override
        public void actionPerformed(ActionEvent e) {
            String newValue = hasAA ? "BB" : "AA";
            hasAA = !hasAA;
            table.getModel().setValueAt(newValue, 0, 0);
        }
    };
    addAction(frame, action);
    show(frame);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:32,代碼來源:JXTableVisualCheck.java

示例6: execute

import javax.swing.RowFilter; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public void execute(MVCEvent argEvent) {
      	ToggleDisabledUsersEvent event = (ToggleDisabledUsersEvent) argEvent;
      	boolean show = event.show;
      	TableRowSorter<SecurityUserTableModelA> usersSorter = event.model.getUsersSorterA();
      	if(show){
      		usersSorter.setRowFilter(null);
      	}
      	else	
      	{
  	        RowFilter<SecurityUserTableModelA, Object> rf = null;
  	        //If current expression doesn't parse, don't update.
  	        try {
  	            rf = RowFilter.regexFilter("t", 5);
  	        } catch (java.util.regex.PatternSyntaxException e) {
  	            return;
  	        }
  	        usersSorter.setRowFilter(rf);
      	}
      }
 
開發者ID:ltrr-arizona-edu,項目名稱:tellervo,代碼行數:21,代碼來源:ToggleDisabledUsersCommand.java

示例7: 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);
}
 
開發者ID:noproblan,項目名稱:npl-cash,代碼行數:19,代碼來源:MainWindow.java

示例8: 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);
}
 
開發者ID:noproblan,項目名稱:npl-cash,代碼行數:25,代碼來源:MainWindow.java

示例9: 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);
}
 
開發者ID:noproblan,項目名稱:npl-cash,代碼行數:19,代碼來源:MainWindow.java

示例10: 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);
}
 
開發者ID:noproblan,項目名稱:npl-cash,代碼行數:19,代碼來源:MainWindow.java

示例11: search

import javax.swing.RowFilter; //導入方法依賴的package包/類
/** Updates the table filtering using the regex field. */
private void search() {
    RowFilter<CollectorMetadataTableModel, Integer> filter;
    try {
        // Get the search text
        String text = findField.getText();
    
        // Set it as a filter
        filter = RowFilter.regexFilter(text);
    }
    catch (PatternSyntaxException pse) {
        // Bad regex
        filter = null;
    }
    
    sorter.setRowFilter(filter);
}
 
開發者ID:stucco,項目名稱:collectors,代碼行數:18,代碼來源:CollectorMetadataUtility.java

示例12: tblFilter

import javax.swing.RowFilter; //導入方法依賴的package包/類
/**
    * Row filter for updating table view based on the expression in the text box Used for searching components
    */
   @SuppressWarnings("unchecked")
public void tblFilter() {
	
   	RowFilter<DefaultTableModel, Object> rf = null;
	// If current expression doesn't parse, don't update.
	try {
	    rf = RowFilter.regexFilter("(?i).*(" + getJTextFieldSearch().getText() + ").*", 0, 1);
	} catch (java.util.regex.PatternSyntaxException e) {
	    return;
	}
	((TableRowSorter<DefaultTableModel>)this.getJTableComponents().getRowSorter()).setRowFilter(rf);
	this.setNumberOfComponents();

   }
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:18,代碼來源:BasicGraphGuiRootJSplitPane.java

示例13: testListGetStringUsedInPatternFilter

import javax.swing.RowFilter; //導入方法依賴的package包/類
/**
 * Issue #1152-swingx: re-enable filtering with single-string-representation.
 * was: Issue #767-swingx: consistent string representation.
 * 
 * Here: test Pattern filtering uses string rep
 */
@Test
public void testListGetStringUsedInPatternFilter() {
    JXList list = new JXList(AncientSwingTeam.createNamedColorListModel(), true);
    list.setCellRenderer(new DefaultListRenderer(sv));
    RowFilter<Object, Integer> filter = RowFilter.regexFilter("R/G/B: -2.*", 0);
    list.setRowFilter(filter);
    assertTrue(list.getElementCount() > 0);
    assertEquals(sv.getString(list.getElementAt(0)), list.getStringAt(0));
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:16,代碼來源:JXListTest.java

示例14: testTableGetStringUsedInPatternFilter

import javax.swing.RowFilter; //導入方法依賴的package包/類
/**
 * Issue #1145-swingx: re-enable filtering with single-string-representation.
 * was: Issue #767-swingx: consistent string representation.
 * 
 * Here: test PatternFilter uses getStringXX
 */
@Test
public void testTableGetStringUsedInPatternFilter() {
    JXTableT table = new JXTableT(new AncientSwingTeam());
    table.setDefaultRenderer(Color.class, new DefaultTableRenderer(sv));
    RowFilter<Object, Integer> filter = RowFilter.regexFilter("R/G/B: -2.*", 2);
    table.setRowFilter(filter);
    assertTrue(table.getRowCount() > 0);
    assertEquals(sv.getString(table.getValueAt(0, 2)), table.getStringAt(0, 2));
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:16,代碼來源:JXTableUnitTest.java

示例15: testToViewAfterRemoveAllPassFilter

import javax.swing.RowFilter; //導入方法依賴的package包/類
/**
 * Core Issue http://forums.sun.com/thread.jspa?messageID=10939199#10939199
 * 
 * Table looses selection of last row if deleted before last.
 * 
 * Here: after being notified, DefaultRowSorter must throw on invalid index 
 */
@Test (expected = IndexOutOfBoundsException.class)
public void testToViewAfterRemoveAllPassFilter() {
    RowFilter<Object, Object> filter = RowFilter.regexFilter(".*");
    sorter.setRowFilter(filter);
    model.removeRow(rows - 1);
    sorter.rowsDeleted(rows - 1, rows - 1);
    sorter.convertRowIndexToView(rows - 1);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:16,代碼來源:DefaultSortControllerTest.java


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