Search in sources :

Example 1 with TableViewModel

use of com.intellij.util.ui.TableViewModel in project intellij-community by JetBrains.

the class FileHistoryPanelImpl method setupDualView.

private void setupDualView(@NotNull DefaultActionGroup group) {
    myDualView.setShowGrid(true);
    PopupHandler.installPopupHandler(myDualView.getTreeView(), group, ActionPlaces.UPDATE_POPUP, ActionManager.getInstance());
    PopupHandler.installPopupHandler(myDualView.getFlatView(), group, ActionPlaces.UPDATE_POPUP, ActionManager.getInstance());
    IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
        IdeFocusManager.getGlobalInstance().requestFocus(myDualView, true);
    });
    myDualView.addListSelectionListener(e -> updateMessage());
    myDualView.setRootVisible(false);
    myDualView.expandAll();
    final TreeCellRenderer defaultCellRenderer = myDualView.getTree().getCellRenderer();
    final Getter<VcsHistorySession> sessionGetter = () -> myHistorySession;
    myDualView.setTreeCellRenderer(new MyTreeCellRenderer(defaultCellRenderer, sessionGetter));
    myDualView.setCellWrapper(new MyCellWrapper(sessionGetter));
    myDualView.installDoubleClickHandler(new MyDiffAction());
    final TableView flatView = myDualView.getFlatView();
    TableViewModel sortableModel = flatView.getTableViewModel();
    sortableModel.setSortable(true);
    final RowSorter<? extends TableModel> rowSorter = flatView.getRowSorter();
    if (rowSorter != null) {
        rowSorter.setSortKeys(Collections.singletonList(new RowSorter.SortKey(0, SortOrder.DESCENDING)));
    }
}
Also used : TreeCellRenderer(javax.swing.tree.TreeCellRenderer) TableViewModel(com.intellij.util.ui.TableViewModel) TableView(com.intellij.ui.table.TableView) TreeTableView(com.intellij.ui.dualView.TreeTableView)

Aggregations

TreeTableView (com.intellij.ui.dualView.TreeTableView)1 TableView (com.intellij.ui.table.TableView)1 TableViewModel (com.intellij.util.ui.TableViewModel)1 TreeCellRenderer (javax.swing.tree.TreeCellRenderer)1