Search in sources :

Example 1 with DecisionTreeNodeRenderer

use of org.knime.base.node.mine.decisiontree2.model.DecisionTreeNodeRenderer in project knime-core by knime.

the class DecTreePredictorNodeView method modelChanged.

/**
 * {@inheritDoc}
 */
@Override
protected void modelChanged() {
    DecTreePredictorNodeModel model = this.getNodeModel();
    DecisionTree dt = model.getDecisionTree();
    if (dt != null) {
        // set new model
        m_jTree.setModel(new DefaultTreeModel(dt.getRootNode()));
        // change default renderer
        m_jTree.setCellRenderer(new DecisionTreeNodeRenderer());
        // make sure no default height is assumed (the renderer's
        // preferred size should be used instead)
        m_jTree.setRowHeight(0);
        // retrieve HiLiteHandler from Input port
        m_hiLiteHdl = model.getInHiLiteHandler(DecTreePredictorNodeModel.INDATAPORT);
        // and adjust menu entries for HiLite-ing
        m_hiLiteMenu.setEnabled(m_hiLiteHdl != null);
    } else {
        m_jTree.setModel(null);
    }
}
Also used : DecisionTree(org.knime.base.node.mine.decisiontree2.model.DecisionTree) DecisionTreeNodeRenderer(org.knime.base.node.mine.decisiontree2.model.DecisionTreeNodeRenderer) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 2 with DecisionTreeNodeRenderer

use of org.knime.base.node.mine.decisiontree2.model.DecisionTreeNodeRenderer in project knime-core by knime.

the class DecTreePredictorNodeView method modelChanged.

/**
 * {@inheritDoc}
 */
@Override
protected void modelChanged() {
    DecTreePredictorNodeModel model = this.getNodeModel();
    DecisionTree dt = model.getDecisionTree();
    if (dt != null) {
        // set new model
        m_jTree.setModel(new DefaultTreeModel(dt.getRootNode()));
        // change default renderer
        m_jTree.setCellRenderer(new DecisionTreeNodeRenderer());
        // make sure no default height is assumed (the renderer's
        // preferred size should be used instead)
        m_jTree.setRowHeight(0);
        // retrieve HiLiteHandler from Input port
        m_hiLiteHdl = model.getInHiLiteHandler(DecTreePredictorNodeModel.INDATAPORT);
        // and adjust menu entries for HiLite-ing
        m_hiLiteMenu.setEnabled(m_hiLiteHdl != null);
    } else {
        m_jTree.setModel(null);
    }
}
Also used : DecisionTree(org.knime.base.node.mine.decisiontree2.model.DecisionTree) DecisionTreeNodeRenderer(org.knime.base.node.mine.decisiontree2.model.DecisionTreeNodeRenderer) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 3 with DecisionTreeNodeRenderer

use of org.knime.base.node.mine.decisiontree2.model.DecisionTreeNodeRenderer in project knime-core by knime.

the class DecTreeNodeView method modelChanged.

/**
 * {@inheritDoc}
 */
@Override
protected void modelChanged() {
    NodeModel model = this.getNodeModel();
    DecisionTree dt = ((DecisionTreeLearnerNodeModel) model).getDecisionTree();
    if (dt != null) {
        // set new model
        m_jTree.setModel(new DefaultTreeModel(dt.getRootNode()));
        // change default renderer
        m_jTree.setCellRenderer(new DecisionTreeNodeRenderer());
        // make sure no default height is assumed (the renderer's
        // preferred size should be used instead)
        m_jTree.setRowHeight(0);
        // retrieve HiLiteHandler from Input port
        m_hiLiteHdl = (((DecisionTreeLearnerNodeModel) model).getInHiLiteHandler(DecisionTreeLearnerNodeModel.DATA_INPORT));
        // and adjust menu entries for HiLite-ing
        m_hiLiteMenu.setEnabled(m_hiLiteHdl != null);
    } else {
        m_jTree.setModel(null);
    }
}
Also used : NodeModel(org.knime.core.node.NodeModel) DecisionTree(org.knime.base.node.mine.decisiontree2.model.DecisionTree) DecisionTreeNodeRenderer(org.knime.base.node.mine.decisiontree2.model.DecisionTreeNodeRenderer) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 4 with DecisionTreeNodeRenderer

use of org.knime.base.node.mine.decisiontree2.model.DecisionTreeNodeRenderer in project knime-core by knime.

the class DecTreeNodeView2 method modelChanged.

/**
 * {@inheritDoc}
 */
@Override
protected void modelChanged() {
    NodeModel model = this.getNodeModel();
    DecisionTree dt = ((DecisionTreeLearnerNodeModel2) model).getDecisionTree();
    if (dt != null) {
        // set new model
        m_jTree.setModel(new DefaultTreeModel(dt.getRootNode()));
        // change default renderer
        m_jTree.setCellRenderer(new DecisionTreeNodeRenderer());
        // make sure no default height is assumed (the renderer's
        // preferred size should be used instead)
        m_jTree.setRowHeight(0);
        // retrieve HiLiteHandler from Input port
        m_hiLiteHdl = (((DecisionTreeLearnerNodeModel2) model).getInHiLiteHandler(DecisionTreeLearnerNodeModel2.DATA_INPORT));
        // and adjust menu entries for HiLite-ing
        m_hiLiteMenu.setEnabled(m_hiLiteHdl != null);
    } else {
        m_jTree.setModel(null);
    }
}
Also used : NodeModel(org.knime.core.node.NodeModel) DecisionTree(org.knime.base.node.mine.decisiontree2.model.DecisionTree) DecisionTreeNodeRenderer(org.knime.base.node.mine.decisiontree2.model.DecisionTreeNodeRenderer) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Aggregations

DefaultTreeModel (javax.swing.tree.DefaultTreeModel)4 DecisionTree (org.knime.base.node.mine.decisiontree2.model.DecisionTree)4 DecisionTreeNodeRenderer (org.knime.base.node.mine.decisiontree2.model.DecisionTreeNodeRenderer)4 NodeModel (org.knime.core.node.NodeModel)2