use of org.vcell.util.document.Version in project vcell by virtualcell.
the class VCellBasicCellRenderer method setComponentProperties.
/**
* Insert the method's description here.
* Creation date: (5/8/01 8:35:45 AM)
* @return javax.swing.Icon
* @param nodeUserObject java.lang.Object
*/
protected void setComponentProperties(JLabel component, BioModelInfo bioModelInfo) {
component.setIcon(fieldBioModelIcon);
Version version = bioModelInfo.getVersion();
component.setToolTipText("BioModel (" + bioModelInfo.getSoftwareVersion().getDescription() + ")");
String access = (version.getGroupAccess().getDescription());
component.setText(access + " " + version.getDate().toString());
}
use of org.vcell.util.document.Version in project vcell by virtualcell.
the class VCellBasicCellRenderer method setComponentProperties.
/**
* Insert the method's description here.
* Creation date: (5/8/01 8:35:45 AM)
* @return javax.swing.Icon
* @param nodeUserObject java.lang.Object
*/
protected void setComponentProperties(JLabel component, GeometryInfo geometryInfo) {
component.setIcon(fieldGeometryIcon);
Version version = geometryInfo.getVersion();
String access = (version.getGroupAccess().getDescription());
component.setToolTipText("Geometry");
String description = null;
if (geometryInfo.getDimension() > 0) {
description = geometryInfo.getDimension() + "D " + ((geometryInfo.getImageRef() != null) ? "image" : "analytic") + " Geometry";
component.setText(access + " " + description + " \"" + version.getName() + "\"" + " (" + version.getDate() + ")");
} else {
component.setText(access + " compartmental Geometry \"" + version.getName() + "\"" + " (" + version.getDate() + ")");
}
}
use of org.vcell.util.document.Version in project vcell by virtualcell.
the class VCellBasicCellRenderer method setComponentProperties.
/**
* Insert the method's description here.
* Creation date: (5/8/01 8:35:45 AM)
* @return javax.swing.Icon
* @param nodeUserObject java.lang.Object
*/
protected void setComponentProperties(JLabel component, Geometry geometry) {
component.setIcon(fieldGeometryIcon);
Version version = geometry.getVersion();
component.setToolTipText("Geometry");
String date = (version != null) ? (" (" + version.getDate().toString() + ")") : " (unsaved)";
if (geometry.getDimension() > 0) {
component.setText("\"" + geometry.getName() + "\"" + date);
} else {
component.setText(BioModelChildSummary.COMPARTMENTAL_GEO_STR);
}
}
use of org.vcell.util.document.Version in project vcell by virtualcell.
the class FieldDataGUIPanel method getJButtonCreateGeom.
/**
* This method initializes jButtonCopyInfo
*
* @return javax.swing.JButton
*/
private JButton getJButtonCreateGeom() {
if (jButtonCreateGeom == null) {
jButtonCreateGeom = new JButton();
jButtonCreateGeom.setEnabled(false);
jButtonCreateGeom.setText("Create Geom");
jButtonCreateGeom.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
try {
RequestManager clientRequestManager = fieldDataWindowManager.getLocalRequestManager();
javax.swing.tree.TreePath selPath = getJTree1().getSelectionPath();
javax.swing.tree.DefaultMutableTreeNode lastPathComponent = (javax.swing.tree.DefaultMutableTreeNode) selPath.getLastPathComponent();
if (lastPathComponent.getUserObject() instanceof FieldDataVarList) {
DataIdentifier dataIdentifier = ((FieldDataVarList) lastPathComponent.getUserObject()).dataIdentifier;
TreePath ppPath = selPath.getParentPath().getParentPath();
javax.swing.tree.DefaultMutableTreeNode ppLastPathComp = (javax.swing.tree.DefaultMutableTreeNode) ppPath.getLastPathComponent();
if (ppLastPathComp.getUserObject() instanceof FieldDataMainList) {
ExternalDataIdentifier extDataID = ((FieldDataMainList) ppLastPathComp.getUserObject()).externalDataIdentifier;
final OpenModelInfoHolder openModelInfoHolder = FieldDataWindowManager.selectOpenModelsFromDesktop(FieldDataGUIPanel.this, fieldDataWindowManager.getRequestManager(), false, "Select BioModel or MathModel to receive new geometry", false);
if (openModelInfoHolder == null) {
DialogUtils.showErrorDialog(FieldDataGUIPanel.this, "Before proceeding, please open a Biomodel application or Mathmodel you wish to apply a new Field Data Geometry to");
return;
}
AsynchClientTask applyGeomTask = new AsynchClientTask("apply geometry", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
Geometry newGeom = (Geometry) hashTable.get("doc");
final String OK_OPTION = "Ok";
if (openModelInfoHolder instanceof FDSimMathModelInfo) {
Version version = ((FDSimMathModelInfo) openModelInfoHolder).getMathModelVersion();
String modelName = (version == null ? "NoName" : version.getName());
if (newGeom.getName() == null) {
newGeom.setName(modelName + "_" + BeanUtils.generateDateTimeString());
}
String message = "Confirm Setting new FieldData derived geometry on MathModel '" + modelName + "'";
if (DialogUtils.showWarningDialog(FieldDataGUIPanel.this, message, new String[] { OK_OPTION, "Cancel" }, OK_OPTION).equals(OK_OPTION)) {
((FDSimMathModelInfo) openModelInfoHolder).getMathDescription().setGeometry(newGeom);
}
} else if (openModelInfoHolder instanceof FDSimBioModelInfo) {
Version version = ((FDSimBioModelInfo) openModelInfoHolder).getBioModelVersion();
String modelName = (version == null ? "NoName" : version.getName());
String simContextName = ((FDSimBioModelInfo) openModelInfoHolder).getSimulationContext().getName();
if (newGeom.getName() == null) {
newGeom.setName(modelName + "_" + simContextName + "_" + BeanUtils.generateDateTimeString());
}
String message = "Confirm Setting new FieldData derived geometry on BioModel '" + modelName + "' , Application '" + simContextName + "'";
if (DialogUtils.showWarningDialog(FieldDataGUIPanel.this, message, new String[] { OK_OPTION, "Cancel" }, OK_OPTION).equals(OK_OPTION)) {
((FDSimBioModelInfo) openModelInfoHolder).getSimulationContext().setGeometry(newGeom);
}
}
}
};
VCDocument.GeomFromFieldDataCreationInfo geomFromFieldDataCreationInfo = new VCDocument.GeomFromFieldDataCreationInfo(extDataID, dataIdentifier.getName());
AsynchClientTask[] createGeomTask = clientRequestManager.createNewGeometryTasks(fieldDataWindowManager, geomFromFieldDataCreationInfo, new AsynchClientTask[] { applyGeomTask }, "Apply Geometry");
Hashtable<String, Object> hash = new Hashtable<String, Object>();
hash.put(ClientRequestManager.GUI_PARENT, fieldDataWindowManager.getComponent());
ClientTaskDispatcher.dispatch(FieldDataGUIPanel.this, hash, createGeomTask, false, false, null, true);
}
}
} catch (UserCancelException e1) {
// ignore
} catch (Exception e1) {
e1.printStackTrace();
DialogUtils.showErrorDialog(FieldDataGUIPanel.this, e1.getMessage());
}
// jButtonFDCopyRef_ActionPerformed(e);
// fieldDataWindowManager.newDocument(VCDocument.GEOMETRY_DOC, option);
// copyMethod(COPY_CRNL);
// // javax.swing.tree.TreePath selPath = getJTree1().getSelectionPath();
// // if(selPath != null){
// // javax.swing.tree.DefaultMutableTreeNode lastPathComponent = (javax.swing.tree.DefaultMutableTreeNode)selPath.getLastPathComponent();
// // copyMethod(lastPathComponent, copyMode);
// // }
// // String copyString = "";
// // javax.swing.tree.DefaultMutableTreeNode lastPathComponent = (javax.swing.tree.DefaultMutableTreeNode)selPath.getLastPathComponent();
// // if(lastPathComponent.equals(getJTree1().getModel().getRoot())){
// // int childCount = lastPathComponent.getChildCount();
// // for(int i=0;i<childCount;i+= 1){
// // if(i != 0){
// // copyString+="\n";
// // }
// // copyString+=
// // ((FieldDataMainList)((DefaultMutableTreeNode)lastPathComponent.getChildAt(i)).getUserObject()).externalDataIdentifier.getName();
// // }
// // }else if(lastPathComponent.getUserObject() instanceof FieldDataOriginList){
// // Origin origin = ((FieldDataOriginList)lastPathComponent.getUserObject()).origin;
// // copyString = origin.getX()+","+origin.getY()+","+origin.getZ();
// // }else if(lastPathComponent.getUserObject() instanceof FieldDataExtentList){
// // Extent extent = ((FieldDataExtentList)lastPathComponent.getUserObject()).extent;
// // copyString = extent.getX()+","+extent.getY()+","+extent.getZ();
// // }else if(lastPathComponent.getUserObject() instanceof FieldDataISizeList){
// // ISize isize = ((FieldDataISizeList)lastPathComponent.getUserObject()).isize;
// // copyString = isize.getX()+","+isize.getY()+","+isize.getZ();
// // }else if(lastPathComponent.getUserObject() instanceof FieldDataTimeList){
// // double[] times = ((FieldDataTimeList)lastPathComponent.getUserObject()).times;
// // for(int i=0;i<times.length;i+= 1){
// // if(i != 0){
// // copyString+="\n";
// // }
// // copyString+= times[i]+"";
// // }
// // }else if(lastPathComponent.getUserObject() instanceof FieldDataMainList){
// // ExternalDataIdentifier extDataID =
// // ((FieldDataMainList)lastPathComponent.getUserObject()).externalDataIdentifier;
// // copyString = extDataID.getName();
// // }else if(lastPathComponent.getUserObject() instanceof FieldDataVarList){
// // DataIdentifier dataIdentifier =
// // ((FieldDataVarList)lastPathComponent.getUserObject()).dataIdentifier;
// // copyString = dataIdentifier.getName();
// // }else if(lastPathComponent.getUserObject() instanceof FieldDataVarMainList){
// // int childCount = lastPathComponent.getChildCount();
// // for(int i=0;i<childCount;i+= 1){
// // if(i != 0){
// // copyString+="\n";
// // }
// // copyString+=
// // ((FieldDataVarList)((DefaultMutableTreeNode)lastPathComponent.getChildAt(i)).getUserObject()).dataIdentifier.getName();
// // }
// // }
// // if(copyString.length() > 0 ){
// // VCellTransferable.sendToClipboard(copyString);
// // }
// // }
}
});
}
return jButtonCreateGeom;
}
use of org.vcell.util.document.Version in project vcell by virtualcell.
the class BioModelDbTreePanel 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 BioModelInfo) {
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());
getBioModelPopupMenu().show(getJTree1(), mouseEvent.getPoint().x, mouseEvent.getPoint().y);
}
}
} else {
ifNeedsDoubleClickEvent(mouseEvent, BioModelInfo.class);
}
}
Aggregations