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

项目:intellij-ce-playground    文件:AutomaticUsageRenamingDialog.java   
private void setupTable() {
  myTable = new JBTable();
  myTableModel = new MyTableModel();
  myTable.setModel(myTableModel);

  myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
    @Override
    public void valueChanged(ListSelectionEvent e) {
      refreshValidatingComponent();
    }
  });
  myTable.setCellSelectionEnabled(false);
  myTable.setColumnSelectionAllowed(false);
  myTable.setRowSelectionAllowed(false);
  myTable.getTableHeader().setReorderingAllowed(false);
}
项目:intellij-ce-playground    文件:ProcessorProfilePanel.java   
private static JPanel createTablePanel(final JBTable table) {
  return ToolbarDecorator.createDecorator(table)
    .disableUpAction()
    .disableDownAction()
    .setAddAction(new AnActionButtonRunnable() {
      @Override
      public void run(AnActionButton anActionButton) {
        final TableCellEditor cellEditor = table.getCellEditor();
        if (cellEditor != null) {
          cellEditor.stopCellEditing();
        }
        final TableModel model = table.getModel();
        ((EditableModel)model).addRow();
        TableUtil.editCellAt(table, model.getRowCount() - 1, 0);
      }
    })
    .createPanel();
}
项目:intellij-ce-playground    文件:RevisionsList.java   
public RevisionsList(SelectionListener l) {
  table = new JBTable();
  table.setModel(new MyModel(Collections.<RevisionItem>emptyList(), Collections.<RevisionItem, Period>emptyMap()));

  table.setTableHeader(null);
  table.setShowGrid(false);
  table.setRowMargin(0);
  table.getColumnModel().setColumnMargin(0);

  table.resetDefaultFocusTraversalKeys();

  table.setDefaultRenderer(Object.class, new MyCellRenderer(table));

  table.getEmptyText().setText(VcsBundle.message("history.empty"));

  addSelectionListener(l);
}
项目:intellij-ce-playground    文件:FindDialog.java   
private void navigateToSelectedUsage(JBTable source) {
  int[] rows = source.getSelectedRows();
  List<Usage> navigations = null;
  for(int row:rows) {
    Object valueAt = source.getModel().getValueAt(row, 0);
    if (valueAt instanceof Usage) {
      if (navigations == null) navigations = new SmartList<Usage>();
      Usage at = (Usage)valueAt;
      navigations.add(at);
    }
  }

  if (navigations != null) {
    applyTo(FindManager.getInstance(myProject).getFindInProjectModel(), false);
    doCancelAction();
    navigations.get(0).navigate(true);
    for(int i = 1; i < navigations.size(); ++i) navigations.get(i).highlightInEditor();
  }
}
项目:intellij-ce-playground    文件:SdkComponentsStep.java   
private void createUIComponents() {
  Splitter splitter = new Splitter(false, 0.5f, 0.2f, 0.8f);
  myBody = splitter;
  myComponentsTable = new JBTable();
  myComponentDescription = new JTextPane();
  splitter.setShowDividerIcon(false);
  splitter.setShowDividerControls(false);
  splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myComponentsTable, false));
  splitter.setSecondComponent(ScrollPaneFactory.createScrollPane(myComponentDescription, false));

  myComponentDescription.setFont(UIUtil.getLabelFont());
  myComponentDescription.setEditable(false);
  myComponentDescription.setBorder(BorderFactory.createEmptyBorder(WizardConstants.STUDIO_WIZARD_INSET_SIZE,
                                                                   WizardConstants.STUDIO_WIZARD_INSET_SIZE,
                                                                   WizardConstants.STUDIO_WIZARD_INSET_SIZE,
                                                                   WizardConstants.STUDIO_WIZARD_INSET_SIZE));
}
项目:tools-idea    文件:ProcessorProfilePanel.java   
private static JPanel createTablePanel(final JBTable table) {
  return ToolbarDecorator.createDecorator(table)
    .disableUpAction()
    .disableDownAction()
    .setAddAction(new AnActionButtonRunnable() {
      @Override
      public void run(AnActionButton anActionButton) {
        final TableCellEditor cellEditor = table.getCellEditor();
        if (cellEditor != null) {
          cellEditor.stopCellEditing();
        }
        final TableModel model = table.getModel();
        ((EditableModel)model).addRow();
        TableUtil.editCellAt(table, model.getRowCount() - 1, 0);
      }
    })
    .createPanel();
}
项目:tools-idea    文件:RevisionsList.java   
public RevisionsList(SelectionListener l) {
  table = new JBTable();
  table.setModel(new MyModel(Collections.<RevisionItem>emptyList(), Collections.<RevisionItem, Period>emptyMap()));

  table.setTableHeader(null);
  table.setShowGrid(false);
  table.setRowMargin(0);
  table.getColumnModel().setColumnMargin(0);

  table.resetDefaultFocusTraversalKeys();

  table.setDefaultRenderer(Object.class, new MyCellRenderer(table));

  table.getEmptyText().setText(VcsBundle.message("history.empty"));

  addSelectionListener(l);
}
项目:ali-idea-plugin    文件:HistoryDialog.java   
private JComponent createTable(List<String[]> properties) {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    JBTable table = new JBTable(new AuditModel(properties));
    table.setDefaultRenderer(String.class, new MyTableCellRenderer());
    table.setRowSelectionAllowed(false);
    table.setColumnSelectionAllowed(false);
    table.setCellSelectionEnabled(false);
    table.setShowGrid(false);
    table.setShowHorizontalLines(true);
    table.setGridColor(table.getGridColor().brighter());
    table.getTableHeader().setResizingAllowed(false);
    table.getTableHeader().setDefaultRenderer(new MyHeaderCellRenderer());
    panel.add(table.getTableHeader());
    panel.add(table);
    return panel;
}
项目:consulo    文件:RevisionsList.java   
public RevisionsList(SelectionListener l) {
  table = new JBTable();
  table.setModel(new MyModel(Collections.<RevisionItem>emptyList(), Collections.<RevisionItem, Period>emptyMap()));

  table.setTableHeader(null);
  table.setShowGrid(false);
  table.setRowMargin(0);
  table.getColumnModel().setColumnMargin(0);

  table.resetDefaultFocusTraversalKeys();

  table.setDefaultRenderer(Object.class, new MyCellRenderer(table));

  table.getEmptyText().setText(VcsBundle.message("history.empty"));

  addSelectionListener(l);
}
项目:consulo    文件:FindDialog.java   
private void navigateToSelectedUsage(JBTable source) {
  int[] rows = source.getSelectedRows();
  List<Usage> navigations = null;
  for (int row : rows) {
    Object valueAt = source.getModel().getValueAt(row, 0);
    if (valueAt instanceof Usage) {
      if (navigations == null) navigations = new SmartList<>();
      Usage at = (Usage)valueAt;
      navigations.add(at);
    }
  }

  if (navigations != null) {
    doCancelAction();
    navigations.get(0).navigate(true);
    for (int i = 1; i < navigations.size(); ++i) navigations.get(i).highlightInEditor();
  }
}
项目:consulo    文件:FindDialog.java   
@Override
public void installOn(@Nonnull final Component c) {
  super.installOn(c);

  if (c instanceof JBTable) {
    String key = "navigate.to.usage";
    JComponent component = (JComponent)c;
    component.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), key);
    component.getActionMap().put(key, new AbstractAction() {
      @Override
      public void actionPerformed(ActionEvent e) {
        navigateToSelectedUsage((JBTable)c);
      }
    });
    //anAction.registerCustomShortcutSet(CommonShortcuts.ENTER, component);
    registerNavigateToSourceShortcutOnComponent((JBTable)c, component);
  }
}
项目:consulo-java    文件:ProcessorProfilePanel.java   
private static JPanel createTablePanel(final JBTable table) {
  return ToolbarDecorator.createDecorator(table)
    .disableUpAction()
    .disableDownAction()
    .setAddAction(new AnActionButtonRunnable() {
      @Override
      public void run(AnActionButton anActionButton) {
        final TableCellEditor cellEditor = table.getCellEditor();
        if (cellEditor != null) {
          cellEditor.stopCellEditing();
        }
        final TableModel model = table.getModel();
        ((EditableModel)model).addRow();
        TableUtil.editCellAt(table, model.getRowCount() - 1, 0);
      }
    })
    .createPanel();
}
项目:date-time-converter-plugin    文件:DateTimeConverterView.java   
@Override
public void initComponent() {
    model = new DateTimeTableModel();

    final KeyStroke shortcutPaste = KeymapUtil.getKeyStroke(CommonShortcuts.getPaste());
    final DateTimeColumnModel columns = new DateTimeColumnModel("Unix timestamp (ms)", "Datetime", "Format");

    final ComboBox defaultPatterns = new ComboBox(DateTimePattern.getPatterns());
    defaultPatterns.setEditable(true);
    columns.getColumn(2).setCellEditor(new DefaultCellEditor(defaultPatterns));

    final JBTable table = new JBTable(model, columns);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setAutoCreateRowSorter(true);
    table.registerKeyboardAction(e -> model.addRows(DateTimeUtil.getClipboardDateTimes()), shortcutPaste, JComponent.WHEN_FOCUSED);

    final JBScrollPane scrollPane = new JBScrollPane(table);

    final DefaultActionGroup group = new DefaultActionGroup();
    group.add(new AddRowAction(model));
    group.add(new DeleteRowAction(model, table));

    final SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false);

    final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("datetimeconverterbar", group, false);
    toolbar.setTargetComponent(panel);

    panel.add(scrollPane);
    panel.setToolbar(toolbar.getComponent());

    component = panel;
}
项目:jfrog-idea-plugin    文件:LicensesTreeCellRenderer.java   
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
    DefaultTreeCellRenderer cellRenderer = (DefaultTreeCellRenderer) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
    tree.putClientProperty(TREE_TABLE_TREE_KEY, new JBTable());
    cellRenderer.setIcon(null);
    return cellRenderer;
}
项目:jfrog-idea-plugin    文件:IssuesTreeCellRenderer.java   
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
    DefaultTreeCellRenderer cellRenderer = (JBDefaultTreeCellRenderer) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
    tree.putClientProperty(TREE_TABLE_TREE_KEY, new JBTable()); // Avoid setting TreeUnfocusedSelectionBackground

    // Set icon
    Issue topIssue = ((ScanTreeNode) value).getTopIssue();
    cellRenderer.setIcon(IconUtils.load(StringUtils.lowerCase(topIssue.getSeverity().toString())));

    return cellRenderer;
}
项目:Android-ORM-ASPlugin    文件:NewProviderDialog.java   
private void init() {
    classList = new ArrayList<ClassEntity>(files.size());
    for (VirtualFile vf : files) {
        classList.add(Utils.getFrom(project, vf));
    }
    if (!classList.isEmpty()) {
        this.classEntity = classList.get(0);
    }
    ClassTableModel model = new ClassTableModel(classList);
    table = new JBTable(model);
    model.setTableEditor(table);
    scrollPane.setViewportView(table);
}
项目:GravSupport    文件:LanguageFileEditorGUI.java   
private void createUIComponents() {
    tabbedPane = new JTabbedPane();
    table1 = new JBTable();
    table1.setFillsViewportHeight(true);
    table1.setComponentPopupMenu(createPopupMenu());
    scrollPane1 = new JBScrollPane(table1);
    table1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    setCellRenderer();
    btnAddNewKey = new JButton();
}
项目:mule-intellij-plugins    文件:MuleRemoteDebuggerConfPanel.java   
private void createUIComponents() {
    NumberFormat format = NumberFormat.getInstance();
    format.setGroupingUsed(false);
    NumberFormatter formatter = new NumberFormatter(format);
    formatter.setValueClass(Integer.class);
    formatter.setMaximum(65535);
    formatter.setAllowsInvalid(false);
    formatter.setCommitsOnValidEdit(true);
    portTextField = new JFormattedTextField(formatter);
    jvmPortTextField = new JFormattedTextField(formatter);

    appsMap = new JBTable(new ModulesTableModel());

}
项目:tomcat-runner    文件:TomcatRunnerConfPanel.java   
private void createUIComponents() {
    contexts = new JBTable(new ModuleTableModel());
    contexts.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    contexts.setDefaultRenderer(String.class, new ModuleCellRenderer());
    contexts.getColumnModel().getColumn(0).setPreferredWidth(25);
    tableScrollPane = new JBScrollPane();
    tableScrollPane.setViewportView(contexts);
    tableScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    tableScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    tableScrollPane.setPreferredSize(new Dimension(400, 100));
    tableScrollPane.setSize(new Dimension(400, 100));
}
项目:intellij-ce-playground    文件:ImportLayoutPanel.java   
public static void resizeColumns(final PackageEntryTable packageTable, JBTable result, boolean areStaticImportsEnabled) {
  ColoredTableCellRenderer packageRenderer = new ColoredTableCellRenderer() {
    @Override
    protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {
      PackageEntry entry = packageTable.getEntryAt(row);

      if (entry == PackageEntry.BLANK_LINE_ENTRY) {
        append("<blank line>", SimpleTextAttributes.GRAYED_ATTRIBUTES);
      }
      else {
        TextAttributes attributes = JavaHighlightingColors.KEYWORD.getDefaultAttributes();
        append("import", SimpleTextAttributes.fromTextAttributes(attributes));
        if (entry.isStatic()) {
          append(" ", SimpleTextAttributes.REGULAR_ATTRIBUTES);
          append("static", SimpleTextAttributes.fromTextAttributes(attributes));
        }
        append(" ", SimpleTextAttributes.REGULAR_ATTRIBUTES);

        if (entry == PackageEntry.ALL_OTHER_IMPORTS_ENTRY || entry == PackageEntry.ALL_OTHER_STATIC_IMPORTS_ENTRY) {
          append("all other imports", SimpleTextAttributes.REGULAR_ATTRIBUTES);
        }
        else {
          append(entry.getPackageName() + ".*", SimpleTextAttributes.REGULAR_ATTRIBUTES);
        }
      }
    }
  };
  if (areStaticImportsEnabled) {
    fixColumnWidthToHeader(result, 0);
    fixColumnWidthToHeader(result, 2);
    result.getColumnModel().getColumn(1).setCellRenderer(packageRenderer);
    result.getColumnModel().getColumn(0).setCellRenderer(new BooleanTableCellRenderer());
    result.getColumnModel().getColumn(2).setCellRenderer(new BooleanTableCellRenderer());
  }
  else {
    fixColumnWidthToHeader(result, 1);
    result.getColumnModel().getColumn(0).setCellRenderer(packageRenderer);
    result.getColumnModel().getColumn(1).setCellRenderer(new BooleanTableCellRenderer());
  }
}
项目:intellij-ce-playground    文件:ImportLayoutPanel.java   
private static void fixColumnWidthToHeader(JBTable result, int columnIdx) {
  final TableColumn column = result.getColumnModel().getColumn(columnIdx);
  final int width =
    15 + result.getTableHeader().getFontMetrics(result.getTableHeader().getFont()).stringWidth(result.getColumnName(columnIdx));
  column.setMinWidth(width);
  column.setMaxWidth(width);
}
项目:intellij-ce-playground    文件:ImportLayoutPanel.java   
public static void refreshTableModel(int selectedRow, JBTable table) {
  AbstractTableModel model = (AbstractTableModel)table.getModel();
  model.fireTableRowsInserted(selectedRow, selectedRow);
  table.setRowSelectionInterval(selectedRow, selectedRow);
  TableUtil.editCellAt(table, selectedRow, 0);
  Component editorComp = table.getEditorComponent();
  if (editorComp != null) {
    editorComp.requestFocus();
  }
}
项目:intellij-ce-playground    文件:PackagePanel.java   
private static void addPackageToPackages(JBTable table, PackageEntryTable list) {
  int selected = table.getSelectedRow() + 1;
  if (selected < 0) {
    selected = list.getEntryCount();
  }
  PackageEntry entry = new PackageEntry(false, "", true);
  list.insertEntryAt(entry, selected);
  ImportLayoutPanel.refreshTableModel(selected, table);
}
项目:intellij-ce-playground    文件:PackagePanel.java   
private static void removeEntryFromPackages(JBTable table, PackageEntryTable list) {
  int selected = table.getSelectedRow();
  if (selected < 0) return;
  TableUtil.stopEditing(table);
  list.removeEntryAt(selected);
  AbstractTableModel model = (AbstractTableModel)table.getModel();
  model.fireTableRowsDeleted(selected, selected);
  if (selected >= list.getEntryCount()) {
    selected--;
  }
  if (selected >= 0) {
    table.setRowSelectionInterval(selected, selected);
  }
}
项目:intellij-ce-playground    文件:ReplaceConstructorWithBuilderDialog.java   
private JScrollPane createTablePanel() {
  myTableModel = new MyTableModel();
  myTable = new JBTable(myTableModel);
  myTable.setSurrendersFocusOnKeystroke(true);
  myTable.getTableHeader().setReorderingAllowed(false);

  final TableColumnModel columnModel = myTable.getColumnModel();
  columnModel.getColumn(SKIP_SETTER).setCellRenderer(new BooleanTableCellRenderer());

  myTable.registerKeyboardAction(
    new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        final int[] selectedRows = myTable.getSelectedRows();
        for (final int selectedRow : selectedRows) {
          final ParameterData parameterData = myTableModel.getParamData(selectedRow);
          if (parameterData.getDefaultValue() != null) {
            parameterData.setInsertSetter(!parameterData.isInsertSetter());
          }
        }
        TableUtil.selectRows(myTable, selectedRows);
      }
    },
    KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0),
    JComponent.WHEN_FOCUSED
  );

  myTable.setPreferredScrollableViewportSize(new Dimension(550, myTable.getRowHeight() * 12));
  myTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

  return ScrollPaneFactory.createScrollPane(myTable);
}
项目:intellij-ce-playground    文件:ProcessorProfilePanel.java   
private static void updateTable(final JPanel tablePanel, final JBTable table, boolean enabled) {
  final AnActionButton addButton = ToolbarDecorator.findAddButton(tablePanel);
  if (addButton != null) {
    addButton.setEnabled(enabled);
  }
  final AnActionButton removeButton = ToolbarDecorator.findRemoveButton(tablePanel);
  if (removeButton != null) {
    removeButton.setEnabled(enabled && table.getSelectedRow() >= 0);
  }
  table.setEnabled(enabled);
  final JTableHeader header = table.getTableHeader();
  if (header != null) {
    header.repaint();
  }
}
项目:intellij-ce-playground    文件:DirDiffDialog.java   
public DirDiffDialog(Project project, DirDiffTableModel model) {
  super(project);
  setModal(false);
  myModel = model;
  setTitle("Directory Diff");
  init();
  final JBTable table = myDiffPanel.getTable();
  table.setColumnSelectionAllowed(false);
  table.getTableHeader().setReorderingAllowed(false);
  table.getTableHeader().setResizingAllowed(false);
  Disposer.register(getDisposable(), myModel);
  Disposer.register(project, getDisposable());
}
项目:intellij-ce-playground    文件:DualView.java   
private void changeViewTo(JTable view) {
  myCurrentView = view;
  if (myCurrentView != null) {
    myCurrentView.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    if (myCurrentView instanceof JBTable) {
      ((JBTable)myCurrentView).setStriped(true);
    }
    final int row = myCurrentView.getSelectedRow();
    myCurrentView.scrollRectToVisible(myCurrentView.getCellRect(row, 0, true));
  }
}
项目:intellij-ce-playground    文件:VcsLogImpl.java   
@Override
@NotNull
public List<Hash> getSelectedCommits() {
  List<Hash> hashes = ContainerUtil.newArrayList();
  JBTable table = myUi.getTable();
  for (int row : table.getSelectedRows()) {
    Hash hash = ((GraphTableModel)table.getModel()).getHashAtRow(row);
    if (hash != null) {
      hashes.add(hash);
    }
  }
  return hashes;
}
项目:intellij-ce-playground    文件:VcsLogImpl.java   
@NotNull
@Override
public List<VcsFullCommitDetails> getSelectedDetails() {
  List<VcsFullCommitDetails> details = ContainerUtil.newArrayList();
  JBTable table = myUi.getTable();
  for (int row : table.getSelectedRows()) {
    GraphTableModel model = (GraphTableModel)table.getModel();
    VcsFullCommitDetails commitDetails = model.getFullCommitDetails(row);
    if (commitDetails == null) {
      return ContainerUtil.emptyList();
    }
    details.add(commitDetails);
  }
  return details;
}
项目: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    文件:FindDialog.java   
@Override
protected boolean onDoubleClick(MouseEvent event) {
  Object source = event.getSource();
  if (!(source instanceof JBTable)) return false;
  navigateToSelectedUsage((JBTable)source);
  return true;
}
项目:intellij-ce-playground    文件:ColumnTreeBuilder.java   
public ColumnTreeBuilder(@NotNull JTree tree) {
  myTree = tree;
  myTableModel = new DefaultTableModel();
  myTable = new JBTable(myTableModel);
  myCellRenderer = new ColumnTreeCellRenderer(myTree, myTable.getColumnModel());
  myRowSorter = new TableRowSorter<TableModel>(myTable.getModel());
  myColumBuilders = new LinkedList<ColumnBuilder>();
}
项目:intellij-ce-playground    文件:ChooseDeviceDialogFixture.java   
private boolean chooseRunningDeviceStep(@NotNull String deviceName) {
  new JRadioButtonFixture(robot(), findRadioButtonByText("Choose a running device")).click();

  JBTable deviceTable = robot().finder().findByType(target(), JBTable.class);
  assertNotNull(deviceTable);
  JTableFixture deviceTableFixture = new JTableFixture(robot(), deviceTable);

  int deviceColumnIndex = deviceTable.getColumn("Device").getModelIndex();
  int compatibleColumnIndex = deviceTable.getColumn("Compatible").getModelIndex();

  int rowToSelect = -1;

  for (int i = 0; i < deviceTable.getRowCount(); ++i) {
    IDevice device = (IDevice)deviceTable.getModel().getValueAt(i, deviceColumnIndex);
    ThreeState launchCompatibility = ((LaunchCompatibility)deviceTable.getModel().getValueAt(i, compatibleColumnIndex)).isCompatible();

    // Only run devices if they're what's specified and are ready/compatible.
    if (device.getAvdName() != null &&
        device.getAvdName().equals(deviceName) &&
        device.getState() == IDevice.DeviceState.ONLINE &&
        launchCompatibility == ThreeState.YES) {
      rowToSelect = i;
      break;
    }
  }

  if (rowToSelect < 0) {
    return false;
  }
  deviceTableFixture.selectRows(rowToSelect);
  return true;
}
项目: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    文件:PropertiesComponent.java   
public void init() {
  setLayout(new BorderLayout());
  myTable = new JBTable();
  myTextArea = new JTextArea(0, 0);
  myTextArea.setEditable(false);
  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable);
  mySplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, scrollPane, ScrollPaneFactory.createScrollPane(myTextArea));
  add(mySplitPane, BorderLayout.CENTER);
  add(createToolbar(), BorderLayout.WEST);
  final DefaultTableModel model = new DefaultTableModel(createTableModel(new HashMap<String, String>()), new Object[]{"Name", "Value"}) {
    public boolean isCellEditable(final int row, final int column) {
      return false;
    }
  };
  myTable.setModel(model);
  myTable.setShowVerticalLines(true);
  myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
      int index = myTable.getSelectedRow();
      if (index >= 0) {
        Object value = myTable.getValueAt(index, 1);
        if (value instanceof String) {
          myTextArea.setText(((String) value));
        } else {
          myTextArea.setText("");
        }
      } else {
        myTextArea.setText("");
      }
    }
  });
  myPopupActionGroup = createPopup();
  PopupHandler.installPopupHandler(myTable, myPopupActionGroup, ActionPlaces.UNKNOWN, ActionManager.getInstance());
  PopupHandler.installPopupHandler(scrollPane, myPopupActionGroup, ActionPlaces.UNKNOWN, ActionManager.getInstance());
  final Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_CLOSE_ACTIVE_TAB);
  myCloseAction.registerCustomShortcutSet(new CustomShortcutSet(shortcuts), this);
  myRefreshAction.registerCustomShortcutSet(CommonShortcuts.getRerun(), this);
}
项目:intellij-ce-playground    文件:CoverageViewBuilder.java   
CoverageViewBuilder(final Project project,
                    final JList list,
                    final Model model,
                    final AbstractTreeStructure treeStructure, final JBTable table) {
  super(project, list, model, treeStructure, AlphaComparator.INSTANCE, false);
  myTable = table;
  ProgressManager.getInstance().run(new Task.Backgroundable(project, "Building coverage report...") {
    @Override
    public void run(@NotNull ProgressIndicator indicator) {
      buildRoot();
    }

    @Override
    public void onSuccess() {
      ensureSelectionExist();
      updateParentTitle();
    }
  });
  myFileStatusListener = new FileStatusListener() {
    @Override
    public void fileStatusesChanged() {
      table.repaint();
    }

    @Override
    public void fileStatusChanged(@NotNull VirtualFile virtualFile) {
      table.repaint();
    }
  };
  myCoverageViewExtension = ((CoverageViewTreeStructure)myTreeStructure).myData
    .getCoverageEngine().createCoverageViewExtension(myProject, ((CoverageViewTreeStructure)myTreeStructure).myData,
                                                     ((CoverageViewTreeStructure)myTreeStructure).myStateBean);
  FileStatusManager.getInstance(myProject).addFileStatusListener(myFileStatusListener);
}
项目:vso-intellij    文件:ResolveConflictsForm.java   
/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL
 */
