Example usage for weka.gui ViewerDialog ViewerDialog

List of usage examples for weka.gui ViewerDialog ViewerDialog

Introduction

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

Prototype

public ViewerDialog(Frame parent) 

Source Link

Document

initializes the dialog with the given parent

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 ww  . j  a  v a 2  s .  c om
 */
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 www.ja  v  a2s  . c om*/
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);
    }
}