Java 类com.intellij.ui.table.TableView 实例源码

项目: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    文件:CompareWithSelectedRevisionAction.java   
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;
}
项目:intellij-ce-playground    文件:AvdManagerDialogFixture.java   
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());
}
项目:intellij-ce-playground    文件:AvdManagerDialogFixture.java   
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();
}
项目:intellij-ce-playground    文件:StatisticsPanel.java   
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);
  }
项目: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    文件:CompareWithSelectedRevisionAction.java   
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;
}
项目:tools-idea    文件:FileHistoryPanelImpl.java   
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);
    }
  }
}
项目:tools-idea    文件:StatisticsPanel.java   
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);
  }
项目:intellij-xquery    文件:VariablesPanel.java   
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();
        }
    };
}
项目:intellij-xquery    文件:VariablesPanel.java   
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);
            }
        }
    };
}
项目:idea-php-symfony2-plugin    文件:MethodParameterDialog.java   
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());
    }

}
项目: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();
}
项目:consulo    文件:CompareWithSelectedRevisionAction.java   
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;
}
项目:intellij-ce-playground    文件:JavaChangeSignatureDialog.java   
@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();
      }
    }
  });
}
项目:intellij-ce-playground    文件:TableModelEditor.java   
/**
 * 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();
  }
}
项目:intellij-ce-playground    文件:FileHistoryPanelImpl.java   
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);
    }
  }
}
项目:intellij-ce-playground    文件:FileHistoryPanelImpl.java   
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";
}
项目:intellij-ce-playground    文件:DependencyConfigurable.java   
@Override
public JComponent createComponent() {
  myDenyRulesModel = new MyTableModel(myProject, new ColumnInfo[]{DENY_USAGES_OF, DENY_USAGES_IN}, true);
  myDenyRulesModel.setSortable(false);

  myAllowRulesModel = new MyTableModel(myProject, new ColumnInfo[]{ALLOW_USAGES_OF, ALLOW_USAGES_ONLY_IN}, false);
  myAllowRulesModel.setSortable(false);

  myDenyTable = new TableView<DependencyRule>(myDenyRulesModel);
  myDenyPanel.add(createRulesPanel(myDenyRulesModel, myDenyTable), BorderLayout.CENTER);
  myAllowTable = new TableView<DependencyRule>(myAllowRulesModel);
  myAllowPanel.add(createRulesPanel(myAllowRulesModel, myAllowTable), BorderLayout.CENTER);
  return myWholePanel;
}
项目:intellij-ce-playground    文件:DependencyConfigurable.java   
private JPanel createRulesPanel(MyTableModel model, TableView<DependencyRule> table) {
  table.setSurrendersFocusOnKeystroke(true);
  table.setPreferredScrollableViewportSize(JBUI.size(300, 150));
  table.setShowGrid(true);
  table.setRowHeight(new PackageSetChooserCombo(myProject, null).getPreferredSize().height);

  return ToolbarDecorator.createDecorator(table).createPanel();
}
项目:intellij-ce-playground    文件:UpdateSitesPanel.java   
private void createUIComponents() {
  mySourcesLoadingIcon = new AsyncProcessIcon("Loading...");
  mySourcesTableModel = new SourcesTableModel();
  myUpdateSitesTable = new TableView<SourcesTableModel.Row>(mySourcesTableModel);
  ToolbarDecorator userDefinedDecorator = ToolbarDecorator.createDecorator(myUpdateSitesTable);
  mySourcesPanel = addExtraActions(userDefinedDecorator).createPanel();
}
项目:intellij-ce-playground    文件:ChooseDeviceDefinitionStepFixture.java   
@NotNull
private JTableFixture getTableFixture() {
  final TableView deviceList = robot().finder().find(target(), new GenericTypeMatcher<TableView>(TableView.class) {
    @Override
    protected boolean isMatching(@NotNull TableView component) {
      return component.getRowCount() > 0 && component.getColumnCount() > 1; // There are two tables on this step, but the category table only has 1 column
    }
  });
  return new JTableFixture(robot(), deviceList);
}
项目:intellij-ce-playground    文件:ChooseSystemImageStepFixture.java   
@NotNull
public ChooseSystemImageStepFixture selectSystemImage(@NotNull String releaseName,
                                                      @NotNull String apiLevel,
                                                      @NotNull String abiType,
                                                      @NotNull String targetName) {
  final TableView systemImageList = robot().finder().findByType(target(), TableView.class);
  JTableFixture systemImageListFixture = new JTableFixture(robot(), systemImageList);

  JTableCellFixture cell = systemImageListFixture.cell(rowWithValue(releaseName, apiLevel, abiType, targetName).column(0));
  cell.select();
  return this;
}
项目:intellij-ce-playground    文件:TestNGResults.java   
public TestNGResults(final JComponent component,
                     final TestNGConfiguration configuration,
                     final TestNGConsoleView console) {
  super(component, console.getConsole().createConsoleActions(), console.getProperties(),
        TESTNG_SPLITTER_PROPERTY, 0.5f);
  this.configuration = configuration;
  this.project = configuration.getProject();

  model = new TestNGResultsTableModel(project);
  resultsTable = new TableView(model);
  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      final Object result = resultsTable.getSelectedObject();
      if (result instanceof TestResultMessage) {
        final String testClass = ((TestResultMessage)result).getTestClass();
        final PsiClass psiClass = ClassUtil.findPsiClass(PsiManager.getInstance(project), testClass);
        if (psiClass != null) {
          final String method = ((TestResultMessage)result).getMethod();
          if (method != null) {
            final PsiMethod[] psiMethods = psiClass.findMethodsByName(method, false);
            if (psiMethods.length > 0) {
              psiMethods[0].navigate(true);
            }
          }
          psiClass.navigate(true);
          return true;
        }
      }
      return false;
    }
  }.installOn(resultsTable);

  rootNode = new TreeRootNode();
  console.getUnboundOutput().addChild(rootNode);
}
项目:intellij-ce-playground    文件:GitCommitListPanel.java   
public GitCommitListPanel(@NotNull List<GitCommit> commits, @Nullable String emptyText) {
  myCommits = commits;

  myTable = new TableView<GitCommit>();
  updateModel();
  myTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  myTable.setStriped(true);
  if (emptyText != null) {
    myTable.getEmptyText().setText(emptyText);
  }

  setLayout(new BorderLayout());
  add(ScrollPaneFactory.createScrollPane(myTable));
}
项目:intellij-ce-playground    文件:CustomizeKeywordSubstitutionDialog.java   
@Override
protected JComponent createCenterPanel() {
  final TableView<FileExtension> table = new TableView<FileExtension>(myModel);
  final Dimension preferredSize = table.getPreferredSize();
  final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(table);
  final Dimension scrollPaneSize = scrollPane.getPreferredSize();
  scrollPaneSize.width = preferredSize.width;
  scrollPane.setPreferredSize(scrollPaneSize);
  return scrollPane;
}
项目: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();
}
项目:idea-php-laravel-plugin    文件:TemplatePathDialog.java   
public TemplatePathDialog(Project project, TableView<TemplatePath> tableView, TemplatePath twigPath) {
    this(project, tableView);
    this.name.setText(twigPath.getNamespace());
    this.namespacePath.getTextField().setText(twigPath.getPath());
    //this.namespaceType.getModel().setSelectedItem(twigPath.getNamespaceType().toString());
    this.twigPath = twigPath;
    this.setOkState();
}
项目:tools-idea    文件:JavaChangeSignatureDialog.java   
@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();
      }
    }
  });
}
项目:tools-idea    文件:FileHistoryPanelImpl.java   
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";
}
项目:tools-idea    文件:DependencyConfigurable.java   
@Override
public JComponent createComponent() {
  myDenyRulesModel = new MyTableModel(myProject, new ColumnInfo[]{DENY_USAGES_OF, DENY_USAGES_IN}, true);
  myDenyRulesModel.setSortable(false);

  myAllowRulesModel = new MyTableModel(myProject, new ColumnInfo[]{ALLOW_USAGES_OF, ALLOW_USAGES_ONLY_IN}, false);
  myAllowRulesModel.setSortable(false);

  myDenyTable = new TableView<DependencyRule>(myDenyRulesModel);
  myDenyPanel.add(createRulesPanel(myDenyRulesModel, myDenyTable), BorderLayout.CENTER);
  myAllowTable = new TableView<DependencyRule>(myAllowRulesModel);
  myAllowPanel.add(createRulesPanel(myAllowRulesModel, myAllowTable), BorderLayout.CENTER);
  return myWholePanel;
}
项目:tools-idea    文件:DependencyConfigurable.java   
private JPanel createRulesPanel(MyTableModel model, TableView<DependencyRule> table) {
  table.setSurrendersFocusOnKeystroke(true);
  table.setPreferredScrollableViewportSize(new Dimension(300, 150));
  table.setShowGrid(true);
  table.setRowHeight(new PackageSetChooserCombo(myProject, null).getPreferredSize().height);

  return ToolbarDecorator.createDecorator(table).createPanel();
}
项目:tools-idea    文件:TestNGResults.java   
public TestNGResults(final JComponent component,
                     final TestNGConfiguration configuration,
                     final TestNGConsoleView console,
                     final ExecutionEnvironment environment) {
  super(component, console.getConsole().createConsoleActions(), console.getProperties(),
        environment, TESTNG_SPLITTER_PROPERTY, 0.5f);
  this.project = configuration.getProject();

  model = new TestNGResultsTableModel(project);
  resultsTable = new TableView(model);
  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      final Object result = resultsTable.getSelectedObject();
      if (result instanceof TestResultMessage) {
        final String testClass = ((TestResultMessage)result).getTestClass();
        final PsiClass psiClass = ClassUtil.findPsiClass(PsiManager.getInstance(project), testClass);
        if (psiClass != null) {
          final String method = ((TestResultMessage)result).getMethod();
          if (method != null) {
            final PsiMethod[] psiMethods = psiClass.findMethodsByName(method, false);
            if (psiMethods.length > 0) {
              psiMethods[0].navigate(true);
            }
          }
          psiClass.navigate(true);
          return true;
        }
      }
      return false;
    }
  }.installOn(resultsTable);

  rootNode = new TreeRootNode();
  console.getUnboundOutput().addChild(rootNode);
}
项目:tools-idea    文件:GitCommitListPanel.java   
public GitCommitListPanel(@NotNull List<GitCommit> commits, @Nullable String emptyText) {
  myCommits = commits;

  myTable = new TableView<GitCommit>();
  updateModel();
  myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  myTable.setStriped(true);
  if (emptyText != null) {
    myTable.getEmptyText().setText(emptyText);
  }

  setLayout(new BorderLayout());
  add(ScrollPaneFactory.createScrollPane(myTable));
}
项目:tools-idea    文件:CustomizeKeywordSubstitutionDialog.java   
@Override
protected JComponent createCenterPanel() {
  final TableView<FileExtension> table = new TableView<FileExtension>(myModel);
  final Dimension preferredSize = table.getPreferredSize();
  final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(table);
  final Dimension scrollPaneSize = scrollPane.getPreferredSize();
  scrollPaneSize.width = preferredSize.width;
  scrollPane.setPreferredSize(scrollPaneSize);
  return scrollPane;
}
项目:consulo-csharp    文件:CSharpChangeSignatureDialog.java   
@Override
protected void customizeParametersTable(TableView<CSharpParameterTableModelItem> 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();
            }
        }
    }); }
项目:intellij-xquery    文件:VariablesPanel.java   
private AnActionButtonRunnable getUpdateAction(final TableView<XQueryRunVariable> variablesTable) {
    return new AnActionButtonRunnable() {
        @Override
        public void run(AnActionButton button) {
            final int selectedRow = variablesTable.getSelectedRow();
            final XQueryRunVariable selectedVariable = variablesTable.getSelectedObject();
            showEditorDialog(selectedVariable);
            variablesModel.fireTableDataChanged();
            variablesTable.setRowSelectionInterval(selectedRow, selectedRow);
        }
    };
}
项目:intellij-xquery    文件:VariablesPanel.java   
private TableView<XQueryRunVariable> prepareVariablesTable() {
    TableView<XQueryRunVariable> variablesTable = new TableView<XQueryRunVariable>(variablesModel);
    variablesTable.getEmptyText().setText("No variables defined");
    variablesTable.setColumnSelectionAllowed(false);
    variablesTable.setShowGrid(false);
    variablesTable.setDragEnabled(false);
    variablesTable.setShowHorizontalLines(false);
    variablesTable.setShowVerticalLines(false);
    variablesTable.setIntercellSpacing(new Dimension(0, 0));
    return variablesTable;
}
项目:idea-php-symfony2-plugin    文件:MethodSignatureTypeDialog.java   
public MethodSignatureTypeDialog(Project project, TableView<MethodSignatureSetting> tableView, MethodSignatureSetting methodParameterSetting) {
    this(project, tableView);

    this.textCallTo.setText(methodParameterSetting.getCallTo());
    this.textMethodName.setText(methodParameterSetting.getMethodName());
    this.textIndex.setText(String.valueOf(methodParameterSetting.getIndexParameter()));
    this.methodParameterSetting = methodParameterSetting;

    if(methodParameterSetting.getReferenceProviderName() != null) {
        this.comboProvider.setSelectedItem(methodParameterSetting.getReferenceProviderName());
    }

}
项目:idea-php-symfony2-plugin    文件:TwigNamespaceDialog.java   
public TwigNamespaceDialog(Project project, TableView<TwigPath> tableView, TwigPath twigPath) {
    this(project, tableView);
    this.name.setText(twigPath.getNamespace());
    this.namespacePath.getTextField().setText(twigPath.getPath());
    this.namespaceType.getModel().setSelectedItem(twigPath.getNamespaceType().toString());
    this.twigPath = twigPath;
    this.setOkState();
}