Example usage for weka.gui ViewerDialog APPROVE_OPTION

List of usage examples for weka.gui ViewerDialog APPROVE_OPTION

Introduction

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

Prototype

int APPROVE_OPTION

To view the source code for weka.gui ViewerDialog APPROVE_OPTION.

Click Source Link

Document

Signifies an OK property selection

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 ww w . j  ava2 s  .com*/
 */
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. java 2  s .com
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);
    }
}