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;
}
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;
}
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);
}
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;
}
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);
}
}
}
}
Aggregations