Example usage for weka.gui PropertySelectorDialog getPath

List of usage examples for weka.gui PropertySelectorDialog getPath

Introduction

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

Prototype

public PropertyNode[] getPath() 

Source Link

Document

Gets the path of property nodes to the selected property.

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   w  w w  .ja va2 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;
}