use of com.talosvfx.talos.editor.widgets.ui.FilteredTree in project talos by rockbite.
the class NodeListPopup method parseCategory.
private void parseCategory(FilteredTree<String> tree, FilteredTree.Node parent, XmlReader.Element element) {
Array<XmlReader.Element> categories = element.getChildrenByName("category");
for (XmlReader.Element category : categories) {
FilteredTree.Node categoryNode = new FilteredTree.Node(category.getAttribute("title"), new Label(category.getAttribute("title"), getSkin()));
if (parent != null)
parent.add(categoryNode);
else
tree.add(categoryNode);
parseCategory(tree, categoryNode, category);
}
// get modules
Array<XmlReader.Element> modules = element.getChildrenByName("module");
for (XmlReader.Element module : modules) {
FilteredTree.Node node = new FilteredTree.Node(module.getAttribute("title"), new Label(module.getAttribute("title"), getSkin()));
titleToNodeName.put(module.getAttribute("title"), module.getAttribute("name"));
registerNode(module);
if (parent != null)
parent.add(node);
else
tree.add(node);
}
}
use of com.talosvfx.talos.editor.widgets.ui.FilteredTree in project talos by rockbite.
the class DynamicItemListWidget method getSubWidget.
@Override
public Actor getSubWidget() {
Table table = new Table();
Skin skin = TalosMain.Instance().getSkin();
Table topBar = new Table();
topBar.setBackground(ColorLibrary.obtainBackground(getSkin(), ColorLibrary.BackgroundColor.DARK_GRAY));
SquareButton newBtn = new SquareButton(skin, skin.getDrawable("timeline-btn-icon-new"));
SquareButton deleteBtn = new SquareButton(skin, skin.getDrawable("timeline-btn-icon-delete"));
topBar.add().expandX();
topBar.add(newBtn).padRight(2);
topBar.add(deleteBtn).padRight(2);
list = new FilteredTree<>(skin, "modern");
list.draggable = true;
list.setItemListener(new FilteredTree.ItemListener() {
@Override
public void onNodeMove(FilteredTree.Node parentToMoveTo, FilteredTree.Node childThatHasMoved, int indexInParent, int indexOfPayloadInPayloadBefore) {
callValueChanged(makeDataArray());
}
@Override
public void delete(Array<FilteredTree.Node> nodes) {
deleteSelection();
}
});
table.add(list).growX();
table.row();
table.add(topBar).growX().padLeft(-10).padRight(-10);
newBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
ItemData newItemData = new ItemData(defaultItemName, defaultItemName);
Selection<FilteredTree.Node<Object>> selection = list.getSelection();
FilteredTree.Node node;
if (selection.size() > 0) {
int index = 0;
Array<FilteredTree.Node<Object>> rootNodes = list.getRootNodes();
for (index = 0; index < rootNodes.size; index++) {
if (rootNodes.get(index) == selection.first()) {
break;
}
}
node = addNode(newItemData, index + 1);
} else {
node = addNode(newItemData);
}
callValueChanged(makeDataArray());
EditableLabel label = (EditableLabel) node.getActor();
label.setEditMode();
}
});
deleteBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
deleteSelection();
}
});
return table;
}
use of com.talosvfx.talos.editor.widgets.ui.FilteredTree in project talos by rockbite.
the class TemplateListPopup method traverseTree.
private void traverseTree(FilteredTree<String> tree, Object o, XmlReader.Element root) {
Array<XmlReader.Element> templates = root.getChildrenByName("template");
for (XmlReader.Element template : templates) {
configurationMap.put(template.getAttribute("name"), template);
FilteredTree.Node node = new FilteredTree.Node(template.getAttribute("name"), new Label(template.getAttribute("title"), getSkin()));
tree.add(node);
}
}
Aggregations