Example usage for weka.gui PropertySelectorDialog showDialog

List of usage examples for weka.gui PropertySelectorDialog showDialog

Introduction

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

Prototype

public int showDialog() 

Source Link

Document

Pops up the modal dialog and waits for cancel or a selection.

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  . jav a 2 s .c  om*/
 */
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;
}