Search in sources :

Example 16 with QBounds

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

the class Table method applyComlumnsSize.

public void applyComlumnsSize(QBounds tableBound, Diagram diagram) {
    double width = getMinWidth();
    double w = width / columns.length;
    double x = tableBound.getLocation().getX();
    for (TableColumn tableColumn : columns) {
        QBounds bounds = (QBounds) diagram.getBounds(tableColumn);
        Dimension2D size = bounds.getSize();
        size.setSize(w, size.getHeight());
        bounds.setLocation(new Point2D.Double(x, getColumnYLocation(tableBound, size)));
        tableColumn.setWidth(w);
        x += w;
    }
}
Also used : Point2D(java.awt.geom.Point2D) Dimension2D(java.awt.geom.Dimension2D) QBounds(com.ramussoft.reportgef.model.QBounds)

Example 17 with QBounds

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

the class Table method getNewIndex.

private int getNewIndex(double tX, TableColumn tableColumn, Diagram diagram) {
    QBounds qBounds = (QBounds) diagram.getBounds(tableColumn);
    double width = getMinWidth();
    double w = width / columns.length;
    double x = qBounds.getLocation().getX() - XMLDiagram.LEFT + tX;
    double index;
    for (index = 0; index < columns.length; index++) {
        if (w * index > x) {
            int i = (int) index;
            if (columns[i].equals(tableColumn))
                return -1;
            if ((i > 0) && (columns[i - 1].equals(tableColumn))) {
                return -1;
            }
            return i;
        }
    }
    int i = (int) index;
    if (i < columns.length)
        if (columns[i].equals(tableColumn))
            return -1;
    if ((i > 0) && (columns[i - 1].equals(tableColumn))) {
        return -1;
    }
    return i;
}
Also used : QBounds(com.ramussoft.reportgef.model.QBounds) GradientPaint(java.awt.GradientPaint)

Example 18 with QBounds

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

the class Table method applyTransformForGroup.

public void applyTransformForGroup(Group group, Diagram diagram) {
    List<TableColumn> list = new ArrayList<TableColumn>();
    for (Bounds bounds : group.getBounds()) {
        Component component = diagram.getComponent(bounds);
        if ((component instanceof TableColumn) && (((TableColumn) component).getTable().equals(this)))
            list.add((TableColumn) component);
    }
    if (list.size() <= 0)
        return;
    int index = getNewIndex(group.getTranslate().getX(), list.get(0), diagram);
    if (index < 0)
        return;
    int realIndex = -1;
    List<TableColumn> columns = new ArrayList<TableColumn>();
    for (int i = 0; i < this.columns.length; i++) {
        TableColumn column = this.columns[i];
        if (list.indexOf(column) < 0) {
            if (i == index)
                realIndex = columns.size();
            columns.add(column);
        }
    }
    if (realIndex < 0)
        realIndex = columns.size();
    for (TableColumn column : list) {
        columns.add(realIndex, column);
        realIndex++;
    }
    this.columns = columns.toArray(new TableColumn[columns.size()]);
    applyComlumnsSize((QBounds) diagram.getBounds(this), diagram);
}
Also used : QBounds(com.ramussoft.reportgef.model.QBounds) Bounds(com.ramussoft.reportgef.model.Bounds) ArrayList(java.util.ArrayList) Component(com.ramussoft.reportgef.Component) GradientPaint(java.awt.GradientPaint)

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