Example usage for weka.core Drawable graphType

List of usage examples for weka.core Drawable graphType

Introduction

In this page you can find the example usage for weka.core Drawable graphType.

Prototype

int graphType();

Source Link

Document

Returns the type of graph representing the object.

Usage

From source file:de.fub.maps.project.detector.model.inference.impl.ShowGraphAction.java

License:Open Source License

@NbBundle.Messages({ "CLT_Tree_Visualization=Visualisation" })
@Override//from  w w  w .ja  va  2  s  . c o  m
public void actionPerformed(ActionEvent e) {
    Classifier classifier = inferenceModel.getClassifier();
    if (classifier instanceof Drawable) {
        try {
            Drawable graph = (Drawable) classifier;
            JComponent panel = null;
            String graphDescriptor = null;

            switch (graph.graphType()) {
            case Drawable.BayesNet:
                graphDescriptor = graph.graph();

                if (graphDescriptor != null) {
                    LOG.log(Level.INFO, "\n{0}", graphDescriptor);
                    panel = createBayesGraph(graphDescriptor);
                }
                break;
            case Drawable.Newick:
                break;
            case Drawable.TREE:
                graphDescriptor = graph.graph();
                if (graphDescriptor != null) {
                    LOG.log(Level.INFO, "\n{0}", graphDescriptor);
                    panel = createTreeGraph(graphDescriptor);
                }
                break;
            default:
                break;
            }

            if (panel != null) {
                displayGraph(panel);
            }
        } catch (Exception ex) {
            NotifyDescriptor nd = new NotifyDescriptor.Message(MessageFormat
                    .format("{0}\nYou have to build the classifier before you can visualize.", ex.getMessage()),
                    NotifyDescriptor.Message.ERROR_MESSAGE);
            DialogDisplayer.getDefault().notify(nd);
        }
    }
}