当前位置: 首页>>代码示例>>Java>>正文


Java SimpleTree.setModel方法代码示例

本文整理汇总了Java中com.intellij.ui.treeStructure.SimpleTree.setModel方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleTree.setModel方法的具体用法?Java SimpleTree.setModel怎么用?Java SimpleTree.setModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ui.treeStructure.SimpleTree的用法示例。


在下文中一共展示了SimpleTree.setModel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createRepositoryTree

import com.intellij.ui.treeStructure.SimpleTree; //导入方法依赖的package包/类
private void createRepositoryTree() {

        tree = new SimpleTree();
        tree.setCellRenderer(new TreeCellRendererLivingDoc());
        tree.setRootVisible(true);

        tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);

        treeModel = new DefaultTreeModel(rootNode, true);
        tree.setModel(treeModel);

        JBScrollPane scrollPane = new JBScrollPane(tree);
        mainContent.add(scrollPane, BorderLayout.CENTER);
    }
 
开发者ID:testIT-LivingDoc,项目名称:livingdoc-intellij,代码行数:15,代码来源:ToolWindowPanel.java

示例2: GenerateByPatternDialog

import com.intellij.ui.treeStructure.SimpleTree; //导入方法依赖的package包/类
public GenerateByPatternDialog(Project project, PatternDescriptor[] descriptors) {
  super(project);
  myProject = project;
  setTitle("Generate by Pattern");
  setOKButtonText("Generate");

  myMap = new MultiMap<String, PatternDescriptor>();
  for (PatternDescriptor descriptor : descriptors) {
    myMap.putValue(descriptor.getParentId(), descriptor);
  }
  DefaultMutableTreeNode root = createNode(null);

  myTree = new SimpleTree() {

  };
  myTree.setRootVisible(false);
  myTree.setCellRenderer(new DefaultTreeCellRenderer() {
    @NotNull
    @Override
    public Component getTreeCellRendererComponent(@NotNull JTree tree,
                                                  Object value,
                                                  boolean sel,
                                                  boolean expanded,
                                                  boolean leaf,
                                                  int row,
                                                  boolean hasFocus) {
      Component component = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row,

                                                                         hasFocus);
      Object object = ((DefaultMutableTreeNode)value).getUserObject();
      if (object instanceof PatternDescriptor) {
        setText(((PatternDescriptor)object).getName());
        setIcon(((PatternDescriptor)object).getIcon());
      }
      return component;
    }
  });

  myTree.setModel(new DefaultTreeModel(root));
  myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
    @Override
    public void valueChanged(@NotNull TreeSelectionEvent e) {
      update();
    }
  });
  myEditor = TemplateEditorUtil.createEditor(true, "");

  mySplitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myTree));
  JPanel details = new JPanel(new BorderLayout());
  details.add(myEditor.getComponent(), BorderLayout.CENTER);
  mySplitter.setSecondComponent(details);
  mySplitter.setHonorComponentsMinimumSize(true);
  mySplitter.setShowDividerControls(true);

  myTree.setSelectionRow(0);

  init();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:59,代码来源:GenerateByPatternDialog.java

示例3: GenerateByPatternDialog

import com.intellij.ui.treeStructure.SimpleTree; //导入方法依赖的package包/类
public GenerateByPatternDialog(Project project, PatternDescriptor[] descriptors, DataContext context) {
  super(project);
  setTitle("Generate by Pattern");
  setOKButtonText("Generate");

  myMap = new MultiMap<String, PatternDescriptor>();
  for (PatternDescriptor descriptor : descriptors) {
    myMap.putValue(descriptor.getParentId(), descriptor);
  }
  DefaultMutableTreeNode root = createNode(null);

  myTree = new SimpleTree() {

  };
  myTree.setRootVisible(false);
  myTree.setCellRenderer(new DefaultTreeCellRenderer() {
    @Override
    public Component getTreeCellRendererComponent(JTree tree,
                                                  Object value,
                                                  boolean sel,
                                                  boolean expanded,
                                                  boolean leaf,
                                                  int row,
                                                  boolean hasFocus) {
      Component component = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row,

                                                                         hasFocus);
      Object object = ((DefaultMutableTreeNode)value).getUserObject();
      if (object instanceof PatternDescriptor) {
        setText(((PatternDescriptor)object).getName());
        setIcon(((PatternDescriptor)object).getIcon());
      }
      return component;
    }
  });

  myTree.setModel(new DefaultTreeModel(root));
  myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
    @Override
    public void valueChanged(TreeSelectionEvent e) {
      update();
    }
  });
  myEditor = TemplateEditorUtil.createEditor(true, "");

  mySplitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myTree));
  JPanel details = new JPanel(new BorderLayout());
  details.add(myEditor.getComponent(), BorderLayout.CENTER);
  mySplitter.setSecondComponent(details);
  mySplitter.setHonorComponentsMinimumSize(true);
  mySplitter.setShowDividerControls(true);

  myTree.setSelectionRow(0);

  init();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:57,代码来源:GenerateByPatternDialog.java


注:本文中的com.intellij.ui.treeStructure.SimpleTree.setModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。