blob: 53c582fb198af6e6cca8f7af395409b0b3ed7bf1 [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 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*/
grammar org.eclipse.osbp.xtext.table.TableDSL with org.eclipse.osbp.xtext.oxtype.OXtype
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:
importSection=XImportSection?
packages+=TablePackage*;
TablePackage:
{TablePackage} 'package' name=QualifiedName
('{' (tables+=Table)* '}')?;
Table:
{Table} 'table' name=TRANSLATABLEID (description?='describedBy' descriptionValue=TRANSLATABLESTRING)?
'as' tabletype=TableOption;
TableOption:
TableSelection | TableTable | TableGrid;
TableSelection:
{TableSelection} 'selection'
(multiSelection?='multiple' | 'single')
((selectalways?='alwaysSelected')? & ('rowHeader' headerMode=RowHeaderMode)? & (filtering?='filtering')? & (embedded?='embedded')? & ('toolbar' toolbar=[action::ActionToolbar])?)
('using' source=TableDatamart)?;
TableTable:
{TableTable} 'readOnly'
((selectalways?='alwaysSelected')? &
(selectIdOnly?='selectIdOnly')? &
(selectById?='selectById')? &
('rowHeader' headerMode=RowHeaderMode)? &
(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 | TableAttribute | 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];
TableAttribute:
{TableAttribute} 'property' valueRef=[datamart::DatamartAttribute];
TableAggregation:
'aggregation' valueRef=[datamart::DatamartSetAggregationFunction];
TableInterval:
(TableNumberInterval | TableIntInterval | TableDateDayInterval);
TableNumberInterval:
{TableNumberInterval} 'upToNumber' numberIntervalValue=SignedNumber numberRange=TableRangeElement;
TableIntInterval:
{TableIntInterval} 'upToInteger' intIntervalValue=SignedInt intRange=TableRangeElement;
TableDateDayInterval:
{TableDateDayInterval} 'daysInPast' dateIntervalValue=SignedInt dateRange=TableRangeElement;
TableLookup:
(TableNumberLookup | TableIntLookup | TableStringLookup | TableDateDayLookup);
TableIntLookup:
{TableIntLookup} 'integer' lookupValue=SignedInt discrete=TableRangeElement;
TableNumberLookup:
{TableNumberLookup} 'number' lookupValue=SignedNumber discrete=TableRangeElement;
TableStringLookup:
{TableStringLookup} 'string' lookupValue=STRING discrete=TableRangeElement;
TableDateDayLookup:
{TableDateDayLookup} 'daysInPast' lookupValue=SignedInt discrete=TableRangeElement;
TableDatamart:
'datamart' datamartRef=[datamart::DatamartDefinition] ('{' elements+=TableElement* '}')?;
TableElement:
TableAxis;
TableEvent:
source=TableValueElement;
TableAxis:
'axis' axis=AxisEnum ((hasRowHeight?='rowheight' rowHeight=Number)? & (preOrder=TablePreorder)?)
(hasDetails?='details' '{' values+=TableValue* '}')? (hasEvents?='notifyOnSelect' '{' 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;
// ----------------------------- grid --------------------------------------
TableGrid:
{TableGrid} 'editable' 'using' source=TableDtoDatasource;
Property returns CxGridProperty:
(editable?='editable')? 'prop' path=NestedField 'style' style=PropertyStyle;
TableDtoDatasource:
'dto' dtoSource=[dto::LDto] ('{'properties+=Property*'}')?;
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 | PropertyBlobImageStyle | GridPropIndicatorStyle /*|
PropertyPriceStyle | PropertyQuantityStyle */;
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';
PropertyBlobImageStyle returns style::CxGridPropBlobImageStyle:
{style::CxGridPropBlobImageStyle}
'blobImageStyle';
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 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;
SignedInt returns ecore::EInt:
'-'? INT;
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>)*/;