Search in sources :

Example 1 with BooleanInputEditor

use of beast.app.draw.BooleanInputEditor in project beast2 by CompEvol.

the class MRCAPriorInputEditor method createTipsonlyEditor.

public InputEditor createTipsonlyEditor() throws NoSuchMethodException, SecurityException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
    BooleanInputEditor e = new BooleanInputEditor(doc) {

        private static final long serialVersionUID = 1L;

        @Override
        public void init(Input<?> input, BEASTInterface beastObject, int itemNr, ExpandOption isExpandOption, boolean addButtons) {
            super.init(input, beastObject, itemNr, isExpandOption, addButtons);
            // hack to get to JCheckBox
            Component[] components = getComponents();
            ((JCheckBox) components[0]).addActionListener(e -> {
                JCheckBox src = (JCheckBox) e.getSource();
                if (src.isSelected()) {
                    enableTipSampling();
                } else {
                    disableTipSampling(m_beastObject, doc);
                }
            });
        }
    };
    MRCAPrior prior = (MRCAPrior) m_beastObject;
    Input<?> input = prior.onlyUseTipsInput;
    e.init(input, prior, -1, ExpandOption.FALSE, false);
    return e;
}
Also used : JCheckBox(javax.swing.JCheckBox) Input(beast.core.Input) MRCAPrior(beast.math.distributions.MRCAPrior) BEASTInterface(beast.core.BEASTInterface) Component(java.awt.Component) BooleanInputEditor(beast.app.draw.BooleanInputEditor)

Aggregations

BooleanInputEditor (beast.app.draw.BooleanInputEditor)1 BEASTInterface (beast.core.BEASTInterface)1 Input (beast.core.Input)1 MRCAPrior (beast.math.distributions.MRCAPrior)1 Component (java.awt.Component)1 JCheckBox (javax.swing.JCheckBox)1