com.intellij.ui.BooleanTableCellEditor Java Examples
The following examples show how to use
com.intellij.ui.BooleanTableCellEditor.
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: AbstractTableGroupPanel.java From EasyCode with MIT License | 6 votes |
/** * 刷新类类型配置 */ private void refreshEditorType() { for (ColumnConfig column : columnConfigInfo) { TableColumn tableColumn = table.getColumn(column.getTitle()); switch (column.getType()) { case TEXT: break; case SELECT: tableColumn.setCellEditor(new ComboBoxCellEditor() { @Override protected List<String> getComboBoxItems() { return Arrays.asList(column.getSelectValue().split(",")); } }); break; case BOOLEAN: tableColumn.setCellEditor(new BooleanTableCellEditor()); break; default: break; } } }
Example #2
Source File: ConfigTableDialog.java From EasyCode with MIT License | 5 votes |
/** * 刷新列编辑器 * * @param columnConfigList 列配置集合 */ private void refreshColumnEditor(List<ColumnConfig> columnConfigList) { columnConfigList.forEach(columnConfig -> { TableColumn tableColumn = table.getColumn(columnConfig.getTitle()); int index = tableColumn.getModelIndex(); switch (columnConfig.getType()) { case TEXT: break; case SELECT: tableColumn.setCellEditor(new ComboBoxCellEditor() { @Override protected List<String> getComboBoxItems() { String selectValue = columnConfig.getSelectValue(); if (StringUtils.isEmpty(selectValue)) { //noinspection unchecked return Collections.EMPTY_LIST; } return Arrays.asList(columnConfig.getSelectValue().split(",")); } }); break; case BOOLEAN: //给空列赋初始值 for (int row = 0; row < tableModel.getRowCount(); row++) { if (tableModel.getValueAt(row, index) == null) { tableModel.setValueAt(false, row, index); } } tableColumn.setCellEditor(new BooleanTableCellEditor()); break; default: break; } }); }
Example #3
Source File: SearchSelectPanel.java From p4ic4idea with Apache License 2.0 | 4 votes |
public SearchSelectPanel(@NotNull P4CommandRunner.QueryAnswer<? extends Collection<T>> query, @Nullable final SelectionChangedListener listener, @NotNull List<ColumnInfo<T, ?>> columns) { super(new BorderLayout()); Runnable onSelectionChange = () -> { if (listener == null) { return; } int count = 0; synchronized (itemSync) { for (SelectedItem<T> item : items) { if (item.selected) { count++; } } } listener.selectionCount(count); }; ColumnInfo[] columnArray = new ColumnInfo[columns.size() + 1]; columnArray[0] = new BooleanColumnInfo<SelectedItem<T>>(P4Bundle.getString("search-select.column.selected"), true) { @Override protected boolean booleanValue(SelectedItem<T> o) { return o.selected; } @Override protected void setBooleanValue(SelectedItem<T> o, boolean value) { o.selected = value; onSelectionChange.run(); } }; this.searchableColumns = new ArrayList<>(columns.size()); for (int i = 0; i < columns.size(); i++) { ColumnInfo<T, ?> column = columns.get(i); columnArray[i + 1] = proxyColumnInfo(column, onSelectionChange); if (String.class.equals(column.getColumnClass())) { //noinspection unchecked searchableColumns.add((ColumnInfo<T, String>) column); } } tableModel = new ListTableModel<>(columnArray); final JBTable table = new JBTable(tableModel); table.getColumnModel().getColumn(0).setCellEditor(new BooleanTableCellEditor(false, SwingConstants.CENTER)); table.getColumnModel().getColumn(0).setCellRenderer(new BooleanTableCellRenderer(SwingConstants.CENTER)); this.add(new JBScrollPane(table), BorderLayout.CENTER); this.add(table.getTableHeader(), BorderLayout.NORTH); table.getEmptyText().setText(P4Bundle.getString("search-select.status.loading")); final FilterComponent filterComponent = new FilterComponent("search-select", 10, true) { @Override public void filter() { String text = getFilter(); filterTable(text); } }; this.add(filterComponent, BorderLayout.SOUTH); query .whenCompleted((tValues) -> { table.getEmptyText().setText(P4Bundle.getString("search-select.status.empty")); synchronized (itemSync) { items.clear(); tValues.forEach(t -> items.add(new SelectedItem<>(t))); } filterTable(filterComponent.getFilter()); }) .whenServerError(e -> { table.getEmptyText().setText(P4Bundle.message("search-select.status.error", e.getLocalizedMessage())); synchronized (itemSync) { items.clear(); } if (listener != null) { listener.selectionCount(-1); } }); }
Example #4
Source File: PluginAdvertiserPluginModel.java From consulo with Apache License 2.0 | 4 votes |
@Override public TableCellEditor getEditor(final PluginDescriptor o) { return new BooleanTableCellEditor(); }
Example #5
Source File: InstalledPluginsTableModel.java From consulo with Apache License 2.0 | 4 votes |
@Override public TableCellEditor getEditor(final PluginDescriptor o) { return new BooleanTableCellEditor(); }