Java Examples for weka.gui.treevisualizer.TreeDisplayListener
The following java examples will help you to understand the usage of weka.gui.treevisualizer.TreeDisplayListener. These source code samples are taken from different open source projects.
Example 1
Project: ComplexRapidMiner-master File: WekaClassifier.java View source code |
public Component getVisualizationComponent(IOContainer container) {
if (classifier instanceof Drawable) {
try {
Drawable drawable = (Drawable) classifier;
int graphType = drawable.graphType();
switch(graphType) {
case Drawable.TREE:
Component treeView = new TreeVisualizer(new TreeDisplayListener() {
public void userCommand(TreeDisplayEvent e) {
}
}, drawable.graph(), new PlaceNode2());
return createTextAndGraphView(super.getVisualizationComponent(container), treeView);
case Drawable.BayesNet:
GraphVisualizer visualizer = new GraphVisualizer();
// remove graph tool bar from original location (NORTH)
JToolBar graphTools = (JToolBar) visualizer.getComponent(0);
visualizer.remove(graphTools);
// remove progress bar from tool bar
graphTools.remove(graphTools.getComponentCount() - 1);
// add tool bar to new location (WEST)
JPanel toolPanel = new JPanel(new BorderLayout());
toolPanel.add(graphTools, BorderLayout.NORTH);
visualizer.add(toolPanel, BorderLayout.WEST);
// init graph
visualizer.readBIF(drawable.graph());
visualizer.layoutGraph();
return createTextAndGraphView(super.getVisualizationComponent(container), visualizer);
case Drawable.NOT_DRAWABLE:
default:
return super.getVisualizationComponent(container);
}
} catch (Exception e) {
return super.getVisualizationComponent(container);
}
} else {
return super.getVisualizationComponent(container);
}
}