Search in sources :

Example 91 with DefaultTreeModel

use of javax.swing.tree.DefaultTreeModel in project jdk8u_jdk by JetBrains.

the class Test4631471 method main.

private static void main() throws Exception {
    // the DefaultMutableTreeNode will archive correctly
    new Test4631471() {

        protected Object getObject() {
            return getRoot();
        }
    }.test(false);
    // the DefaultTreeModel will also archive correctly
    new Test4631471() {

        protected Object getObject() {
            return getModel();
        }
    }.test(false);
    // create a new model from the root node
    // this simulates the the MetaData ctor:
    // registerConstructor("javax.swing.tree.DefaultTreeModel", new String[]{"root"});
    new Test4631471() {

        protected Object getObject() {
            return new DefaultTreeModel((TreeNode) getModel().getRoot());
        }
    }.test(false);
    // the JTree will archive correctly too
    new Test4631471() {

        protected Object getObject() {
            return getTree();
        }
    }.test(false);
}
Also used : TreeNode(javax.swing.tree.TreeNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 92 with DefaultTreeModel

use of javax.swing.tree.DefaultTreeModel in project MyPet by xXKeyleXx.

the class LevelCreator method createUIComponents.

private void createUIComponents() {
    DefaultMutableTreeNode root = new DefaultMutableTreeNode("");
    skillTreeTreeModel = new DefaultTreeModel(root);
    skillTreeTree = new JTree(skillTreeTreeModel);
    skillTreeTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    createRightclickMenus();
    inheritanceComboBoxModel = new DefaultComboBoxModel();
    inheritanceComboBox = new JComboBox(inheritanceComboBoxModel);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 93 with DefaultTreeModel

use of javax.swing.tree.DefaultTreeModel in project MyPet by xXKeyleXx.

the class SkilltreeCreator method createUIComponents.

private void createUIComponents() {
    DefaultMutableTreeNode root = new DefaultMutableTreeNode("");
    skilltreeTreeModel = new DefaultTreeModel(root);
    skilltreeTree = new JTree(skilltreeTreeModel);
    skilltreeTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    createRightclickMenus();
    mobTypeComboBox = new JComboBox(GuiMain.petTypes);
    selectedMobtype = SkillTreeMobType.DEFAULT;
    skilltreeTreeSetSkilltrees();
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 94 with DefaultTreeModel

use of javax.swing.tree.DefaultTreeModel 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 95 with DefaultTreeModel

use of javax.swing.tree.DefaultTreeModel in project knime-core by knime.

the class MissingNodeDialog method loadSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
    m_settings = new NodeSettings("ignored");
    settings.copyTo(m_settings);
    m_tree.setModel(new DefaultTreeModel(settings));
    for (int i = m_tree.getRowCount() - 1; i >= 0; i--) {
        m_tree.expandRow(i);
    }
}
Also used : NodeSettings(org.knime.core.node.NodeSettings) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Aggregations

DefaultTreeModel (javax.swing.tree.DefaultTreeModel)196 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)99 TreePath (javax.swing.tree.TreePath)50 Tree (com.intellij.ui.treeStructure.Tree)22 Test (org.junit.Test)21 JTree (javax.swing.JTree)17 MockTreeModelListener (com.facebook.buck.intellij.ideabuck.test.util.MockTreeModelListener)16 JScrollPane (javax.swing.JScrollPane)16 TreeSelectionEvent (javax.swing.event.TreeSelectionEvent)15 TreeSelectionListener (javax.swing.event.TreeSelectionListener)14 ArrayList (java.util.ArrayList)10 TreeNode (javax.swing.tree.TreeNode)10 NotNull (org.jetbrains.annotations.NotNull)10 Module (com.intellij.openapi.module.Module)9 MouseEvent (java.awt.event.MouseEvent)9 DefaultTreeCellRenderer (javax.swing.tree.DefaultTreeCellRenderer)9 Project (com.intellij.openapi.project.Project)7 javax.swing (javax.swing)7 JPanel (javax.swing.JPanel)7 ColumnTreeBuilder (com.android.tools.adtui.common.ColumnTreeBuilder)6