blob: 6552c176f8bce1a1d9e1a79048f7d376d1c543d8 [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
*
*/
grammar org.eclipse.osbp.xtext.table.TableDSL with org.eclipse.xtext.xbase.annotations.XbaseWithAnnotations
import "http://osbp.eclipse.org/gridsource/v1/core"
import "http://osbp.eclipse.org/gridsource/v1/core/style" as style
import "http://osbp.eclipse.org/xtext/table/TableDSL"
import "http://osbp.eclipse.org/xtext/datamartdsl/DatamartDSL" as datamart
import "http://osbp.eclipse.org/xtext/cubedsl/CubeDSL" as cube
import "http://osbp.eclipse.org/xtext/action/ActionDSL" as action
import "http://osbp.eclipse.org/dsl/common/types/v1" as types
import "http://osbp.eclipse.org/dsl/dto/v1" as dto
import "http://osbp.eclipse.org/dsl/entity/v1" as entity
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "http://www.eclipse.org/xtext/common/JavaVMTypes"
TableModel:
packages+=TablePackage*;
TablePackage:
{TablePackage} 'package' name=QualifiedName
('{' (imports+=TableImport)* (tables+=Table)* '}')?;
Table:
{Table} 'table' name=TRANSLATABLEID (description?='described by' descriptionValue=TRANSLATABLESTRING)?
'as' tabletype=TableOption;
TableOption:
TableSelection | TableTable | TableGrid;
TableSelection:
{TableSelection} (multiSelection?='multiselection' | 'singleselection') (((selectalways?='selectalways')?) & ('rowheader' headerMode=RowHeaderMode)?)
((polling?='polling' pollingTime=Number)? &
(filtering?='filtering')? &
(embedded?='embedded')? &
('toolbar' toolbar=[action::ActionToolbar])?)
('using' source=TableDatamart)?;
TableTable:
{TableTable} 'table' (((selectalways?='selectalways')?) & ('rowheader' headerMode=RowHeaderMode)?)
((polling?='polling' pollingTime=Number)? &
(filtering?='filtering')? &
(embedded?='embedded')? &
('toolbar' toolbar=[action::ActionToolbar])?)
('using' source=TableDatamart)?;
TablePreorder:
{TablePreorder} 'preorder' column=TableValueElement (ascending?='ascending')?;
TableValue:
{TableValue} 'value' column=TableValueElement ((collapsed?='collapse')? & ('icon' iconName=STRING)? &
(formatter=TableFormatter)? & (hasImage?='image' image=TableImage)? & (tooltipPattern=TableTooltipPattern)?)
(('intervals' (hideLabelInterval?='hidelabel')? '{' (intervals+=TableInterval)* '}')? & ('lookups'
(hideLabelLookup?='hidelabel')? '{' (lookups+=TableLookup)* '}')?);
TableFormatter:
{TableFormatter} 'formatter' format=STRING;
TableImage:
{TableImage} 'path' imagePathPattern=STRING ((hasParameter?='dynamic')? & (hideImageLabel?='hidelabel')? &
(resize?='resize' resizeString=STRING)?);
TableTooltipPattern:
{TableTooltipPattern} 'tooltipPattern' tooltipPattern=TRANSLATABLESTRING;
TableValueElement:
TableMeasure | TableDerived | TableHierarchy | TableProperty | TableAggregation | TableOrdinal |
TableColumn | TableTask | TableAllColumns;
TableTask:
{TableTask} 'taskId';
TableAllColumns:
{TableAllColumns} 'allColumns';
TableOrdinal:
'ordinal' valueRef=Number;
TableColumn:
'column' valueRef=[datamart::DatamartColumn];
TableMeasure:
'measure' valueRef=[datamart::DatamartMeasure];
TableDerived:
'derived' valueRef=[datamart::DatamartDerivedMeasure];
TableHierarchy:
'level' valueRef=[cube::CubeLevel];
TableProperty:
{TableProperty} 'property' valueRef=[datamart::DatamartProperty];
TableAggregation:
'aggregation' valueRef=[datamart::DatamartSetAggregationFunction];
TableInterval:
(TableNumberInterval | TableDateDayInterval);
TableNumberInterval:
{TableNumberInterval} 'up to' numberIntervalValue=SignedNumber numberRange=TableRangeElement;
TableDateDayInterval:
{TableDateDayInterval} 'days in past' dateIntervalValue=SignedNumber dateRange=TableRangeElement;
TableLookup:
(TableNumberLookup | TableStringLookup | TableDateDayLookup);
TableNumberLookup:
{TableNumberLookup} 'number' lookupValue=SignedNumber discrete=TableRangeElement;
TableStringLookup:
{TableStringLookup} 'string' lookupValue=STRING discrete=TableRangeElement;
TableDateDayLookup:
{TableDateDayLookup} 'days in past' lookupValue=SignedNumber discrete=TableRangeElement;
TableDatamart:
'datamart' datamartRef=[datamart::DatamartDefinition] ('{' elements+=TableElement* '}')?;
TableElement:
TableAxis;
TableEvent:
'broker' source=TableValueElement 'to' '{' brokerDatamarts+=TableBrokerDatamart* '}';
TableBrokerDatamart:
'datamart' datamartDef=[datamart::DatamartDefinition] (('filter' filter=STRING) | ('referenced'
reference=[entity::LEntityReference]));
TableAxis:
'axis' axis=AxisEnum ((hasRowHeight?='rowheight' rowHeight=Number)? & (preOrder=TablePreorder)?)
(hasDetails?='details' '{' values+=TableValue* '}')? (hasEvents?='events' '{' events+=TableEvent* '}')?;
TableRangeElement:
TableTextColor | TableCellColor | TableIcon | TableTrend | TableTooltip;
TableTextColor:
'textcolor' rgb=STRING;
TableCellColor:
'cellcolor' rgb=STRING;
TableIcon:
'icon' icon=STRING;
TableTrend:
'trend' icon=TrendIconEnum;
TableTooltip:
'tooltip' tooltip=TRANSLATABLESTRING;
TableImport returns types::LImport:
'import' importedNamespace=TableQualifiedNameWithWildCard;
// ----------------------------- grid --------------------------------------
TableGrid:
{TableGrid} 'grid' (((selectalways?='selectalways')?) & ('rowheader' headerMode=RowHeaderMode)?)
((polling?='polling' pollingTime=Number)? &
(filtering?='filtering')? &
(embedded?='embedded')? &
('toolbar' toolbar=[action::ActionToolbar])?)
('using' source=TableDtoDatasource)?;
TableDtoDatasource:
// 'dto' rootType=JvmTypeReference '{'
'dto' dtoSource=[dto::LDto] ('{'properties+=Property*'}')?;
Property returns CxGridProperty:
(editable?='editable')? 'prop' path=NestedField 'style' style=PropertyStyle;
NestedField returns CxGridNestedField:
{CxGridNestedField}
field=[JvmOperation] path=(NestedPath)?;
NestedPath returns CxGridNestedPath:
{CxGridNestedPath}
'.' field=[JvmOperation] path=(NestedPath)?;
PropertyStyle returns style::CxGridPropStyle:
PropertyButtonStyle | PropertyHtmlStyle | PropertyProgressbarStyle | PropertyTextStyle |
PropertyBooleanStyle | PropertyDateStyle | PropertyNumberStyle | PropertyImageStyle | PropertyQuantityStyle |
PropertyPriceStyle | GridPropIndicatorStyle;
PropertyButtonStyle returns style::CxGridPropButtonStyle:
{style::CxGridPropButtonStyle}
'buttonStyle' 'eventTopic' eventTopic=STRING;
PropertyHtmlStyle returns style::CxGridPropHtmlStyle:
{style::CxGridPropHtmlStyle}
'htmlStyle';
PropertyBooleanStyle returns style::CxGridPropBooleanStyle:
{style::CxGridPropBooleanStyle}
'boolStyle';
PropertyDateStyle returns style::CxGridPropDateStyle:
{style::CxGridPropDateStyle}
'dateStyle' 'format' dateFormat=STRING;
PropertyNumberStyle returns style::CxGridPropNumberStyle:
{style::CxGridPropNumberStyle}
'numberStyle' 'format' numberFormat=STRING;
PropertyProgressbarStyle returns style::CxGridPropProgressbarStyle:
{style::CxGridPropProgressbarStyle}
'progressbarStyle' 'max' maxValue=LDouble;
GridPropIndicatorStyle returns style::CxGridPropIndicatorStyle:
{style::CxGridPropIndicatorStyle}
'indicatorStyle' 'greenFrom' greenStarts=LDouble 'redUntil' redEnds=LDouble;
PropertyQuantityStyle returns style::CxGridPropQuantityStyle:
{style::CxGridPropQuantityStyle}
'quantityStyle' (htmlPattern=STRING)? 'value' '=' valuePropertyPath=NestedField ('(' 'format' valueNumberFormat=STRING
')')? 'uom' '='
uomPropertyPath=NestedField;
PropertyPriceStyle returns style::CxGridPropPriceStyle:
{style::CxGridPropPriceStyle}
'priceStyle' (htmlPattern=STRING)? 'value' '=' valuePropertyPath=NestedField ('(' 'format' valueNumberFormat=STRING
')')? 'currency' '='
currencyPropertyPath=NestedField;
PropertyTextStyle returns style::CxGridPropTextStyle:
{style::CxGridPropTextStyle}
'textStyle';
PropertyImageStyle returns style::CxGridPropImageStyle:
{style::CxGridPropImageStyle}
'imageStyle' ('eventTopic' eventTopic=STRING)? '{'
configs+=StyleConfig*
'}';
StyleConfig returns style::CxGridStyleConfig:
NumericToResourceStyleConfig | StringToResourceStyleConfig;
NumericToResourceStyleConfig returns style::CxGridStyleConfigNumericToResource:
'number' compare=StyleCompare value=LDouble 'then' resourceThemePath=THEME_RESOURCE;
StringToResourceStyleConfig returns style::CxGridStyleConfigStringToResource:
'string' compare=StyleCompare value=STRING 'then' resourceThemePath=THEME_RESOURCE;
enum StyleCompare returns style::CxGridCompare:
Equal="equal" | GreaterEqual="greater equal" | GreaterThan="greater than" | LowerEqual="lower equal" |
LowerThan="lower than" | NotEqual="not equal";
terminal ID:
'^'? ('a'..'z' | 'A'..'Z' | '$' | '_') ('a'..'z' | 'A'..'Z' | '$' | '_' | '0'..'9')*;
terminal INT returns ecore::EInt:
'0'..'9' ('0'..'9' | '_')*;
terminal THEME_RESOURCE:
'theme:/' ('a'..'z' | 'A'..'Z' | '$' | '_' | '.' | '/' | '0'..'9')*;
LInt returns ecore::EInt:
('+' | '-')? INT;
LDouble returns ecore::EDouble:
LInt ('.' INT)?;
terminal EVENT_TOPIC:
"'" (ID) ('/' ID)* ('/*')? "'";
// ----------------- grid ends ------------------------
SignedNumber returns ecore::EDouble:
'-'? Number;
TableQualifiedNameWithWildCard:
QualifiedName ('.' '*')?;
QualifiedName:
ValidID (=> '.' ValidID)*;
ValidID:
ID;
TRANSLATABLESTRING:
STRING;
TRANSLATABLEID:
ID;
enum TrendIconEnum:
RISING='rising' | BADRISING='bad-rising' | SLOPING='sloping' | GOODSLOPING='good-sloping' | STAGNATING='stagnating';
enum RowHeaderMode:
HIDDEN='hidden' | EXPLICIT_DEFAULTS_ID='explicit' | INDEX='indexed';
enum AxisEnum returns datamart::AxisEnum:
DEFAULT='default' | COLUMNS='columns' | ROWS='rows' | PAGES='pages' | SECTIONS='sections' | CHAPTERS='chapters'
/* | AXIS(<index>)*/;