RtcPlanItemCheckerPopupComponent(RtcPlanItemChecker[] checkers) { super(); RtcPlanItem planItem = null; RtcPlanItemProblem.RtcSeverity maxSeverity = null; String tip = ""; for (RtcPlanItemChecker ch : checkers) { for (RtcPlanItemProblem p : ch.getProblems()) { if (planItem != null && maxSeverity != null) { if (RtcPlanItemCheckerUtilities.compareSeverities(maxSeverity, p.getSeverity()) > 0) { planItem = p.getPlanItem(); maxSeverity = p.getSeverity(); } } else { planItem = p.getPlanItem(); maxSeverity = p.getSeverity(); } tip += "<p>" + p.getMessage() + "</p>"; } } if (planItem != null) { setIcon(getIconFor(planItem, checkers)); } else { setIcon(null); } setToolTipText("<html>" + tip + "</html>"); }
private static ImageIcon getIconFor(RtcPlanItem planItem, RtcPlanItemChecker[] checkers) { RtcPlanItemProblem.RtcSeverity max = RtcPlanItemCheckerUtilities.getHighestPlanItemProblemSeverity(planItem, checkers); switch (max) { case FATAL_ERROR: case ERROR: return ImageUtilities.loadImageIcon( "pl/edu/amu/wmi/kino/rtc/client/plans/editor/checker/resources/checkError.gif", false); case WARNING: return ImageUtilities.loadImageIcon( "pl/edu/amu/wmi/kino/rtc/client/plans/editor/checker/resources/checkWarning.gif", false); case NONE: case INFO: default: return null; } }