blob: 43bd6e639b0537b48e289043fcb934627e3eeaf1 [file] [log] [blame]
/**
*
* 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.List;
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.datamartdsl.DatamartAttribute;
import org.eclipse.osbp.xtext.datamartdsl.DatamartDefinition;
import org.eclipse.osbp.xtext.reportdsl.DatamartTableAttribute;
import org.eclipse.osbp.xtext.reportdsl.DatamartTableGroup;
import org.eclipse.osbp.xtext.reportdsl.StringBinder;
import org.eclipse.osbp.xtext.reportdsl.Style;
import org.eclipse.osbp.xtext.reportdsl.TableMultipleAggregation;
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 addText(String i18nKey, String text, Style style, String contentType) throws SemanticException {
add(
new TextItem(fWorkset, i18nKey, text, contentType),
style
);
}
public void addText(String text, Style style) throws SemanticException {
add(
new TextItem(fWorkset, text, BaseItem.CONTENT_TYPE_PLAIN),
style
);
}
public void addTextData(DatamartDefinition datamart, List<DatamartAttribute> datamartAttributes, Style style) throws SemanticException {
add(
new TextDataItem(fWorkset, BaseItem.CONTENT_TYPE_HTML, datamart, datamartAttributes),
style
);
}
public void addTextData(DatamartDefinition datamart, StringBinder stringBinder, Style style) throws SemanticException {
add(
new TextDataItem(fWorkset, BaseItem.CONTENT_TYPE_HTML, datamart, stringBinder),
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, List<ComputedColumn> boundColumns, DatamartTableGroup[] groups, Style propertiesStyle, DatamartTableAttribute[] tableProperties, Style style, Attribute[] attributes) throws SemanticException { // NOSONAR
add(
new TableItem(fWorkset, dataSet, withHeaderFooter, boundColumns, groups, propertiesStyle, tableProperties),
style,
attributes
);
}
public void addData(DatamartTableAttribute tableAttribute, Style style) throws SemanticException {
add(
new DataItem(fWorkset, tableAttribute),
style
);
}
public void addDataImage(DatamartTableAttribute tableAttribute, Style style) throws SemanticException {
add(
new ImageItem(fWorkset, tableAttribute),
style
);
}
public void addHeaderData(DatamartTableAttribute tableAttribute, Style style) throws SemanticException {
add(
new DataItem(fWorkset, tableAttribute),
style
);
}
}