private void $$$setupUI$$$() {
    myContentPanel = new JPanel();
    myContentPanel.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1));
    myContentPanel.add(panel1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    myAcceptYoursButton = new JButton();
    myAcceptYoursButton.setEnabled(false);
    myAcceptYoursButton.setText("Accept Yours");
    myAcceptYoursButton.setMnemonic('Y');
    myAcceptYoursButton.setDisplayedMnemonicIndex(7);
    panel1.add(myAcceptYoursButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final Spacer spacer1 = new Spacer();
    panel1.add(spacer1, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
    myAcceptTheirsButton = new JButton();
    myAcceptTheirsButton.setEnabled(false);
    myAcceptTheirsButton.setText("Accept Theirs");
    myAcceptTheirsButton.setMnemonic('T');
    myAcceptTheirsButton.setDisplayedMnemonicIndex(7);
    panel1.add(myAcceptTheirsButton, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    myMergeButton = new JButton();
    myMergeButton.setEnabled(false);
    myMergeButton.setText("Merge");
    myMergeButton.setMnemonic('M');
    myMergeButton.setDisplayedMnemonicIndex(0);
    panel1.add(myMergeButton, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JBScrollPane jBScrollPane1 = new JBScrollPane();
    myContentPanel.add(jBScrollPane1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
    myItemsTable = new JBTable();
    myItemsTable.putClientProperty("Table.isFileList", Boolean.FALSE);
    jBScrollPane1.setViewportView(myItemsTable);
}
项目:vso-intellij    文件:LockItemsForm.java   
/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL
 */
private void $$$setupUI$$$() {
    contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout(0, 0));
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1));
    contentPane.add(panel1, BorderLayout.SOUTH);
    panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("LockDialog.LockBox")));
    lockCheckInRadioButton = new JRadioButton();
    this.$$$loadButtonText$$$(lockCheckInRadioButton, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("LockDialog.CheckinRadio"));
    panel1.add(lockCheckInRadioButton, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    lockCheckOutRadioButton = new JRadioButton();
    this.$$$loadButtonText$$$(lockCheckOutRadioButton, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("LockDialog.CheckoutRadio"));
    panel1.add(lockCheckOutRadioButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    recursiveCheckBox = new JCheckBox();
    recursiveCheckBox.setSelected(true);
    this.$$$loadButtonText$$$(recursiveCheckBox, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("LockDialog.RecursiveCheck"));
    panel1.add(recursiveCheckBox, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JPanel panel2 = new JPanel();
    panel2.setLayout(new BorderLayout(0, 0));
    contentPane.add(panel2, BorderLayout.CENTER);
    panel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("LockDialog.ItemsBox")));
    final JBScrollPane jBScrollPane1 = new JBScrollPane();
    panel2.add(jBScrollPane1, BorderLayout.CENTER);
    lockItemsTable = new JBTable();
    lockItemsTable.setEnabled(true);
    lockItemsTable.setPreferredScrollableViewportSize(new Dimension(500, 200));
    jBScrollPane1.setViewportView(lockItemsTable);
    ButtonGroup buttonGroup;
    buttonGroup = new ButtonGroup();
    buttonGroup.add(lockCheckInRadioButton);
    buttonGroup.add(lockCheckOutRadioButton);
}
项目:plgin    文件:AndroidBatchScaleImporter.java   
private void createUIComponents() {
    table = new JBTable() {
        @NotNull
        @Override
        public Component prepareRenderer(@NotNull TableCellRenderer renderer, int row, int column) {
            Component c = super.prepareRenderer(renderer, row, column);
            c.setEnabled(isCellEditable(row, column));
            return c;
        }
    };
}