Search in sources :

Example 6 with QBounds

use of com.ramussoft.reportgef.model.QBounds in project ramus by Vitaliy-Yakovchuk.

the class TableColumn method paint.

@Override
public void paint(Graphics2D g, Bounds bounds, Diagram diagram) {
    QBounds qBounds = (QBounds) bounds;
    columnHeader.paint(g, createHeaderBounds(qBounds), diagram);
    g.translate(0, 35);
    columnBody.paint(g, createBodyBounds(qBounds), diagram);
    g.translate(0, -35);
    g.draw(new Line2D.Double(0, 0, 0, height));
}
Also used : QBounds(com.ramussoft.reportgef.model.QBounds) Line2D(java.awt.geom.Line2D)

Example 7 with QBounds

use of com.ramussoft.reportgef.model.QBounds in project ramus by Vitaliy-Yakovchuk.

the class TableColumn method createBodyBounds.

private Bounds createBodyBounds(QBounds mBounds) {
    QBounds bounds = new QBounds();
    Point2D p = mBounds.getLocation();
    bounds.setLocation(new Point2D.Double(p.getX(), p.getY() + 25));
    bounds.setBackground(columnBody.getDefaultBackground());
    bounds.setFont(columnBody.getDefaultFont());
    bounds.setFontColor(columnBody.getDefaultFontColor());
    bounds.setForeground(columnBody.getDefaultForeground());
    bounds.setSize(new Dimension2DImpl(mBounds.getSize().getWidth(), columnBody.getMinHeight()));
    return bounds;
}
Also used : Point2D(java.awt.geom.Point2D) QBounds(com.ramussoft.reportgef.model.QBounds) Dimension2DImpl(com.ramussoft.reportgef.model.Dimension2DImpl)

Example 8 with QBounds

use of com.ramussoft.reportgef.model.QBounds in project ramus by Vitaliy-Yakovchuk.

the class TableColumn method createHeaderBounds.

private Bounds createHeaderBounds(QBounds mBounds) {
    QBounds bounds = new QBounds();
    Point2D p = mBounds.getLocation();
    bounds.setLocation(new Point2D.Double(p.getX(), p.getY()));
    bounds.setBackground(columnHeader.getDefaultBackground());
    bounds.setFont(columnHeader.getDefaultFont());
    bounds.setFontColor(columnHeader.getDefaultFontColor());
    bounds.setForeground(columnHeader.getDefaultForeground());
    bounds.setSize(new Dimension2DImpl(mBounds.getSize().getWidth(), columnHeader.getMinHeight()));
    return bounds;
}
Also used : Point2D(java.awt.geom.Point2D) QBounds(com.ramussoft.reportgef.model.QBounds) Dimension2DImpl(com.ramussoft.reportgef.model.Dimension2DImpl)

Example 9 with QBounds

use of com.ramussoft.reportgef.model.QBounds in project ramus by Vitaliy-Yakovchuk.

the class GEFComponent method updateBounds.

public void updateBounds(Bounds[] bounds) {
    for (int i = 0; i < bounds.length; i++) {
        if (bounds[i] instanceof QBounds) {
            QBounds qBounds = (QBounds) bounds[i];
            Component component = diagram.getComponent(qBounds);
            double width = qBounds.getSize().getWidth();
            double height = qBounds.getSize().getHeight();
            if (!component.isResizeableX()) {
                width = component.getMinWidth();
            }
            if (!component.isResizeableY()) {
                height = component.getMinHeight();
            }
            qBounds.getSize().setSize(width, height);
        }
    }
}
Also used : Component(com.ramussoft.reportgef.Component) XMLComponent(com.ramussoft.report.editor.xml.components.XMLComponent) JComponent(javax.swing.JComponent) QBounds(com.ramussoft.reportgef.model.QBounds) Point(java.awt.Point)

Example 10 with QBounds

use of com.ramussoft.reportgef.model.QBounds in project ramus by Vitaliy-Yakovchuk.

the class XMLDiagram method getSize.

@Override
public Dimension2D getSize() {
    double height = top * 2;
    for (int i = 0; i < components.length; i++) {
        XMLComponent component = (XMLComponent) components[i];
        if (component.isY()) {
            height += ((QBounds) bounds[i]).getSize().getHeight();
        }
    }
    final Dimension2DImpl size = new Dimension2DImpl(width + LEFT * 2, height);
    if (!size.equals(this.size)) {
        this.size = size;
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                if (editor != null) {
                    editor.setPreferredSize(new Dimension((int) size.getWidth(), (int) size.getHeight()));
                    editor.revalidate();
                    editor.repaint();
                }
            }
        });
    }
    return size;
}
Also used : Dimension(java.awt.Dimension) QBounds(com.ramussoft.reportgef.model.QBounds) GradientPaint(java.awt.GradientPaint) XMLComponent(com.ramussoft.report.editor.xml.components.XMLComponent) Dimension2DImpl(com.ramussoft.reportgef.model.Dimension2DImpl)

Aggregations

QBounds (com.ramussoft.reportgef.model.QBounds)18 Point2D (java.awt.geom.Point2D)8 XMLComponent (com.ramussoft.report.editor.xml.components.XMLComponent)7 GradientPaint (java.awt.GradientPaint)7 Component (com.ramussoft.reportgef.Component)6 Bounds (com.ramussoft.reportgef.model.Bounds)6 Dimension2DImpl (com.ramussoft.reportgef.model.Dimension2DImpl)6 Table (com.ramussoft.report.editor.xml.components.Table)4 TableColumn (com.ramussoft.report.editor.xml.components.TableColumn)4 ArrayList (java.util.ArrayList)4 Dimension (java.awt.Dimension)2 Dimension2D (java.awt.geom.Dimension2D)2 Line2D (java.awt.geom.Line2D)2 ArrowBounds (com.ramussoft.reportgef.model.ArrowBounds)1 BasicStroke (java.awt.BasicStroke)1 Point (java.awt.Point)1 Stroke (java.awt.Stroke)1 JComponent (javax.swing.JComponent)1