Search in sources :

Example 1 with Label

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

the class ComponentLoader method startElement.

@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
    text = "";
    if (qName.equals("attribute")) {
        this.attributes = attributes;
    } else if (qName.equals("Table")) {
        currentTable = new Table();
        current = currentTable;
        yComponents.add(current);
        currentTableHeadColumn = 0;
        currentTableBodyColumn = 0;
    } else if (qName.equals("Label")) {
        current = new Label();
        yComponents.add(current);
    } else if (qName.equals("TitleElement")) {
        TableColumn[] columns = currentTable.getColumns();
        if (columns.length <= currentTableHeadColumn) {
            columns = Arrays.copyOf(columns, columns.length + 1);
            currentTable.setColumns(columns);
            TableColumn tableColumn = new TableColumn();
            tableColumn.setTable(currentTable);
            columns[columns.length - 1] = tableColumn;
        }
        currentTable.setColumns(columns);
        current = columns[currentTableHeadColumn].getColumnHeader();
        currentTableHeadColumn++;
    } else if (qName.equals("BodyElement")) {
        TableColumn[] columns = currentTable.getColumns();
        if (columns.length <= currentTableBodyColumn) {
            columns = Arrays.copyOf(columns, columns.length + 1);
            currentTable.setColumns(columns);
            TableColumn tableColumn = new TableColumn();
            tableColumn.setTable(currentTable);
            columns[columns.length - 1] = tableColumn;
        }
        currentTable.setColumns(columns);
        current = columns[currentTableBodyColumn].getColumnBody();
        currentTableBodyColumn++;
    }
}
Also used : Table(com.ramussoft.report.editor.xml.components.Table) Label(com.ramussoft.report.editor.xml.components.Label) TableColumn(com.ramussoft.report.editor.xml.components.TableColumn)

Example 2 with Label

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

Aggregations

Label (com.ramussoft.report.editor.xml.components.Label)2 AccessRules (com.ramussoft.common.AccessRules)1 Engine (com.ramussoft.common.Engine)1 Table (com.ramussoft.report.editor.xml.components.Table)1 TableColumn (com.ramussoft.report.editor.xml.components.TableColumn)1 AbstractComponentFactory (com.ramussoft.reportgef.AbstractComponentFactory)1 Diagram (com.ramussoft.reportgef.gui.Diagram)1 Bounds (com.ramussoft.reportgef.model.Bounds)1