use of javax.swing.tree.DefaultTreeModel in project darkFunction-Editor by darkFunction.
the class SpritesheetReader method getTreeModel.
public DefaultTreeModel getTreeModel() {
DefaultTreeModel retTree = null;
NodeList defList = doc.getElementsByTagName("definitions");
// only support one bunch of definitions, use the first
if (defList.getLength() > 0) {
Element first = (Element) defList.item(0);
if (first != null) {
NodeList children = first.getChildNodes();
Element firstChild = null;
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
firstChild = (Element) child;
break;
}
}
if (firstChild != null) {
retTree = createTreeModelFromDOM(firstChild);
}
}
}
return retTree;
}
use of javax.swing.tree.DefaultTreeModel in project buck by facebook.
the class BuckEventsConsumerTest method hasUIWorkBeenDoneOnNonAwtThreadInConsumeBuckProjectGenerationFinishedThenFail.
@Test
public void hasUIWorkBeenDoneOnNonAwtThreadInConsumeBuckProjectGenerationFinishedThenFail() {
DefaultTreeModel treeModel = new DefaultTreeModel(null);
BuckEventsConsumer buckEventsConsumer = initialiseEventsConsumer();
MockTreeModelListener listener = addListeners(treeModel);
buckEventsConsumer.attach(null, treeModel);
assertFalse(listener.calledOnWrongThread);
assertTrue(buckEventsConsumer.isAttached());
buckEventsConsumer.consumeBuckProjectGenerationFinished(0);
assertFalse(listener.calledOnWrongThread);
}
use of javax.swing.tree.DefaultTreeModel in project buck by facebook.
the class BuckEventsConsumerTest method hasUIWorkBeenDoneOnNonAwtThreadInConsumeBuckProjectGenerationProgressThenFail.
@Test
public void hasUIWorkBeenDoneOnNonAwtThreadInConsumeBuckProjectGenerationProgressThenFail() {
DefaultTreeModel treeModel = new DefaultTreeModel(null);
BuckEventsConsumer buckEventsConsumer = initialiseEventsConsumer();
MockTreeModelListener listener = addListeners(treeModel);
buckEventsConsumer.attach(null, treeModel);
assertFalse(listener.calledOnWrongThread);
assertTrue(buckEventsConsumer.isAttached());
buckEventsConsumer.consumeBuckProjectGenerationProgress(0, 0);
assertFalse(listener.calledOnWrongThread);
}
use of javax.swing.tree.DefaultTreeModel in project buck by facebook.
the class BuckEventsConsumerTest method hasUIWorkBeenDoneOnNonAwtThreadInAttachThenFail.
@Test
public void hasUIWorkBeenDoneOnNonAwtThreadInAttachThenFail() {
DefaultTreeModel treeModel = new DefaultTreeModel(null);
BuckEventsConsumer buckEventsConsumer = initialiseEventsConsumer();
MockTreeModelListener listener = addListeners(treeModel);
buckEventsConsumer.attach(null, treeModel);
assertFalse(listener.calledOnWrongThread);
assertTrue(buckEventsConsumer.isAttached());
}
use of javax.swing.tree.DefaultTreeModel in project buck by facebook.
the class BuckEventsConsumerTest method hasUIWorkBeenDoneOnNonAwtThreadInConsumeConsoleEventThenFail.
@Test
public void hasUIWorkBeenDoneOnNonAwtThreadInConsumeConsoleEventThenFail() {
DefaultTreeModel treeModel = new DefaultTreeModel(null);
BuckEventsConsumer buckEventsConsumer = initialiseEventsConsumer();
MockTreeModelListener listener = addListeners(treeModel);
buckEventsConsumer.attach(null, treeModel);
assertFalse(listener.calledOnWrongThread);
assertTrue(buckEventsConsumer.isAttached());
buckEventsConsumer.consumeConsoleEvent("");
assertFalse(listener.calledOnWrongThread);
}
Aggregations