Search in sources :

Example 1 with Severity

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

the class IssueManager method updateIssues0.

/**
 * @param immediate update now, skip check of {@link #LAST_DIRTY_MILLISECONDS}
 */
private void updateIssues0(boolean immediate) {
    if (vcDocument == null) {
        return;
    }
    if (!immediate) {
        if (dirtyTimestamp == 0) {
            return;
        }
        long elapsedTime = System.currentTimeMillis() - dirtyTimestamp;
        if (elapsedTime < LAST_DIRTY_MILLISECONDS) {
            return;
        }
    }
    try {
        VCDocumentDecorator decorator = VCDocumentDecorator.getDecorator(vcDocument);
        numErrors = 0;
        numWarnings = 0;
        ArrayList<Issue> oldIssueList = new ArrayList<Issue>(issueList);
        ArrayList<Issue> tempIssueList = new ArrayList<Issue>();
        IssueContext issueContext = new ManagerContext();
        decorator.gatherIssues(issueContext, tempIssueList);
        // vcDocument.gatherIssues(issueContext,tempIssueList);
        issueList = new ArrayList<Issue>();
        for (Issue issue : tempIssueList) {
            if (issue instanceof SimpleBoundsIssue) {
                continue;
            }
            issueList.add(issue);
            Severity severity = issue.getSeverity();
            if (severity == Issue.Severity.ERROR) {
                numErrors++;
            } else if (severity == Issue.Severity.WARNING) {
                numWarnings++;
            }
        }
        fireIssueEventListener(new IssueEvent(vcDocument, oldIssueList, issueList));
    // System.out.println("\n................... update performed .................." + System.currentTimeMillis());
    } finally {
        dirtyTimestamp = 0;
        if (bMoreTime) {
            setDirty();
            bMoreTime = false;
        }
    }
}
Also used : SimpleBoundsIssue(cbit.vcell.model.SimpleBoundsIssue) Issue(org.vcell.util.Issue) VCDocumentDecorator(cbit.vcell.client.desktop.VCDocumentDecorator) SimpleBoundsIssue(cbit.vcell.model.SimpleBoundsIssue) ArrayList(java.util.ArrayList) IssueContext(org.vcell.util.IssueContext) Severity(org.vcell.util.Issue.Severity)

Example 2 with Severity

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

the class IssueTableModel method getComparator.

@Override
protected Comparator<Issue> getComparator(final int col, final boolean ascending) {
    return new Comparator<Issue>() {

        public int compare(Issue o1, Issue o2) {
            VCDocument vcDocument = (issueManager != null) ? (issueManager.getVCDocument()) : null;
            int scale = ascending ? 1 : -1;
            switch(col) {
                case COLUMN_DESCRIPTION:
                    {
                        Severity s1 = o1.getSeverity();
                        Severity s2 = o2.getSeverity();
                        if (s1 == s2) {
                            return scale * o1.getMessage().compareTo(o2.getMessage());
                        } else {
                            return scale * s1.compareTo(s2);
                        }
                    }
                case COLUMN_URL:
                    {
                        String u1 = o1.getHyperlink();
                        String u2 = o2.getHyperlink();
                        return u1 != null ? u1.compareTo(u2) : -1;
                    }
                case COLUMN_SOURCE:
                    return scale * getSourceObjectDescription(vcDocument, o1).compareTo(getSourceObjectDescription(vcDocument, o2));
                case COLUMN_PATH:
                    return scale * getSourceObjectPathDescription(vcDocument, o1).compareTo(getSourceObjectPathDescription(vcDocument, o2));
            }
            return 0;
        }
    };
}
Also used : Issue(org.vcell.util.Issue) VCDocument(org.vcell.util.document.VCDocument) Severity(org.vcell.util.Issue.Severity) Comparator(java.util.Comparator)

Example 3 with Severity

use of org.vcell.util.Issue.Severity 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)

Aggregations

Issue (org.vcell.util.Issue)3 Severity (org.vcell.util.Issue.Severity)3 VCDocumentDecorator (cbit.vcell.client.desktop.VCDocumentDecorator)1 SimpleBoundsIssue (cbit.vcell.model.SimpleBoundsIssue)1 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 IssueContext (org.vcell.util.IssueContext)1 VCDocument (org.vcell.util.document.VCDocument)1