public FrameworkGroupOptionsComponent( final FrameworkGroup<?> group, final FrameworkSupportModelBase model) { JPanel panel = new JPanel(new VerticalFlowLayout()); List<? extends FrameworkGroupVersion> versions = group.getGroupVersions(); if (!versions.isEmpty()) { final ComboBox versionsBox = new ComboBox(); versionsBox.setRenderer( new ListCellRendererWrapper<FrameworkGroupVersion>() { @Override public void customize( JList list, FrameworkGroupVersion value, int index, boolean selected, boolean hasFocus) { setText(value != null ? value.getPresentableName() : ""); } }); versionsBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { model.setSelectedVersion( group, (FrameworkGroupVersion) versionsBox.getSelectedItem()); } }); for (FrameworkGroupVersion version : versions) { versionsBox.addItem(version); } panel.add( FormBuilder.createFormBuilder().addLabeledComponent("Version:", versionsBox).getPanel()); } myMainPanel = panel; }
private JPanel initializeGroupPanel(FrameworkGroup<?> group, boolean addToOptions) { JPanel panel = myInitializedGroupPanels.get(group); if (panel == null) { FrameworkVersionComponent component = new FrameworkVersionComponent( myModel, group.getId(), group.getGroupVersions(), group.getPresentableName() + " version:"); panel = component.getMainPanel(); myInitializedGroupPanels.put(group, panel); if (addToOptions) { myOptionsPanel.add(group.getId(), wrapInScrollPane(panel)); } } return panel; }
private void updateOptionsPanel() { final FrameworkSupportNodeBase node = getSelectedNode(); if (node instanceof FrameworkSupportNode) { FrameworkSupportNode frameworkSupportNode = (FrameworkSupportNode) node; initializeOptionsPanel(frameworkSupportNode, true); showCard(frameworkSupportNode.getId()); UIUtil.setEnabled(myOptionsPanel, frameworkSupportNode.isChecked(), true); frameworkSupportNode.getConfigurable().onFrameworkSelectionChanged(node.isChecked()); } else if (node instanceof FrameworkGroupNode) { FrameworkGroup<?> group = ((FrameworkGroupNode) node).getUserObject(); initializeGroupPanel(group, true); showCard(group.getId()); UIUtil.setEnabled(myOptionsPanel, true, true); } else { showCard(EMPTY_CARD); } }