本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Tree类的典型用法代码示例。如果您正苦于以下问题:Java Tree类的具体用法?Java Tree怎么用?Java Tree使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Tree类属于com.badlogic.gdx.scenes.scene2d.ui包,在下文中一共展示了Tree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addActor
import com.badlogic.gdx.scenes.scene2d.ui.Tree; //导入依赖的package包/类
@Override
public void addActor(ActorAddEvent event) {
Actor actor = event.actor;
StringBuilder item_name = new StringBuilder();
item_name.append(actor.getName()==null?"":actor.getName());
item_name.append("[");
item_name.append(EditorManager.getInstance()
.getActorType(actor).getSimpleName());
item_name.append("]");
Tree.Node item = createNodeItem(actor,item_name.toString());
item.setIcon(new TextureRegionDrawable(new TextureRegion(new Texture(
Gdx.files.internal("icon/Label_16.png")))));
item.getActor().setTouchable(Touchable.disabled);
if (actor.getParent() instanceof MainWindow){
stageNode.add(item);
}else {
Tree.Node parentNode = stageNode.findNode(actor.getParent());
if (parentNode!=null) parentNode.add(item);
}
tree.getSelection().choose(item);
}
示例2: touchDown
import com.badlogic.gdx.scenes.scene2d.ui.Tree; //导入依赖的package包/类
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
if (tree.getStage().hit(x, y, true) == tree && tree.getNodeAt(y) != null){
tree.getClickListener().clicked(event,x,y);
tree.getClickListener().cancel();
Array<Actor> actors = new Array<>();
for (Tree.Node node:tree.getSelection().items() ) {
actors.add((Actor) node.getObject());
}
if (actors.size>0){
EditorManager.getInstance().getEventBus().post(new TreeSelectedActroEvent(actors));
}else {
EditorManager.getInstance().getEventBus().post(new TreeCancelEvent());
}
}
return false;
}
示例3: fillNode
import com.badlogic.gdx.scenes.scene2d.ui.Tree; //导入依赖的package包/类
private void fillNode(Tree.Node node, String samplerId) {
AbstractSampler sampler = loader.getSampler(samplerId);
SamplerNode subNode = createNode(samplerId);
if (subNode != null) {
node.add(subNode);
if (expansionMemory.containsKey(subNode.nodeId)) {
subNode.setExpanded(expansionMemory.get(subNode.nodeId));
}
if (sampler.getConfig() instanceof AbstractSamplerContainerConfig) {
AbstractSamplerContainerConfig c = (AbstractSamplerContainerConfig) sampler.getConfig();
for (ChildSamplerConfig child : c.getChildSamplerConfigs()) {
fillNode(subNode, child.samplerReferenceId);
}
}
}
}
示例4: addChild
import com.badlogic.gdx.scenes.scene2d.ui.Tree; //导入依赖的package包/类
/** @param child will be added to the actor casted to a Group or a Table. */
protected void addChild(final Actor child) {
final Actor actor = getActor();
if (actor instanceof Tree) {
final Tree.Node node = LmlUtilities.getTreeNode(child);
if (node != null) {
((Tree) actor).add(node);
} else {
((Tree) actor).add(new Tree.Node(child));
}
} else if (actor instanceof Table) {
LmlUtilities.getCell(child, (Table) actor);
} else {
((Group) actor).addActor(child);
}
}
示例5: handleDataBetweenTags
import com.badlogic.gdx.scenes.scene2d.ui.Tree; //导入依赖的package包/类
@Override
public final void handleDataBetweenTags(final CharSequence rawData) {
if (Strings.isWhitespace(rawData)) {
return;
}
final String[] lines = Strings.split(rawData, '\n');
final Tree.Node node = LmlUtilities.getTreeNode(actor);
if (node != null) {
appendTreeNodes(lines, node);
return;
}
for (String line : lines) {
if (Strings.isNotWhitespace(line)) {
line = line.trim();
handlePlainTextLine(line);
}
}
}
示例6: handleChild
import com.badlogic.gdx.scenes.scene2d.ui.Tree; //导入依赖的package包/类
@Override
public void handleChild(final LmlTag childTag) {
if (childTag.isAttachable()) {
// Child tag is an attachable object that can be appended to any widget, even if it is not prepared to
// handle children. For example, tooltip tag can be nested inside a label and will be properly attached,
// even though label wouldn't know how to handle a normal child, like a button or another label.
if (actor != null) {
childTag.attachTo(this);
}
} else if (childTag.getActor() != null) {
final Tree.Node node = LmlUtilities.getTreeNode(actor);
if (node != null) {
// This actor is a tree node. Adding its child as a leaf.
Tree.Node childNode = LmlUtilities.getTreeNode(childTag.getActor());
if (childNode == null) {
childNode = new Tree.Node(childTag.getActor());
}
node.add(childNode);
} else {
handleValidChild(childTag);
}
}
}
示例7: setup
import com.badlogic.gdx.scenes.scene2d.ui.Tree; //导入依赖的package包/类
public static void setup(){
registerSerializer(Actor.class, new ActorSerializer());
registerSerializer(Scene.class, new SceneSerializer());
registerSerializer(ImageJson.class, new ImageJson());
registerSerializer(Label.class, new LabelSerializer());
registerSerializer(Button.class, new ButtonSerializer());
registerSerializer(TextButton.class, new TextButtonSerializer());
registerSerializer(Table.class, new TableSerializer());
registerSerializer(CheckBox.class, new CheckBoxSerializer());
registerSerializer(SelectBox.class, new SelectBoxSerializer());
registerSerializer(List.class, new ListSerializer());
registerSerializer(Slider.class, new SliderSerializer());
registerSerializer(TextField.class, new TextFieldSerializer());
registerSerializer(Touchpad.class, new TouchpadSerializer());
registerSerializer(Sprite.class, new SpriteSerializer());
registerSerializer(Dialog.class, new DialogSerializer());
registerSerializer(SplitPane.class, new SplitPaneSerializer());
registerSerializer(ScrollPane.class, new ScrollPaneSerializer());
registerSerializer(Stack.class, new StackSerializer());
registerSerializer(Tree.class, new TreeSerializer());
registerSerializer(Table.class, new TableSerializer());
registerSerializer(ButtonGroup.class, new ButtonGroupSerializer());
registerSerializer(HorizontalGroup.class, new HorizontalGroupSerializer());
registerSerializer(VerticalGroup.class, new VerticalGroupSerializer());
}
示例8: createNodeItem
import com.badlogic.gdx.scenes.scene2d.ui.Tree; //导入依赖的package包/类
private Tree.Node createNodeItem(Object object, String title){
VisLabel label = new VisLabel(title);
Tree.Node node = new Tree.Node(label);
node.setObject(object);
return node;
}
示例9: sureActor
import com.badlogic.gdx.scenes.scene2d.ui.Tree; //导入依赖的package包/类
@Override
public void sureActor(SureActorEvent sureActorEvent) {
Tree.Node selectedNode = tree.findNode(sureActorEvent.actor);
if (selectedNode !=null && !tree.getSelection().contains(selectedNode)){
tree.getSelection().choose(selectedNode);
}
}
示例10: setActorName
import com.badlogic.gdx.scenes.scene2d.ui.Tree; //导入依赖的package包/类
@Override
public void setActorName(ActorNameEvent event) {
Tree.Node item = tree.getSelection().getLastSelected();
if (item!=null){
Actor actor = (Actor) item.getObject();
StringBuilder item_name = new StringBuilder();
item_name.append(event.name);
item_name.append("[");
item_name.append(EditorManager.getInstance()
.getActorType(actor).getSimpleName());
item_name.append("]");
((Label)item.getActor()).setText(item_name.toString());
}
}
示例11: keyDel
import com.badlogic.gdx.scenes.scene2d.ui.Tree; //导入依赖的package包/类
@Override
public void keyDel(KeyDelEvent event) {
if (tree.getSelection().size()>0){
for (Tree.Node node : tree.getSelection().items()){
if (node.getObject() instanceof Actor){
((Actor) node.getObject()).remove();
}
tree.remove(node);
}
tree.getSelection().clear();
}
}
示例12: ui
import com.badlogic.gdx.scenes.scene2d.ui.Tree; //导入依赖的package包/类
@Override
protected AbstractPanel ui() {
configTree = new Tree(skin);
configScroller = new ScrollPane(configTree, skin);
addActor(configScroller);
return this;
}
示例13: ui
import com.badlogic.gdx.scenes.scene2d.ui.Tree; //导入依赖的package包/类
@Override
protected AbstractPanel ui() {
if(gameWorld.hasLandscape()) {
this.terrain = gameWorld.terrain;
configTree = new Tree(skin);
configScroller = new ScrollPane(configTree);
addActor(configScroller);
return this;
}
this.terrain = null;
addActor(addLandscapeBtn = new TextButton("Add landscape", skin));
return this;
}
示例14: visitData
import com.badlogic.gdx.scenes.scene2d.ui.Tree; //导入依赖的package包/类
@Override
public void visitData(Visitable<GDXComponentBuilder.AttributeWrapper> visitable, GDXComponentBuilder.AttributeWrapper data) {
if(true) return;
if(data.attr != null) {
Object compObj = GDXComponentBuilder.instance().buildComponent(data.attr);
if(compObj instanceof Actor) {
Tree.Node node = new Tree.Node((Actor)compObj);
this.node.add(node);
float compWidth = tree.getWidth() - 192;
((Actor) compObj).setWidth(compWidth-30);
}
}
cat = data.name+": "+data.path;
}
示例15: memory
import com.badlogic.gdx.scenes.scene2d.ui.Tree; //导入依赖的package包/类
public void memory(Tree.Node node) {
if (node instanceof SamplerNode) {
SamplerNode sn = (SamplerNode) node;
if (expansionMemory.containsKey(sn.nodeId)) {
expansionMemory.remove(sn.nodeId);
}
expansionMemory.put(sn.nodeId, sn.isExpanded());
}
for (Tree.Node n : node.getChildren()) {
memory(n);
}
}