org.eadge.extractpdfexcel.debug.display.JPanelLane Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pdf-to-excel Show documentation
Show all versions of pdf-to-excel Show documentation
A Java library used to convert PDF to Excel.
The newest version!
package org.eadge.extractpdfexcel.debug.display;
import org.eadge.extractpdfexcel.data.block.Block;
import org.eadge.extractpdfexcel.data.lane.Lane;
import org.eadge.extractpdfexcel.data.lane.Lanes;
import java.awt.*;
import java.util.Collection;
/**
* Created by eadgyo on 22/07/16.
*
* Display lanes bounds
*/
public class JPanelLane extends JResizedPanelPdf
{
private Lanes lanes = null;
private boolean drawBlocks;
public JPanelLane(double pdfWidth, double pdfHeight, boolean drawBlocks)
{
super(pdfWidth, pdfHeight);
this.drawBlocks = drawBlocks;
}
public void setLanes(Lanes lanes)
{
this.lanes = lanes;
}
@Override
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
assert (lanes != null);
Graphics2D g2d = (Graphics2D) g;
Collection lanes = this.lanes.getLanes();
g.setColor(Color.GRAY);
// Draw each lane
for (Lane lane : lanes)
{
DisplayTools.drawRect(g2d, lane.getBound());
if (drawBlocks)
{
// Display block text content
Collection blocksCollection = lane.getBlocksCollection();
for (Block block : blocksCollection)
{
DisplayTools.drawBlock(g2d, block);
DisplayTools.drawBlockText(g2d, block);
}
}
}
}
}