use of cbit.vcell.desktop.BioModelNode in project vcell by virtualcell.
the class TestingFrmwkTreeModel method updateTree.
/**
* Invoked when an action occurs.
*/
private void updateTree(final TestSuiteGroup tsg, boolean bRemove) throws Exception {
if (tsg != null) {
if (tsg.latestTestSuite == null && tsg.latestTestSuiteInfos != null && !bRemove) {
BioModelNode finalNode = new BioModelNode("VCell Testing Framework");
BioModelNode testSuiteNode = null;
try {
testSuiteNode = createTestSuiteTree(tsg);
} finally {
if (testSuiteNode == null) {
testSuiteNode = new BioModelNode("Error Creating TestSuite Tree", false);
}
}
BioModelNode loadTestNode = null;
try {
loadTestNode = createLoadTestTree();
} finally {
if (loadTestNode == null) {
loadTestNode = new BioModelNode("Error Creating LoadTest Tree", false);
}
}
finalNode.add(loadTestNode);
finalNode.add(testSuiteNode);
setRoot(finalNode);
} else if (tsg.latestTestSuite != null && !bRemove) {
BioModelNode finalNode = null;
BioModelNode rootNode = getTestSuiteRoot(TestingFrmwkTreeModel.this);
finalNode = createTestSuiteSubTree(tsg.latestTestSuite);
for (int i = 0; i < rootNode.getChildCount(); i++) {
BioModelNode childNode = (BioModelNode) rootNode.getChildAt(i);
TestSuiteInfoNew childtsin = (TestSuiteInfoNew) childNode.getUserObject();
if (childtsin.getTSKey().equals(tsg.latestTestSuite.getTSInfoNew().getTSKey())) {
removeNodeFromParent(childNode);
insertNodeInto(finalNode, rootNode, i);
firePropertyChange(TS_NODE_REFRESH, childNode, finalNode);
return;
}
}
// Must be NEW TeestSuite
// insert at top
insertNodeInto(finalNode, rootNode, rootNode.getChildCount());
} else if (tsg.latestTestSuiteInfos != null && bRemove) {
// Remove tree nodes that aren't in DB
BioModelNode rootNode = getTestSuiteRoot(TestingFrmwkTreeModel.this);
for (int j = 0; j < tsg.latestTestSuiteInfos.length; j++) {
for (int i = 0; i < rootNode.getChildCount(); i++) {
BioModelNode childNode = (BioModelNode) rootNode.getChildAt(i);
TestSuiteInfoNew childtsin = (TestSuiteInfoNew) childNode.getUserObject();
if (childtsin.getTSKey().equals(tsg.latestTestSuiteInfos[j].getTSKey())) {
removeNodeFromParent(childNode);
break;
}
}
}
}
}
}
use of cbit.vcell.desktop.BioModelNode in project vcell by virtualcell.
the class CSGObjectTreeCellEditor method getTreeCellEditorComponent.
@Override
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) {
if (!(value instanceof BioModelNode)) {
return null;
}
Object userObject = ((BioModelNode) value).getUserObject();
CSGObjectTreeCellRenderer.CSGNodeLabel csgNodeLabel = new CSGObjectTreeCellRenderer.CSGNodeLabel();
CSGObjectTreeCellRenderer.getCSGNodeLabel(userObject, csgNodeLabel);
renderer.setOpenIcon(csgNodeLabel.icon);
renderer.setClosedIcon(csgNodeLabel.icon);
renderer.setLeafIcon(csgNodeLabel.icon);
Component component = null;
if (bRenaming) {
realEditor = defaultCellEditor;
component = super.getTreeCellEditorComponent(tree, value, isSelected, expanded, leaf, row);
if (editingComponent instanceof JTextField) {
String text = null;
JTextField textField = (JTextField) editingComponent;
if (userObject instanceof CSGObject) {
text = ((CSGObject) userObject).getName();
} else if (userObject instanceof CSGNode) {
text = ((CSGNode) userObject).getName();
}
textField.setText(text);
}
} else {
if (userObject instanceof CSGScale || userObject instanceof CSGTranslation) {
realEditor = getVect3dCellEditor();
Vect3d vect3d = null;
if (userObject instanceof CSGScale) {
vect3d = ((CSGScale) userObject).getScale();
} else if (userObject instanceof CSGTranslation) {
vect3d = ((CSGTranslation) userObject).getTranslation();
}
component = super.getTreeCellEditorComponent(tree, vect3d, isSelected, expanded, leaf, row);
} else if (userObject instanceof CSGRotation) {
realEditor = getRotationCellEditor();
component = super.getTreeCellEditorComponent(tree, value, isSelected, expanded, leaf, row);
}
}
return component;
}
Aggregations