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

项目:intellij-ce-playground    文件:TableView.java   
@Override
protected void createDefaultRenderers() {
  super.createDefaultRenderers();

  UIDefaults.LazyValue booleanRenderer = new UIDefaults.LazyValue() {
    @Override
    public Object createValue(@NotNull UIDefaults table) {
      DefaultCellEditor editor = new DefaultCellEditor(GuiUtils.createUndoableTextField());
      editor.setClickCountToStart(1);
      return new BooleanTableCellRenderer();
    }
  };
  //noinspection unchecked
  defaultRenderersByColumnClass.put(boolean.class, booleanRenderer);
  //noinspection unchecked
  defaultRenderersByColumnClass.put(Boolean.class, booleanRenderer);
}
项目:Android-ORM-ASPlugin    文件:ClassTableModel.java   
public void setTableEditor(JTable table) {
    this.table = table;
    TableColumnModel columnModel = table.getColumnModel();
    columnModel.getColumn(COL_CHECK).setCellRenderer(new BooleanTableCellRenderer());
    columnModel.getColumn(COL_CHECK).setCellEditor(new BooleanTableCellEditor());
    columnModel.getColumn(COL_CHECK).setPreferredWidth(50);
    columnModel.getColumn(COL_TABLE).setPreferredWidth(100);

    JTableHeader header = table.getTableHeader();
    header.setDefaultRenderer(new ClassTableHeaderRenderer(table, true));
}
项目:intellij-ce-playground    文件:InstalledPluginsTableModel.java   
@Override
public TableCellRenderer getRenderer(final IdeaPluginDescriptor ideaPluginDescriptor) {
  return new BooleanTableCellRenderer() {
    @Override
    public Component getTableCellRendererComponent(JTable table,
                                                   Object value,
                                                   boolean isSelected,
                                                   boolean hasFocus,
                                                   int row,
                                                   int column) {
      return super.getTableCellRendererComponent(table, value == null ? Boolean.TRUE : value, isSelected, hasFocus, row, column);
    }
  };
}
项目:intellij-ce-playground    文件:CreateTestDialog.java   
public void methodsSize(int methods) {
  myTableModel = new DefaultTableModel(methods, 2);
  myMethodsTable.setModel(myTableModel);

  TableColumn checkColumn = myMethodsTable.getColumnModel().getColumn(0);
  TableUtil.setupCheckboxColumn(checkColumn);
  checkColumn.setCellRenderer(new BooleanTableCellRenderer());
  checkColumn.setCellEditor(new DefaultCellEditor(new JCheckBox()));

  myMethodsTable.getColumnModel().getColumn(1).setHeaderValue("Test method");
  checkColumn.setHeaderValue("");
  getOKAction().setEnabled(true);
}
项目:intellij-ce-playground    文件:PyParameterTableModel.java   
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, final boolean hasFocus, int row, int column) {
  JPanel panel = new JPanel();
  final Component component = super.getTableCellRendererComponent(table, ((Pair)value).getFirst(), isSelected, hasFocus, row, column);
  panel.add(component);

  final Component component1 =
    new BooleanTableCellRenderer().getTableCellRendererComponent(table, ((Pair)value).getSecond(), isSelected, hasFocus, row, column);
  panel.add(component1);
  return panel;
}
项目:intellij-ce-playground    文件:ColumnUtil.java   
public static void setColumns(@NotNull JTable table) {
  StringResourceTableModel model = (StringResourceTableModel) table.getModel();

  Enumeration<TableColumn> columns = table.getColumnModel().getColumns();
  while (columns.hasMoreElements()) {
    TableColumn column = columns.nextElement();
    if (column.getModelIndex() == ConstantColumn.UNTRANSLATABLE.ordinal()) {
      column.setCellRenderer(new BooleanTableCellRenderer());
    }
    else {
      column.setCellRenderer(CELL_RENDERER);
    }
    int index = column.getModelIndex();
    FontMetrics fontMetrics = table.getFontMetrics(table.getFont());
    Locale locale = model.localeOfColumn(index);
    HeaderCellRenderer renderer =
      locale == null ? new ConstantHeaderCellRenderer(index, fontMetrics) : new TranslationHeaderCellRenderer(fontMetrics, locale);
    column.setHeaderRenderer(renderer);
    // Sets Key and Default Value columns to initially display at full width and all others to be collapsed
    int width;
    if (ConstantColumn.KEY.ordinal() == index ||
        ConstantColumn.DEFAULT_VALUE.ordinal() == index) {
      width = renderer.getFullExpandedWidth();
    } else {
      width = renderer.getCollapsedWidth();
    }
    setPreferredWidth(column, width);
  }

  expandToViewportWidthIfNecessary(table, -1);
}
项目:google-cloud-intellij    文件:GoogleCloudApiSelectorPanel.java   
CloudLibraryTable(List<CloudLibrary> libraries) {
  super(new CloudLibraryTableModel(libraries));
  setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  setDefaultRenderer(CloudLibrary.class, new CloudLibraryRenderer());
  setDefaultRenderer(Boolean.class, new BooleanTableCellRenderer());
  setDefaultEditor(Boolean.class, new BooleanTableCellEditor());
  TableUtil.setupCheckboxColumn(getColumnModel().getColumn(1));
}
项目:tools-idea    文件:InstalledPluginsTableModel.java   
public TableCellRenderer getRenderer(final IdeaPluginDescriptor ideaPluginDescriptor) {
  return new BooleanTableCellRenderer() {
    @Override
    public Component getTableCellRendererComponent(JTable table,
                                                   Object value,
                                                   boolean isSelected,
                                                   boolean hasFocus,
                                                   int row,
                                                   int column) {
      return super.getTableCellRendererComponent(table, value == null ? Boolean.TRUE : value, isSelected, hasFocus, row, column);
    }
  };
}
项目:consulo    文件:PluginAdvertiserPluginModel.java   
@Override
public TableCellRenderer getRenderer(final IdeaPluginDescriptor ideaPluginDescriptor) {
  return new BooleanTableCellRenderer() {
    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      return super.getTableCellRendererComponent(table, value == null ? Boolean.TRUE : value, isSelected, hasFocus, row, column);
    }
  };
}
项目:consulo    文件:InstalledPluginsTableModel.java   
@Override
public TableCellRenderer getRenderer(final IdeaPluginDescriptor ideaPluginDescriptor) {
  return new BooleanTableCellRenderer() {
    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      return super.getTableCellRendererComponent(table, value == null ? Boolean.TRUE : value, isSelected, hasFocus, row, column);
    }
  };
}
项目:consulo-java    文件:ReplaceConstructorWithBuilderDialog.java   
private JScrollPane createTablePanel() {
  myTableModel = new MyTableModel();
  myTable = new Table(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);

  final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable);
  //final Border titledBorder = IdeBorderFactory.createBoldTitledBorder("Parameters to Pass to the Builder");
  //final Border emptyBorder = BorderFactory.createEmptyBorder(0, 5, 5, 5);
  //final Border border = BorderFactory.createCompoundBorder(titledBorder, emptyBorder);
  //scrollPane.setBorder(border);

  return scrollPane;
}
项目:intellij-ce-playground    文件:BooleanColumnInfo.java   
public BooleanColumnInfo(final String name) {
  super(name, new BooleanTableCellRenderer());
}
项目:tools-idea    文件:BooleanColumnInfo.java   
public BooleanColumnInfo(final String name) {
  super(name, new BooleanTableCellRenderer());
}
项目:consulo    文件:AbstractParameterTablePanel.java   
@Nullable
@Override
public TableCellRenderer getRenderer(AbstractVariableData data) {
  return new BooleanTableCellRenderer();
}
项目:consulo-xml    文件:BooleanColumnInfo.java   
public BooleanColumnInfo(final String name) {
  super(name, new BooleanTableCellRenderer());
}