Search in sources :

Example 6 with Bounds

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

the class XMLDiagram method paintGroup.

@Override
public void paintGroup(Graphics2D g, Group selection) {
    super.paintGroup(g, selection);
    Bounds[] bounds = selection.getBounds();
    g.setComposite(instance);
    if (bounds.length > 0) {
        Component component = getComponent(bounds[0]);
        try {
            if (((XMLComponent) component).isY())
                paintYShow(g, selection.getTranslate().getY(), bounds[0]);
            else
                paintXShow(g, selection.getTranslate().getX(), bounds[0]);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Also used : QBounds(com.ramussoft.reportgef.model.QBounds) Bounds(com.ramussoft.reportgef.model.Bounds) Component(com.ramussoft.reportgef.Component) XMLComponent(com.ramussoft.report.editor.xml.components.XMLComponent) SAXException(org.xml.sax.SAXException) XMLComponent(com.ramussoft.report.editor.xml.components.XMLComponent)

Example 7 with Bounds

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

the class XMLDiagram method loadFromYComponents.

public void loadFromYComponents(List<XMLComponent> yComponents) {
    List<Component> components = new ArrayList<Component>();
    List<Bounds> allBounds = new ArrayList<Bounds>();
    List<QBounds> yBounds = new ArrayList<QBounds>();
    double y = top;
    for (int i = 0; i < yComponents.size(); i++) {
        Component component = yComponents.get(i);
        ((XMLComponent) component).setWidth(width);
        QBounds bounds = new QBounds();
        bounds.setLocation(new Point2D.Double(LEFT, y));
        bounds.setComponentType(((XMLComponent) component).getTypeName());
        bounds.setPosition(allBounds.size());
        bounds.setBackground(component.getDefaultBackground());
        bounds.setFont(component.getDefaultFont());
        bounds.setFontColor(component.getDefaultFontColor());
        bounds.setForeground(component.getDefaultForeground());
        bounds.setSize(new Dimension2DImpl(component.getMinWidth(), component.getMinHeight()));
        components.add(component);
        yBounds.add(bounds);
        y += bounds.getSize().getHeight();
        allBounds.add(bounds);
        if (component instanceof Table) {
            Table table = (Table) component;
            TableColumn[] columns = table.getColumns();
            QBounds[] bounds2 = new QBounds[columns.length];
            for (int j = 0; j < columns.length; j++) {
                TableColumn column = columns[j];
                column.setWidth(width);
                QBounds cBounds = new QBounds();
                bounds2[j] = cBounds;
                cBounds.setComponentType(((XMLComponent) column).getTypeName());
                cBounds.setPosition(allBounds.size());
                cBounds.setBackground(column.getDefaultBackground());
                cBounds.setFont(column.getDefaultFont());
                cBounds.setFontColor(column.getDefaultFontColor());
                cBounds.setForeground(column.getDefaultForeground());
                cBounds.setSize(new Dimension2DImpl(column.getMinWidth(), column.getMinHeight()));
                components.add(column);
                allBounds.add(cBounds);
            }
            table.applyComlumnsSize(bounds, bounds2);
        }
    }
    this.components = components.toArray(new Component[components.size()]);
    this.bounds = new Bounds[allBounds.size()];
    for (int i = 0; i < this.bounds.length; i++) this.bounds[i] = allBounds.get(i);
    this.yBounds = new QBounds[yBounds.size()];
    for (int i = 0; i < this.yBounds.length; i++) this.yBounds[i] = yBounds.get(i);
}
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) 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) Dimension2DImpl(com.ramussoft.reportgef.model.Dimension2DImpl) Point2D(java.awt.geom.Point2D) Component(com.ramussoft.reportgef.Component) XMLComponent(com.ramussoft.report.editor.xml.components.XMLComponent)

Example 8 with Bounds

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

the class XMLDiagram method getYNumber.

private int getYNumber(double yPos) {
    int i = 0;
    double y = top;
    if (yPos < 0)
        return 0;
    for (Bounds bounds : this.yBounds) {
        if (bounds instanceof QBounds) {
            QBounds qBounds = (QBounds) bounds;
            double h = qBounds.getSize().getHeight();
            y += h;
            if (y - h / 2d > yPos)
                return i;
            i++;
        }
    }
    return i;
}
Also used : QBounds(com.ramussoft.reportgef.model.QBounds) Bounds(com.ramussoft.reportgef.model.Bounds) QBounds(com.ramussoft.reportgef.model.QBounds) GradientPaint(java.awt.GradientPaint)

Example 9 with Bounds

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

the class XMLComponentFramefork method createLabalComponentFactory.

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

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

        @Override
        public Component createComponent(Diagram diagram, Engine engine, AccessRules accessRules, Bounds bounds) {
            Label label = new Label();
            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) Label(com.ramussoft.report.editor.xml.components.Label) AccessRules(com.ramussoft.common.AccessRules) AbstractComponentFactory(com.ramussoft.reportgef.AbstractComponentFactory) Engine(com.ramussoft.common.Engine) Diagram(com.ramussoft.reportgef.gui.Diagram)

Example 10 with Bounds

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

the class XMLComponentFramefork method createTableComponentFactory.

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

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

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

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

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