Search in sources :

Example 11 with Bounds

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

the class XMLComponentFramefork method createTableColumnFactory.

private ComponentFactory createTableColumnFactory() {
    return new AbstractComponentFactory() {

        @Override
        public String getType() {
            return "TableColumn";
        }

        @Override
        public Component createComponent(Diagram diagram, Engine engine, AccessRules accessRules, Bounds bounds) {
            TableColumn label = new TableColumn();
            label.setWidth(((XMLDiagram) diagram).getWidthForCompontns());
            return label;
        }

        @Override
        public Component getComponent(Engine engine, AccessRules accessRules, Bounds bounds) {
            return null;
        }
    };
}
Also used : Bounds(com.ramussoft.reportgef.model.Bounds) AccessRules(com.ramussoft.common.AccessRules) AbstractComponentFactory(com.ramussoft.reportgef.AbstractComponentFactory) TableColumn(com.ramussoft.report.editor.xml.components.TableColumn) Engine(com.ramussoft.common.Engine) Diagram(com.ramussoft.reportgef.gui.Diagram)

Example 12 with Bounds

use of com.ramussoft.reportgef.model.Bounds 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)

Example 13 with Bounds

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

the class GEFComponent method mousePressed.

@Override
public void mousePressed(MouseEvent e) {
    if (e.getButton() == MouseEvent.BUTTON1) {
        Bounds[] bounds = selection.getBounds();
        mousePressed(translateMouseEvent(e));
        if (e.isControlDown()) {
            Bounds[] bounds2 = selection.getBounds();
            if (!Arrays.equals(bounds, bounds2)) {
                Bounds[] bounds3 = Arrays.copyOf(bounds, bounds.length + bounds2.length);
                for (int i = 0; i < bounds2.length; i++) {
                    bounds3[i + bounds.length] = bounds2[i];
                }
                selection.setBounds(bounds3);
                selectionChanged();
            }
        }
    }
}
Also used : QBounds(com.ramussoft.reportgef.model.QBounds) Bounds(com.ramussoft.reportgef.model.Bounds) Point(java.awt.Point)

Example 14 with Bounds

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

the class GEFComponent method getSelected.

private Bounds getSelected(Point point) {
    Bounds[] bounds = diagram.getBounds();
    double x = untranslate(point.getX());
    double y = untranslate(point.getY());
    Bounds bounds3 = null;
    for (int i = bounds.length - 1; i >= 0; i--) {
        Bounds bounds2 = bounds[i];
        if ((bounds2.getLeft() < x) && (bounds2.getTop() < y) && (bounds2.getRight() > x) && (bounds2.getBottom() > y)) {
            bounds3 = bounds2;
            break;
        }
    }
    return bounds3;
}
Also used : QBounds(com.ramussoft.reportgef.model.QBounds) Bounds(com.ramussoft.reportgef.model.Bounds) Point(java.awt.Point)

Example 15 with Bounds

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

the class GEFComponent method mousePressed.

public void mousePressed(Point point) {
    synchronized (mouseLock) {
        mousePressedPosition = point;
        mouseDragPosition = mousePressedPosition;
        mouseDragged = false;
        Bounds bounds = getSelected(point);
        setDragSides(point);
        drag = false;
        if (bounds == null) {
            if (selection.getBounds().length > 0) {
                if (dragSides.size() == 0) {
                    selection.setBounds(new Bounds[] {});
                    selectionChanged();
                }
            }
        } else {
            boolean selected = false;
            for (Bounds bounds2 : selection.getBounds()) {
                if (bounds2.equals(bounds))
                    selected = true;
            }
            if (!selected) {
                selection.setBounds(new Bounds[] { bounds });
            }
            selectionChanged();
        }
    }
}
Also used : 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