Search in sources :

Example 1 with QBounds

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

the class XMLDiagram method createNewBounds.

public QBounds createNewBounds(String componentName) {
    QBounds bounds = new QBounds();
    double y = top;
    for (QBounds bounds2 : this.yBounds) {
        y += bounds2.getSize().getHeight();
    }
    bounds.setLocation(new Point2D.Double(LEFT, y));
    bounds.setComponentType(componentName);
    bounds.setPosition(this.bounds.length);
    Component component = framework.createComponent(this, bounds);
    bounds.setBackground(component.getDefaultBackground());
    bounds.setFont(component.getDefaultFont());
    bounds.setFontColor(component.getDefaultFontColor());
    bounds.setForeground(component.getDefaultForeground());
    bounds.setSize(new Dimension2DImpl(component.getMinWidth(), component.getMinHeight()));
    add(bounds, component);
    return new QBounds();
}
Also used : Point2D(java.awt.geom.Point2D) Component(com.ramussoft.reportgef.Component) XMLComponent(com.ramussoft.report.editor.xml.components.XMLComponent) QBounds(com.ramussoft.reportgef.model.QBounds) Dimension2DImpl(com.ramussoft.reportgef.model.Dimension2DImpl)

Example 2 with QBounds

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

the class XMLDiagram method createTableColumn.

public void createTableColumn() {
    Table table = getSelectedTable();
    if (table != null) {
        QBounds tableBound = (QBounds) getBounds(table);
        createNewBounds("TableColumn");
        TableColumn column = (TableColumn) components[components.length - 1];
        column.setTable(table);
        table.addColumn(tableBound, this, column);
    }
}
Also used : Table(com.ramussoft.report.editor.xml.components.Table) QBounds(com.ramussoft.reportgef.model.QBounds) TableColumn(com.ramussoft.report.editor.xml.components.TableColumn)

Example 3 with QBounds

use of com.ramussoft.reportgef.model.QBounds 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 4 with QBounds

use of com.ramussoft.reportgef.model.QBounds 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 5 with QBounds

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

the class BoundsCloner method copy.

public static Bounds copy(Bounds bounds) {
    if (bounds instanceof QBounds) {
        QBounds qBounds = (QBounds) bounds;
        QBounds bounds2 = new QBounds();
        bounds2.setBackground(copy(qBounds.getBackground()));
        bounds2.setComponentType(qBounds.getComponentType());
        bounds2.setElementId(qBounds.getElementId());
        bounds2.setFont(qBounds.getFont());
        bounds2.setFontColor(qBounds.getFontColor());
        bounds2.setForeground(copy(qBounds.getForeground()));
        bounds2.setLinkElementId(qBounds.getLinkElementId());
        bounds2.setLocation(qBounds.getLocation());
        bounds2.setPosition(qBounds.getPosition());
        bounds2.setRotation(qBounds.getRotation());
        bounds2.setSize(qBounds.getSize());
        return bounds2;
    } else {
        ArrowBounds arrowBounds = (ArrowBounds) bounds;
        ArrowBounds bounds2 = new ArrowBounds();
        bounds2.setComponentType(arrowBounds.getComponentType());
        bounds2.setElementId(arrowBounds.getElementId());
        bounds2.setFont(arrowBounds.getFont());
        bounds2.setFontColor(arrowBounds.getFontColor());
        bounds2.setForeground(copy(arrowBounds.getForeground()));
        bounds2.setLinkElementId(arrowBounds.getLinkElementId());
        bounds2.setPosition(arrowBounds.getPosition());
        bounds2.setFromBounds(arrowBounds.getFromBounds());
        bounds2.setPoints(copy(arrowBounds.getPoints()));
        bounds2.setToBounds(arrowBounds.getToBounds());
        bounds2.setFromPreferences(arrowBounds.getFromPreferences());
        bounds2.setToPreferences(arrowBounds.getToPreferences());
        return bounds2;
    }
}
Also used : ArrowBounds(com.ramussoft.reportgef.model.ArrowBounds) QBounds(com.ramussoft.reportgef.model.QBounds)

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