use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.
the class ClientDocumentManager method setGroupPrivate.
/**
* Insert the method's description here.
* Creation date: (11/28/00 5:43:44 PM)
* @param bioModelInfo cbit.vcell.biomodel.BioModelInfo
*/
public MathModelInfo setGroupPrivate(MathModelInfo mathModelInfo) throws DataAccessException {
try {
//
// unpublish from database
//
MathModelInfo newMathModelInfo = (MathModelInfo) setGroupPrivate0(mathModelInfo, VersionableType.MathModelMetaData, mathModelInfoHash);
//
// delete MathModelMetaData from cache
//
xmlHash.remove(mathModelInfo.getVersion().getVersionKey());
fireDatabaseUpdate(new DatabaseEvent(this, DatabaseEvent.UPDATE, mathModelInfo, newMathModelInfo));
return newMathModelInfo;
} catch (RemoteProxyException e) {
handleRemoteProxyException(e);
throw new DataAccessException(e.getMessage());
}
}
use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.
the class ClientDocumentManager method curate.
/**
* Insert the method's description here.
* Creation date: (5/23/2006 9:23:34 AM)
*/
public void curate(CurateSpec curateSpec) throws DataAccessException {
try {
VCDocumentInfo newVCDocumentInfo = getSessionManager().getUserMetaDbServer().curate(curateSpec);
xmlHash.remove(curateSpec.getVCDocumentInfo().getVersion().getVersionKey());
if (curateSpec.getVCDocumentInfo() instanceof MathModelInfo) {
mathModelInfoHash.remove(curateSpec.getVCDocumentInfo().getVersion().getVersionKey());
mathModelInfoHash.put(newVCDocumentInfo.getVersion().getVersionKey(), (MathModelInfo) newVCDocumentInfo);
} else if (curateSpec.getVCDocumentInfo() instanceof BioModelInfo) {
bioModelInfoHash.remove(curateSpec.getVCDocumentInfo().getVersion().getVersionKey());
bioModelInfoHash.put(newVCDocumentInfo.getVersion().getVersionKey(), (BioModelInfo) newVCDocumentInfo);
}
fireDatabaseUpdate(new DatabaseEvent(this, DatabaseEvent.UPDATE, curateSpec.getVCDocumentInfo(), newVCDocumentInfo));
} catch (Exception e) {
e.printStackTrace();
throw new DataAccessException(e.getClass().getName() + " " + e.getMessage());
}
}
use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.
the class MathModelCellRenderer method getTreeCellRendererComponent.
/**
* Insert the method's description here.
* Creation date: (7/27/2000 6:41:57 PM)
* @return java.awt.Component
*/
public java.awt.Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
JLabel component = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
//
try {
if (value instanceof BioModelNode) {
BioModelNode node = (BioModelNode) value;
Object userObject = node.getUserObject();
if (userObject instanceof User) {
String label = null;
if (sessionUser != null && sessionUser.compareEqual((User) userObject)) {
label = "My MathModels (" + ((User) userObject).getName() + ") (" + node.getChildCount() + ")";
} else {
label = ((User) userObject).getName() + " ";
}
component.setToolTipText(label);
component.setText(label);
} else if (userObject instanceof MathModelInfo) {
MathModelInfo mathModelInfo = (MathModelInfo) userObject;
if (mathModelInfo.getVersion().getFlag().compareEqual(org.vcell.util.document.VersionFlag.Archived)) {
component.setText("(Archived) " + component.getText());
} else if (mathModelInfo.getVersion().getFlag().compareEqual(org.vcell.util.document.VersionFlag.Published)) {
component.setText("(Published) " + component.getText());
}
} else if (userObject instanceof VCDocumentInfoNode) {
VCDocumentInfoNode infonode = (VCDocumentInfoNode) userObject;
User nodeUser = infonode.getVCDocumentInfo().getVersion().getOwner();
String modelName = infonode.getVCDocumentInfo().getVersion().getName();
String username = nodeUser.getName();
if (nodeUser.compareEqual(sessionUser) || username.equals(VCDocumentDbTreeModel.USER_tutorial) || username.equals(VCDocumentDbTreeModel.USER_Education)) {
setText(modelName);
} else {
setText("<html><b>" + nodeUser.getName() + " </b> : " + modelName + "</html>");
}
}
}
} catch (Throwable e) {
e.printStackTrace(System.out);
}
//
if (component.getToolTipText() == null || component.getToolTipText().length() == 0) {
component.setToolTipText(component.getText());
}
return component;
}
use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.
the class MathModelDbTreeModel method databaseDelete.
/**
* @param event cbit.vcell.clientdb.DatabaseEvent
*/
public void databaseDelete(DatabaseEvent databaseEvent) {
if (databaseEvent.getOldVersionInfo() instanceof MathModelInfo) {
MathModelInfo removedMathModelInfo = (MathModelInfo) databaseEvent.getOldVersionInfo();
BioModelNode removedNode = ((BioModelNode) getRoot()).findNodeByUserObject(removedMathModelInfo);
if (removedNode != null) {
if (removedNode.getParent() != null && removedNode.getSiblingCount() == 1) {
// just this one version
removedNode = (BioModelNode) removedNode.getParent();
}
removeNodeFromParent(removedNode);
}
}
}
use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.
the class MathModelDbTreeModel method createOwnerSubTree.
/**
* Insert the method's description here.
* Creation date: (11/28/00 1:06:51 PM)
* @return cbit.vcell.desktop.BioModelNode
* @param docManager cbit.vcell.clientdb.DocumentManager
*/
public BioModelNode createOwnerSubTree(User owner, MathModelInfo[] mathModelInfos) throws DataAccessException {
//
// for each user
//
BioModelNode rootNode = new BioModelNode(owner, true);
for (int i = 0; i < mathModelInfos.length; i++) {
MathModelInfo mathModelInfo = mathModelInfos[i];
if (mathModelInfo.getVersion().getOwner().equals(owner)) {
if (!meetSearchCriteria(mathModelInfo)) {
continue;
}
BioModelNode bioModelNode = new BioModelNode(new VCDocumentInfoNode(mathModelInfo), true);
rootNode.add(bioModelNode);
//
// get list of bioModels with the same branch
//
Vector<MathModelInfo> mathModelBranchList = new Vector<MathModelInfo>();
mathModelBranchList.addElement(mathModelInfo);
for (i = i + 1; i < mathModelInfos.length; i++) {
if (mathModelInfos[i].getVersion().getBranchID().equals(mathModelInfo.getVersion().getBranchID())) {
if (!meetSearchCriteria(mathModelInfos[i])) {
continue;
}
mathModelBranchList.add(0, mathModelInfos[i]);
} else {
i--;
break;
}
}
MathModelInfo[] mathModelInfosInBranch = null;
if (getLatestOnly()) {
mathModelInfosInBranch = new MathModelInfo[1];
mathModelInfosInBranch[0] = (MathModelInfo) mathModelBranchList.elementAt(0);
} else {
mathModelInfosInBranch = new MathModelInfo[mathModelBranchList.size()];
mathModelBranchList.copyInto(mathModelInfosInBranch);
}
for (int versionCount = 0; versionCount < mathModelInfosInBranch.length; versionCount++) {
bioModelNode.add(createVersionSubTree(mathModelInfosInBranch[versionCount]));
}
}
}
return rootNode;
}
Aggregations