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


Java RowSorter.setSortKeys方法代碼示例

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


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

示例1: setRowSorter

import javax.swing.RowSorter; //導入方法依賴的package包/類
public void setRowSorter(RowSorter<? extends TableModel> sorter) {
    if (! (sorter instanceof TransactionTableRowSorter)) {
        sorter = new TransactionTableRowSorter(this);
    }
    sorter.setSortKeys(Collections.singletonList(defaultSortKey()));
    super.setRowSorter(sorter);
}
 
開發者ID:jonestimd,項目名稱:finances,代碼行數:8,代碼來源:TransactionTable.java

示例2: mouseClicked

import javax.swing.RowSorter; //導入方法依賴的package包/類
@Override
public void mouseClicked(MouseEvent e) {
    GridColumnsNode colGroup = cell.getColGroup();
    if (colGroup.isLeaf() && colGroup.isSortable() && colGroup.getTableColumn() != null
            && cell.getHeader().getRowSorter() != null) {
        RowSorter rowSorter = cell.getHeader().getRowSorter();
        int modelIndex = colGroup.getTableColumn().getModelIndex();
        if (!e.isControlDown() && (rowSorter.getSortKeys().size() != 1 || ((RowSorter.SortKey)rowSorter.getSortKeys().get(0)).getColumn() != modelIndex)) {
            rowSorter.setSortKeys(new ArrayList<>());
        }
        rowSorter.toggleSortOrder(modelIndex);
    }
}
 
開發者ID:marat-gainullin,項目名稱:platypus-js,代碼行數:14,代碼來源:CellSortingToggler.java

示例3: resetSort

import javax.swing.RowSorter; //導入方法依賴的package包/類
public void resetSort() {
	for (int i = 0; i < getColumnCount(); i++) {
		RowSorter<?> sorter = getRowSorter();
		List<SortKey> sortKeys = new ArrayList<>();
		sortKeys.add(new RowSorter.SortKey(i, SortOrder.UNSORTED));
		sorter.setSortKeys(sortKeys);
	}
}
 
開發者ID:Mikescher,項目名稱:jClipCorn,代碼行數:9,代碼來源:SFixTable.java

示例4: fillServerTable

import javax.swing.RowSorter; //導入方法依賴的package包/類
private void fillServerTable() {
    final DefaultTableModel model = (DefaultTableModel) serverTable.getModel();

    // reset sort order
    final RowSorter<? extends TableModel> rowSorter = serverTable.getRowSorter();
    rowSorter.setSortKeys(null);

    // remove all rows
    model.setNumRows(0);
    displayedServerList.clear();
    tServerURL.setText("");

    // add new rows
    boolean isCC = (session.getServiceType() == GameServiceType.ClassiCubeNetService);
    final String searchTerm = tSearch.getText().toLowerCase();
    for (final ServerListEntry server : serverList) {
        if (server.name.toLowerCase().contains(searchTerm)) {
            displayedServerList.add(server);
            model.addRow(new Object[]{
                server.name.replaceAll("\\s+", " "), // strip consecutive spaces
                server.players,
                server.maxPlayers,
                server.uptime,
                // CC.net servers show "Software" in the last column.
                // MC.net servers show "Country" instead.
                (isCC ? server.software : ServerListEntry.toCountryName(server.flag))
            });
        }
    }

    // select first server
    if (model.getRowCount() > 0) {
        serverTable.setRowSelectionInterval(0, 0);
    }
}
 
開發者ID:fragmer,項目名稱:ClassiCubeLauncher,代碼行數:36,代碼來源:ServerListScreen.java

示例5: resortByDefault

import javax.swing.RowSorter; //導入方法依賴的package包/類
void resortByDefault () {
    RowSorter sorter = getRowSorter();
    sorter.setSortKeys(Arrays.asList(new RowSorter.SortKey(2, SortOrder.ASCENDING)));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:UnitTable.java

示例6: setData

import javax.swing.RowSorter; //導入方法依賴的package包/類
public void setData(List<Heuristic> heuristics) {
    if (heuristics == null || heuristics.isEmpty()) {
        return;
    }
    
    List<Heuristic> checkedHeuristics = checkHeuristics(heuristics);
    
    String[][] data = new String[checkedHeuristics.size()][HEADERS.length];
    
    int index = 0;
    
    // Add sorting option to the columns!
    for (Heuristic h : checkedHeuristics) {
        if (h == null) {
            continue;
        }
        
        String name = h.getName();
        
        if (name == null || name.isEmpty()) {
            continue;
        }
        
        String summary = h.getSummary();
        String desc = h.getDescription();
        
        //heuristicSummaryMap.put(name, summary);
        heuristicsList.add(h);
        
        Boolean result = h.getResult();
        
        data[index][0] = name;
        
        //data[index][1] = h.getType();
        
        String status = null;
        
        if (Boolean.TRUE.equals(result)) {
            status = IHeuristic.STATUS_UNSAFE;
        } else if (Boolean.FALSE.equals(result)) {
            status = IHeuristic.STATUS_SAFE;
        } else {
            status = IHeuristic.STATUS_UNKNOWN;
        }
        
        data[index][COLUMN_INDEX_STATUS] = status;
        
        index++;
    }
    
    RowSorter sorter = table.getRowSorter();
    
    if (sorter != null) {
        try {
            sorter.setSortKeys(Arrays.asList(new RowSorter.SortKey(COLUMN_INDEX_STATUS, SortOrder.DESCENDING)));
        } catch (Exception e) {
            // ignore
        }
    }
    
    model.setData(data);
    model.fireTableDataChanged();
}
 
開發者ID:samini,項目名稱:gort-public,代碼行數:64,代碼來源:HeuristicsTable.java


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