Search in sources :

Example 1 with Bounds

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

the class ReportEditor method setActionsEnability.

private void setActionsEnability() {
    Bounds[] bounds = getSelection().getBounds();
    if (bounds.length > 0) {
        if ((xmlDiagram.getComponent(bounds[0]) instanceof Table)) {
            Table table = (Table) xmlDiagram.getComponent(bounds[0]);
            addTableColumnAction.setEnabled(table.getColumns().length < 20);
        } else
            addTableColumnAction.setEnabled(false);
        removeComponentAction.setEnabled(true);
    }
}
Also used : Table(com.ramussoft.report.editor.xml.components.Table) Bounds(com.ramussoft.reportgef.model.Bounds)

Example 2 with Bounds

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

the class XMLDiagram method removeSelectedComponents.

public void removeSelectedComponents() {
    Bounds[] bounds = editor.getSelection().getBounds();
    List<Integer> list = new ArrayList<Integer>();
    for (Bounds bounds2 : bounds) {
        int index = getIndexOfBounds(bounds2);
        list.add(index);
        Component component = components[index];
        if (component instanceof Table) {
            for (TableColumn column : ((Table) component).getColumns()) {
                list.add(getIndexOfComponent(column));
            }
        }
    }
    List<Bounds> bounds2 = new ArrayList<Bounds>();
    List<QBounds> yBounds = new ArrayList<QBounds>();
    List<Component> components = new ArrayList<Component>();
    for (int i = 0; i < this.components.length; i++) {
        if (list.indexOf(i) < 0) {
            bounds2.add(this.bounds[i]);
            components.add(this.components[i]);
        }
    }
    this.bounds = bounds2.toArray(new Bounds[bounds2.size()]);
    this.components = components.toArray(new Component[components.size()]);
    for (QBounds qBounds : this.yBounds) {
        if (bounds2.indexOf(qBounds) >= 0) {
            yBounds.add(qBounds);
        }
    }
    this.yBounds = yBounds.toArray(new QBounds[yBounds.size()]);
    editor.getSelection().setBounds(new Bounds[] {});
    double y = top;
    for (int i = 0; i < this.components.length; i++) {
        if (((XMLComponent) this.components[i]).isY()) {
            QBounds e = (QBounds) this.bounds[i];
            e.setLocation(new Point2D.Double(e.getLocation().getX(), y));
            yBounds.add(e);
            y += e.getSize().getHeight();
            if (this.components[i] instanceof Table) {
                Table table = (Table) this.components[i];
                table.removeComlumntIfNeed(components, this);
            }
        }
    }
}
Also used : Table(com.ramussoft.report.editor.xml.components.Table) QBounds(com.ramussoft.reportgef.model.QBounds) Bounds(com.ramussoft.reportgef.model.Bounds) ArrayList(java.util.ArrayList) TableColumn(com.ramussoft.report.editor.xml.components.TableColumn) QBounds(com.ramussoft.reportgef.model.QBounds) GradientPaint(java.awt.GradientPaint) XMLComponent(com.ramussoft.report.editor.xml.components.XMLComponent) Point2D(java.awt.geom.Point2D) Component(com.ramussoft.reportgef.Component) XMLComponent(com.ramussoft.report.editor.xml.components.XMLComponent)

Example 3 with Bounds

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

the class Group method applyTransforms.

public void applyTransforms() {
    double scaleX = getScaleX();
    double scaleY = getScaleY();
    for (Bounds bounds : this.bounds) {
        if (bounds instanceof QBounds) {
            QBounds qBounds = (QBounds) bounds;
            Point2D point = qBounds.getLocation();
            qBounds.setLocation(new Point2D.Double(point.getX() + translate.getX(), point.getY() + translate.getY()));
            Dimension2D d = qBounds.getSize();
            qBounds.setSize(new Dimension2DImpl(d.getWidth() * scaleX, d.getHeight() * scaleY));
        }
    }
    clear();
}
Also used : Point2D(java.awt.geom.Point2D) QBounds(com.ramussoft.reportgef.model.QBounds) Bounds(com.ramussoft.reportgef.model.Bounds) Dimension2D(java.awt.geom.Dimension2D) QBounds(com.ramussoft.reportgef.model.QBounds) Dimension2DImpl(com.ramussoft.reportgef.model.Dimension2DImpl)

