Search in sources :

Example 61 with Issue

use of org.vcell.util.Issue in project vcell by virtualcell.

the class RbmTreeCellRenderer method hasErrorIssues.

public boolean hasErrorIssues(Displayable owner, MolecularComponentPattern mcp, MolecularComponent mc) {
    if (issueManager == null) {
        return false;
    }
    if (owner == null) {
        return false;
    }
    List<Issue> allIssueList = issueManager.getIssueList();
    for (Issue issue : allIssueList) {
        if (issue.getSeverity() != Issue.Severity.ERROR) {
            continue;
        }
        Object source = issue.getSource();
        Object detailedSource = issue.getDetailedSource();
        if (mcp != null && source == owner && detailedSource == mcp) {
            return true;
        } else if (mc != null & source == owner && detailedSource == mc) {
            return true;
        }
    }
    return false;
}
Also used : Issue(org.vcell.util.Issue)

Example 62 with Issue

use of org.vcell.util.Issue in project vcell by virtualcell.

the class IssueTableModel method getValueAt.

public Object getValueAt(int rowIndex, int columnIndex) {
    VCDocument vcDocument = (issueManager != null) ? (issueManager.getVCDocument()) : null;
    Issue issue = getValueAt(rowIndex);
    switch(columnIndex) {
        case COLUMN_DESCRIPTION:
            return issue;
        case COLUMN_URL:
            {
                String url = issue.getHyperlink();
                if (url == null) {
                    return "";
                }
                return "<html><a href=\"" + url + "\">More</a></html>";
            }
        case COLUMN_SOURCE:
            return getSourceObjectDescription(vcDocument, issue);
        case COLUMN_PATH:
            return getSourceObjectPathDescription(vcDocument, issue);
    }
    return null;
}
Also used : Issue(org.vcell.util.Issue) VCDocument(org.vcell.util.document.VCDocument)

Example 63 with Issue

use of org.vcell.util.Issue in project vcell by virtualcell.

the class IssueTableModel method refreshData.

void refreshData() {
    List<Issue> issueList = null;
    if (issueManager != null) {
        List<Issue> allIssueList = issueManager.getIssueList();
        issueList = new ArrayList<Issue>();
        for (Issue issue : allIssueList) {
            Severity severity = issue.getSeverity();
            if (severity == Issue.Severity.ERROR) {
                issueList.add(issue);
            }
        }
        if (bShowWarning) {
            for (Issue issue : allIssueList) {
                Severity severity = issue.getSeverity();
                if (severity == Issue.Severity.WARNING) {
                    issueList.add(issue);
                }
            }
        }
    }
    setData(issueList);
    GuiUtils.flexResizeTableColumns(ownerTable);
}
Also used : Issue(org.vcell.util.Issue) Severity(org.vcell.util.Issue.Severity)

Example 64 with Issue

use of org.vcell.util.Issue in project vcell by virtualcell.

the class ClientRequestManager method updateMath.

public static Collection<AsynchClientTask> updateMath(final Component requester, final SimulationContext simulationContext, final boolean bShowWarning, final NetworkGenerationRequirements networkGenerationRequirements) {
    ArrayList<AsynchClientTask> rval = new ArrayList<>();
    AsynchClientTask task1 = new AsynchClientTask("generating math", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            Geometry geometry = simulationContext.getGeometry();
            if (geometry.getDimension() > 0 && geometry.getGeometrySurfaceDescription().getGeometricRegions() == null) {
                geometry.getGeometrySurfaceDescription().updateAll();
            }
            // Use differnt mathmapping for different applications (stoch or non-stoch)
            simulationContext.checkValidity();
            MathMappingCallback callback = new MathMappingCallbackTaskAdapter(getClientTaskStatusSupport());
            MathMapping mathMapping = simulationContext.createNewMathMapping(callback, networkGenerationRequirements);
            MathDescription mathDesc = mathMapping.getMathDescription(callback);
            callback.setProgressFraction(1.0f / 3.0f * 2.0f);
            hashTable.put("mathMapping", mathMapping);
            hashTable.put("mathDesc", mathDesc);
        }
    };
    rval.add(task1);
    AsynchClientTask task2 = new AsynchClientTask("formating math", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            MathDescription mathDesc = (MathDescription) hashTable.get("mathDesc");
            if (mathDesc != null) {
                simulationContext.setMathDescription(mathDesc);
            }
        }
    };
    rval.add(task2);
    if (bShowWarning) {
        AsynchClientTask task3 = new AsynchClientTask("showing issues", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

            @Override
            public void run(Hashtable<String, Object> hashTable) throws Exception {
                MathMapping mathMapping = (MathMapping) hashTable.get("mathMapping");
                MathDescription mathDesc = (MathDescription) hashTable.get("mathDesc");
                if (mathDesc != null) {
                    // 
                    // inform user if any issues
                    // 
                    Issue[] issues = mathMapping.getIssues();
                    if (issues != null && issues.length > 0) {
                        StringBuffer messageBuffer = new StringBuffer("Issues encountered during Math Generation:\n");
                        int issueCount = 0;
                        for (int i = 0; i < issues.length; i++) {
                            if (issues[i].getSeverity() == Issue.SEVERITY_ERROR || issues[i].getSeverity() == Issue.SEVERITY_WARNING) {
                                messageBuffer.append(issues[i].getCategory() + " " + issues[i].getSeverityName() + " : " + issues[i].getMessage() + "\n");
                                issueCount++;
                            }
                        }
                        if (issueCount > 0) {
                            PopupGenerator.showWarningDialog(requester, messageBuffer.toString(), new String[] { "OK" }, "OK");
                        }
                    }
                }
            }
        };
        rval.add(task3);
    }
    return rval;
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) MathMappingCallbackTaskAdapter(cbit.vcell.mapping.MathMappingCallbackTaskAdapter) Issue(org.vcell.util.Issue) MathMappingCallback(cbit.vcell.mapping.SimulationContext.MathMappingCallback) SetMathDescription(cbit.vcell.client.task.SetMathDescription) MathDescription(cbit.vcell.math.MathDescription) Hashtable(java.util.Hashtable) ArrayList(java.util.ArrayList) Geometry(cbit.vcell.geometry.Geometry) MathMapping(cbit.vcell.mapping.MathMapping)

