protected void _initRightPanel() {
_rightPanel.removeAll();
ComboElement selectedElement = (ComboElement) _classSelector
.getSelectedItem();
GTIngredient ingredient = selectedElement.getIngredient();
GTIngredientElement[] elements = ingredient.getElements();
_components = new JComponent[elements.length];
_checkBoxes = new JCheckBox[elements.length];
GridBagConstraints c = new GridBagConstraints();
for (int i = 0; i < elements.length; i++) {
GTIngredientElement element = elements[i];
JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(new EmptyBorder(0, 3, 2, 3));
panel.setOpaque(false);
String columnName = element.getName();
JPanel captionPanel = new JPanel(new FlowLayout(
FlowLayout.CENTER, 0, 0));
captionPanel.setOpaque(false);
captionPanel.setPreferredSize(new Dimension(0, 18));
JCheckBox checkBox = null;
boolean enabled;
if (element.canDisable()) {
checkBox = new JCheckBox(columnName);
checkBox.setOpaque(false);
checkBox.setBorder(_EMPTY_BORDER);
checkBox.setHorizontalAlignment(SwingConstants.CENTER);
checkBox.setVerticalAlignment(SwingConstants.TOP);
checkBox.addActionListener(new CheckBoxActionListener(i));
captionPanel.add(checkBox);
enabled = ingredient.isEnabled(i);
checkBox.setSelected(enabled);
} else {
JLabel label = new JLabel(columnName);
captionPanel.add(label);
enabled = true;
}
panel.add(captionPanel, BorderLayout.NORTH);
JComponent component = _getComponent(element);
component.setPreferredSize(new Dimension(0, 20));
_setComponentValue(element, component, ingredient.getValue(i));
panel.add(component, BorderLayout.CENTER);
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = _getColumnWidth(component);
c.gridx = i + 1;