use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.
the class MathModelDbTreePanel method actionsOnClick.
/**
* Comment
*/
protected void actionsOnClick(MouseEvent mouseEvent) {
if (mouseEvent.isPopupTrigger()) {
if (!getPopupMenuDisabled()) {
TreePath treePath = ((JTree) mouseEvent.getSource()).getPathForLocation(mouseEvent.getX(), mouseEvent.getY());
((JTree) mouseEvent.getSource()).setSelectionPath(treePath);
if (getSelectedVersionInfo() instanceof MathModelInfo) {
Version version = getSelectedVersionInfo().getVersion();
boolean isOwner = version.getOwner().compareEqual(getDocumentManager().getUser());
configureArhivePublishMenuState(version, isOwner);
getJMenuItemPermission().setEnabled(isOwner && !version.getFlag().compareEqual(VersionFlag.Published));
getJMenuItemDelete().setEnabled(isOwner && !version.getFlag().compareEqual(VersionFlag.Archived) && !version.getFlag().compareEqual(VersionFlag.Published));
compareWithMenuItemEnable(getSelectedVersionInfo());
getMathModelPopupMenu().show(getJTree1(), mouseEvent.getPoint().x, mouseEvent.getPoint().y);
}
}
} else {
ifNeedsDoubleClickEvent(mouseEvent, MathModelInfo.class);
}
}
use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.
the class MathModelDbTreePanel method compareWithMenuItemEnable.
/**
* Comment
*/
private void compareWithMenuItemEnable(VersionInfo vInfo) {
boolean bPreviousEditionMenuItem = false;
boolean bLatestEditionMenuItem = false;
boolean bAnotherEditionMenuItem = false;
if (vInfo != null) {
MathModelInfo thisMathModelInfo = (MathModelInfo) vInfo;
try {
//
// Get the other versions of the Mathmodel
//
MathModelInfo[] mathModelVersionsList = getMathModelVersionDates(thisMathModelInfo);
if (mathModelVersionsList != null && mathModelVersionsList.length > 0) {
bAnotherEditionMenuItem = true;
//
// Obtaining the previous version of the current biomodel
//
MathModelInfo previousMathModelInfo = mathModelVersionsList[0];
boolean bPrevious = false;
for (int i = 0; i < mathModelVersionsList.length; i++) {
if (mathModelVersionsList[i].getVersion().getDate().before(thisMathModelInfo.getVersion().getDate())) {
bPrevious = true;
previousMathModelInfo = mathModelVersionsList[i];
} else {
break;
}
}
if (previousMathModelInfo.equals(mathModelVersionsList[0]) && !bPrevious) {
bPreviousEditionMenuItem = false;
} else {
bPreviousEditionMenuItem = true;
}
//
// Obtaining the latest version of the current mathmodel
//
MathModelInfo latestMathModelInfo = mathModelVersionsList[mathModelVersionsList.length - 1];
for (int i = 0; i < mathModelVersionsList.length; i++) {
if (mathModelVersionsList[i].getVersion().getDate().after(latestMathModelInfo.getVersion().getDate())) {
latestMathModelInfo = mathModelVersionsList[i];
}
}
if (thisMathModelInfo.getVersion().getDate().after(latestMathModelInfo.getVersion().getDate())) {
bLatestEditionMenuItem = false;
} else {
bLatestEditionMenuItem = true;
}
}
} catch (DataAccessException ex) {
ex.printStackTrace();
}
}
getJPreviousEditionMenuItem().setEnabled(bPreviousEditionMenuItem);
getJLatestEditionMenuItem().setEnabled(bLatestEditionMenuItem);
getJAnotherEditionMenuItem().setEnabled(bAnotherEditionMenuItem);
}
use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.
the class MathModelDbTreePanel method treeSelection.
/**
* Comment
*/
protected void treeSelection() {
TreePath treePath = getJTree1().getSelectionPath();
if (treePath == null) {
setSelectedVersionInfo(null);
return;
}
BioModelNode bioModelNode = (BioModelNode) treePath.getLastPathComponent();
Object object = bioModelNode.getUserObject();
if (object instanceof VersionInfo) {
setSelectedVersionInfo((VersionInfo) object);
} else if (object instanceof VCDocumentInfoNode && bioModelNode.getChildCount() > 0 && ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject() instanceof MathModelInfo) {
MathModelInfo mathModelInfo = (MathModelInfo) ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject();
setSelectedVersionInfo(mathModelInfo);
} else {
setSelectedVersionInfo(null);
}
}
use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.
the class MathModelDbTreePanel method documentManager_DatabaseUpdate.
/**
* Comment
*/
protected void documentManager_DatabaseUpdate(DatabaseEvent event) {
if (event.getNewVersionInfo() instanceof MathModelInfo && getSelectedVersionInfo() instanceof MathModelInfo) {
MathModelInfo selectedMMInfo = (MathModelInfo) getSelectedVersionInfo();
MathModelInfo eventMMInfo = (MathModelInfo) event.getNewVersionInfo();
if (eventMMInfo.getVersion().getVersionKey().equals(selectedMMInfo.getVersion().getVersionKey())) {
setSelectedVersionInfo(event.getNewVersionInfo());
}
}
}
use of org.vcell.util.document.MathModelInfo in project vcell by virtualcell.
the class MathModelDbTreePanel method documentManager_DatabaseDelete.
/**
* Comment
*/
protected void documentManager_DatabaseDelete(DatabaseEvent event) {
if (event.getOldVersionInfo() instanceof MathModelInfo && getSelectedVersionInfo() instanceof MathModelInfo) {
MathModelInfo selectedMMInfo = (MathModelInfo) getSelectedVersionInfo();
MathModelInfo eventMMInfo = (MathModelInfo) event.getOldVersionInfo();
if (eventMMInfo.getVersion().getVersionKey().equals(selectedMMInfo.getVersion().getVersionKey())) {
setSelectedVersionInfo(null);
getJTree1().getSelectionModel().clearSelection();
}
}
}
Aggregations