Java Code Examples for com.intellij.ui.table.JBTable#setColumnSelectionAllowed()

The following examples show how to use com.intellij.ui.table.JBTable#setColumnSelectionAllowed() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IgnoreSettingsPanel.java    From idea-gitignore with MIT License 5 votes vote down vote up
/** Create UI components. */
private void createUIComponents() {
    templatesListPanel = new TemplatesListPanel();
    editorPanel = new EditorPanel();
    editorPanel.setPreferredSize(new Dimension(Integer.MAX_VALUE, 200));

    templatesSplitter = new Splitter(false, 0.3f);
    templatesSplitter.setFirstComponent(templatesListPanel);
    templatesSplitter.setSecondComponent(editorPanel);

    languagesTable = new JBTable();
    languagesTable.setModel(new LanguagesTableModel());
    languagesTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    languagesTable.setColumnSelectionAllowed(false);
    languagesTable.setRowHeight(22);
    languagesTable.getColumnModel().getColumn(2).setCellRenderer(new BooleanTableCellRenderer() {
        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSel, boolean hasFocus,
                                                       int row, int column) {
            boolean editable = table.isCellEditable(row, column);
            Object newValue = editable ? value : null;
            return super.getTableCellRendererComponent(table, newValue, isSel, hasFocus, row, column);
        }
    });
    languagesTable.setPreferredScrollableViewportSize(
            new Dimension(-1, languagesTable.getRowHeight() * IgnoreBundle.LANGUAGES.size() / 2)
    );

    languagesTable.setStriped(true);
    languagesTable.setShowGrid(false);
    languagesTable.setBorder(JBUI.Borders.empty());
    languagesTable.setDragEnabled(false);

    languagesPanel = ScrollPaneFactory.createScrollPane(languagesTable);
}
 
Example 2
Source File: DirDiffDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
public DirDiffDialog(Project project, DirDiffTableModel model) {
  super(project);
  setModal(false);
  myModel = model;
  setTitle("Directory Diff");
  init();
  final JBTable table = myDiffPanel.getTable();
  table.setColumnSelectionAllowed(false);
  table.getTableHeader().setReorderingAllowed(false);
  table.getTableHeader().setResizingAllowed(false);
  Disposer.register(getDisposable(), myModel);
  Disposer.register(project, getDisposable());
}
 
Example 3
Source File: PatternFilterEditor.java    From KodeBeagle with Apache License 2.0 4 votes vote down vote up
public PatternFilterEditor(final Project project, final String patternsHelpId) {
    super(new BorderLayout());
    myPatternsHelpId = patternsHelpId;
    myTable = new JBTable();
    myProject = project;
    final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTable);
    decorator.addExtraAction(new AnActionButton(getAddPatternButtonText(),
            getAddPatternButtonIcon()) {
        @Override
        public void actionPerformed(final AnActionEvent e) {
            addPatternFilter();
        }
    });

    add(decorator.setRemoveAction(new AnActionButtonRunnable() {
        @Override
        public void run(final AnActionButton button) {
            TableUtil.removeSelectedItems(myTable);
        }
    }).setButtonComparator(getAddPatternButtonText(), "Remove")
            .disableUpDownActions().createPanel(), BorderLayout.CENTER);

    myTableModel = new FilterTableModel();
    myTable.setModel(myTableModel);
    myTable.setShowGrid(false);
    myTable.setShowGrid(false);
    myTable.setIntercellSpacing(new Dimension(0, 0));
    myTable.setTableHeader(null);
    myTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    myTable.setColumnSelectionAllowed(false);
    myTable.setPreferredScrollableViewportSize(new Dimension(WIDTH,
            myTable.getRowHeight() * PREFERRED_SCROLLABLE_VIEWPORT_HEIGHT_IN_ROWS));

    TableColumnModel columnModel = myTable.getColumnModel();
    TableColumn column = columnModel.getColumn(FilterTableModel.CHECK_MARK);
    TableUtil.setupCheckboxColumn(column);
    column.setCellRenderer(new EnabledCellRenderer(myTable.getDefaultRenderer(Boolean.class)));
    columnModel.getColumn(FilterTableModel.FILTER).setCellRenderer(new FilterCellRenderer());

    getEmptyText().setText(EMPTY_PATTERNS);
}