Search in sources :

Example 6 with ListTableModel

use of com.intellij.util.ui.ListTableModel in project intellij-community by JetBrains.

the class DynamicMethodDialog method setupParameterList.

private void setupParameterList(List<ParamInfo> arguments) {
    final ListTableModel<ParamInfo> dataModel = new ListTableModel<>(new NameColumnInfo(), new TypeColumnInfo());
    dataModel.setItems(arguments);
    myParametersTable.setModel(dataModel);
    if (arguments.isEmpty())
        return;
    String max0 = arguments.get(0).name;
    String max1 = arguments.get(0).type;
    for (ParamInfo argument : arguments) {
        if (argument.name.length() > max0.length())
            max0 = argument.name;
        if (argument.type.length() > max1.length())
            max1 = argument.type;
    }
    final FontMetrics metrics = myParametersTable.getFontMetrics(myParametersTable.getFont());
    final TableColumn column0 = myParametersTable.getColumnModel().getColumn(0);
    column0.setPreferredWidth(metrics.stringWidth(max0 + "  "));
    final TableColumn column1 = myParametersTable.getColumnModel().getColumn(1);
    column1.setPreferredWidth(metrics.stringWidth(max1 + "  "));
}
Also used : ListTableModel(com.intellij.util.ui.ListTableModel) TableColumn(javax.swing.table.TableColumn) ParamInfo(org.jetbrains.plugins.groovy.annotator.intentions.dynamic.ParamInfo)

Aggregations

ListTableModel (com.intellij.util.ui.ListTableModel)6 ColumnInfo (com.intellij.util.ui.ColumnInfo)3 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)1 JBScrollPane (com.intellij.ui.components.JBScrollPane)1 BaseTableView (com.intellij.ui.table.BaseTableView)1 TableView (com.intellij.ui.table.TableView)1 PathMappingSettings (com.intellij.util.PathMappingSettings)1 EditableModel (com.intellij.util.ui.EditableModel)1 ArrayList (java.util.ArrayList)1 TableCellRenderer (javax.swing.table.TableCellRenderer)1 TableColumn (javax.swing.table.TableColumn)1 NotNull (org.jetbrains.annotations.NotNull)1 ParamInfo (org.jetbrains.plugins.groovy.annotator.intentions.dynamic.ParamInfo)1