| /** |
| * |
| * 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 |
| * |
| */ |
| |
| @GenModel(fileExtensions="report") |
| @GenModel(modelName="ReportDSL") |
| @GenModel(prefix="ReportDSL") |
| @GenModel(updateClasspath="false") |
| // force bigModel == false |
| @GenModel(loadInitialization="false") |
| @GenModel(literalsInterface="true") |
| @GenModel(copyrightText="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 |
| |
| Based on ideas from Xtext, Xtend, Xcore |
| |
| Contributors: |
| Christophe Loetz (Loetz GmbH&Co.KG) - Initial implementation |
| ") |
| @Ecore(nsURI="http://osbp.eclipse.org/xtext/reportdsl/ReportDSL") |
| @Ecore(nsPrefix="reportdsl") |
| @Ecore(rootPackage="reportdsl") |
| package org.eclipse.osbp.xtext.reportdsl |
| |
| import org.eclipse.emf.ecore.EObject |
| import org.eclipse.emf.ecore.InternalEObject |
| import org.eclipse.osbp.dsl.semantic.common.types.LPackage |
| import org.eclipse.osbp.xtext.action.ActionToolbar |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartAttribute |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartDefinition |
| import org.eclipse.osbp.xtext.oxtype.resource.EcoreUtil3 |
| import org.eclipse.xtext.xtype.XImportSection |
| |
| class ReportModel { |
| contains XImportSection importSection |
| contains ReportPackage[] pckg |
| } |
| |
| type InternalEObject wraps InternalEObject |
| |
| class ReportLazyResolver { |
| op EObject eResolveProxy(InternalEObject proxy) { |
| return EcoreUtil3.resolve(proxy, this.eResource().resourceSet); |
| } |
| } |
| |
| class ReportBase extends ReportLazyResolver { |
| String name |
| } |
| |
| class ReportPackage extends LPackage { |
| String externalCssURI |
| String externalCssURIBundle |
| contains PageTemplates pagetemplates |
| contains SomeFormats formatters |
| contains Colors colors |
| contains Fonts fonts |
| contains Medias medias |
| contains Styles styles |
| contains Report[] reports |
| } |
| |
| class PageTemplates extends ReportLazyResolver { |
| contains PageTemplate[] pagetemplates |
| } |
| |
| class SomeFormats extends ReportLazyResolver { |
| contains SomeFormat[] formatters |
| } |
| |
| class Colors extends ReportLazyResolver { |
| contains Color[] colors |
| } |
| |
| class Fonts extends ReportLazyResolver { |
| contains Font[] fonts |
| } |
| |
| class Medias extends ReportLazyResolver { |
| contains Media[] medias |
| } |
| |
| class Styles extends ReportLazyResolver { |
| contains Style[] styles |
| } |
| |
| class PageTemplate extends ReportBase { |
| PageSizeEnum size |
| OrientationEnum orientation |
| double topMarginValue |
| double leftMarginValue |
| double bottomMarginValue |
| double rightMarginValue |
| contains PageHeader header |
| contains PageFooter footer |
| } |
| |
| enum UnitEnum{ |
| // NULL as '' |
| MM as 'mm' |
| CM as 'cm' |
| PT as 'pt' |
| IN as 'inch' |
| PC as 'pc' |
| EM as 'em' |
| EX as 'ex' |
| PX as 'px' |
| PERCENTAGE as '%' |
| } |
| |
| enum PageSizeEnum{ |
| A4 as 'a4' |
| A3 as 'a3' |
| A5 as 'a5' |
| US_LETTER as 'us-letter' |
| US_LEGAL as 'us-legal' |
| US_LEDGER as 'us-ledger' |
| US_SUPER_B as 'us-super-b' |
| } |
| |
| enum OrientationEnum{ |
| PORTRAIT as 'portrait' |
| LANDSCAPE as 'landscape' |
| } |
| |
| class Color extends ReportBase { |
| String color |
| refers Color basecolor |
| Integer darkensby |
| Integer lightensby |
| Integer transformsby |
| refers Color targetcolor |
| } |
| |
| class Font extends ReportBase { |
| refers Font ^extends |
| contains FontFamily family |
| FontStyleEnum style |
| boolean bold |
| double sizevalue |
| UnitEnum sizeunit |
| } |
| |
| enum FontStyleEnum { |
| NORMAL as 'normal' |
| ITALIC as 'italic' |
| OBLIQUE as 'oblique' |
| } |
| |
| interface FontFamily extends ReportLazyResolver{} |
| |
| class BuildInFontFamily extends FontFamily { |
| BuildInFontFamilyEnum custom |
| } |
| |
| enum BuildInFontFamilyEnum { |
| MONOSPACE as 'monospace' |
| SANS_SERIF as 'sans-serif' |
| SERIF as 'serif' |
| } |
| |
| class CustomFontFamily extends FontFamily { |
| String custom |
| } |
| |
| class Media extends ReportBase { |
| } |
| |
| class BorderStyle extends ReportLazyResolver { |
| BorderTypeEnum ^type |
| double widthValue |
| refers Color color |
| } |
| |
| enum BorderTypeEnum { |
| NONE as 'none' |
| SOLID as 'solid' |
| DOTTED as 'dotted' |
| DASHED as 'dashed' |
| DOUBLE as 'double' |
| GROOVE as 'groove' |
| RIDGE as 'ridge' |
| INSET as 'inset' |
| OUTSET as 'outset' |
| } |
| |
| class BaseStyle extends ReportLazyResolver { |
| refers SomeFormat format |
| refers Font font |
| refers Color backgroundcolor |
| refers Color backgroundcolor_alternate |
| refers Color textcolor |
| TextAlignEnum textalign |
| VerticalTextAlignEnum verticalalign |
| contains BorderStyle borderTop |
| contains BorderStyle borderBottom |
| contains BorderStyle borderLeft |
| contains BorderStyle borderRight |
| double paddingTopValue |
| double paddingBottomValue |
| double paddingLeftValue |
| double paddingRightValue |
| double marginTopValue |
| double marginLeftValue |
| double marginBottomValue |
| double marginRightValue |
| } |
| |
| class MediaStyle extends BaseStyle { |
| refers Media media |
| } |
| |
| class Style extends ReportBase, BaseStyle { |
| refers Style ^extends |
| contains MediaStyle[] mediastyles |
| } |
| |
| enum TextAlignEnum { |
| NULL as '' |
| LEFT as 'left' |
| CENTER as 'center' |
| RIGHT as 'right' |
| } |
| |
| enum VerticalTextAlignEnum { |
| NULL as '' |
| BOTTOM as 'bottom' |
| MIDDLE as 'middle' |
| TOP as 'top' |
| } |
| |
| class SomeFormat extends ReportBase { |
| String ui_pattern |
| String report_pattern |
| TextAlignEnum textalign |
| } |
| |
| class UomoFormat extends SomeFormat { |
| } |
| |
| class NumberFormat extends SomeFormat { |
| NumberFormatCategoryEnum report_category |
| } |
| |
| enum NumberFormatCategoryEnum { |
| UNFORMATTED as 'unformatted' |
| GENERAL_NUMBER as 'general-number' |
| FIXED as 'fixed' |
| PERCENT as 'percent' |
| SCIENTIFIC as 'scientific' |
| CUSTOM as 'custom' |
| } |
| |
| class CurrencyFormat extends SomeFormat { |
| CurrencyFormatCategoryEnum report_category |
| } |
| |
| enum CurrencyFormatCategoryEnum { |
| UNFORMATTED as 'unformatted' |
| CURRENCY as 'currency' |
| CUSTOM as 'custom' |
| } |
| |
| class DateFormat extends SomeFormat { |
| DateFormatCategoryEnum report_category |
| } |
| |
| enum DateFormatCategoryEnum { |
| CUSTOM as 'custom' |
| } |
| |
| class DateTimeFormat extends SomeFormat { |
| DateTimeFormatCategoryEnum report_category |
| } |
| |
| enum DateTimeFormatCategoryEnum { |
| CUSTOM as 'custom' |
| } |
| |
| class TimeFormat extends SomeFormat { |
| TimeFormatCategoryEnum report_category |
| } |
| |
| enum TimeFormatCategoryEnum { |
| CUSTOM as 'custom' |
| } |
| |
| class DatamartContainer { |
| refers DatamartDefinition datamartRef |
| } |
| |
| class Report extends ReportBase, DatamartContainer { |
| boolean selectById |
| boolean description |
| String descriptionValue |
| RenderingEnum rendering |
| String externalCssURI |
| String externalCssURIBundle |
| UnitEnum defaultUnit |
| refers PageTemplate pageTemplate |
| refers Media media |
| refers ActionToolbar toolbar |
| contains ReportDesign design |
| } |
| |
| interface ReportDesign extends ReportLazyResolver {} |
| |
| class ReportDesignFile extends ReportDesign { |
| String name |
| } |
| |
| class ReportDesignTemplate extends ReportDesign { |
| String description |
| contains PageHeader header |
| contains PageDetail detail |
| contains PageFooter footer |
| } |
| |
| class Container extends ReportLazyResolver { |
| contains Element[] elements |
| } |
| |
| class PageHeader extends Container { |
| boolean showOnFirst |
| double heightValue |
| } |
| |
| class PageDetail extends Container {} |
| |
| class PageFooter extends Container { |
| boolean showOnLast |
| double heightValue |
| } |
| |
| interface Element extends ReportLazyResolver {} |
| |
| class WithStyle extends ReportLazyResolver { |
| refers Style style |
| } |
| |
| class TextElement extends Element, WithStyle { |
| String text |
| } |
| |
| class Title extends TextElement {} |
| |
| class SubTitle extends TextElement {} |
| |
| class SubSubTitle extends TextElement {} |
| |
| class Label extends TextElement {} |
| |
| class Text extends TextElement { |
| TextContentTypeEnum textContentType |
| } |
| |
| class AutoText extends Element, WithStyle { |
| AutoTextEnum ^type |
| } |
| |
| enum AutoTextEnum { |
| PAGE_NUMBER as "page-number" |
| TOTAL_PAGE as "total-page" |
| PAGE_NUMBER_UNFILTERED as "page-number-unfiltered" |
| TOTAL_PAGE_UNFILTERED as "total-page-unfiltered" |
| PAGE_VARIABLE as "page-variable" |
| ACTUAL_DATE as "actual-date" |
| ACTUAL_TIME as "actual-time" |
| REPORT_NAME as "report-name" |
| } |
| |
| class Image extends Element, WithStyle { |
| ImageSizeEnum size |
| double scale |
| double heightValue |
| double widthValue |
| UnitEnum heightUnit |
| UnitEnum widthUnit |
| ImageSourceEnum sourceType |
| String filename |
| } |
| |
| enum ImageSizeEnum { |
| SIZE_TO_IMAGE as 'size-to-image' |
| SCALE_TO_ITEM as 'scale-to-item' |
| CLIP as 'clip' |
| } |
| |
| enum ImageSourceEnum { |
| // FILE as 'file' |
| URL as 'url' |
| EMBED as 'embed' |
| } |
| |
| enum TextContentTypeEnum { |
| AUTO as 'auto' |
| PLAIN as 'plain' |
| HTML as 'html' |
| } |
| |
| class WithHeaderFooter extends ReportLazyResolver { |
| contains DatamartTableHeader header |
| contains DatamartTableFooter footer |
| contains Visibility visibilityItem |
| contains PageBreak pageBreak |
| // boolean detailheader |
| // refers Style headerstyle |
| // boolean detailfooter |
| // refers Style footerstyle |
| } |
| |
| class DatamartTable extends ReportBase, Element, WithStyle, WithHeaderFooter, DatamartContainer { |
| contains DatamartTableGroup[] groups |
| contains DatamartTableDetail detail |
| } |
| |
| class DatamartTableGroup extends ReportBase, WithHeaderFooter { |
| refers DatamartAttribute groupingRef |
| } |
| |
| class SomeGrid extends ReportLazyResolver { |
| contains GridRow[] rows |
| } |
| |
| class DatamartTableHeader extends Element, SomeGrid, WithStyle { |
| contains PageBreak pageBreak |
| } |
| |
| class DatamartTableFooter extends Element, SomeGrid, WithStyle { |
| contains PageBreak pageBreak |
| } |
| |
| class DatamartTableDetail extends WithStyle { |
| contains DatamartTableAttribute[] columnFormatters |
| } |
| |
| /* !!! copy from tabledsl ... */ |
| class DatamartTableAttribute extends Element, WithStyle { |
| contains TableValueElement column |
| double widthValue |
| contains TableInterval[] intervals |
| boolean hideLabelInterval |
| contains TableLookup[] lookups |
| boolean hideLabelLookup |
| boolean hasImage |
| contains TableImage image |
| } |
| |
| enum PureAggregationTypeEnum { |
| COUNT as 'count' |
| RUNNINGCOUNT as 'running-count' |
| } |
| |
| enum UnaryAggregationTypeEnum { |
| SUM as 'sum' |
| AVE as 'average' |
| MIN as 'minimum' |
| MAX as 'maximum' |
| RUNNINGSUM as 'running-sum' |
| } |
| |
| enum BinaryAggregationTypeEnum { |
| DIV as 'divide' |
| } |
| |
| enum MultipleAggregationTypeEnum { |
| CONCATENATE as 'concat' |
| } |
| |
| class TableFormatter{ |
| String format |
| } |
| |
| class TableImage extends ReportLazyResolver{ |
| String imagePathPattern |
| boolean hideImageLabel |
| boolean hasParameter |
| boolean resize |
| String resizeString |
| contains TableValueElement imagePathParameter |
| } |
| |
| interface TableValueElement extends ReportLazyResolver{} |
| |
| |
| class TableAttribute extends TableValueElement, StringBinderValue{ |
| refers DatamartAttribute valueRef |
| } |
| |
| class TableAggregation extends TableValueElement { |
| String text |
| contains TableBaseAggregation aggregation |
| refers DatamartTableGroup onGroup |
| } |
| |
| class TableBaseAggregation extends ReportLazyResolver { |
| refers DatamartAttribute[] valueRefs |
| } |
| |
| class TablePureAggregation extends TableBaseAggregation { |
| PureAggregationTypeEnum aggregation |
| } |
| |
| class TableUnaryAggregation extends TableBaseAggregation { |
| UnaryAggregationTypeEnum aggregation |
| } |
| |
| class TableMultipleAggregation extends TableBaseAggregation { |
| MultipleAggregationTypeEnum aggregation |
| } |
| |
| class TableBinaryAggregation extends TableBaseAggregation { |
| BinaryAggregationTypeEnum aggregation |
| } |
| |
| interface TableInterval extends ReportLazyResolver{} |
| |
| class TableNumberInterval extends TableInterval{ |
| double numberIntervalValue |
| contains TableRangeElement numberRange |
| } |
| |
| class TableDateDayInterval extends TableInterval{ |
| double dateIntervalValue |
| contains TableRangeElement dateRange |
| } |
| |
| interface TableLookup extends ReportLazyResolver{} |
| |
| class TableNumberLookup extends TableLookup{ |
| double lookupValue |
| contains TableRangeElement discrete |
| } |
| |
| class TableStringLookup extends TableLookup{ |
| String lookupValue |
| contains TableRangeElement discrete |
| } |
| |
| class TableDateDayLookup extends TableLookup{ |
| double lookupValue |
| contains TableRangeElement discrete |
| } |
| |
| interface TableRangeElement extends ReportLazyResolver{} |
| |
| class TableTextColor extends TableRangeElement{ |
| refers Color color |
| } |
| |
| class TableCellColor extends TableRangeElement{ |
| refers Color color |
| } |
| |
| class TableIcon extends TableRangeElement{ |
| String icon |
| } |
| |
| class TableTrend extends TableRangeElement{ |
| TrendIconEnum icon |
| } |
| |
| class TableTooltip extends TableRangeElement{ |
| String tooltip |
| } |
| |
| interface StringBinderElement extends ReportLazyResolver{} |
| |
| interface StringBinderValue extends ReportLazyResolver{ |
| String value |
| } |
| |
| class TranslatableText extends StringBinderValue { |
| } |
| |
| class NonTranslatableText extends StringBinderValue, Element { |
| } |
| |
| class StringBinder extends Element, WithStyle { |
| contains StringBinderValue[] elements |
| } |
| |
| class Visibility { |
| boolean visibility |
| refers DatamartAttribute visibilityAttribute |
| } |
| |
| class PageBreak { |
| BeforeAfterPageBreakEnum beforePageBreak |
| BeforeAfterPageBreakEnum afterPageBreak |
| InsidePageBreakEnum insidePageBreak |
| } |
| |
| enum BeforeAfterPageBreakEnum { |
| AUTO as 'auto' |
| ALWAYS as 'always' |
| AVOID as 'avoid' |
| } |
| |
| enum InsidePageBreakEnum { |
| AUTO as 'auto' |
| AVOID as 'avoid' |
| } |
| |
| enum TrendIconEnum{ |
| RISING as 'rising' |
| BADRISING as 'bad-rising' |
| SLOPING as 'sloping' |
| GOODSLOPING as 'good-sloping' |
| STAGNATING as 'stagnating' |
| } |
| |
| /* ... copy from tabledsl !!! */ |
| |
| class Grid extends ReportBase, Element, SomeGrid, WithStyle { |
| double widthValue |
| contains Visibility visibilityItem |
| } |
| |
| class GridRow extends ReportBase, WithStyle { |
| double heightValue |
| contains GridCell[] cells |
| contains Visibility visibilityItem |
| } |
| |
| class GridCell extends ReportBase, Container, WithStyle { |
| int columnspan |
| double widthValue |
| contains Visibility visibilityItem |
| } |
| |
| enum RenderingEnum{ |
| HTML as 'html' |
| PDF as 'pdf' |
| } |