Search in sources :

Example 16 with Bounds

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

the class GEFComponent method mouseMoved.

public void mouseMoved(Point point) {
    synchronized (mouseLock) {
        if (mousePressedPosition != null)
            mouseDragPosition = point;
        Bounds bounds = getSelected(point);
        int cursorType;
        if (bounds == null)
            cursorType = Cursor.DEFAULT_CURSOR;
        else {
            cursorType = Cursor.MOVE_CURSOR;
        }
        if (selection.getBounds().length == 1) {
            boolean resizableX = selection.isResizeableX(diagram);
            boolean resizableY = selection.isResizeableY(diagram);
            if ((resizableX) && (isRightMove(point)))
                cursorType = Cursor.E_RESIZE_CURSOR;
            else if ((resizableX) && (isLeftMove(point)))
                cursorType = Cursor.W_RESIZE_CURSOR;
            else if ((resizableY) && (isTopMove(point)))
                cursorType = Cursor.N_RESIZE_CURSOR;
            else if ((resizableY) && (isBottomMove(point)))
                cursorType = Cursor.S_RESIZE_CURSOR;
            else if ((resizableY) && (resizableX) && (isRightBottomMove(point)))
                cursorType = Cursor.SE_RESIZE_CURSOR;
            else if ((resizableY) && (resizableX) && (isLeftBottomMove(point)))
                cursorType = Cursor.SW_RESIZE_CURSOR;
            else if ((resizableY) && (resizableX) && (isTopRightMove(point)))
                cursorType = Cursor.NE_RESIZE_CURSOR;
            else if ((resizableY) && (resizableX) && (isTopLeftMove(point)))
                cursorType = Cursor.NW_RESIZE_CURSOR;
        }
        if (this.cursorType != cursorType) {
            this.cursorType = cursorType;
            this.setCursor(new Cursor(cursorType));
        }
    }
    repaint();
}
Also used : QBounds(com.ramussoft.reportgef.model.QBounds) Bounds(com.ramussoft.reportgef.model.Bounds) Cursor(java.awt.Cursor) Point(java.awt.Point)

Example 17 with Bounds

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

the class Group method getRectangle.

public Rectangle2D getRectangle() {
    double minX = bounds[0].getLeft();
    double minY = bounds[0].getTop();
    double maxX = bounds[0].getRight();
    double maxY = bounds[0].getBottom();
    for (int i = 1; i < bounds.length; i++) {
        Bounds bounds = this.bounds[i];
        if (bounds.getLeft() < minX)
            minX = bounds.getLeft();
        if (bounds.getTop() < minY)
            minY = bounds.getTop();
        if (bounds.getRight() > maxX)
            maxX = bounds.getRight();
        if (bounds.getBottom() > maxY)
            maxY = bounds.getBottom();
    }
    return new Rectangle2D.Double(minX, minY, maxX - minX, maxY - minY);
}
Also used : QBounds(com.ramussoft.reportgef.model.QBounds) Bounds(com.ramussoft.reportgef.model.Bounds)

Example 18 with Bounds

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

the class Group method getCenter.

public Point2D getCenter() {
    if (center == null) {
        if (bounds.length == 0)
            center = new Point2D.Double();
        else {
            double minX = bounds[0].getLeft();
            double minY = bounds[0].getTop();
            double maxX = bounds[0].getRight();
            double maxY = bounds[0].getBottom();
            for (int i = 1; i < bounds.length; i++) {
                Bounds bounds = this.bounds[i];
                if (bounds.getLeft() < minX)
                    minX = bounds.getLeft();
                if (bounds.getTop() < minY)
                    minY = bounds.getTop();
                if (bounds.getRight() > maxX)
                    maxX = bounds.getRight();
                if (bounds.getBottom() > maxY)
                    maxY = bounds.getBottom();
            }
            center = new Point2D.Double((minX + maxX) / 2d, (minY + maxY) / 2);
        }
    }
    return center;
}
Also used : Point2D(java.awt.geom.Point2D) QBounds(com.ramussoft.reportgef.model.QBounds) Bounds(com.ramussoft.reportgef.model.Bounds)

Aggregations

Bounds (com.ramussoft.reportgef.model.Bounds)18 QBounds (com.ramussoft.reportgef.model.QBounds)14 Table (com.ramussoft.report.editor.xml.components.Table)5 Component (com.ramussoft.reportgef.Component)5 GradientPaint (java.awt.GradientPaint)5 Point2D (java.awt.geom.Point2D)5 ArrayList (java.util.ArrayList)5 TableColumn (com.ramussoft.report.editor.xml.components.TableColumn)4 XMLComponent (com.ramussoft.report.editor.xml.components.XMLComponent)4 AccessRules (com.ramussoft.common.AccessRules)3 Engine (com.ramussoft.common.Engine)3 AbstractComponentFactory (com.ramussoft.reportgef.AbstractComponentFactory)3 Diagram (com.ramussoft.reportgef.gui.Diagram)3 Point (java.awt.Point)3 Dimension2DImpl (com.ramussoft.reportgef.model.Dimension2DImpl)2 Label (com.ramussoft.report.editor.xml.components.Label)1 Cursor (java.awt.Cursor)1 Dimension2D (java.awt.geom.Dimension2D)1 SAXException (org.xml.sax.SAXException)1