Search in sources :

Example 1 with TableColumn

use of com.ramussoft.report.editor.xml.components.TableColumn in project ramus by Vitaliy-Yakovchuk.

the class XMLDiagram method paintXShow.

private void paintXShow(Graphics2D g, double tX, Bounds bounds) {
    TableColumn tableColumn = (TableColumn) getComponent(bounds);
    tableColumn.getTable().paintPin(g, tX, tableColumn, this);
}
Also used : TableColumn(com.ramussoft.report.editor.xml.components.TableColumn)

Example 2 with TableColumn

use of com.ramussoft.report.editor.xml.components.TableColumn 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 TableColumn

use of com.ramussoft.report.editor.xml.components.TableColumn 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 TableColumn

use of com.ramussoft.report.editor.xml.components.TableColumn 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)

Example 5 with TableColumn

use of com.ramussoft.report.editor.xml.components.TableColumn 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)

Aggregations

TableColumn (com.ramussoft.report.editor.xml.components.TableColumn)7 Table (com.ramussoft.report.editor.xml.components.Table)5 Bounds (com.ramussoft.reportgef.model.Bounds)4 QBounds (com.ramussoft.reportgef.model.QBounds)4 XMLComponent (com.ramussoft.report.editor.xml.components.XMLComponent)3 Component (com.ramussoft.reportgef.Component)3 GradientPaint (java.awt.GradientPaint)3 Point2D (java.awt.geom.Point2D)3 ArrayList (java.util.ArrayList)3 AccessRules (com.ramussoft.common.AccessRules)1 Engine (com.ramussoft.common.Engine)1 Label (com.ramussoft.report.editor.xml.components.Label)1 AbstractComponentFactory (com.ramussoft.reportgef.AbstractComponentFactory)1 Diagram (com.ramussoft.reportgef.gui.Diagram)1 Dimension2DImpl (com.ramussoft.reportgef.model.Dimension2DImpl)1