Example 65 with Issue

use of org.vcell.util.Issue in project vcell by virtualcell.

the class MathOverrides method gatherIssues.

/**
 * This method was created in VisualAge.
 * @return boolean
 */
public void gatherIssues(IssueContext issueContext, List<Issue> issueList) {
    MathDescription mathDescription = getSimulation().getMathDescription();
    // 
    // get list of names of constants in this math
    // 
    Enumeration<Constant> enumeration = mathDescription.getConstants();
    java.util.HashSet<String> mathDescriptionHash = new java.util.HashSet<String>();
    while (enumeration.hasMoreElements()) {
        Constant constant = enumeration.nextElement();
        mathDescriptionHash.add(constant.getName());
    }
    // 
    // for any elements in this MathOverrides but not in the new MathDescription, add an "error" issue
    // 
    Enumeration<String> mathOverrideNamesEnum = getOverridesHash().keys();
    while (mathOverrideNamesEnum.hasMoreElements()) {
        String name = mathOverrideNamesEnum.nextElement();
        if (!mathDescriptionHash.contains(name)) {
            Issue issue = new Issue(getSimulation(), issueContext, IssueCategory.Simulation_Override_NotFound, VCellErrorMessages.getErrorMessage(VCellErrorMessages.SIMULATION_OVERRIDE_NOTFOUND, name, getSimulation().getName()), Issue.SEVERITY_ERROR);
            issueList.add(issue);
        }
        Variable var = mathDescription.getVariable(name);
        if (getSimulation().getSimulationOwner() != null) {
            Issue issue = getSimulation().getSimulationOwner().gatherIssueForMathOverride(issueContext, getSimulation(), name);
            if (issue != null) {
                issueList.add(issue);
            }
        }
    }
}
Also used : Issue(org.vcell.util.Issue) Variable(cbit.vcell.math.Variable) MathDescription(cbit.vcell.math.MathDescription) Constant(cbit.vcell.math.Constant)

Aggregations

Issue (org.vcell.util.Issue)88 ArrayList (java.util.ArrayList)18 IssueContext (org.vcell.util.IssueContext)14 Expression (cbit.vcell.parser.Expression)13 ExpressionException (cbit.vcell.parser.ExpressionException)13 PropertyVetoException (java.beans.PropertyVetoException)9 MolecularType (org.vcell.model.rbm.MolecularType)9 Structure (cbit.vcell.model.Structure)8 VCUnitDefinition (cbit.vcell.units.VCUnitDefinition)8 SymbolTableEntry (cbit.vcell.parser.SymbolTableEntry)7 MolecularComponentPattern (org.vcell.model.rbm.MolecularComponentPattern)7 Model (cbit.vcell.model.Model)6 ModelParameter (cbit.vcell.model.Model.ModelParameter)6 ExpressionBindingException (cbit.vcell.parser.ExpressionBindingException)6 BioModel (cbit.vcell.biomodel.BioModel)5 ModelException (cbit.vcell.model.ModelException)5 Product (cbit.vcell.model.Product)5 Reactant (cbit.vcell.model.Reactant)5 ReactionParticipant (cbit.vcell.model.ReactionParticipant)5 InteriorPoint (org.sbml.jsbml.ext.spatial.InteriorPoint)5