当前位置: 首页>>代码示例>>Java>>正文


Java CheckBoxList类代码示例

本文整理汇总了Java中com.intellij.ui.CheckBoxList的典型用法代码示例。如果您正苦于以下问题:Java CheckBoxList类的具体用法?Java CheckBoxList怎么用?Java CheckBoxList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CheckBoxList类属于com.intellij.ui包,在下文中一共展示了CheckBoxList类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createComponent

import com.intellij.ui.CheckBoxList; //导入依赖的package包/类
@RequiredDispatchThread
@Nullable
@Override
public JComponent createComponent() {
  myList = new CheckBoxList<>();
  myList.setBorder(null);

  EarlyAccessProgramDescriptor[] extensions = EarlyAccessProgramDescriptor.EP_NAME.getExtensions();
  Arrays.sort(extensions, (o1, o2) -> {
    if (o1.isAvailable() && !o2.isAvailable()) {
      return -1;
    }
    else if (o2.isAvailable() && !o1.isAvailable()) {
      return 1;
    }
    return o1.getName().compareToIgnoreCase(o2.getName());
  });
  myList.setItems(Arrays.asList(extensions), EarlyAccessProgramDescriptor::getName, desc -> EarlyAccessProgramManager.is(desc.getClass()));
  myList.setCellRenderer(new EarlyAccessCellRender());

  return JBUI.Panels.simplePanel().addToTop(createWarningPanel()).addToCenter(ScrollPaneFactory.createScrollPane(myList, true));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:EarlyAccessProgramConfigurable.java

示例2: CheckBoxListModelEditor

import com.intellij.ui.CheckBoxList; //导入依赖的package包/类
public CheckBoxListModelEditor(@NotNull Function<T, String> toNameConverter, @NotNull String emptyText) {
  this.toNameConverter = toNameConverter;
  list = new CheckBoxList<T>();
  list.setEmptyText(emptyText);
  // toolbar decorator is responsible for border
  list.setBorder(null);
  toolbarDecorator = ToolbarDecorator.createDecorator(list);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:CheckBoxListModelEditor.java

示例3: PyModuleDependenciesConfigurable

import com.intellij.ui.CheckBoxList; //导入依赖的package包/类
public PyModuleDependenciesConfigurable(Module module) {
  myModule = module;
  myDependenciesList = new CheckBoxList<Module>();
  resetModel();
  ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myDependenciesList,
                                                                new EditableListModelDecorator((DefaultListModel) myDependenciesList.getModel()));
  decorator.disableRemoveAction();
  myListHolderPanel.add(decorator.createPanel(), BorderLayout.CENTER);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PyModuleDependenciesConfigurable.java

示例4: testDirectoryAsImportProjectPath

import com.intellij.ui.CheckBoxList; //导入依赖的package包/类
public void testDirectoryAsImportProjectPath() {
  myFromPantsControl.onLinkedProjectPathChange(getProjectPath() + File.separator + "examples/src/java/org/pantsbuild/example/hello");
  updateSettingsBasedOnGuiStates();

  CheckBoxList<String> checkBoxList = getTargetSpecCheckBoxList();
  assertFalse("Check box list should be disabled, but it is not.", checkBoxList.isEnabled());

  assertEquals(
    ContainerUtil.newArrayList("examples/src/java/org/pantsbuild/example/hello/::"),
    myFromPantsControl.getProjectSettings().getTargetSpecs()
  );
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:13,代码来源:PantsProjectSettingsTest.java

示例5: testBuildFileAsImportProjectPath

import com.intellij.ui.CheckBoxList; //导入依赖的package包/类
public void testBuildFileAsImportProjectPath() {
  myFromPantsControl.onLinkedProjectPathChange(
    getProjectPath() + File.separator +
    "examples/src/java/org/pantsbuild/example/hello/main/BUILD"
  );

  updateSettingsBasedOnGuiStates();

  // Checkbox is made, but it none of the targets should be selected.
  assertEquals(
    "None of the target specs should be selected, but some are.",
    ContainerUtil.emptyList(),
    myFromPantsControl.getProjectSettings().getTargetSpecs()
  );

  CheckBoxList<String> checkBoxList = getTargetSpecCheckBoxList();

  assertTrue("Check box list should be enabled, but it is not.", checkBoxList.isEnabled());

  // Simulate checking all the boxes.
  for (int i = 0; i < checkBoxList.getItemsCount(); i++) {
    String target = checkBoxList.getItemAt(i);
    checkBoxList.setItemSelected(target, true);
  }

  updateSettingsBasedOnGuiStates();

  // Now project setting should contain all the targets in the BUILD file.
  assertEquals(
    ContainerUtil.newArrayList(
      "examples/src/java/org/pantsbuild/example/hello/main:main",
      "examples/src/java/org/pantsbuild/example/hello/main:readme",
      "examples/src/java/org/pantsbuild/example/hello/main:main-bin"
    ),
    myFromPantsControl.getProjectSettings().getTargetSpecs()
  );
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:38,代码来源:PantsProjectSettingsTest.java

示例6: focus

import com.intellij.ui.CheckBoxList; //导入依赖的package包/类
private void focus(final CheckBoxList list) {
  list.addFocusListener(new FocusAdapter() {
    @Override
    public void focusGained(FocusEvent e) {
      if (list.getItemsCount() > 0 && list.getSelectedIndex() == -1) {
        list.setSelectedIndex(0);
        //list.removeSelectionInterval(0, 0);
        list.removeFocusListener(this);
      }
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:ContainedInBranchesConfigDialog.java

示例7: setItems

import com.intellij.ui.CheckBoxList; //导入依赖的package包/类
private static void setItems(Collection<String> localBranches, Set<String> localBranchesCopy, final CheckBoxList list) {
  // order
  final Map<String, Boolean> localBranchesState = new TreeMap<String, Boolean>();
  for (String localBranch : localBranches) {
    localBranchesState.put(localBranch, localBranchesCopy.contains(localBranch));
  }
  list.setStringItems(localBranchesState);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:ContainedInBranchesConfigDialog.java

示例8: CustomizeSelectTemplateStepPanel

import com.intellij.ui.CheckBoxList; //导入依赖的package包/类
public CustomizeSelectTemplateStepPanel(MultiMap<String, String> predefinedTemplates) {
  myPredefinedTemplates = predefinedTemplates;
  setLayout(new BorderLayout());

  myCheckBoxList = new CheckBoxList<>();

  myCheckBoxList.setItems(new ArrayList<>(predefinedTemplates.keySet()), s -> s);
  add(ScrollPaneFactory.createScrollPane(myCheckBoxList, true), BorderLayout.CENTER);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:CustomizeSelectTemplateStepPanel.java

示例9: createComponent

import com.intellij.ui.CheckBoxList; //导入依赖的package包/类
@RequiredDispatchThread
@Nullable
@Override
public JComponent createComponent() {
  PostfixTemplateProvider postfixTemplateProvider = myExtensionPoint.getInstance();
  if (postfixTemplateProvider == null) {
    return null;
  }

  OnePixelSplitter splitter = new OnePixelSplitter();
  splitter.setSplitterProportionKey("PostfixTemplatesChildConfigurable.splitter");

  myCheckBoxList = new CheckBoxList<>();

  splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myCheckBoxList, true));

  myPostfixDescriptionPanel = new PostfixDescriptionPanel();
  JPanel component = myPostfixDescriptionPanel.getComponent();
  component.setBorder(JBUI.Borders.empty(0, 8, 0, 0));
  splitter.setSecondComponent(component);

  myCheckBoxList.setItems(new ArrayList<>(postfixTemplateProvider.getTemplates()), PostfixTemplate::getPresentableName, postfixTemplate -> Boolean.TRUE);

  myCheckBoxList.addListSelectionListener(new ListSelectionListener() {
    @Override
    public void valueChanged(ListSelectionEvent e) {
      PostfixTemplate itemAt = myCheckBoxList.getItemAt(myCheckBoxList.getSelectedIndex());

      myPostfixDescriptionPanel.reset(PostfixTemplateMetaData.createMetaData(itemAt));
    }
  });
  return splitter;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:34,代码来源:PostfixTemplatesChildConfigurable.java

示例10: getList

import com.intellij.ui.CheckBoxList; //导入依赖的package包/类
public CheckBoxList<T> getList() {
  return list;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:CheckBoxListModelEditor.java

示例11: getTargetSpecCheckBoxList

import com.intellij.ui.CheckBoxList; //导入依赖的package包/类
/**
 * @return the GUI component to select target specs.
 */
private CheckBoxList<String> getTargetSpecCheckBoxList() {
  return ((PantsProjectSettingsControl) myFromPantsControl.getProjectSettingsControl()).myTargetSpecsBox;
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:7,代码来源:PantsProjectSettingsTest.java

示例12: getListCellRendererComponent

import com.intellij.ui.CheckBoxList; //导入依赖的package包/类
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
  CheckBoxList checkBoxList = (CheckBoxList)list;
  EarlyAccessProgramDescriptor earlyAccessProgramDescriptor = (EarlyAccessProgramDescriptor)checkBoxList.getItemAt(index);

  JCheckBox checkbox = (JCheckBox)value;

  checkbox.setEnabled(list.isEnabled());
  checkbox.setFocusPainted(false);
  checkbox.setBorderPainted(true);

  if (earlyAccessProgramDescriptor == null) {
    return checkbox;
  }
  else {
    checkbox.setEnabled(earlyAccessProgramDescriptor.isAvailable());

    JPanel panel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, true, true)) {
      @Override
      public Dimension getPreferredSize() {
        Dimension size = super.getPreferredSize();
        return new Dimension(Math.min(size.width, 200), size.height);
      }
    };
    panel.setEnabled(earlyAccessProgramDescriptor.isAvailable());

    JPanel topPanel = new JPanel(new BorderLayout());
    topPanel.add(checkbox, BorderLayout.WEST);

    if (earlyAccessProgramDescriptor.isRestartRequired()) {
      JBLabel comp = new JBLabel("Restart required");
      comp.setForeground(JBColor.GRAY);
      topPanel.add(comp, BorderLayout.EAST);
    }

    panel.add(topPanel);
    panel.setBorder(new CustomLineBorder(0, 0, 1, 0));

    String description = StringUtil.notNullizeIfEmpty(earlyAccessProgramDescriptor.getDescription(), "Description is not available");
    JTextPane textPane = new JTextPane();
    textPane.setText(description);
    textPane.setEditable(false);
    if (!earlyAccessProgramDescriptor.isAvailable()) {
      textPane.setForeground(JBColor.GRAY);
    }
    panel.add(textPane);
    return panel;
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:50,代码来源:EarlyAccessProgramConfigurable.java

示例13: createUIComponents

import com.intellij.ui.CheckBoxList; //导入依赖的package包/类
private void createUIComponents() {
  myList = new CheckBoxList<GutterIconDescriptor>() {
    @Override
    protected JComponent adjustRendering(JComponent rootComponent, JCheckBox checkBox, int index, boolean selected, boolean hasFocus) {
      JPanel panel = new JPanel(new BorderLayout());
      panel.setBorder(BorderFactory.createEmptyBorder());
      GutterIconDescriptor descriptor = myList.getItemAt(index);
      Icon icon = descriptor == null ? null : descriptor.getIcon();
      JLabel label = new JLabel(icon == null ? EmptyIcon.ICON_16 : icon);
      label.setOpaque(true);
      label.setPreferredSize(new Dimension(25, -1));
      label.setHorizontalAlignment(SwingConstants.CENTER);
      panel.add(label, BorderLayout.WEST);
      panel.add(checkBox, BorderLayout.CENTER);
      panel.setBackground(getBackground(false));
      label.setBackground(getBackground(selected));
      if (!checkBox.isOpaque()) {
        checkBox.setOpaque(true);
      }
      checkBox.setBorder(null);

      PluginDescriptor pluginDescriptor = myFirstDescriptors.get(descriptor);
      if (pluginDescriptor instanceof IdeaPluginDescriptor) {
        SeparatorWithText separator = new SeparatorWithText();
        String name = ((IdeaPluginDescriptor)pluginDescriptor).getName();
        separator.setCaption("IDEA CORE".equals(name) ? "Common" : name);
        panel.add(separator, BorderLayout.NORTH);
      }

      return panel;
    }

    @Nullable
    @Override
    protected Point findPointRelativeToCheckBox(int x, int y, @Nonnull JCheckBox checkBox, int index) {
      return super.findPointRelativeToCheckBoxWithAdjustedRendering(x, y, checkBox, index);
    }
  };
  myList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  myList.setBorder(BorderFactory.createEmptyBorder());
  new ListSpeedSearch(myList, (Convertor<Object, String>)o -> o instanceof JCheckBox ? ((JCheckBox)o).getText() : null);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:43,代码来源:GutterIconsConfigurable.java


注:本文中的com.intellij.ui.CheckBoxList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。