use of com.intellij.util.ui.ColumnInfo in project intellij-community by JetBrains.
the class IssueNavigationConfigurationPanel method reset.
public void reset() {
IssueNavigationConfiguration configuration = IssueNavigationConfiguration.getInstance(myProject);
myLinks = new ArrayList<>();
for (IssueNavigationLink link : configuration.getLinks()) {
myLinks.add(new IssueNavigationLink(link.getIssueRegexp(), link.getLinkRegexp()));
}
myModel = new ListTableModel<>(new ColumnInfo[] { ISSUE_COLUMN, LINK_COLUMN }, myLinks, 0);
myLinkTable.setModel(myModel);
}
use of com.intellij.util.ui.ColumnInfo in project intellij-community by JetBrains.
the class GitCommitListPanel method generateColumnsInfo.
@NotNull
private ColumnInfo[] generateColumnsInfo(@NotNull List<GitCommit> commits) {
ItemAndWidth hash = new ItemAndWidth("", 0);
ItemAndWidth author = new ItemAndWidth("", 0);
ItemAndWidth time = new ItemAndWidth("", 0);
for (GitCommit commit : commits) {
hash = getMax(hash, getHash(commit));
author = getMax(author, getAuthor(commit));
time = getMax(time, getTime(commit));
}
return new ColumnInfo[] { new GitCommitColumnInfo("Hash", hash.myItem) {
@Override
public String valueOf(GitCommit commit) {
return getHash(commit);
}
}, new ColumnInfo<GitCommit, String>("Subject") {
@Override
public String valueOf(GitCommit commit) {
return commit.getSubject();
}
}, new GitCommitColumnInfo("Author", author.myItem) {
@Override
public String valueOf(GitCommit commit) {
return getAuthor(commit);
}
}, new GitCommitColumnInfo("Author time", time.myItem) {
@Override
public String valueOf(GitCommit commit) {
return getTime(commit);
}
} };
}
use of com.intellij.util.ui.ColumnInfo in project intellij-community by JetBrains.
the class AbstractTableView method getColumnPreferredWidth.
protected int getColumnPreferredWidth(final int i) {
final ColumnInfo columnInfo = myTableModel.getColumnInfos()[i];
final java.util.List items = myTableModel.getItems();
int width = -1;
for (int j = 0; j < items.size(); j++) {
final TableCellRenderer renderer = myTable.getCellRenderer(j, i);
final Component component = renderer.getTableCellRendererComponent(myTable, columnInfo.valueOf(items.get(j)), false, false, j, i);
width = Math.max(width, component.getPreferredSize().width);
}
return width;
}
use of com.intellij.util.ui.ColumnInfo in project android by JetBrains.
the class AbstractDeclaredDependenciesTableModelTest method testShowArtifactDependencySpec.
public void testShowArtifactDependencySpec() {
PsArtifactDependencySpec spec = new PsArtifactDependencySpec("appcompat-v7", "com.android.support", "23.1.0");
when(myLibraryDependency.getResolvedSpec()).thenReturn(spec);
when(myLibraryDependency.getDeclaredSpec()).thenReturn(spec);
when(myLibraryDependency.toText(PLAIN_TEXT)).thenReturn("com.android.support:appcompat-v7:23.1.0");
ColumnInfo[] columnInfos = myTableModel.getColumnInfos();
PsUISettings.getInstance().DECLARED_DEPENDENCIES_SHOW_GROUP_ID = true;
//noinspection unchecked
ColumnInfo<PsAndroidDependency, String> specColumnInfo = columnInfos[0];
DependencyCellRenderer renderer = (DependencyCellRenderer) specColumnInfo.getRenderer(myLibraryDependency);
assertNotNull(renderer);
String text = renderer.getText();
assertEquals("com.android.support:appcompat-v7:23.1.0", text);
PsUISettings.getInstance().DECLARED_DEPENDENCIES_SHOW_GROUP_ID = false;
text = renderer.getText();
assertEquals("appcompat-v7:23.1.0", text);
}
use of com.intellij.util.ui.ColumnInfo in project intellij-plugins by JetBrains.
the class EditableTreeTable method getCellRenderer.
// copied from TableView
@Override
public TableCellRenderer getCellRenderer(int row, int column) {
ListTreeTableModelOnColumns model = (ListTreeTableModelOnColumns) getTableModel();
ColumnInfo columnInfo = model.getColumnInfos()[convertColumnIndexToModel(column)];
T item = (T) getValueAt(convertRowIndexToModel(row), 0);
final TableCellRenderer renderer = columnInfo.getCustomizedRenderer(item, columnInfo.getRenderer(item));
return renderer == null ? super.getCellRenderer(row, column) : renderer;
}
Aggregations