Search in sources :

Example 1 with PIDEF0painter

use of com.ramussoft.pb.print.PIDEF0painter in project ramus by Vitaliy-Yakovchuk.

the class AbstractTemplate method createPainter.

private void createPainter(final Rectangle rectangle) {
    painter = new PIDEF0painter(base, rectangle.getSize(), dataPlugin);
    rect = rectangle;
    refresh = false;
}
Also used : PIDEF0painter(com.ramussoft.pb.print.PIDEF0painter)

Example 2 with PIDEF0painter

use of com.ramussoft.pb.print.PIDEF0painter in project ramus by Vitaliy-Yakovchuk.

the class HTMLHelper method getDiagramPicture.

public byte[] getDiagramPicture(final String id) {
    final Row r = dataPlugin.findRowByGlobalId(GlobalId.convert(id));
    if (r instanceof Function) {
        final Function f = (Function) r;
        final PIDEF0painter painter = new PIDEF0painter(f, new Dimension(IMAGE_WIDTH, IMAGE_HEIGHT), dataPlugin);
        final ByteArrayOutputStream stream = new ByteArrayOutputStream();
        try {
            painter.writeToStream(stream, PIDEF0painter.PNG_FORMAT);
        } catch (final IOException e) {
            e.printStackTrace();
        }
        return stream.toByteArray();
    }
    return new byte[] {};
}
Also used : Function(com.ramussoft.pb.Function) PIDEF0painter(com.ramussoft.pb.print.PIDEF0painter) Row(com.ramussoft.pb.Row) Dimension(java.awt.Dimension) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException)

Example 3 with PIDEF0painter

use of com.ramussoft.pb.print.PIDEF0painter in project ramus by Vitaliy-Yakovchuk.

the class HTTPParser method outFunctionModel.

private void outFunctionModel(final int format) throws IOException {
    Row row = loadRowById();
    if (row == null || !(row instanceof Function))
        return;
    row = replaceIDEF0Row(row);
    final Function f = (Function) row;
    int imageWidth = IMAGE_WIDTH;
    String s = (String) params.get("w");
    if (s != null) {
        try {
            imageWidth = new Integer(s).intValue();
            if (imageWidth > 2000)
                imageWidth = 2000;
        } catch (final Exception e) {
        }
    }
    int imageHeight = IMAGE_HEIGHT;
    s = (String) params.get("h");
    if (s != null) {
        try {
            imageHeight = new Integer(s).intValue();
            if (imageHeight > 1600)
                imageHeight = 1600;
        } catch (final Exception e) {
        }
    }
    final PIDEF0painter painter = new PIDEF0painter(f, new Dimension(imageWidth, imageHeight), dataPlugin);
    painter.writeToStream(stream, format);
}
Also used : Function(com.ramussoft.pb.Function) MovingFunction(com.ramussoft.pb.idef.visual.MovingFunction) PIDEF0painter(com.ramussoft.pb.print.PIDEF0painter) Row(com.ramussoft.pb.Row) NRow(com.ramussoft.pb.data.negine.NRow) Dimension(java.awt.Dimension) DataException(com.ramussoft.report.data.DataException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) SQLException(java.sql.SQLException) IOException(java.io.IOException)

Example 4 with PIDEF0painter

use of com.ramussoft.pb.print.PIDEF0painter in project ramus by Vitaliy-Yakovchuk.

the class ExportToImagesDialog method exportToFile.

protected void exportToFile(File dir, Function f, String prefix) throws FileNotFoundException, IOException {
    String size = null;
    switch(imageSizeComboBox.getSelectedIndex()) {
        case 0:
            size = "800x535";
            break;
        case 1:
            size = "905x700";
            break;
        case 2:
            size = "1024x768";
            break;
        case 3:
            size = "1152x864";
            break;
        case 4:
            size = "1300x1000";
            break;
        case 5:
            size = "1601x1200";
            break;
    }
    StringTokenizer st = new StringTokenizer(size, "x");
    int width = Integer.valueOf(st.nextToken());
    int height = Integer.valueOf(st.nextToken());
    PIDEF0painter painter = new PIDEF0painter(f, new Dimension(width, height), dataPlugin);
    File file = new File(dir, prefix + MovingFunction.getIDEF0Kod((com.ramussoft.database.common.Row) f) + imageTypeComboBox.getSelectedItem().toString());
    FileOutputStream stream = new FileOutputStream(file);
    painter.writeToStream(stream, imageTypeComboBox.getSelectedIndex());
    stream.close();
}
Also used : StringTokenizer(java.util.StringTokenizer) FileOutputStream(java.io.FileOutputStream) PIDEF0painter(com.ramussoft.pb.print.PIDEF0painter) Dimension(java.awt.Dimension) File(java.io.File)

Aggregations

PIDEF0painter (com.ramussoft.pb.print.PIDEF0painter)4 Dimension (java.awt.Dimension)3 Function (com.ramussoft.pb.Function)2 Row (com.ramussoft.pb.Row)2 IOException (java.io.IOException)2 NRow (com.ramussoft.pb.data.negine.NRow)1 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)1 DataException (com.ramussoft.report.data.DataException)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 SQLException (java.sql.SQLException)1 StringTokenizer (java.util.StringTokenizer)1