示例#1
0
 private void drawCounters(Graphics2D g2d) {
   if (visualConfig.isShowCounters()) {
     g2d.setFont(Consts.UI.SMALL_FONT);
     String index = "(" + planeIndex + "," + blockIndex + ")";
     String blockCounters = "v=" + block.getValidCounter() + ",e=" + block.getEraseCounter();
     String counters = index + " " + blockCounters + " " + block.getStatusName();
     g2d.setColor(block.getStatusColor());
     g2d.drawString(counters, spacing, spacing + blockHeight + 13);
   }
 }
示例#2
0
 private void drawBG(Graphics2D g2d) {
   Color bgColor = block.getBGColor();
   if (bgColor != null) {
     g2d.setColor(bgColor);
     g2d.fillRect(0, 0, dimension.width, dimension.height);
   }
 }
示例#3
0
 private void drawFrame(Graphics2D g2d, Block<?> block) {
   Color frameColor = block.getFrameColor();
   if (frameColor != null) {
     BasicStroke bs3 = new BasicStroke(5, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
     g2d.setStroke(bs3);
     g2d.setColor(frameColor);
     g2d.drawRect(spacing, spacing, blockWidth, blockHeight);
     bs3 = new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
     g2d.setStroke(bs3);
   }
 }
示例#4
0
  private void initSizesAndSpacing(Block<?> block, VisualConfig visualConfig) {
    pageWidth = visualConfig.getPageWidth();
    pageHeight = visualConfig.getPageHeight();
    pagesInRow = visualConfig.getPagesInRow();
    spacing = visualConfig.getBlockSpace();
    if (visualConfig.isShowCounters()) {
      verSpacing = VER_SPACING_WITH_COUNTERS;
    } else {
      verSpacing = spacing;
    }

    blockWidth = pageWidth * pagesInRow;
    blockHeight = pageHeight * ((block.getPagesNum() + pagesInRow - 1) / pagesInRow);

    dimension = new Dimension(blockWidth + 2 * spacing, blockHeight + spacing + verSpacing);
  }
示例#5
0
  private void doDrawing(Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    g2d.setFont(Consts.UI.FONT);

    drawBG(g2d);
    drawCounters(g2d);
    drawFrame(g2d, block);

    int x = spacing;
    int y = spacing;
    if (visualConfig.isShowCounters()) {
      g2d.setFont(Consts.UI.TINY_FONT);
    } else {
      g2d.setFont(Consts.UI.INVISIBLE_FONT);
    }
    int pageIndex = 0;
    for (Page page : block.getPages()) {
      drawPage(g2d, x, y, pageIndex++, page);
    }
  }