| /** |
| * |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| */ |
| package org.eclipse.osbp.xtext.reportdsl.common.item; |
| |
| import java.util.ArrayList; |
| |
| import org.eclipse.birt.report.model.api.DataSetHandle; |
| import org.eclipse.birt.report.model.api.activity.SemanticException; |
| import org.eclipse.birt.report.model.api.elements.structures.ComputedColumn; |
| |
| import org.eclipse.osbp.xtext.reportdsl.DatamartTableGroup; |
| import org.eclipse.osbp.xtext.reportdsl.DatamartTableProperty; |
| import org.eclipse.osbp.xtext.reportdsl.Style; |
| import org.eclipse.osbp.xtext.reportdsl.WithHeaderFooter; |
| import org.eclipse.osbp.xtext.reportdsl.common.attribute.Attribute; |
| import org.eclipse.osbp.xtext.reportdsl.common.attribute.StyleName; |
| import org.eclipse.osbp.xtext.reportdsl.common.attribute.TextAlign; |
| import org.eclipse.osbp.xtext.reportdsl.common.attribute.TextAlign.Align; |
| import org.eclipse.osbp.xtext.reportdsl.common.attribute.Width; |
| import org.eclipse.osbp.xtext.reportdsl.jvmmodel.ReportGeneratorWorkSet; |
| |
| public abstract class ContainerItem extends AContainerItem { |
| |
| public ContainerItem(ReportGeneratorWorkSet workset) { |
| super(workset); |
| } |
| |
| public void addHeader(int level, String i18nKey, String title, Style style) throws SemanticException { |
| add( |
| new TextItem(fWorkset, i18nKey, "<h"+level+">"+title+"</h"+level+">", BaseItem.CONTENT_TYPE_HTML), |
| style, |
| new Width("100%"), |
| new TextAlign(Align.center), |
| new StyleName("h"+level) |
| ); |
| } |
| |
| public void addLabel(String i18nKey, String text, Style style) throws SemanticException { |
| add( |
| new LabelItem(fWorkset, i18nKey, text), |
| style |
| ); |
| } |
| |
| public void addText(String i18nKey, String text, Style style) throws SemanticException { |
| add( |
| new TextItem(fWorkset, i18nKey, text, BaseItem.CONTENT_TYPE_PLAIN), |
| style |
| ); |
| } |
| |
| public void addAutoText(String type, Style style) throws SemanticException { |
| add( |
| new AutoTextItem(fWorkset, type), |
| style |
| ); |
| } |
| |
| public TableItem createTable() { |
| return new TableItem(fWorkset); |
| } |
| |
| public TableItem createTable(int columns) { |
| return new TableItem(fWorkset, columns); |
| } |
| |
| public void addTable(DataSetHandle dataSet, WithHeaderFooter withHeaderFooter, ArrayList<ComputedColumn> boundColumns, DatamartTableGroup[] groups, Style propertiesStyle, DatamartTableProperty[] tableProperties, Style style, Attribute[] attributes) throws SemanticException { |
| add( |
| new TableItem(fWorkset, dataSet, withHeaderFooter, boundColumns, groups, propertiesStyle, tableProperties), |
| style, |
| attributes |
| ); |
| } |
| |
| public void addData(DatamartTableProperty tableProperty, Style style) throws SemanticException { |
| add( |
| new DataItem(fWorkset, tableProperty), |
| style |
| ); |
| } |
| } |