Java 类com.intellij.util.ui.ListTableModel 实例源码

项目:intellij-ce-playground    文件:DetectedRootsChooser.java   
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
  );
}
项目:intellij-ce-playground    文件:TableView.java   
@NotNull
public List<Item> getSelectedObjects() {
  ListSelectionModel selectionModel = getSelectionModel();
  int minSelectionIndex = selectionModel.getMinSelectionIndex();
  int maxSelectionIndex = selectionModel.getMaxSelectionIndex();
  if (minSelectionIndex == -1 || maxSelectionIndex == -1) {
    return Collections.emptyList();
  }

  List<Item> result = new SmartList<Item>();
  ListTableModel<Item> model = getListTableModel();
  for (int i = minSelectionIndex; i <= maxSelectionIndex; i++) {
    if (selectionModel.isSelectedIndex(i)) {
      int modelIndex = convertRowIndexToModel(i);
      if (modelIndex >= 0 && modelIndex < model.getRowCount()) {
        result.add(model.getRowValue(modelIndex));
      }
    }
  }
  return result;
}
项目:intellij-ce-playground    文件:VcsHistoryDialog.java   
private void updateRevisionsList() throws VcsException {
  if (myIsInLoading) return;
  if (myChangesOnlyCheckBox.isSelected()) {
    loadContentsFor(myRevisions.toArray(new VcsFileRevision[myRevisions.size()]));
    try {
      ((ListTableModel)myList.getModel()).setItems(filteredRevisions());
    }
    catch (FilesTooBigForDiffException e) {
      myChangesOnlyCheckBox.setEnabled(false);
      myChangesOnlyCheckBox.setSelected(false);
      setErrorText(e.getMessage());
      ((ListTableModel)myList.getModel()).setItems(myRevisions);
    }
    ((ListTableModel)myList.getModel()).fireTableDataChanged();
    updateDiff(0, 0);

  }
  else {
    ((ListTableModel)myList.getModel()).setItems(myRevisions);
    ((ListTableModel)myList.getModel()).fireTableDataChanged();
  }

}
项目:intellij-ce-playground    文件:VcsHistoryDialog.java   
private synchronized void updateDiff(int first, int second) {
  if (myIsDisposed || myIsInLoading) return;
  List items = ((ListTableModel)myList.getModel()).getItems();
  VcsFileRevision firstRev = (VcsFileRevision)items.get(first);
  VcsFileRevision secondRev = (VcsFileRevision)items.get(second);

  if (VcsHistoryUtil.compare(firstRev, secondRev) > 0) {
    VcsFileRevision tmp = firstRev;
    firstRev = secondRev;
    secondRev = tmp;
  }

  if (myIsDisposed) return;

  DiffRequest diffRequest = createDiffRequest(firstRev, secondRev);
  myDiffPanel.setRequest(diffRequest);
}
项目:intellij-ce-playground    文件:DynamicMethodDialog.java   
private void setupParameterList(List<ParamInfo> arguments) {
  final ListTableModel<ParamInfo> dataModel = new ListTableModel<ParamInfo>(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 + "  "));
}
项目:vso-intellij    文件:CheckInPoliciesForm.java   
private void updateTable() {
  //noinspection unchecked
  List<Pair<StatefulPolicyDescriptor, Boolean>> list =
    new ArrayList<Pair<StatefulPolicyDescriptor, Boolean>>(myProjectToDescriptors.get(getSelectedProject()).descriptors.size());
  try {
    for (StatefulPolicyDescriptor descriptor : myProjectToDescriptors.get(getSelectedProject()).descriptors) {
      list.add(Pair.create(descriptor, CheckinPoliciesManager.find(descriptor.getType()) != null));
    }
  }
  catch (DuplicatePolicyIdException e) {
    // can't get here
    throw new RuntimeException(e);
  }
  //noinspection unchecked
  ((ListTableModel)myPoliciesTable.getModel()).setItems(list);
}
项目:tools-idea    文件:DetectedRootsChooser.java   
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
  );
}
项目:tools-idea    文件:VcsHistoryDialog.java   
private void updateRevisionsList() throws VcsException {
  if (myIsInLoading) return;
  if (myChangesOnlyCheckBox.isSelected()) {
    loadContentsFor(myRevisions.toArray(new VcsFileRevision[myRevisions.size()]));
    try {
      ((ListTableModel)myList.getModel()).setItems(filteredRevisions());
    }
    catch (FilesTooBigForDiffException e) {
      myChangesOnlyCheckBox.setEnabled(false);
      myChangesOnlyCheckBox.setSelected(false);
      setErrorText(e.getMessage());
      ((ListTableModel)myList.getModel()).setItems(myRevisions);
    }
    ((ListTableModel)myList.getModel()).fireTableDataChanged();
    updateDiff(0, 0);

  }
  else {
    ((ListTableModel)myList.getModel()).setItems(myRevisions);
    ((ListTableModel)myList.getModel()).fireTableDataChanged();
  }

}
项目:tools-idea    文件:DynamicMethodDialog.java   
private void setupParameterList(List<ParamInfo> arguments) {
  final ListTableModel<ParamInfo> dataModel = new ListTableModel<ParamInfo>(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 + "  "));
}
项目:idea-php-annotation-plugin    文件:UseAliasListForm.java   
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();
}
项目:intellij-ce-playground    文件:DualView.java   
public void changeColumnSet(DualViewColumnInfo[] columns) {
  myTreeView.setTableModel(new ListTreeTableModelOnColumns((TreeNode)myTreeView.getTreeViewModel().getRoot(),
                                                           createTreeColumns(columns)));
  myFlatView.setModelAndUpdateColumns(new ListTableModel(columns));
  if (myTreeCellRenderer != null) myTreeView.setTreeCellRenderer(myTreeCellRenderer);
  setRootVisible(myRootVisible);

  refreshFlatModel();

  addWidthListenersTo(myTreeView);
  addWidthListenersTo(myFlatView);
}
项目:intellij-ce-playground    文件:AttachmentsTabForm.java   
public void selectFirstIncludedAttachment() {
  final List items = ((ListTableModel)myTable.getModel()).getItems();
  for (Object item : items) {
    if (((Attachment)item).isIncluded()) {
      myTable.setSelection(Collections.singleton((Attachment)item));
      break;
    }
  }
}
项目:intellij-ce-playground    文件:IssueNavigationConfigurationPanel.java   
public void reset() {
  IssueNavigationConfiguration configuration = IssueNavigationConfiguration.getInstance(myProject);
  myLinks = new ArrayList<IssueNavigationLink>();
  for(IssueNavigationLink link: configuration.getLinks()) {
    myLinks.add(new IssueNavigationLink(link.getIssueRegexp(), link.getLinkRegexp()));
  }
  myModel = new ListTableModel<IssueNavigationLink>(
    new ColumnInfo[] { ISSUE_COLUMN, LINK_COLUMN },
    myLinks,
    0);
  myLinkTable.setModel(myModel);
}
项目:intellij-ce-playground    文件:BrowserSettingsPanel.java   
private void setCustomPathToFirstListed() {
  ListTableModel<ConfigurableWebBrowser> model = browsersEditor.getModel();
  for (int i = 0, n = model.getRowCount(); i < n; i++) {
    ConfigurableWebBrowser browser = model.getRowValue(i);
    if (browser.isActive() && browser.getPath() != null) {
      alternativeBrowserPathField.setText(browser.getPath());
      return;
    }
  }

  alternativeBrowserPathField.setText("");
}
项目:intellij-ce-playground    文件:StatisticsPanel.java   
public void doDispose() {
  BaseTableView.store(myStorage, myTable);
  myTable.setModelAndUpdateColumns(new ListTableModel(TestColumnInfo.COLUMN_NAMES));
  myModel = null;
  myChildInfo = null;
  myCurrentTest = null;
}
项目:intellij-ce-playground    文件:BuildFilePropertiesPanel.java   
public PropertiesTab() {
  myPropertiesTable = new JBTable();
  UIPropertyBinding.TableListBinding<BuildFileProperty> tableListBinding = getBinding().bindList(myPropertiesTable, PROPERTY_COLUMNS,
                                                                                                 AntBuildFileImpl.ANT_PROPERTIES);
  tableListBinding.setColumnWidths(GlobalAntConfiguration.PROPERTIES_TABLE_LAYOUT);

  myWholePanel = ToolbarDecorator.createDecorator(myPropertiesTable)
    .setAddAction(new AnActionButtonRunnable() {


      @Override
      public void run(AnActionButton button) {
        if (myPropertiesTable.isEditing() && !myPropertiesTable.getCellEditor().stopCellEditing()) {
          return;
        }
        BuildFileProperty item = new BuildFileProperty();
        ListTableModel<BuildFileProperty> model = (ListTableModel<BuildFileProperty>)myPropertiesTable.getModel();
        ArrayList<BuildFileProperty> items = new ArrayList<BuildFileProperty>(model.getItems());
        items.add(item);
        model.setItems(items);
        int newIndex = model.indexOf(item);
        ListSelectionModel selectionModel = myPropertiesTable.getSelectionModel();
        selectionModel.clearSelection();
        selectionModel.setSelectionInterval(newIndex, newIndex);
        ColumnInfo[] columns = model.getColumnInfos();
        for (int i = 0; i < columns.length; i++) {
          ColumnInfo column = columns[i];
          if (column.isCellEditable(item)) {
            myPropertiesTable.requestFocusInWindow();
            myPropertiesTable.editCellAt(newIndex, i);
            break;
          }
        }
      }
    }).disableUpDownActions().createPanel();
  myWholePanel.setBorder(null);
}
项目:intellij-ce-playground    文件:CustomizeKeywordSubstitutionDialog.java   
public CustomizeKeywordSubstitutionDialog(Project project, String description, ImportConfiguration importConfiguration) {
  super(project);
  setTitle(description);
  myImportConfiguration = importConfiguration;
  myModel = new ListTableModel<FileExtension>(COLUMNS);
  myModel.setItems(collectFileTypes());
  init();
  pack();
}
项目:Azure-Toolkit-for-IntelliJ    文件:ActivityLogToolWindowFactory.java   
@Override
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {
    this.project = project;
    table = new TableView<DeploymentTableItem>(new ListTableModel<DeploymentTableItem>(DESC, PROGRESS, STATUS, START_TIME));
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    // add mouse listener for links in table
    table.addMouseListener(createTableMouseListener());

    toolWindow.getComponent().add(new JBScrollPane(table));
    registerDeploymentListener();
}
项目:tools-idea    文件:DualView.java   
public void changeColumnSet(DualViewColumnInfo[] columns) {
  myTreeView.setTableModel(new ListTreeTableModelOnColumns((TreeNode)myTreeView.getTreeViewModel().getRoot(),
                                                           createTreeColumns(columns)));
  myFlatView.setModelAndUpdateColumns(new ListTableModel(columns));
  if (myTreeCellRenderer != null) myTreeView.setTreeCellRenderer(myTreeCellRenderer);
  setRootVisible(myRootVisible);

  refreshFlatModel();

  addWidthListenersTo(myTreeView);
  addWidthListenersTo(myFlatView);
}
项目:tools-idea    文件:AttachmentsTabForm.java   
public void selectFirstIncludedAttachment() {
  final List items = ((ListTableModel)myTable.getModel()).getItems();
  for (Object item : items) {
    if (((Attachment)item).isIncluded()) {
      myTable.setSelection(Collections.singleton((Attachment)item));
      break;
    }
  }
}
项目:tools-idea    文件:IssueNavigationConfigurationPanel.java   
public void reset() {
  IssueNavigationConfiguration configuration = IssueNavigationConfiguration.getInstance(myProject);
  myLinks = new ArrayList<IssueNavigationLink>();
  for(IssueNavigationLink link: configuration.getLinks()) {
    myLinks.add(new IssueNavigationLink(link.getIssueRegexp(), link.getLinkRegexp()));
  }
  myModel = new ListTableModel<IssueNavigationLink>(
    new ColumnInfo[] { ISSUE_COLUMN, LINK_COLUMN },
    myLinks,
    0);
  myLinkTable.setModel(myModel);
}
项目:tools-idea    文件:StatisticsPanel.java   
public void doDispose() {
  BaseTableView.store(myStorage, myTable);
  myTable.setModelAndUpdateColumns(new ListTableModel(TestColumnInfo.COLUMN_NAMES));
  myModel = null;
  myChildInfo = null;
  myCurrentTest = null;
}
项目:tools-idea    文件:BuildFilePropertiesPanel.java   
public PropertiesTab() {
  myPropertiesTable = new JBTable();
  UIPropertyBinding.TableListBinding<BuildFileProperty> tableListBinding = getBinding().bindList(myPropertiesTable, PROPERTY_COLUMNS,
                                                                                                 AntBuildFileImpl.ANT_PROPERTIES);
  tableListBinding.setColumnWidths(GlobalAntConfiguration.PROPERTIES_TABLE_LAYOUT);

  myWholePanel = ToolbarDecorator.createDecorator(myPropertiesTable)
    .setAddAction(new AnActionButtonRunnable() {


      @Override
      public void run(AnActionButton button) {
        if (myPropertiesTable.isEditing() && !myPropertiesTable.getCellEditor().stopCellEditing()) {
          return;
        }
        BuildFileProperty item = new BuildFileProperty();
        ListTableModel<BuildFileProperty> model = (ListTableModel<BuildFileProperty>)myPropertiesTable.getModel();
        ArrayList<BuildFileProperty> items = new ArrayList<BuildFileProperty>(model.getItems());
        items.add(item);
        model.setItems(items);
        int newIndex = model.indexOf(item);
        ListSelectionModel selectionModel = myPropertiesTable.getSelectionModel();
        selectionModel.clearSelection();
        selectionModel.setSelectionInterval(newIndex, newIndex);
        ColumnInfo[] columns = model.getColumnInfos();
        for (int i = 0; i < columns.length; i++) {
          ColumnInfo column = columns[i];
          if (column.isCellEditable(item)) {
            myPropertiesTable.requestFocusInWindow();
            myPropertiesTable.editCellAt(newIndex, i);
            break;
          }
        }
      }
    }).disableUpDownActions().createPanel();
  myWholePanel.setBorder(null);
}
项目:tools-idea    文件:TelemetryDisplay.java   
public TelemetryDisplay(InspectionGadgetsTelemetry telemetry) {
  tableModel = new ListTableModel<InspectionRunTime>(createColumns(),
                                                     telemetry.buildList(), 0);
  final JTable table = new JBTable(tableModel);
  new TableSpeedSearch(table);
  scrollPane = ScrollPaneFactory.createScrollPane(table);
}
项目:tools-idea    文件:CustomizeKeywordSubstitutionDialog.java   
public CustomizeKeywordSubstitutionDialog(Project project, String description, ImportConfiguration importConfiguration) {
  super(project);
  setTitle(description);
  myImportConfiguration = importConfiguration;
  myModel = new ListTableModel<FileExtension>(COLUMNS);
  myModel.setItems(collectFileTypes());
  init();
  pack();
}
项目:intellij-xquery    文件:VariablesPanel.java   
public VariablesPanel() {
    super(new BorderLayout());
    setName(VARIABLES_PANEL);
    variablesModel = new ListTableModel<XQueryRunVariable>(IS_ACTIVE, NAME, NAMESPACE, TYPE, VALUE);
    variablesTable = prepareVariablesTable();
    toolbarDecorator = prepareVariablesTableToolbarDecorator(variablesTable);
    add(toolbarDecorator.createPanel());
    setPreferredSize(new Dimension(- 1, 120));
}
项目:intellij-xquery    文件:VariablesPanelGuiTest.java   
@Test
public void shouldHaveTheRightColumnNames() {
    ListTableModel<XQueryRunVariable> model = (ListTableModel<XQueryRunVariable>) window.table().component()
            .getModel();

    ColumnInfo[] columnInfoArray = model.getColumnInfos();

    assertThat(columnInfoArray[0].getName(), is(IsActiveColumnInfo.HEADER));
    assertThat(columnInfoArray[1].getName(), is(NameColumnInfo.HEADER));
    assertThat(columnInfoArray[2].getName(), is(NamespaceColumnInfo.HEADER));
    assertThat(columnInfoArray[3].getName(), is(TypeColumnInfo.HEADER));
    assertThat(columnInfoArray[4].getName(), is(ValueColumnInfo.HEADER));
}
项目:idea-php-symfony2-plugin    文件:ServiceArgumentSelectionDialog.java   
private void createUIComponents() {
    mainPanel = new JPanel();

    mainPanel.setLayout(new GridLayout(0, 1));

    this.modelList = new ListTableModel<>(
        new IconColumn(),
        new NamespaceColumn(),
        new ServiceColumn()
    );

    for (Map.Entry<String, Set<String>> entry : this.arguments.entrySet()) {
        this.modelList.addRow(new ServiceParameter(entry.getKey(), entry.getValue()));
    }

    this.tableView = new TableView<>();
    this.tableView.setModelAndUpdateColumns(this.modelList);

    mainPanel.add(ToolbarDecorator.createDecorator(this.tableView)
            .disableAddAction()
            .disableDownAction()
            .disableRemoveAction()
            .disableUpDownActions()
            .createPanel()
    );

}
项目:consulo    文件:DualView.java   
public void changeColumnSet(DualViewColumnInfo[] columns) {
  myTreeView.setTableModel(new ListTreeTableModelOnColumns((TreeNode)myTreeView.getTreeViewModel().getRoot(),
                                                           createTreeColumns(columns)));
  myFlatView.setModelAndUpdateColumns(new ListTableModel(columns));
  if (myTreeCellRenderer != null) myTreeView.setTreeCellRenderer(myTreeCellRenderer);
  setRootVisible(myRootVisible);

  refreshFlatModel();

  addWidthListenersTo(myTreeView);
  addWidthListenersTo(myFlatView);
}
项目:consulo    文件:AttachmentsTabForm.java   
public void selectFirstIncludedAttachment() {
  final List items = ((ListTableModel)myTable.getModel()).getItems();
  for (Object item : items) {
    if (((Attachment)item).isIncluded()) {
      myTable.setSelection(Collections.singleton((Attachment)item));
      break;
    }
  }
}
项目:consulo    文件:IssueNavigationConfigurationPanel.java   
public void reset() {
  IssueNavigationConfiguration configuration = IssueNavigationConfiguration.getInstance(myProject);
  myLinks = new ArrayList<IssueNavigationLink>();
  for(IssueNavigationLink link: configuration.getLinks()) {
    myLinks.add(new IssueNavigationLink(link.getIssueRegexp(), link.getLinkRegexp()));
  }
  myModel = new ListTableModel<IssueNavigationLink>(
    new ColumnInfo[] { ISSUE_COLUMN, LINK_COLUMN },
    myLinks,
    0);
  myLinkTable.setModel(myModel);
}
项目:mule-intellij-plugins    文件:MuleSdkSelectionDialog.java   
protected ListTableModel<MuleSdk> getSdkTableModel() {
    return new SdkTableModel();
}
项目:mule-intellij-plugins    文件:WeaveRunnerConfPanel.java   
public ListTableModel<WeaveInput> getWeaveInputs()
{
    return myModel;
}
项目:mule-intellij-plugins    文件:WeaveRunnerConfPanel.java   
public AddWeaveInputAction(ListTableModel<WeaveInput> myModel)
{
    this.myModel = myModel;
}
项目:mule-intellij-plugins    文件:WeaveRunnerConfPanel.java   
public RemoveWeaveInputAction(ListTableModel<WeaveInput> myModel)
{
    this.myModel = myModel;
}
项目:mule-intellij-plugins    文件:WeaveRunnerConfPanel.java   
public EditWeaveInputAction(ListTableModel<WeaveInput> myModel)
{
    this.myModel = myModel;
}
项目:intellij-ce-playground    文件:ExcludeTable.java   
@Override
protected ListTableModel createListModel() {
  return new ListTableModel<Item>(NAME_COLUMN, SCOPE_COLUMN);
}
项目:intellij-ce-playground    文件:TableView.java   
public TableView() {
  this(new ListTableModel<Item>(ColumnInfo.EMPTY_ARRAY));
}
项目:intellij-ce-playground    文件:TableView.java   
public TableView(final ListTableModel<Item> model) {
  super(model);
  setModelAndUpdateColumns(model);
}
项目:intellij-ce-playground    文件:TableView.java   
/**
 * use {@link #setModelAndUpdateColumns(com.intellij.util.ui.ListTableModel<Item>)} instead
 * @param model
 */
@Deprecated
public void setModel(final ListTableModel<Item> model) {
  setModelAndUpdateColumns(model);
}