public List<Controls> getControls(boolean detachPrimaryCheckbox) {

        List<Controls> controlsList = new ArrayList<Controls>();

        if (controls == null) {
            OptionsPanel optionsPanel = new OptionsPanel();

            final JCheckBox showTextCHeckBox = new JCheckBox("Show " + getTitle());
            if (! detachPrimaryCheckbox) {
                optionsPanel.addComponent(showTextCHeckBox);
            }

            visible = PREFS.getBoolean(getTitle() + isOPenKey, isVisible());
            showTextCHeckBox.setSelected(visible);

            showTextCHeckBox.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent changeEvent) {
                    final boolean selected = showTextCHeckBox.isSelected();
                    if( isVisible() != selected ) {
                        setVisible(selected);
                    }
                }
            });

            final String whatPrefKey = getTitle() + "_whatToDisplay";
            String[] attributes = getAttributes();
            final JComboBox combo1 = new JComboBox(attributes);
            combo1.addItemListener(new ItemListener() {
                public void itemStateChanged(ItemEvent itemEvent) {
                    String attribute = (String) combo1.getSelectedItem();
                    setAttribute(attribute);
                    PREFS.put(whatPrefKey, attribute);
                }
            });

            final String whatToDisplay = PREFS.get(whatPrefKey, null);
            if( whatToDisplay != null ) {
                int i = Arrays.asList(attributes).indexOf(whatToDisplay);
                if( i >= 0 ) {
                    combo1.setSelectedIndex(i);
                }
            }

            optionsPanel.addComponentWithLabel("Display:", combo1);
            final JSpinner fontSizeSpinner = new JSpinner(new SpinnerNumberModel(defaultFontSize, 0.01, 48, 1));

            optionsPanel.addComponentWithLabel("Font Size:", fontSizeSpinner);
            //final boolean xselected = showTextCHeckBox.isSelected();
            //label1.setEnabled(selected);
            //fontSizeSpinner.setEnabled(selected);

            final String fontSizePrefKey = getTitle() + "_fontsize";
            final float fontsize = PREFS.getFloat(fontSizePrefKey, taxonLabelFont.getSize());
            setFontSize(fontsize, false);
            fontSizeSpinner.setValue(fontsize);

            fontSizeSpinner.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent changeEvent) {
                    final float size = ((Double) fontSizeSpinner.getValue()).floatValue();
                    setFontSize(size, true);
                    PREFS.putFloat(fontSizePrefKey, size);
                }
            });


            //-----------------------------------------



            //final boolean xselected = showTextCHeckBox.isSelected();
            //label1.setEnabled(selected);
            //fontSizeSpinner.setEnabled(selected);

            final String fontMinSizePrefKey = getTitle() + "_fontminsize";
            final float size = PREFS.getFloat(fontMinSizePrefKey, 6);
            setFontMinSize(size, false);

            final JSpinner fontMinSizeSpinner = new JSpinner(new SpinnerNumberModel(defaultMinFontSize, 0.01, 48, 1));
            optionsPanel.addComponentWithLabel("Minimum Size:", fontMinSizeSpinner);
            //fontMinSizeSpinner.setValue(size);

            fontMinSizeSpinner.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent changeEvent) {
                    final float size = ((Double) fontMinSizeSpinner.getValue()).floatValue();
                    setFontMinSize(size, true);
                    PREFS.putFloat(fontMinSizePrefKey, size);
                }
            });
            //-------------------------
            final JSpinner digitsSpinner = new JSpinner(new SpinnerNumberModel(defaultDigits, 2, 14, 1));

            if( hasNumericAttributes ) {
                final JLabel label2 = optionsPanel.addComponentWithLabel("Significant Digits:", digitsSpinner);
                // label2.setEnabled(selected);
                //  digitsSpinner.setEnabled(selected);

                final String digitsPrefKey = getTitle() + "_sigDigits";
                final int digits = PREFS.getInt(digitsPrefKey, defaultDigits);
                setSignificantDigits(digits);
                digitsSpinner.setValue(digits);

                digitsSpinner.addChangeListener(new ChangeListener() {
                    public void stateChanged(ChangeEvent changeEvent) {
                        final int digits = (Integer)digitsSpinner.getValue();
                        setSignificantDigits(digits);
                        PREFS.putInt(digitsPrefKey, digits);
                    }
                });
            }

            controls = new Controls(getTitle(), optionsPanel, false, false, detachPrimaryCheckbox ? showTextCHeckBox : null);
        }

        controlsList.add(controls);

        return controlsList;
    }