Exemplo n.º 1
0
 private void warnOnCounterViolations(LayoutState ls) {
   Reporter reporter = context.getReporter();
   ls.finalizeCounters();
   int regions = ls.getCounter(LayoutState.Counter.REGIONS_IN_CANVAS);
   if ((maxRegions >= 0) && (regions > maxRegions))
     reporter.logWarning(
         reporter.message(
             "*KEY*",
             "Regions per canvas limit exceeded, {0} present, must not exceed {1}.",
             regions,
             maxRegions));
   int lines = ls.getCounter(LayoutState.Counter.LINES_IN_CANVAS);
   if ((maxLines >= 0) && (lines > maxLines))
     reporter.logWarning(
         reporter.message(
             "*KEY*",
             "Lines per canvas limit exceeded, {0} present, must not exceed {1}.",
             lines,
             maxLines));
   int linesPerRegion = ls.getCounter(LayoutState.Counter.MAX_LINES_IN_REGION);
   if ((maxLinesPerRegion >= 0) && (linesPerRegion > maxLinesPerRegion))
     reporter.logWarning(
         reporter.message(
             "*KEY*",
             "Lines per region limit exceeded, {0} present, must not exceed {1}.",
             linesPerRegion,
             maxLinesPerRegion));
   int chars = ls.getCounter(LayoutState.Counter.CHARS_IN_CANVAS);
   if ((maxChars >= 0) && (chars > maxChars))
     reporter.logWarning(
         reporter.message(
             "*KEY*",
             "Characters per canvas limit exceeded, {0} present, must not exceed {1}.",
             chars,
             maxChars));
   int charsPerRegion = ls.getCounter(LayoutState.Counter.MAX_CHARS_IN_REGION);
   if ((maxCharsPerRegion >= 0) && (charsPerRegion > maxCharsPerRegion))
     reporter.logWarning(
         reporter.message(
             "*KEY*",
             "Characters per region limit exceeded, {0} present, must not exceed {1}.",
             charsPerRegion,
             maxCharsPerRegion));
   int charsPerLine = ls.getCounter(LayoutState.Counter.MAX_CHARS_IN_LINE);
   if ((maxCharsPerLine >= 0) && (charsPerLine > maxCharsPerLine))
     reporter.logWarning(
         reporter.message(
             "*KEY*",
             "Characters per line limit exceeded, {0} present, must not exceed {1}.",
             charsPerLine,
             maxCharsPerLine));
 }