A complete 3D game development suite written purely in Java.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
jmonkeyengine/sdk/jme3-gui/src/com/jme3/gde/gui/multiview/NiftyFileChildren.java

55 lines
1.3 KiB

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.jme3.gde.gui.multiview;
import java.util.LinkedList;
import java.util.List;
import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.w3c.dom.Element;
/**
*
* @author normenhansen
*/
public class NiftyFileChildren extends Children.Keys<Element> {
Element xmlNode;
public NiftyFileChildren(Element xmlNode) {
this.xmlNode = xmlNode;
}
@Override
protected void addNotify() {
super.addNotify();
setKeys(createKeys());
}
protected List<Element> createKeys() {
LinkedList<Element> ret = new LinkedList<Element>();
Element curElement = XmlHelper.findFirstChildElement(xmlNode);
while (curElement != null) {
if (checkElement(curElement)) {
ret.add(curElement);
}
curElement = XmlHelper.findNextSiblingElement(curElement);
}
return ret;
}
private boolean checkElement(Element curElement) {
if (!"screen".equals(curElement.getTagName())) {
return false;
}
return true;
}
@Override
protected Node[] createNodes(Element key) {
return new Node[]{new NiftyScreenNode(key.getAttribute("id"))};
}
}