本文整理汇总了Java中com.intellij.ui.table.JBTable.setCellSelectionEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java JBTable.setCellSelectionEnabled方法的具体用法?Java JBTable.setCellSelectionEnabled怎么用?Java JBTable.setCellSelectionEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.table.JBTable
的用法示例。
在下文中一共展示了JBTable.setCellSelectionEnabled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupTable
import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
private void setupTable() {
myTable = new JBTable();
myTableModel = new MyTableModel();
myTable.setModel(myTableModel);
myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
refreshValidatingComponent();
}
});
myTable.setCellSelectionEnabled(false);
myTable.setColumnSelectionAllowed(false);
myTable.setRowSelectionAllowed(false);
myTable.getTableHeader().setReorderingAllowed(false);
}
示例2: createTable
import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
private JComponent createTable(List<String[]> properties) {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
JBTable table = new JBTable(new AuditModel(properties));
table.setDefaultRenderer(String.class, new MyTableCellRenderer());
table.setRowSelectionAllowed(false);
table.setColumnSelectionAllowed(false);
table.setCellSelectionEnabled(false);
table.setShowGrid(false);
table.setShowHorizontalLines(true);
table.setGridColor(table.getGridColor().brighter());
table.getTableHeader().setResizingAllowed(false);
table.getTableHeader().setDefaultRenderer(new MyHeaderCellRenderer());
panel.add(table.getTableHeader());
panel.add(table);
return panel;
}
示例3: createFilterTable
import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
protected JPanel createFilterTable(final E query, final Metadata metadata) {
final EntityFilterTableModel<E> model = new EntityFilterTableModel<E>(project, metadata, query, hiddenFields);
JBTable table = new JBTable() {
public TableCellEditor getCellEditor(int row, int col) {
int modelRow = convertRowIndexToModel(row);
Field field = model.getFields().get(modelRow);
FilterFactory factory = fieldManager.getFilterFactory(new Context<E>(query), entityType, field, true);
if(factory != null) {
if(factory.getCustomChoices() == null) {
return new ReferenceCellEditor(factory, model);
} else {
return new LookupCellEditor(factory.getCustomChoices(), false);
}
} else if(field.getListId() != null) {
List<String> list = project.getComponent(ProjectListService.class).getProjectList(entityType, field);
return new LookupCellEditor(list, true);
} else {
return super.getCellEditor(row, col);
}
}
};
table.setRowSelectionAllowed(false);
table.setCellSelectionEnabled(true);
table.setModel(model);
TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model);
table.setRowSorter(sorter);
new TableFilterHeader(table);
model.addTableModelListener(new TableModelListener() {
public void tableChanged(TableModelEvent tableModelEvent) {
queryModel.fireFilterUpdated(true);
}
});
sorter.setSortKeys(Arrays.asList(new RowSorter.SortKey(0, SortOrder.ASCENDING)));
JPanel panel = new JPanel(new BorderLayout());
panel.add(new JBScrollPane(table), BorderLayout.CENTER);
return panel;
}
示例4: createCenterPanel
import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
protected JComponent createCenterPanel() {
myTable = new JBTable(myTableModel);
myTable.setStriped(true);
TableColumn nameColumn = myTable.getColumnModel().getColumn(NAME_COLUMN);
TableColumn valueColumn = myTable.getColumnModel().getColumn(VALUE_COLUMN);
Project project = myClass.getProject();
nameColumn.setCellRenderer(new MyCellRenderer());
nameColumn.setCellEditor(new StringTableCellEditor(project));
valueColumn.setCellRenderer(new MyCodeFragmentTableCellRenderer());
valueColumn.setCellEditor(new JavaCodeFragmentTableCellEditor(project));
myTable.setPreferredScrollableViewportSize(new Dimension(210, myTable.getRowHeight() * 4));
myTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
myTable.getSelectionModel().setSelectionInterval(0, 0);
myTable.setSurrendersFocusOnKeystroke(true);
myTable.setCellSelectionEnabled(true);
myTable.setFocusCycleRoot(true);
if (myHideDefaultValueColumn) {
final TableColumn defaultValue = myTable.getColumnModel().getColumn(VALUE_COLUMN);
myTable.removeColumn(defaultValue);
myTable.getModel().addTableModelListener(new TableModelListener() {
@Override
public void tableChanged(TableModelEvent e) {
if (e.getType() == TableModelEvent.INSERT) {
myTable.getModel().removeTableModelListener(this);
final TableColumnAnimator animator = new TableColumnAnimator(myTable);
animator.setStep(20);
animator.addColumn(defaultValue, myTable.getWidth() / 2);
animator.startAndDoWhenDone(new Runnable() {
@Override
public void run() {
myTable.editCellAt(myTable.getRowCount() - 1, 0);
}
});
animator.start();
}
}
});
}
final JPanel panel = new JPanel(new BorderLayout());
panel.add(SeparatorFactory.createSeparator(RefactoringBundle.message("changeClassSignature.parameters.panel.border.title"), myTable), BorderLayout.NORTH);
panel.add(ToolbarDecorator.createDecorator(myTable).createPanel(), BorderLayout.CENTER);
return panel;
}
示例5: RegistryUi
import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
public RegistryUi() {
myContent.setLayout(new BorderLayout(UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP));
myModel = new MyTableModel();
myTable = new JBTable(myModel);
myTable.setCellSelectionEnabled(true);
myTable.setEnableAntialiasing(true);
final MyRenderer r = new MyRenderer();
final TableColumn c0 = myTable.getColumnModel().getColumn(0);
c0.setCellRenderer(r);
c0.setMaxWidth(RESTART_ICON.getIconWidth() + 12);
c0.setMinWidth(RESTART_ICON.getIconWidth() + 12);
c0.setHeaderValue(null);
final TableColumn c1 = myTable.getColumnModel().getColumn(1);
c1.setCellRenderer(r);
c1.setHeaderValue("Key");
final TableColumn c2 = myTable.getColumnModel().getColumn(2);
c2.setCellRenderer(r);
c2.setHeaderValue("Value");
c2.setCellEditor(new MyEditor());
myTable.setStriped(true);
myDescriptionLabel = new JTextArea(3, 50);
myDescriptionLabel.setEditable(false);
final JScrollPane label = ScrollPaneFactory.createScrollPane(myDescriptionLabel);
final JPanel descriptionPanel = new JPanel(new BorderLayout());
descriptionPanel.add(label, BorderLayout.CENTER);
descriptionPanel.setBorder(IdeBorderFactory.createTitledBorder("Description", false));
myContent.add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
myContent.add(descriptionPanel, BorderLayout.SOUTH);
myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) return;
final int selected = myTable.getSelectedRow();
if (selected != -1) {
final RegistryValue value = myModel.getRegistryValue(selected);
String desc = value.getDescription();
if (value.isRestartRequired()) {
String required = "Requires IDE restart.";
if (desc.endsWith(".")) {
desc += required;
} else {
desc += (". " + required);
}
}
myDescriptionLabel.setText(desc);
} else {
myDescriptionLabel.setText(null);
}
}
});
myRestoreDefaultsAction = new RestoreDefaultsAction();
final DefaultActionGroup tbGroup = new DefaultActionGroup();
tbGroup.add(new EditAction());
tbGroup.add(new RevertAction());
final ActionToolbar tb = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, tbGroup, true);
tb.setTargetComponent(myTable);
myContent.add(tb.getComponent(), BorderLayout.NORTH);
new TableSpeedSearch(myTable).setComparator(new SpeedSearchComparator(false));
}