Search in sources :

Example 6 with Version

use of org.vcell.util.document.Version in project vcell by virtualcell.

the class VersionInfoComparator method compare.

/**
 * Compares its two arguments for order.  Returns a negative integer,
 * zero, or a positive integer as the first argument is less than, equal
 * to, or greater than the second.<p>
 *
 * The implementor must ensure that <tt>sgn(compare(x, y)) ==
 * -sgn(compare(y, x))</tt> for all <tt>x</tt> and <tt>y</tt>.  (This
 * implies that <tt>compare(x, y)</tt> must throw an exception if and only
 * if <tt>compare(y, x)</tt> throws an exception.)<p>
 *
 * The implementor must also ensure that the relation is transitive:
 * <tt>((compare(x, y)&gt;0) &amp;&amp; (compare(y, z)&gt;0))</tt> implies
 * <tt>compare(x, z)&gt;0</tt>.<p>
 *
 * Finally, the implementer must ensure that <tt>compare(x, y)==0</tt>
 * implies that <tt>sgn(compare(x, z))==sgn(compare(y, z))</tt> for all
 * <tt>z</tt>.<p>
 *
 * It is generally the case, but <i>not</i> strictly required that
 * <tt>(compare(x, y)==0) == (x.equals(y))</tt>.  Generally speaking,
 * any comparator that violates this condition should clearly indicate
 * this fact.  The recommended language is "Note: this comparator
 * imposes orderings that are inconsistent with equals."
 *
 * @return a negative integer, zero, or a positive integer as the
 * 	       first argument is less than, equal to, or greater than the
 *	       second.
 * @throws ClassCastException if the arguments' types prevent them from
 * 	       being compared by this Comparator.
 */
public int compare(VersionInfo v1, VersionInfo v2) {
    // 
    // first, compare by names
    // 
    Version version1 = v1.getVersion();
    Version version2 = v2.getVersion();
    int result = version1.getName().compareToIgnoreCase(version2.getName());
    if (result != 0) {
        return result;
    }
    // second, compare by branchID
    result = version1.getBranchID().compareTo(version2.getBranchID());
    if (result != 0) {
        return result;
    }
    // third, compare by date
    return version1.getDate().compareTo(version2.getDate());
}
Also used : Version(org.vcell.util.document.Version)

Example 7 with Version

use of org.vcell.util.document.Version in project vcell by virtualcell.

the class TestCriteriaNewBioModel method describe.

@Override
public String describe() {
    StringBuilder sb = new StringBuilder();
    if (regrBioModelInfo != null) {
        Version v = regrBioModelInfo.getVersion();
        if (v != null) {
            sb.append(v.getName());
            sb.append(' ');
        } else {
            sb.append("unversioned ");
        }
    } else {
        sb.append("no model info");
    }
    SimulationInfo si = getSimInfo();
    if (si != null) {
        sb.append(si.getName());
    } else {
        sb.append("no simulation");
    }
    return sb.toString();
}
Also used : Version(org.vcell.util.document.Version) SimulationInfo(cbit.vcell.solver.SimulationInfo)

Example 8 with Version

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

Example 9 with Version

use of org.vcell.util.document.Version in project vcell by virtualcell.

the class VCDocumentDbTreeModel method initFinalTree.

protected static synchronized void initFinalTree(VCDocumentDbTreeModel vcDocumentDbTreeModel, TreeMap<String, BioModelNode> treeMap, User loginUser) {
    BioModelNode ownerNode = (BioModelNode) treeMap.remove(loginUser.getName());
    vcDocumentDbTreeModel.myModelsNode.setUserObject(loginUser);
    vcDocumentDbTreeModel.myModelsNode.removeAllChildren();
    for (int c = 0; c < ownerNode.getChildCount(); ) {
        BioModelNode childNode = (BioModelNode) ownerNode.getChildAt(c);
        vcDocumentDbTreeModel.myModelsNode.add(childNode);
    }
    vcDocumentDbTreeModel.sharedModelsNode.removeAllChildren();
    vcDocumentDbTreeModel.publicModelsNode.removeAllChildren();
    boolean bTutorial = vcDocumentDbTreeModel.tutorialModelsNode != null;
    boolean bEducation = vcDocumentDbTreeModel.educationModelsNode != null;
    if (bTutorial) {
        vcDocumentDbTreeModel.tutorialModelsNode.removeAllChildren();
    }
    if (bEducation) {
        vcDocumentDbTreeModel.educationModelsNode.removeAllChildren();
    }
    for (String username : treeMap.keySet()) {
        BioModelNode userNode = treeMap.get(username);
        BioModelNode parentNode = vcDocumentDbTreeModel.sharedModelsNode;
        boolean bSpecificUser = true;
        if ((username.equals(USER_tutorial) || username.equals(USER_tutorial610) || username.equals(USER_tutorial611)) && bTutorial) {
            parentNode = vcDocumentDbTreeModel.tutorialModelsNode;
        } else if (username.equals(USER_Education) && bEducation) {
            parentNode = vcDocumentDbTreeModel.educationModelsNode;
        } else {
            bSpecificUser = false;
        }
        for (int c = 0; c < userNode.getChildCount(); ) {
            BioModelNode childNode = (BioModelNode) userNode.getChildAt(c);
            VCDocumentInfoNode vcdDocumentInfoNode = (VCDocumentInfoNode) childNode.getUserObject();
            if (!bSpecificUser) {
                parentNode = vcDocumentDbTreeModel.sharedModelsNode;
                BigDecimal groupid = GroupAccess.GROUPACCESS_NONE;
                Version version = vcdDocumentInfoNode.getVCDocumentInfo().getVersion();
                if (version != null && version.getGroupAccess() != null) {
                    groupid = version.getGroupAccess().getGroupid();
                }
                if (groupid.equals(GroupAccess.GROUPACCESS_ALL)) {
                    parentNode = vcDocumentDbTreeModel.publicModelsNode;
                }
            }
            // when added to other node, this childNode was removed from userNode
            parentNode.add(childNode);
        }
    }
}
Also used : Version(org.vcell.util.document.Version) VCDocumentInfoNode(cbit.vcell.desktop.VCellBasicCellRenderer.VCDocumentInfoNode) BigDecimal(java.math.BigDecimal)

Example 10 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, MathModelInfo mathModelInfo) {
    component.setIcon(fieldMathModelIcon);
    Version version = mathModelInfo.getVersion();
    component.setToolTipText("MathModel (" + mathModelInfo.getSoftwareVersion().getDescription() + ")");
    String access = (version.getGroupAccess().getDescription());
    component.setText(access + " " + version.getDate().toString());
}
Also used : Version(org.vcell.util.document.Version)

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