本文整理汇总了Java中com.intellij.ui.table.TableView类的典型用法代码示例。如果您正苦于以下问题:Java TableView类的具体用法?Java TableView怎么用?Java TableView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TableView类属于com.intellij.ui.table包,在下文中一共展示了TableView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DetectedRootsChooser
import com.intellij.ui.table.TableView; //导入依赖的package包/类
public DetectedRootsChooser() {
myModel = new ListTableModel<DetectedRootData>();
myTable = new TableView<DetectedRootData>(myModel);
myTable.setTableHeader(null);
myTable.setShowGrid(false);
myComponent = ScrollPaneFactory.createScrollPane(myTable);
myTable.registerKeyboardAction(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
invertSelectedRows();
}
},
KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0),
JComponent.WHEN_FOCUSED
);
}
示例2: createCommentsPanel
import com.intellij.ui.table.TableView; //导入依赖的package包/类
private static JPanel createCommentsPanel(final TableView<VcsFileRevision> table) {
final JTextArea textArea = createTextArea();
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(@NotNull ListSelectionEvent e) {
final VcsFileRevision revision = table.getSelectedObject();
if (revision == null) {
textArea.setText("");
} else {
textArea.setText(revision.getCommitMessage());
textArea.select(0, 0);
}
}
});
JPanel jPanel = new JPanel(new BorderLayout());
final JScrollPane textScrollPane = ScrollPaneFactory.createScrollPane(textArea);
// text on title border has some problems if text font size is bigger than expected.
final JLabel commentLabel = new JLabel(VcsBundle.message("border.selected.revision.commit.message"));
jPanel.add(commentLabel, BorderLayout.NORTH);
commentLabel.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.LEFT | SideBorder.BOTTOM));
textScrollPane.setBorder(null);
jPanel.add(textScrollPane, BorderLayout.CENTER);
jPanel.setPreferredSize(new Dimension(300, 100));
return jPanel;
}
示例3: editAvdWithName
import com.intellij.ui.table.TableView; //导入依赖的package包/类
public AvdEditWizardFixture editAvdWithName(@NotNull String name) {
final TableView tableView = robot().finder().findByType(target(), TableView.class, true);
JTableFixture tableFixture = new JTableFixture(robot(), tableView);
JTableCellFixture cell = tableFixture.cell(name);
final TableCell actionCell = TableCell.row(cell.row()).column(7);
JTableCellFixture actionCellFixture = tableFixture.cell(actionCell);
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
tableView.editCellAt(actionCell.row, actionCell.column);
}
});
JPanel actionPanel = (JPanel)actionCellFixture.editor();
HyperlinkLabel editButtonLabel = robot().finder().find(actionPanel, new GenericTypeMatcher<HyperlinkLabel>(HyperlinkLabel.class) {
@Override
protected boolean isMatching(@NotNull HyperlinkLabel component) {
return "Edit this AVD".equals(component.getToolTipText());
}
});
robot().click(editButtonLabel);
return AvdEditWizardFixture.find(robot());
}
示例4: deleteAvdByName
import com.intellij.ui.table.TableView; //导入依赖的package包/类
public void deleteAvdByName(String name) {
TableView tableView = robot().finder().findByType(target(), TableView.class, true);
JTableFixture tableFixture = new JTableFixture(robot(), tableView);
JTableCellFixture cell = tableFixture.cell(name);
cell.click(RIGHT_BUTTON);
JPopupMenu contextMenu = robot().findActivePopupMenu();
assertNotNull(contextMenu);
JPopupMenuFixture contextMenuFixture = new JPopupMenuFixture(robot(), contextMenu);
contextMenuFixture.menuItem(new GenericTypeMatcher<JMenuItem>(JMenuItem.class) {
@Override
protected boolean isMatching(@NotNull JMenuItem component) {
return "Delete".equals(component.getText());
}
}).click();
MessagesFixture.findByTitle(robot(), target(), "Confirm Deletion").clickYes();
}
示例5: StatisticsPanel
import com.intellij.ui.table.TableView; //导入依赖的package包/类
public StatisticsPanel() {
super(new BorderLayout(0, 0));
myChildInfo = new StatisticsTable(TestColumnInfo.COLUMN_NAMES);
myTable = new TableView(myChildInfo) {
@Override
public TableCellRenderer getCellRenderer(int row, int column) {
return new TestTableRenderer(TestColumnInfo.COLUMN_NAMES);
}
};
EditSourceOnDoubleClickHandler.install(myTable);
PopupHandler.installPopupHandler(myTable,
IdeActions.GROUP_TESTSTATISTICS_POPUP,
ActionPlaces.TESTSTATISTICS_VIEW_POPUP);
// add(myTestCaseInfo, BorderLayout.NORTH);
add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
final JPanel eastPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false));
myTotalLabel = new SimpleColoredComponent();
eastPanel.add(myTotalLabel);
myTimeLabel = new SimpleColoredComponent();
eastPanel.add(myTimeLabel);
add(eastPanel, BorderLayout.SOUTH);
}
示例6: createCommentsPanel
import com.intellij.ui.table.TableView; //导入依赖的package包/类
private static JPanel createCommentsPanel(final TableView<VcsFileRevision> table) {
final JTextArea textArea = createTextArea();
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
final VcsFileRevision revision = table.getSelectedObject();
if (revision == null) {
textArea.setText("");
} else {
textArea.setText(revision.getCommitMessage());
textArea.select(0, 0);
}
}
});
JPanel jPanel = new JPanel(new BorderLayout());
final JScrollPane textScrollPane = ScrollPaneFactory.createScrollPane(textArea);
textScrollPane.setBorder(IdeBorderFactory.createTitledBorder(VcsBundle.message("border.selected.revision.commit.message"), false
));
jPanel.add(textScrollPane, BorderLayout.SOUTH);
jPanel.setPreferredSize(new Dimension(300, 100));
return jPanel;
}
示例7: executeAction
import com.intellij.ui.table.TableView; //导入依赖的package包/类
protected void executeAction(AnActionEvent e) {
List<TreeNodeOnVcsRevision> sel = getSelection();
int selectionSize = sel.size();
if (selectionSize > 1) {
myDiffHandler.showDiffForTwo(myFilePath, sel.get(0).getRevision(), sel.get(sel.size() - 1).getRevision());
}
else if (selectionSize == 1) {
final TableView<TreeNodeOnVcsRevision> flatView = myDualView.getFlatView();
final int selectedRow = flatView.getSelectedRow();
VcsFileRevision revision = getFirstSelectedRevision();
VcsFileRevision previousRevision;
if (selectedRow == (flatView.getRowCount() - 1)) {
// no previous
previousRevision = myBottomRevisionForShowDiff != null ? myBottomRevisionForShowDiff : VcsFileRevision.NULL;
} else {
previousRevision = flatView.getRow(selectedRow + 1).getRevision();
}
if (revision != null) {
myDiffHandler.showDiffForOne(e, myFilePath, previousRevision, revision);
}
}
}
示例8: getRemoveAction
import com.intellij.ui.table.TableView; //导入依赖的package包/类
private AnActionButtonRunnable getRemoveAction(final TableView<XQueryRunVariable> variablesTable) {
return new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
TableUtil.stopEditing(variablesTable);
final int[] selected = variablesTable.getSelectedRows();
if (selected == null || selected.length == 0) return;
for (int i = selected.length - 1; i >= 0; i--) {
variablesModel.removeRow(selected[i]);
}
for (int i = selected.length - 1; i >= 0; i--) {
int idx = selected[i];
variablesModel.fireTableRowsDeleted(idx, idx);
}
int selection = selected[0];
if (selection >= variablesModel.getRowCount()) {
selection = variablesModel.getRowCount() - 1;
}
if (selection >= 0) {
variablesTable.setRowSelectionInterval(selection, selection);
}
variablesTable.requestFocus();
}
};
}
示例9: getAddAction
import com.intellij.ui.table.TableView; //导入依赖的package包/类
private AnActionButtonRunnable getAddAction(final TableView<XQueryRunVariable> variablesTable) {
return new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
XQueryRunVariable newVariable = new XQueryRunVariable();
if (showEditorDialog(newVariable)) {
ArrayList<XQueryRunVariable> newList = new ArrayList<XQueryRunVariable>(variablesModel
.getItems());
newList.add(newVariable);
variablesModel.setItems(newList);
int index = variablesModel.getRowCount() - 1;
variablesModel.fireTableRowsInserted(index, index);
variablesTable.setRowSelectionInterval(index, index);
}
}
};
}
示例10: MethodParameterDialog
import com.intellij.ui.table.TableView; //导入依赖的package包/类
public MethodParameterDialog(Project project, TableView<MethodParameterSetting> tableView, MethodParameterSetting methodParameterSetting) {
this(project, tableView);
this.textCallTo.setText(methodParameterSetting.getCallTo());
this.textMethodName.setText(methodParameterSetting.getMethodName());
this.textIndex.setText(String.valueOf(methodParameterSetting.getIndexParameter()));
this.textContributorData.setText(methodParameterSetting.getContributorData());
this.methodParameterSetting = methodParameterSetting;
if(methodParameterSetting.getReferenceProviderName() != null) {
this.comboProvider.setSelectedItem(methodParameterSetting.getReferenceProviderName());
}
if(methodParameterSetting.getContributorName() != null) {
this.comboContributor.setSelectedItem(methodParameterSetting.getContributorName());
}
}
示例11: UseAliasListForm
import com.intellij.ui.table.TableView; //导入依赖的package包/类
public UseAliasListForm() {
this.tableView = new TableView<>();
this.modelList = new ListTableModel<>(
new ClassColumn(),
new AliasColumn(),
new DisableColumn()
);
this.tableView.setModelAndUpdateColumns(this.modelList);
buttonReset.addActionListener(e -> {
tableView.getTableViewModel().fireTableDataChanged();
changed = true;
resetList();
try {
apply();
ApplicationSettings.getInstance().provideDefaults = false;
JOptionPane.showMessageDialog(panel, "Default alias applied");
} catch (ConfigurationException ignored) {
}
});
initList();
}
示例12: customizeParametersTable
import com.intellij.ui.table.TableView; //导入依赖的package包/类
@Override
protected void customizeParametersTable(TableView<ParameterTableModelItemBase<ParameterInfoImpl>> table) {
final JTable t = table.getComponent();
final TableColumn defaultValue = t.getColumnModel().getColumn(2);
final TableColumn varArg = t.getColumnModel().getColumn(3);
t.removeColumn(defaultValue);
t.removeColumn(varArg);
t.getModel().addTableModelListener(new TableModelListener() {
@Override
public void tableChanged(TableModelEvent e) {
if (e.getType() == TableModelEvent.INSERT) {
t.getModel().removeTableModelListener(this);
final TableColumnAnimator animator = new TableColumnAnimator(t);
animator.setStep(48);
animator.addColumn(defaultValue, (t.getWidth() - 48) / 3);
animator.addColumn(varArg, 48);
animator.startAndDoWhenDone(new Runnable() {
@Override
public void run() {
t.editCellAt(t.getRowCount() - 1, 0);
}
});
animator.start();
}
}
});
}
示例13: TableModelEditor
import com.intellij.ui.table.TableView; //导入依赖的package包/类
/**
* source will be copied, passed list will not be used directly
*
* Implement {@link DialogItemEditor} instead of {@link CollectionItemEditor} if you want provide dialog to edit.
*/
public TableModelEditor(@NotNull List<T> items, @NotNull ColumnInfo[] columns, @NotNull CollectionItemEditor<T> itemEditor, @NotNull String emptyText) {
super(itemEditor);
model = new MyListTableModel(columns, new ArrayList<T>(items));
table = new TableView<T>(model);
table.setDefaultEditor(Enum.class, ComboBoxTableCellEditor.INSTANCE);
table.setStriped(true);
table.setEnableAntialiasing(true);
preferredScrollableViewportHeightInRows(JBTable.PREFERRED_SCROLLABLE_VIEWPORT_HEIGHT_IN_ROWS);
new TableSpeedSearch(table);
ColumnInfo firstColumn = columns[0];
if ((firstColumn.getColumnClass() == boolean.class || firstColumn.getColumnClass() == Boolean.class) && firstColumn.getName().isEmpty()) {
TableUtil.setupCheckboxColumn(table.getColumnModel().getColumn(0));
}
boolean needTableHeader = false;
for (ColumnInfo column : columns) {
if (!StringUtil.isEmpty(column.getName())) {
needTableHeader = true;
break;
}
}
if (!needTableHeader) {
table.setTableHeader(null);
}
table.getEmptyText().setText(emptyText);
MyRemoveAction removeAction = new MyRemoveAction();
toolbarDecorator = ToolbarDecorator.createDecorator(table, this).setRemoveAction(removeAction).setRemoveActionUpdater(removeAction);
if (itemEditor instanceof DialogItemEditor) {
addDialogActions();
}
}
示例14: executeAction
import com.intellij.ui.table.TableView; //导入依赖的package包/类
protected void executeAction(AnActionEvent e) {
List<TreeNodeOnVcsRevision> sel = getSelection();
int selectionSize = sel.size();
if (selectionSize > 1) {
List<VcsFileRevision> selectedRevisions = ContainerUtil.sorted(ContainerUtil.map(sel, new Function<TreeNodeOnVcsRevision, VcsFileRevision>() {
@Override
public VcsFileRevision fun(TreeNodeOnVcsRevision treeNode) {
return treeNode.getRevision();
}
}), myRevisionsInOrderComparator);
VcsFileRevision olderRevision = selectedRevisions.get(0);
VcsFileRevision newestRevision = selectedRevisions.get(sel.size() - 1);
myDiffHandler.showDiffForTwo(e.getRequiredData(CommonDataKeys.PROJECT), myFilePath, olderRevision, newestRevision);
}
else if (selectionSize == 1) {
final TableView<TreeNodeOnVcsRevision> flatView = myDualView.getFlatView();
final int selectedRow = flatView.getSelectedRow();
VcsFileRevision revision = getFirstSelectedRevision();
VcsFileRevision previousRevision;
if (selectedRow == (flatView.getRowCount() - 1)) {
// no previous
previousRevision = myBottomRevisionForShowDiff != null ? myBottomRevisionForShowDiff : VcsFileRevision.NULL;
} else {
previousRevision = flatView.getRow(selectedRow + 1).getRevision();
}
if (revision != null) {
myDiffHandler.showDiffForOne(e, e.getRequiredData(CommonDataKeys.PROJECT), myFilePath, previousRevision, revision);
}
}
}
示例15: getMaxValue
import com.intellij.ui.table.TableView; //导入依赖的package包/类
private String getMaxValue(String name) {
if (myDualView == null) return null;
TableView table = myDualView.getFlatView();
if (table.getRowCount() == 0) return null;
final Enumeration<TableColumn> columns = table.getColumnModel().getColumns();
int idx = 0;
while (columns.hasMoreElements()) {
TableColumn column = columns.nextElement();
if (name.equals(column.getHeaderValue())) {
break;
}
++ idx;
}
if (idx >= table.getColumnModel().getColumnCount() - 1) return null;
final FontMetrics fm = table.getFontMetrics(table.getFont().deriveFont(Font.BOLD));
final Object header = table.getColumnModel().getColumn(idx).getHeaderValue();
double maxValue = fm.stringWidth((String)header);
String value = (String)header;
for (int i = 0; i < table.getRowCount(); i++) {
final Object at = table.getValueAt(i, idx);
if (at instanceof String) {
final int newWidth = fm.stringWidth((String)at);
if (newWidth > maxValue) {
maxValue = newWidth;
value = (String) at;
}
}
}
return value + "ww";
}