Java 类net.sf.jasperreports.engine.export.draw.Offset 实例源码

项目:jasperreports    文件:HtmlElementGraphics2DHandler.java   
@Override
public void exportElement(JRGraphics2DExporterContext exporterContext, JRGenericPrintElement element, Graphics2D grx, Offset offset) {
    HtmlPrintElement htmlPrintElement;
    try {
        htmlPrintElement = HtmlPrintElementUtils.getHtmlPrintElement();

        JRGraphics2DExporter exporter = (JRGraphics2DExporter)exporterContext.getExporterRef();
        ImageDrawer imageDrawer = exporter.getDrawVisitor().getImageDrawer();

        imageDrawer.draw(
                grx,
                htmlPrintElement.createImageFromElement(element), 
                offset.getX(), 
                offset.getY()
                );

    } catch (JRException e) {
        throw new RuntimeException(e);
    }

}
项目:jasperreports    文件:MapElementGraphics2DHandler.java   
@Override
public void exportElement(
        JRGraphics2DExporterContext exporterContext, 
        JRGenericPrintElement element, 
        Graphics2D grx, 
        Offset offset)
{
    try
    {
        JRGraphics2DExporter exporter = (JRGraphics2DExporter)exporterContext.getExporterRef();
        ImageDrawer imageDrawer = exporter.getDrawVisitor().getImageDrawer();

        imageDrawer.draw(
                grx,
                MapElementImageProvider.getImage(exporterContext.getJasperReportsContext(), element), 
                offset.getX(), 
                offset.getY()
                );
    }
    catch (Exception e)
    {
        throw new RuntimeException(e);
    }
}
项目:jasperreports-wms-component    文件:WmsMapElementGraphics2DHandler.java   
@Override
public void exportElement(JRGraphics2DExporterContext context,
    JRGenericPrintElement element, Graphics2D grx, Offset offset) {
  try {
    JRGraphics2DExporter exporter = (JRGraphics2DExporter) context
        .getExporter();
    ImageDrawer imageDrawer = exporter.getFrameDrawer().getDrawVisitor()
        .getImageDrawer();
    JRPrintImage image = getImage(context.getJasperReportsContext(), element);
    imageDrawer.draw(grx, image, offset.getX(), offset.getY());
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
项目:jasperreports-wms-component    文件:WmsMapElementGraphics2DHandlerTest.java   
@Ignore
@Test
public void testExportElement() throws JRException {
  JRGraphics2DExporter exporter = new JRGraphics2DExporter();
  JRGraphics2DExporterContext context = mock(JRGraphics2DExporterContext.class);
  when(context.getExporter()).thenReturn(exporter);
  JRGenericPrintElement element = mock(JRGenericPrintElement.class);
  java.awt.Container container = new Container();
  Graphics2D graphics = (Graphics2D) container.getGraphics();
  Offset offset = new Offset(0, 0);
  handler.exportElement(context, element, graphics, offset);
}
项目:jasperreports    文件:IconLabelElementGraphics2DHandler.java   
@Override
public void exportElement(
        JRGraphics2DExporterContext exporterContext, 
        JRGenericPrintElement element, 
        Graphics2D grx, 
        Offset offset)
{
    try
    {
        JRPrintText labelPrintText = (JRPrintText)element.getParameterValue(IconLabelElement.PARAMETER_LABEL_TEXT_ELEMENT);
        if (labelPrintText == null) //FIXMEINPUT deal with xml serialization
        {
            return;
        }

        JRBasePrintFrame frame = new JRBasePrintFrame(element.getDefaultStyleProvider());
        frame.setX(element.getX());
        frame.setY(element.getY());
        frame.setWidth(element.getWidth());
        frame.setHeight(element.getHeight());
        frame.setStyle(element.getStyle());
        frame.setBackcolor(element.getBackcolor());
        frame.setForecolor(element.getForecolor());
        frame.setMode(element.getModeValue());
        JRLineBox lineBox = (JRLineBox)element.getParameterValue(IconLabelElement.PARAMETER_LINE_BOX);
        if (lineBox != null)
        {
            frame.copyBox(lineBox);
        }

        frame.addElement(labelPrintText);

        JRPrintText iconPrintText = (JRPrintText)element.getParameterValue(IconLabelElement.PARAMETER_ICON_TEXT_ELEMENT);
        if (iconPrintText != null) //FIXMEINPUT deal with xml serialization
        {
            frame.addElement(iconPrintText);
        }

        JRGraphics2DExporter exporter = (JRGraphics2DExporter)exporterContext.getExporterRef();

        FrameDrawer frameDrawer = exporter.getDrawVisitor().getFrameDrawer();
        frameDrawer.draw(
            grx, 
            frame, 
            offset.getX(), 
            offset.getY()
            );
    }
    catch (Exception e)
    {
        throw new RuntimeException(e);
    }
}
项目:PDFReporter-Studio    文件:JSSDrawVisitor.java   
public static Offset elementOffset(JRElement element) {
    return new Offset(-element.getX(), -element.getY());
}
项目:jasperreports    文件:GenericElementGraphics2DHandler.java   
/**
 * Exports a generic element.
 * 
 * @param grx the graphic context
 * @param element the generic element to export
 */
//FIXME grx and maybe offset could have been passed as part of the context
void exportElement(JRGraphics2DExporterContext context, JRGenericPrintElement element, Graphics2D grx, Offset offset);