本文整理汇总了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);
}
示例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();
}
示例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();
}