本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Tree.Node类的典型用法代码示例。如果您正苦于以下问题:Java Node类的具体用法?Java Node怎么用?Java Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Node类属于com.badlogic.gdx.scenes.scene2d.ui.Tree包,在下文中一共展示了Node类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createTree
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
private Array<Node> createTree(Array<SceneGraphNode> nodes) {
Array<Node> treeNodes = new Array<Node>(nodes.size);
for (SceneGraphNode node : nodes) {
Label l = new Label(node.name, skin, "ui-10");
l.setColor(Color.BLACK);
Node treeNode = new Node(l);
if (node.children != null && node.children.size != 0) {
treeNode.addAll(createTree(node.children));
}
treeNodes.add(treeNode);
treeToModel.add(node, treeNode);
}
return treeNodes;
}
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:18,代码来源:ObjectsComponent.java
示例2: addVisWidgets
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
private void addVisWidgets () {
VisTree tree = new VisTree();
Node item1 = new Node(new VisLabel("item 1"));
Node item2 = new Node(new VisLabel("item 2"));
Node item3 = new Node(new VisLabel("item 3"));
item1.add(new Node(new VisLabel("item 1.1")));
item1.add(new Node(new VisLabel("item 1.2")));
item1.add(new Node(new VisLabel("item 1.3")));
item2.add(new Node(new VisLabel("item 2.1")));
item2.add(new Node(new VisLabel("item 2.2")));
item2.add(new Node(new VisLabel("item 2.3")));
item3.add(new Node(new VisLabel("item 3.1")));
item3.add(new Node(new VisLabel("item 3.2")));
item3.add(new Node(new VisLabel("item 3.3")));
item1.setExpanded(true);
tree.add(item1);
tree.add(item2);
tree.add(item3);
add(tree).expand().fill();
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:27,代码来源:TestTree.java
示例3: highlightDir
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
private boolean highlightDir (FileHandle dir, Array<Node> nodes) {
for (Node node : nodes) {
if (((FolderItem) node.getActor()).getFile().equals(dir)) {
contentTree.getSelection().set(node);
return true;
}
if (node.getChildren().size > 0) {
boolean prevNodeState = node.isExpanded();
node.setExpanded(true);
if (highlightDir(dir, node.getChildren())) return true;
node.setExpanded(prevNodeState);
}
}
return false;
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:18,代码来源:AssetsUIModule.java
示例4: createContentTree
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
private void createContentTree () {
contentTree = new VisTree();
contentTree.getSelection().setMultiple(false);
contentTree.getSelection().setRequired(true);
contentTree.getSelection().setProgrammaticChangeEvents(false);
treeTable.add(createScrollPane(contentTree, false)).expand().fill();
contentTree.addListener(new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
Node node = contentTree.getSelection().first();
if (node != null) {
searchField.clearSearch();
FolderItem item = (FolderItem) node.getActor();
changeCurrentDirectory(item.getFile(), HistoryPolicy.ADD);
}
}
});
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:22,代码来源:AssetsUIModule.java
示例5: buildGroupNodeState
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
private void buildGroupNodeState (Array<Node> nodes) {
for (Node n : nodes) {
if (n.getChildren().size > 0) {
if (n instanceof GroupNode) {
GroupNode groupNode = (GroupNode) n;
if (groupNode.isExpanded()) {
expandedNodes.add(groupNode.groupId);
}
buildGroupNodeState(groupNode.getChildren());
}
}
}
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:18,代码来源:SceneOutline.java
示例6: create
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
public void create () {
stage = new Stage();
Gdx.input.setInputProcessor(stage);
Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
Table table = new Table();
table.setFillParent(true);
stage.addActor(table);
final Tree tree = new Tree(skin);
final Node moo1 = new Node(new TextButton("moo1", skin));
final Node moo2 = new Node(new TextButton("moo2", skin));
final Node moo3 = new Node(new TextButton("moo3", skin));
final Node moo4 = new Node(new TextButton("moo4", skin));
final Node moo5 = new Node(new TextButton("moo5", skin));
tree.add(moo1);
tree.add(moo2);
moo2.add(moo3);
moo3.add(moo4);
tree.add(moo5);
moo5.getActor().addListener(new ClickListener() {
public void clicked (InputEvent event, float x, float y) {
tree.remove(moo4);
}
});
table.add(tree).fill().expand();
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:32,代码来源:TreeTest.java
示例7: getSiblings
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
public Array<Node> getSiblings() {
Selection<Node> selection = tree.getSelection();
Node nodeSel = selection.first();
int level = nodeSel.getLevel();
Array<Node> siblings = (level == 1) ? tree.getRootNodes(): nodeSel.getParent().getChildren();
return siblings;
}
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:10,代码来源:EditTree.java
示例8: addNormalWidgets
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
private void addNormalWidgets () {
Skin skin = VisUI.getSkin();
Tree tree = new Tree(skin);
Node item1 = new Node(new Label("item 1", skin));
Node item2 = new Node(new Label("item 2", skin));
Node item3 = new Node(new Label("item 3", skin));
item1.add(new Node(new Label("item 1.1", skin)));
item1.add(new Node(new Label("item 1.2", skin)));
item1.add(new Node(new Label("item 1.3", skin)));
item2.add(new Node(new Label("item 2.1", skin)));
item2.add(new Node(new Label("item 2.2", skin)));
item2.add(new Node(new Label("item 2.3", skin)));
item3.add(new Node(new Label("item 3.1", skin)));
item3.add(new Node(new Label("item 3.2", skin)));
item3.add(new Node(new Label("item 3.3", skin)));
item1.setExpanded(true);
tree.add(item1);
tree.add(item2);
tree.add(item3);
add(tree).expand().fill();
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:29,代码来源:TestTree.java
示例9: init
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
@Override
public void init () {
initModule();
initUI();
rebuildFolderTree();
Node node = contentTree.getNodes().get(0);
contentTree.getSelection().set(node); // select first item in tree
changeCurrentDirectory(((FolderItem) node.getActor()).getFile(), HistoryPolicy.IGNORE);
Array<AssetsUIContextGeneratorProvider> providers = extensionStorage.getAssetsContextGeneratorsProviders();
for (AssetsUIContextGeneratorProvider provider : providers) {
contextGenerators.add(provider.provide());
}
for (AssetsUIContextGenerator generator : contextGenerators) {
projectContainer.injectModules(generator);
generator.init();
}
tabsModule.addListener(this);
assetsWatcher.addListener(this);
json = new Json();
metadataFile = fileAccess.getModuleFolder(".metadata").child("assetsUIMetadata");
if (metadataFile.exists())
metadata = json.fromJson(AssetsUIModuleMetadata.class, metadataFile);
else
metadata = new AssetsUIModuleMetadata();
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:32,代码来源:AssetsUIModule.java
示例10: rebuildFolderTree
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
private void rebuildFolderTree () {
contentTree.clearChildren();
contentTree.add(new Node(new FolderItem(assetsFolder, true)));
for (FileHandle contentRoot : assetsFolder.list(DirectoriesOnlyFileFilter.FILTER)) {
//hide empty dirs except 'gfx' and 'scene'
if (contentRoot.list().length != 0 || contentRoot.name().equals("gfx") || contentRoot.name().equals("scene")) {
Node node = new Node(new FolderItem(contentRoot));
processFolder(node, contentRoot);
contentTree.add(node);
}
}
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:16,代码来源:AssetsUIModule.java
示例11: processFolder
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
private void processFolder (Node node, FileHandle dir) {
FileHandle[] files = dir.list(DirectoriesOnlyFileFilter.FILTER);
for (FileHandle file : files) {
if (file.name().startsWith(".")) continue; //hide folders starting with dot
Node currentNode = new Node(new FolderItem(file));
node.add(currentNode);
processFolder(currentNode, file);
}
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:13,代码来源:AssetsUIModule.java
示例12: add
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
public void add (final SettableModule module) {
Node node = new Node(new SettingsCategoryLabel(module.getSettingsName(), module.getListPriority()));
modulesMap.put(module, node);
tree.add(node);
tree.getNodes().sort(nodeComparator);
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:8,代码来源:SettingsDialog.java
示例13: compare
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
@Override
public int compare (Node n1, Node n2) {
SettingsCategoryLabel l1 = (SettingsCategoryLabel) n1.getActor();
SettingsCategoryLabel l2 = (SettingsCategoryLabel) n2.getActor();
String t1 = l1.getText().toString();
String t2 = l2.getText().toString();
int priorityResult = (int) Math.signum(l1.getPriority() - l2.getPriority()) * -1;
if (priorityResult != 0)
return priorityResult;
else
return t1.compareToIgnoreCase(t2);
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:15,代码来源:SettingsDialog.java
示例14: buildTreeRecursively
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
private void buildTreeRecursively (Array<EntityProxy> groupProxies, int gid, Node parent) {
GroupNode groupRoot = new GroupNode(groupProxies.first().getLayerID(), gid);
if (parent == null)
tree.add(groupRoot);
else
parent.add(groupRoot);
if (expandedNodes.contains(gid)) {
groupRoot.setExpanded(true);
}
Array<EntityProxy> ignoreProxies = new Array<>();
for (EntityProxy proxy : groupProxies) {
if (ignoreProxies.contains(proxy, true)) {
continue;
}
int gidBefore = proxy.getGroupIdBefore(gid);
if (gidBefore != -1) {
Array<EntityProxy> result = entitiesCollector.collect(proxy.getLayerID(), gidBefore);
ignoreProxies.addAll(result);
buildTreeRecursively(result, gidBefore, groupRoot);
continue;
}
groupRoot.add(new ProxyNode(proxy));
}
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:30,代码来源:SceneOutline.java
示例15: AssetsUsagesTab
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
public AssetsUsagesTab (ModuleInjector injector, AssetsUsages usages, boolean showDeleteButton) {
super(false, true);
injector.injectModules(this);
this.usages = usages;
createButtonTable(showDeleteButton);
mainTable = new VisTable();
mainTable.setBackground("window-bg");
mainTable.defaults().left();
tree = new VisTree();
usagesTable = new VisTable();
VisScrollPane scrollPane = new VisScrollPane(usagesTable);
scrollPane.setFadeScrollBars(false);
mainTable.row();
mainTable.add(scrollPane).expand().fill().row();
mainTable.addSeparator();
mainTable.add(buttonTable).pad(3);
rebuildUsagesTable();
tree.addListener(new ClickListener() {
@Override
public void clicked (InputEvent event, float x, float y) {
super.clicked(event, x, y);
if (getTapCount() == 2) {
Node node = tree.getNodeAt(y);
if (node != null) {
Actor actor = node.getActor();
if (actor instanceof UsageLabel) selectEntityInScene((UsageLabel) actor);
}
}
}
});
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:39,代码来源:AssetsUsagesTab.java
示例16: processUsages
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
private void processUsages () {
for (SceneUsages sceneUsages : usages.list) {
Node node = new Node(new VisLabel(sceneUsages.scene.path, "small"));
node.setExpanded(true);
tree.add(node);
for (int i = 0; i < sceneUsages.ids.size; i++) {
int id = sceneUsages.ids.get(i);
node.add(new Node(new UsageLabel(sceneUsages.scene, id)));
}
}
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:14,代码来源:AssetsUsagesTab.java
示例17: SceneOutline
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
public SceneOutline (SceneModuleContainer sceneMC) {
super(true);
sceneMC.injectModules(this);
scene = sceneMC.getScene();
proxyCache.addListener(this);
tree = new VisTree();
tree.getSelection().setMultiple(true);
tree.getSelection().setRequired(false);
tree.getSelection().setProgrammaticChangeEvents(false);
tree.addListener(new ClickListener() {
Node selection;
@Override
public void clicked (InputEvent event, float x, float y) {
//tree will deselect item after double click so we on first click store selection
if (getTapCount() == 1 && tree.getSelection().size() == 1) {
selection = tree.getSelection().getLastSelected();
}
if (getTapCount() == 2 && selection != null) {
if (selection instanceof ProxyNode) {
sceneMC.getSceneTab().centerAround(((ProxyNode) selection).proxy);
}
if (selection instanceof GroupNode) {
GroupNode groupNode = (GroupNode) selection;
sceneMC.getSceneTab().centerAroundGroup(groupNode.layerId, groupNode.groupId);
}
selection = null;
}
}
});
setBackground(VisUI.getSkin().getDrawable("window-bg"));
setTouchable(Touchable.enabled);
add(new VisLabel("Outline", Align.center)).expandX().fillX().top().spaceBottom(0).row();
VisScrollPane scrollPane = new VisScrollPane(tree);
scrollPane.setFadeScrollBars(false);
add(scrollPane).expand().fill();
pack();
rebuildOutline(); //do first update
}
开发者ID:kotcrab,项目名称:vis-editor,代码行数:51,代码来源:SceneOutline.java
示例18: fill
import com.badlogic.gdx.scenes.scene2d.ui.Tree.Node; //导入依赖的package包/类
private void fill (IntArray taskSteps, TaskNode taskNode) {
taskSteps.add(taskNode.step);
for (Node child : taskNode.getChildren()) {
fill(taskSteps, (TaskNode)child);
}
}
开发者ID:libgdx,项目名称:gdx-ai,代码行数:7,代码来源:BehaviorTreeViewer.java
注:本文中的com.badlogic.gdx.scenes.scene2d.ui.Tree.Node类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论