Java 类com.intellij.ui.TableSpeedSearch 实例源码

项目:dagger2-intellij-plugin    文件:AbstractTypeSelectionTable.java   
public AbstractTypeSelectionTable(Collection<M> memberInfos, @Nullable TypeInfoModel<T, M> memberInfoModel) {
    myTableModel = new MyTableModel<T, M>(this);

    myTypesInfos = new ArrayList<M>(memberInfos);
    if (memberInfoModel != null) {
        myTypeInfoModel = memberInfoModel;
    } else {
        myTypeInfoModel = new DefaultTypeInfoModel<T, M>();
    }

    setModel(myTableModel);

    TableColumnModel model = getColumnModel();
    model.getColumn(DISPLAY_NAME_COLUMN).setCellRenderer(new MyTableRenderer<T, M>(this));
    TableColumn checkBoxColumn = model.getColumn(CHECKED_COLUMN);
    TableUtil.setupCheckboxColumn(checkBoxColumn);
    checkBoxColumn.setCellRenderer(new MyBooleanRenderer<T, M>(this));

    setPreferredScrollableViewportSize(new Dimension(400, getRowHeight() * 12));
    getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    setShowGrid(false);
    setIntercellSpacing(new Dimension(0, 0));

    new MyEnableDisableAction().register();
    new TableSpeedSearch(this);
}
项目:intellij-ce-playground    文件:ModulesToImportDialog.java   
private void createUIComponents() {
  myModulesTable = new ModuleTable();
  new TableSpeedSearch(myModulesTable, new PairFunction<Object, Cell, String>() {
    @Override
    public String fun(Object o, Cell v) {
      if (o instanceof ModuleRow) {
        ModuleRow row = (ModuleRow)o;
        return getNameOf(row.module);
      }
      return o == null || o instanceof Boolean ? "" : o.toString();
    }
  });
}
项目:intellij-ce-playground    文件:VmStatsTreeUtils.java   
public static void setSpeedSearch(TreeTable treeTable) {
  new TableSpeedSearch(treeTable) {
    @Override
    protected boolean isMatchingElement(Object element, String pattern) {
      String text = super.getElementText(element);
      // match search as long as some portion of the text matches the pattern
      return text != null && text.contains(pattern);
    }
  };
}
项目:intellij-ce-playground    文件:AttributesPanel.java   
public AttributesPanel() {
  myBackButton.setIcon(AllIcons.Actions.Back);
  myBackButton.setBorder(BORDER);

  myPaletteScrollPane.setVisible(false);
  myAdvancedFilterCheckBox.setVisible(false);
  myAttrGroupCombo.setVisible(false);

  new ComboboxSpeedSearch(myThemeCombo);

  myBackButton.setToolTipText("Back to the theme");

  myAttributesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  myAttributesTable.setTableHeader(null);

  // TODO: TableSpeedSearch does not really support filtered tables since it incorrectly uses the model to calculate the number
  // of available cells. Fix this.
  new TableSpeedSearch(myAttributesTable) {
    @Override
    protected int getElementCount() {
      return myComponent.getRowCount() * myComponent.getColumnCount();
    }
  };

  mySubStyleLabel.setVisible(false);
  mySubStyleLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

  myPalette.setShowCheckeredBackground(true);

  // Stop the combo box long items from blocking the right panel from being able to be made small.
  myThemeCombo.setMinimumSize(new Dimension(10, myThemeCombo.getMinimumSize().height));
  myThemeCombo.setPreferredSize(new Dimension(10, myThemeCombo.getPreferredSize().height));
}
项目:intellij-ce-playground    文件:HgMqUnAppliedPatchesPanel.java   
public HgMqUnAppliedPatchesPanel(@NotNull HgRepository repository) {
  super(new BorderLayout());
  myRepository = repository;
  myProject = myRepository.getProject();
  myMqPatchDir = myRepository.getHgDir().findChild("patches");
  mySeriesFile = myMqPatchDir != null ? new File(myMqPatchDir.getPath(), "series") : null;

  myPatchTable = new MyPatchTable(new MyPatchModel(myRepository.getUnappliedPatchNames()));
  myPatchTable.addFocusListener(new FocusAdapter() {
    @Override
    public void focusLost(FocusEvent e) {
      updatePatchSeriesInBackground(null);
      super.focusLost(e);
    }
  });
  myPatchTable.setShowColumns(true);
  myPatchTable.setFillsViewportHeight(true);
  myPatchTable.getEmptyText().setText("Nothing to show");
  myPatchTable.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0), START_EDITING);
  myPatchTable.setDragEnabled(true);
  new TableSpeedSearch(myPatchTable);
  myPatchTable.setDropMode(DropMode.INSERT_ROWS);
  myPatchTable.setTransferHandler(new TableRowsTransferHandler(myPatchTable));

  add(createToolbar(), BorderLayout.WEST);

  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myPatchTable);
  add(scrollPane, BorderLayout.CENTER);
  myProject.getMessageBus().connect(myProject).subscribe(HgVcs.STATUS_TOPIC, this);
}
项目:google-cloud-intellij    文件:ProjectSelectionDialog.java   
@VisibleForTesting
void installTableSpeedSearch(JTable projectListTable) {
  // IDEA implementation of instant type-search within a table.
  new TableSpeedSearch(projectListTable) {
    // reflect this text in the filter text field.
    @Override
    protected void selectElement(Object element, String selectedText) {
      filterTextField.setText(selectedText);
      super.selectElement(element, selectedText);
    }
  };
}
项目: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);
}
项目:intellij-ce-playground    文件:BuildVariantView.java   
private void createUIComponents() {
  myVariantsTable = new BuildVariantTable();
  new TableSpeedSearch(myVariantsTable);
  myNotificationPanel = new NotificationPanel();
  myNotificationPanel.setVisible(false);
}