Search in sources :

Example 21 with ColumnInfo

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);
}
Also used : IssueNavigationLink(com.intellij.openapi.vcs.IssueNavigationLink) ColumnInfo(com.intellij.util.ui.ColumnInfo) IssueNavigationConfiguration(com.intellij.openapi.vcs.IssueNavigationConfiguration)

Example 22 with ColumnInfo

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);
        }
    } };
}
Also used : GitCommit(git4idea.GitCommit) ColumnInfo(com.intellij.util.ui.ColumnInfo) NotNull(org.jetbrains.annotations.NotNull)

Example 23 with ColumnInfo

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;
}
Also used : TableCellRenderer(javax.swing.table.TableCellRenderer) List(java.util.List) ColumnInfo(com.intellij.util.ui.ColumnInfo)

Example 24 with ColumnInfo

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);
}
Also used : DependencyCellRenderer(com.android.tools.idea.gradle.structure.configurables.ui.dependencies.AbstractDeclaredDependenciesTableModel.DependencyCellRenderer) PsAndroidDependency(com.android.tools.idea.gradle.structure.model.android.PsAndroidDependency) PsArtifactDependencySpec(com.android.tools.idea.gradle.structure.model.PsArtifactDependencySpec) ColumnInfo(com.intellij.util.ui.ColumnInfo)

Example 25 with ColumnInfo

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;
}
Also used : TableCellRenderer(javax.swing.table.TableCellRenderer) ColumnInfo(com.intellij.util.ui.ColumnInfo)

Aggregations

ColumnInfo (com.intellij.util.ui.ColumnInfo)27 TableCellRenderer (javax.swing.table.TableCellRenderer)7 TreeTableView (com.intellij.ui.dualView.TreeTableView)4 TreeTableModel (com.intellij.ui.treeStructure.treetable.TreeTableModel)4 ListTableModel (com.intellij.util.ui.ListTableModel)4 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)4 NotNull (org.jetbrains.annotations.NotNull)4 TableView (com.intellij.ui.table.TableView)3 ListTreeTableModelOnColumns (com.intellij.ui.treeStructure.treetable.ListTreeTableModelOnColumns)3 List (java.util.List)3 TableColumn (javax.swing.table.TableColumn)3 Project (com.intellij.openapi.project.Project)2 PopupChooserBuilder (com.intellij.openapi.ui.popup.PopupChooserBuilder)2 TreeColumnInfo (com.intellij.ui.treeStructure.treetable.TreeColumnInfo)2 AsyncProcessIcon (com.intellij.util.ui.AsyncProcessIcon)2 ArrayList (java.util.ArrayList)2 TableCellEditor (javax.swing.table.TableCellEditor)2 Nullable (org.jetbrains.annotations.Nullable)2 DependencyCellRenderer (com.android.tools.idea.gradle.structure.configurables.ui.dependencies.AbstractDeclaredDependenciesTableModel.DependencyCellRenderer)1 PsArtifactDependencySpec (com.android.tools.idea.gradle.structure.model.PsArtifactDependencySpec)1