import junit.framework.Test; //导入方法依赖的package包/类
@Override protected void updateItem(Test test, boolean empty) {
super.updateItem(test, empty);
if (test != null && !empty) {
String value;
if (test instanceof TestSuite) {
value = ((TestSuite) test).getName();
} else if (test instanceof MarathonTestCase) {
value = ((MarathonTestCase) test).getName();
} else {
value = test.toString();
}
setText(value);
Node icon = test instanceof TestSuite ? FXUIUtils.getIcon("tsuite") : FXUIUtils.getIcon("ttest");
State state = ((TestTreeItem) getTreeItem()).getState();
if (test instanceof TestSuite) {
if (state == State.RUNNING) {
icon = FXUIUtils.getIcon("wait16trans");
}
if (state == State.SUCCESS) {
icon = FXUIUtils.getIcon("tsuiteok");
}
if (state == State.ERROR) {
icon = FXUIUtils.getIcon("tsuiteerror");
}
if (state == State.FAILURE) {
icon = FXUIUtils.getIcon("tsuitefail");
}
} else {
if (state == State.RUNNING) {
icon = FXUIUtils.getIcon("wait16trans");
}
if (state == State.SUCCESS) {
icon = FXUIUtils.getIcon("testok");
}
if (state == State.ERROR) {
icon = FXUIUtils.getIcon("testerror");
}
if (state == State.FAILURE) {
icon = FXUIUtils.getIcon("testfail");
}
}
setGraphic(icon);
} else {
setText(null);
setGraphic(null);
}
}