Example usage for weka.gui ViewerDialog showDialog

List of usage examples for weka.gui ViewerDialog showDialog

Introduction

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

Prototype

public int showDialog(Instances inst) 

Source Link

Document

Pops up the modal dialog and waits for Cancel or OK.

Usage

From source file:meka.gui.explorer.classify.EditTestData.java

License:Open Source License

/**
 * Returns the action lister to use in the menu.
 *
 * @return          the listener/*from  w  w w .  j  a v  a2 s.c  o  m*/
 */
public ActionListener getActionListener(final ClassifyTab owner) {
    return new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ViewerDialog dialog;
            int result;
            Instances copy;
            Instances newInstances;

            copy = new Instances(owner.getTestData());
            dialog = new ViewerDialog(null);
            dialog.setSize(800, 600);
            dialog.setLocationRelativeTo(owner);
            result = dialog.showDialog(copy);
            if (result == ViewerDialog.APPROVE_OPTION) {
                // if class was not set before, reset it again after use of filter
                newInstances = dialog.getInstances();
                if (owner.getTestData().classIndex() < 0)
                    newInstances.setClassIndex(-1);
                owner.setTestData(newInstances);

            }
        }
    };
}

From source file:meka.gui.explorer.Explorer.java

License:Open Source License

/**
 * edits the current instances object in the viewer 
 *//*from  w ww  .jav a  2s  . co  m*/
public void edit() {
    ViewerDialog dialog;
    int result;
    Instances copy;
    Instances newInstances;

    copy = new Instances(m_Data);
    dialog = new ViewerDialog(null);
    dialog.setSize(800, 600);
    dialog.setLocationRelativeTo(this);
    result = dialog.showDialog(copy);
    if (result == ViewerDialog.APPROVE_OPTION) {
        try {
            addUndoPoint();
        } catch (Exception e) {
            e.printStackTrace();
        }
        // if class was not set before, reset it again after use of filter
        newInstances = dialog.getInstances();
        if (m_Data.classIndex() < 0)
            newInstances.setClassIndex(-1);
        notifyTabsDataChanged(null, newInstances);
    }
}