com.intellij.ui.CheckBoxList Java Examples
The following examples show how to use
com.intellij.ui.CheckBoxList.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ModelDialog.java From intellij-extra-icons-plugin with MIT License | 6 votes |
private void initComponents() { setIdComponentsVisible(false); conditionsCheckboxList = new CheckBoxList<>((index, value) -> { //noinspection ConstantConditions conditionsCheckboxList.getItemAt(index).setEnabled(value); }); chooseIconButton.addActionListener(e -> SwingUtilities.invokeLater(() -> { try { customIconImage = loadCustomIcon(); if (customIconImage != null) { iconLabel.setIcon(IconUtil.createImageIcon(customIconImage.getImage())); } } catch (IllegalArgumentException ex) { Messages.showErrorDialog(ex.getMessage(), "Could Not Load Icon."); } })); conditionsCheckboxList.getEmptyText().setText("No conditions added."); toolbarPanel = createConditionsListToolbar(); conditionsPanel.add(toolbarPanel, BorderLayout.CENTER); for (ModelType value : ModelType.values()) { typeComboBox.addItem(value.getFriendlyName()); } }
Example #2
Source File: EarlyAccessProgramConfigurable.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess @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)); }
Example #3
Source File: PantsProjectSettingsTest.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
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()); String expectedProjectName = defaultProjectName("examples/src/java/org/pantsbuild/example/hello"); assertEquals(expectedProjectName, myFromPantsControl.getProjectSettings().getProjectName()); assertEquals( ContainerUtil.newArrayList("examples/src/java/org/pantsbuild/example/hello/::"), myFromPantsControl.getProjectSettings().getSelectedTargetSpecs() ); }
Example #4
Source File: PantsProjectSettingsTest.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
public void testBuildFileAsImportProjectPath() { myFromPantsControl.onLinkedProjectPathChange( getProjectPath() + File.separator + "examples/src/java/org/pantsbuild/example/hello/main/BUILD" ); updateSettingsBasedOnGuiStates(); String expectedProjectName = defaultProjectName("examples/src/java/org/pantsbuild/example/hello/main"); assertEquals(expectedProjectName, myFromPantsControl.getProjectSettings().getProjectName()); // 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().getSelectedTargetSpecs() ); 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(Sets.newLinkedHashSet(Lists.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" )) , Sets.newLinkedHashSet(myFromPantsControl.getProjectSettings().getSelectedTargetSpecs())); }
Example #5
Source File: CustomizeSelectTemplateStepPanel.java From consulo with Apache License 2.0 | 5 votes |
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); }
Example #6
Source File: PostfixTemplatesChildConfigurable.java From consulo with Apache License 2.0 | 5 votes |
@RequiredUIAccess @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; }
Example #7
Source File: PantsProjectSettingsTest.java From intellij-pants-plugin with Apache License 2.0 | 4 votes |
/** * @return the GUI component to select target specs. */ private CheckBoxList<String> getTargetSpecCheckBoxList() { return ((PantsProjectSettingsControl) myFromPantsControl.getProjectSettingsControl()).myTargetSpecsBox; }
Example #8
Source File: EarlyAccessProgramConfigurable.java From consulo with Apache License 2.0 | 4 votes |
@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; } }