Search in sources :

Example 11 with Version

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());
}
Also used : Version(org.vcell.util.document.Version)

Example 12 with Version

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() + ")");
    }
}
Also used : Version(org.vcell.util.document.Version)

Example 13 with Version

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);
    }
}
Also used : Version(org.vcell.util.document.Version)

Example 14 with Version

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;
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) ActionListener(java.awt.event.ActionListener) DataIdentifier(cbit.vcell.simdata.DataIdentifier) ExternalDataIdentifier(org.vcell.util.document.ExternalDataIdentifier) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) JButton(javax.swing.JButton) UserCancelException(org.vcell.util.UserCancelException) RequestManager(cbit.vcell.client.RequestManager) ClientRequestManager(cbit.vcell.client.ClientRequestManager) Version(org.vcell.util.document.Version) ExternalDataIdentifier(org.vcell.util.document.ExternalDataIdentifier) VCDocument(org.vcell.util.document.VCDocument) Hashtable(java.util.Hashtable) FDSimMathModelInfo(cbit.vcell.client.TopLevelWindowManager.FDSimMathModelInfo) OpenModelInfoHolder(cbit.vcell.client.TopLevelWindowManager.OpenModelInfoHolder) ActionEvent(java.awt.event.ActionEvent) DataFormatException(java.util.zip.DataFormatException) UserCancelException(org.vcell.util.UserCancelException) Geometry(cbit.vcell.geometry.Geometry) TreePath(javax.swing.tree.TreePath) FDSimBioModelInfo(cbit.vcell.client.TopLevelWindowManager.FDSimBioModelInfo)

Example 15 with Version

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);
    }
}
Also used : JTree(javax.swing.JTree) TreePath(javax.swing.tree.TreePath) Version(org.vcell.util.document.Version) BioModelInfo(org.vcell.util.document.BioModelInfo)

Aggregations

Version (org.vcell.util.document.Version)74 VCellSoftwareVersion (org.vcell.util.document.VCellSoftwareVersion)27 DataAccessException (org.vcell.util.DataAccessException)24 KeyValue (org.vcell.util.document.KeyValue)22 BigDecimal (java.math.BigDecimal)17 Geometry (cbit.vcell.geometry.Geometry)13 SimulationVersion (org.vcell.util.document.SimulationVersion)12 PropertyVetoException (java.beans.PropertyVetoException)10 User (org.vcell.util.document.User)10 VersionableTypeVersion (org.vcell.util.document.VersionableTypeVersion)10 Element (org.jdom.Element)9 MathDescription (cbit.vcell.math.MathDescription)8 RedistributionVersion (cbit.vcell.solvers.mb.MovingBoundarySolverOptions.RedistributionVersion)8 SimulationContext (cbit.vcell.mapping.SimulationContext)7 ResultSet (java.sql.ResultSet)7 Statement (java.sql.Statement)7 ImageException (cbit.image.ImageException)6 Simulation (cbit.vcell.solver.Simulation)6 VersionFlag (org.vcell.util.document.VersionFlag)6 Model (cbit.vcell.model.Model)5