Example 4 with Bounds

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

the class GEFComponent method getBoundsInRectangle.

private Bounds[] getBoundsInRectangle(Rectangle rectangle) {
    List<Bounds> list = new ArrayList<Bounds>();
    double maxX = untranslate(rectangle.getMaxX());
    double minX = untranslate(rectangle.getMinX());
    double maxY = untranslate(rectangle.getMaxY());
    double minY = untranslate(rectangle.getMinY());
    for (Bounds bounds : diagram.getBounds()) {
        if ((bounds.getLeft() <= maxX) && (bounds.getLeft() >= minX) && (bounds.getRight() <= maxX) && (bounds.getRight() >= minX)) {
            if ((bounds.getTop() <= maxY) && (bounds.getTop() >= minY) && (bounds.getBottom() <= maxY) && (bounds.getBottom() >= minY)) {
                list.add(bounds);
            }
        }
    }
    return list.toArray(new Bounds[list.size()]);
}
Also used : QBounds(com.ramussoft.reportgef.model.QBounds) Bounds(com.ramussoft.reportgef.model.Bounds) ArrayList(java.util.ArrayList)

Example 5 with Bounds

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

the class XMLDiagram method applyTransformForGroup.

public void applyTransformForGroup(Group group) {
    QBounds bounds = (QBounds) group.getBounds()[0];
    XMLComponent component = (XMLComponent) getComponent(bounds);
    if (component.isY()) {
        double yPos = bounds.getTop() + group.getTranslate().getY();
        int cNumber;
        for (cNumber = 0; cNumber < this.yBounds.length; cNumber++) {
            if (this.yBounds[cNumber].equals(bounds))
                break;
        }
        int number = getYNumber(yPos);
        if (number >= 0) {
            if ((number != cNumber) && (number != cNumber + 1)) {
                List<QBounds> list = new ArrayList<QBounds>();
                List<QBounds> seleted = new ArrayList<QBounds>();
                for (Bounds b : group.getBounds()) {
                    XMLComponent component2 = (XMLComponent) getComponent(b);
                    if (component2.isY())
                        seleted.add((QBounds) b);
                }
                int newPos = -1;
                int i = 0;
                for (QBounds q : yBounds) {
                    if (seleted.indexOf(q) < 0) {
                        if (i == number)
                            newPos = list.size();
                        list.add(q);
                    }
                    i++;
                }
                if (newPos < 0)
                    newPos = list.size();
                for (Bounds b : seleted) {
                    list.add(newPos, (QBounds) b);
                    newPos++;
                }
                this.yBounds = list.toArray(new QBounds[list.size()]);
                double y = top;
                for (QBounds b : yBounds) {
                    b.setLocation(new Point2D.Double(LEFT, y));
                    Component component2 = getComponent(b);
                    if (component2 instanceof Table)
                        ((Table) component2).applyComlumnsSize(b, this);
                    y += b.getSize().getHeight();
                }
            }
        }
    } else {
        if (component instanceof TableColumn) {
            Table table = ((TableColumn) component).getTable();
            table.applyTransformForGroup(group, this);
        }
    }
    editor.postChanged();
}
Also used : Table(com.ramussoft.report.editor.xml.components.Table) Point2D(java.awt.geom.Point2D) QBounds(com.ramussoft.reportgef.model.QBounds) Bounds(com.ramussoft.reportgef.model.Bounds) ArrayList(java.util.ArrayList) Component(com.ramussoft.reportgef.Component) XMLComponent(com.ramussoft.report.editor.xml.components.XMLComponent) QBounds(com.ramussoft.reportgef.model.QBounds) TableColumn(com.ramussoft.report.editor.xml.components.TableColumn) GradientPaint(java.awt.GradientPaint) XMLComponent(com.ramussoft.report.editor.xml.components.XMLComponent)

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