Example usage for weka.gui PropertySelectorDialog PropertySelectorDialog

List of usage examples for weka.gui PropertySelectorDialog PropertySelectorDialog

Introduction

In this page you can find the example usage for weka.gui PropertySelectorDialog PropertySelectorDialog.

Prototype

public PropertySelectorDialog(Frame parentFrame, Object rootObject) 

Source Link

Document

Create the property selection dialog.

Usage

From source file:milk.gui.experiment.MIGeneratorPropertyIteratorPanel.java

License:Open Source License

/**
 * Gets the user to select a property of the current resultproducer.
 *
 * @return APPROVE_OPTION if the selection went OK, otherwise the selection
 * was cancelled./*from www . j  ava2 s .c o  m*/
 */
protected int selectProperty() {

    final PropertySelectorDialog jd = new PropertySelectorDialog(null, m_Exp.getResultProducer());
    jd.setLocationRelativeTo(this);
    int result = jd.showDialog();
    if (result == PropertySelectorDialog.APPROVE_OPTION) {
        System.err.println("Property Selected");
        PropertyNode[] path = jd.getPath();
        Object value = path[path.length - 1].value;
        PropertyDescriptor property = path[path.length - 1].property;
        // Make an array containing the propertyValue
        Class propertyClass = property.getPropertyType();
        m_Exp.setPropertyPath(path);
        m_Exp.setPropertyArray(Array.newInstance(propertyClass, 1));
        Array.set(m_Exp.getPropertyArray(), 0, value);
        // Pass it to the arrayeditor
        m_ArrayEditor.setValue(m_Exp.getPropertyArray());
        m_ArrayEditor.repaint();
        System.err.println("Set new array to array editor");
    } else {
        System.err.println("Cancelled");
    }
    return result;
}