| /** |
| * 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 |
| * |
| * |
| * This copyright notice shows up in the generated Java code |
| */ |
| package org.eclipse.osbp.xtext.reportdsl.ui.labeling; |
| |
| import com.google.common.base.Objects; |
| import com.google.inject.Inject; |
| import java.util.HashMap; |
| import java.util.Map; |
| import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; |
| import org.eclipse.jface.resource.ColorRegistry; |
| import org.eclipse.jface.resource.FontDescriptor; |
| import org.eclipse.jface.resource.JFaceResources; |
| import org.eclipse.jface.viewers.StyledString; |
| import org.eclipse.osbp.xtext.basic.ui.labeling.BasicDSLLabelProvider; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartDefinition; |
| import org.eclipse.osbp.xtext.reportdsl.AutoText; |
| import org.eclipse.osbp.xtext.reportdsl.BuildInFontFamily; |
| import org.eclipse.osbp.xtext.reportdsl.Colors; |
| import org.eclipse.osbp.xtext.reportdsl.CurrencyFormat; |
| import org.eclipse.osbp.xtext.reportdsl.CustomFontFamily; |
| import org.eclipse.osbp.xtext.reportdsl.DatamartTable; |
| import org.eclipse.osbp.xtext.reportdsl.DatamartTableAttribute; |
| import org.eclipse.osbp.xtext.reportdsl.DatamartTableDetail; |
| import org.eclipse.osbp.xtext.reportdsl.DatamartTableGroup; |
| import org.eclipse.osbp.xtext.reportdsl.DatamartTableGroupFooter; |
| import org.eclipse.osbp.xtext.reportdsl.DatamartTableGroupHeader; |
| import org.eclipse.osbp.xtext.reportdsl.DateFormat; |
| import org.eclipse.osbp.xtext.reportdsl.DateTimeFormat; |
| import org.eclipse.osbp.xtext.reportdsl.FontFamily; |
| import org.eclipse.osbp.xtext.reportdsl.FontStyle; |
| import org.eclipse.osbp.xtext.reportdsl.FontStyleEnum; |
| import org.eclipse.osbp.xtext.reportdsl.Fonts; |
| import org.eclipse.osbp.xtext.reportdsl.Grid; |
| import org.eclipse.osbp.xtext.reportdsl.GridCell; |
| import org.eclipse.osbp.xtext.reportdsl.GridRow; |
| import org.eclipse.osbp.xtext.reportdsl.Label; |
| import org.eclipse.osbp.xtext.reportdsl.Media; |
| import org.eclipse.osbp.xtext.reportdsl.Medias; |
| import org.eclipse.osbp.xtext.reportdsl.NumberFormat; |
| import org.eclipse.osbp.xtext.reportdsl.PageDetail; |
| import org.eclipse.osbp.xtext.reportdsl.PageFooter; |
| import org.eclipse.osbp.xtext.reportdsl.PageHeader; |
| import org.eclipse.osbp.xtext.reportdsl.PageTemplate; |
| import org.eclipse.osbp.xtext.reportdsl.PageTemplates; |
| import org.eclipse.osbp.xtext.reportdsl.Report; |
| import org.eclipse.osbp.xtext.reportdsl.ReportDesignFile; |
| import org.eclipse.osbp.xtext.reportdsl.ReportDesignTemplate; |
| import org.eclipse.osbp.xtext.reportdsl.ReportModel; |
| import org.eclipse.osbp.xtext.reportdsl.ReportPackage; |
| import org.eclipse.osbp.xtext.reportdsl.SomeFormats; |
| import org.eclipse.osbp.xtext.reportdsl.Style; |
| import org.eclipse.osbp.xtext.reportdsl.Styles; |
| import org.eclipse.osbp.xtext.reportdsl.SubSubTitle; |
| import org.eclipse.osbp.xtext.reportdsl.SubTitle; |
| import org.eclipse.osbp.xtext.reportdsl.TableAggregation; |
| import org.eclipse.osbp.xtext.reportdsl.TableAttribute; |
| import org.eclipse.osbp.xtext.reportdsl.TableCellColor; |
| import org.eclipse.osbp.xtext.reportdsl.TableDateDayInterval; |
| import org.eclipse.osbp.xtext.reportdsl.TableDateDayLookup; |
| import org.eclipse.osbp.xtext.reportdsl.TableIcon; |
| import org.eclipse.osbp.xtext.reportdsl.TableInterval; |
| import org.eclipse.osbp.xtext.reportdsl.TableLookup; |
| import org.eclipse.osbp.xtext.reportdsl.TableNumberInterval; |
| import org.eclipse.osbp.xtext.reportdsl.TableNumberLookup; |
| import org.eclipse.osbp.xtext.reportdsl.TableStringLookup; |
| import org.eclipse.osbp.xtext.reportdsl.TableTextColor; |
| import org.eclipse.osbp.xtext.reportdsl.TableTrend; |
| import org.eclipse.osbp.xtext.reportdsl.Text; |
| import org.eclipse.osbp.xtext.reportdsl.TextElement; |
| import org.eclipse.osbp.xtext.reportdsl.TimeFormat; |
| import org.eclipse.osbp.xtext.reportdsl.Title; |
| import org.eclipse.osbp.xtext.reportdsl.UomoFormat; |
| import org.eclipse.osbp.xtext.reportdsl.common.ColorUtilities; |
| import org.eclipse.osbp.xtext.reportdsl.common.item.AContainerItem; |
| import org.eclipse.swt.SWT; |
| import org.eclipse.swt.graphics.Color; |
| import org.eclipse.swt.graphics.Font; |
| import org.eclipse.swt.graphics.GC; |
| import org.eclipse.swt.graphics.Image; |
| import org.eclipse.swt.graphics.RGB; |
| import org.eclipse.swt.graphics.Rectangle; |
| import org.eclipse.xtend2.lib.StringConcatenation; |
| import org.eclipse.xtext.ui.label.StylerFactory; |
| import org.eclipse.xtext.xbase.lib.Exceptions; |
| |
| /** |
| * Provides labels for a EObjects. |
| * |
| * see http://www.eclipse.org/Xtext/documentation.html#labelProvider |
| */ |
| @SuppressWarnings("all") |
| public class ReportDSLLabelProvider extends BasicDSLLabelProvider { |
| private Map<String, Image> fCachedImages; |
| |
| /** |
| * @param swtColor SWT color |
| * @param size outlineImgSize containing the size of the image |
| * @return a - cached - SWT image object |
| */ |
| public Image getColorImage(final Color swtColor, final BasicDSLLabelProvider.outlineImgSize size) { |
| return this.getColorImage(swtColor, size.getWidth(), size.getHeight()); |
| } |
| |
| /** |
| * @param swtColor SWT color |
| * @param width of the rectangular image |
| * @param height of the rectangular image |
| * @return a - cached - SWT rectangular image object |
| */ |
| public Image getColorImage(final Color swtColor, final int width, final int height) { |
| try { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append(width); |
| _builder.append("/"); |
| _builder.append(height); |
| _builder.append("/"); |
| int _red = swtColor.getRed(); |
| _builder.append(_red); |
| _builder.append("/"); |
| int _green = swtColor.getGreen(); |
| _builder.append(_green); |
| _builder.append("/"); |
| int _blue = swtColor.getBlue(); |
| _builder.append(_blue); |
| String swtColorName = _builder.toString(); |
| Image image = this.fCachedImages.get(swtColorName); |
| boolean _equals = Objects.equal(image, null); |
| if (_equals) { |
| Rectangle _rectangle = new Rectangle(0, 0, width, height); |
| Image _image = new Image(null, _rectangle); |
| image = _image; |
| GC gc = new GC(image); |
| gc.setBackground(swtColor); |
| gc.fillRectangle(0, 0, 16, 16); |
| gc.dispose(); |
| swtColor.dispose(); |
| this.fCachedImages.put(swtColorName, image); |
| } |
| return image; |
| } catch (final Throwable _t) { |
| if (_t instanceof Exception) { |
| final Exception e = (Exception)_t; |
| return this.getErrorImage(); |
| } else { |
| throw Exceptions.sneakyThrow(_t); |
| } |
| } |
| } |
| |
| private Color getColor(final String name) { |
| java.awt.Color awtFore = ColorUtilities.convertToAwtColor(name); |
| int _red = awtFore.getRed(); |
| int _green = awtFore.getGreen(); |
| int _blue = awtFore.getBlue(); |
| return new Color(null, _red, _green, _blue); |
| } |
| |
| private RGB getRGB(final String name) { |
| java.awt.Color awtFore = ColorUtilities.convertToAwtColor(name); |
| int _red = awtFore.getRed(); |
| int _green = awtFore.getGreen(); |
| int _blue = awtFore.getBlue(); |
| return new RGB(_red, _green, _blue); |
| } |
| |
| private Image getColorImage(final org.eclipse.osbp.xtext.reportdsl.Color color) { |
| String colorName = AContainerItem.applyColor(color); |
| Color swtFore = this.getColor(colorName); |
| return this.getColorImage(((Color) swtFore), BasicDSLLabelProvider.outlineImgSize.SMALL); |
| } |
| |
| @Inject |
| public ReportDSLLabelProvider(final AdapterFactoryLabelProvider delegate) { |
| super(delegate); |
| HashMap<String, Image> _hashMap = new HashMap<String, Image>(); |
| this.fCachedImages = _hashMap; |
| } |
| |
| private Font getFont(final org.eclipse.osbp.xtext.reportdsl.Font o) { |
| String family = ((String) null); |
| int size = 0; |
| int italic = (-1); |
| int bold = 0; |
| org.eclipse.osbp.xtext.reportdsl.Font step = o; |
| while ((!Objects.equal(step, null))) { |
| { |
| boolean _equals = Objects.equal(family, null); |
| if (_equals) { |
| FontFamily _family = step.getFamily(); |
| boolean _notEquals = (!Objects.equal(_family, null)); |
| if (_notEquals) { |
| FontFamily f = step.getFamily(); |
| boolean _matched = false; |
| if (f instanceof BuildInFontFamily) { |
| _matched=true; |
| family = ((BuildInFontFamily)f).getCustom().getName(); |
| } |
| if (!_matched) { |
| if (f instanceof CustomFontFamily) { |
| _matched=true; |
| family = ((CustomFontFamily)f).getCustom(); |
| } |
| } |
| } |
| if (((bold == 0) && step.isBold())) { |
| bold = SWT.BOLD; |
| } |
| if ((italic < 0)) { |
| FontStyleEnum _style = step.getStyle(); |
| boolean _matched_1 = false; |
| if (Objects.equal(_style, FontStyle.NORMAL)) { |
| _matched_1=true; |
| italic = 0; |
| } |
| if (!_matched_1) { |
| if (Objects.equal(_style, FontStyle.ITALIC)) { |
| _matched_1=true; |
| italic = SWT.ITALIC; |
| } |
| } |
| if (!_matched_1) { |
| if (Objects.equal(_style, FontStyle.OBLIQUE)) { |
| _matched_1=true; |
| italic = SWT.ITALIC; |
| } |
| } |
| } |
| } |
| step = step.getExtends(); |
| } |
| } |
| return new Font(null, family, size, (italic + bold)); |
| } |
| |
| public StyledString getStyledText(final org.eclipse.osbp.xtext.reportdsl.Font o) { |
| try { |
| String _generateText = this.generateText(o, null); |
| StyledString.Styler _createStyler = new StylerFactory().createStyler(FontDescriptor.createFrom(this.getFont(o)), null, null); |
| return new StyledString(_generateText, _createStyler); |
| } catch (final Throwable _t) { |
| if (_t instanceof Exception) { |
| final Exception e = (Exception)_t; |
| String _generateText_1 = this.generateText(o, null); |
| return new StyledString(_generateText_1); |
| } else { |
| throw Exceptions.sneakyThrow(_t); |
| } |
| } |
| } |
| |
| private Font getFont(final Style o) { |
| Style step = o; |
| while ((!Objects.equal(step, null))) { |
| { |
| org.eclipse.osbp.xtext.reportdsl.Font _font = step.getFont(); |
| boolean _notEquals = (!Objects.equal(_font, null)); |
| if (_notEquals) { |
| return this.getFont(step.getFont()); |
| } |
| step = step.getExtends(); |
| } |
| } |
| return null; |
| } |
| |
| private String getForeColor(final Style o) { |
| Object _xblockexpression = null; |
| { |
| Style step = o; |
| while ((!Objects.equal(step, null))) { |
| { |
| org.eclipse.osbp.xtext.reportdsl.Color _textcolor = step.getTextcolor(); |
| boolean _notEquals = (!Objects.equal(_textcolor, null)); |
| if (_notEquals) { |
| return AContainerItem.applyColor(step.getTextcolor()); |
| } |
| step = step.getExtends(); |
| } |
| } |
| _xblockexpression = null; |
| } |
| return ((String)_xblockexpression); |
| } |
| |
| private String getBackColor(final Style o) { |
| Object _xblockexpression = null; |
| { |
| Style step = o; |
| while ((!Objects.equal(step, null))) { |
| { |
| org.eclipse.osbp.xtext.reportdsl.Color _backgroundcolor = step.getBackgroundcolor(); |
| boolean _notEquals = (!Objects.equal(_backgroundcolor, null)); |
| if (_notEquals) { |
| return AContainerItem.applyColor(step.getBackgroundcolor()); |
| } |
| step = step.getExtends(); |
| } |
| } |
| _xblockexpression = null; |
| } |
| return ((String)_xblockexpression); |
| } |
| |
| private String registerColor(final String color) { |
| boolean _notEquals = (!Objects.equal(color, null)); |
| if (_notEquals) { |
| String name = "reportdsl_".concat(color); |
| ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); |
| Color _get = colorRegistry.get(name); |
| boolean _equals = Objects.equal(_get, null); |
| if (_equals) { |
| colorRegistry.put(name, this.getRGB(color)); |
| } |
| return name; |
| } |
| return color; |
| } |
| |
| public StyledString getStyledText(final Style o) { |
| try { |
| Font font = this.getFont(o); |
| String fore = this.registerColor(this.getForeColor(o)); |
| String back = this.registerColor(this.getBackColor(o)); |
| boolean _equals = Objects.equal(font, null); |
| if (_equals) { |
| if ((Objects.equal(fore, null) && Objects.equal(back, null))) { |
| String _generateText = this.generateText(o, null); |
| return new StyledString(_generateText); |
| } else { |
| String _generateText_1 = this.generateText(o, null); |
| StyledString.Styler _createStyler = new StylerFactory().createStyler(fore, back); |
| return new StyledString(_generateText_1, _createStyler); |
| } |
| } else { |
| String _generateText_2 = this.generateText(o, null); |
| StyledString.Styler _createStyler_1 = new StylerFactory().createStyler( |
| FontDescriptor.createFrom(font), fore, back); |
| return new StyledString(_generateText_2, _createStyler_1); |
| } |
| } catch (final Throwable _t) { |
| if (_t instanceof Exception) { |
| final Exception e = (Exception)_t; |
| String _generateText_3 = this.generateText(o, null); |
| return new StyledString(_generateText_3); |
| } else { |
| throw Exceptions.sneakyThrow(_t); |
| } |
| } |
| } |
| |
| @Override |
| public Object text(final Object o) { |
| Object _switchResult = null; |
| boolean _matched = false; |
| if (o instanceof ReportPackage) { |
| _matched=true; |
| _switchResult = this.generateText(o, "report package"); |
| } |
| if (!_matched) { |
| if (o instanceof PageTemplates) { |
| _matched=true; |
| _switchResult = this.generateText(o, "page templates"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof SomeFormats) { |
| _matched=true; |
| _switchResult = this.generateText(o, "formatters"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Colors) { |
| _matched=true; |
| _switchResult = this.generateText(o, "colors"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Fonts) { |
| _matched=true; |
| _switchResult = this.generateText(o, "fonts"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Styles) { |
| _matched=true; |
| _switchResult = this.generateText(o, "styles"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Medias) { |
| _matched=true; |
| _switchResult = this.generateText(o, "medias"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof PageTemplate) { |
| _matched=true; |
| _switchResult = this.generateText(o, "page template", ((PageTemplate)o).getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof ReportDesignFile) { |
| _matched=true; |
| _switchResult = this.generateText(o, "via design file", ((ReportDesignFile)o).getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof ReportDesignTemplate) { |
| _matched=true; |
| _switchResult = this.generateText(o, "via description"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof PageHeader) { |
| _matched=true; |
| _switchResult = this.generateText(o, "page header"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof PageDetail) { |
| _matched=true; |
| _switchResult = this.generateText(o, "page detail"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof PageFooter) { |
| _matched=true; |
| _switchResult = this.generateText(o, "page footer"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof org.eclipse.osbp.xtext.reportdsl.Color) { |
| _matched=true; |
| _switchResult = this.generateText(o, null); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof org.eclipse.osbp.xtext.reportdsl.Font) { |
| _matched=true; |
| _switchResult = this.getStyledText(((org.eclipse.osbp.xtext.reportdsl.Font)o)); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Media) { |
| _matched=true; |
| _switchResult = this.generateText(o, null); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Style) { |
| _matched=true; |
| _switchResult = this.getStyledText(((Style)o)); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Report) { |
| _matched=true; |
| _switchResult = this.generateText(o, "report", ((Report)o).getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartDefinition) { |
| _matched=true; |
| _switchResult = this.generateText(o, "datamart"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTable) { |
| _matched=true; |
| _switchResult = this.generateText(o, "datamart"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTableGroup) { |
| _matched=true; |
| _switchResult = this.generateText(o, "table group"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTableGroupHeader) { |
| _matched=true; |
| _switchResult = this.generateText(o, "table group header", ((DatamartTableGroupHeader)o).getStyle().getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTableGroupFooter) { |
| _matched=true; |
| _switchResult = this.generateText(o, "table group footer", ((DatamartTableGroupFooter)o).getStyle().getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTableDetail) { |
| _matched=true; |
| _switchResult = this.generateText(o, "table detail", ((DatamartTableDetail)o).getStyle().getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTableAttribute) { |
| _matched=true; |
| _switchResult = this.generateText(o, "table property"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableAttribute) { |
| _matched=true; |
| _switchResult = this.generateText(o, "property", ((TableAttribute)o).getValueRef().getAttributeRef().getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableAggregation) { |
| _matched=true; |
| _switchResult = this.generateText(o, "aggregation"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof UomoFormat) { |
| _matched=true; |
| _switchResult = this.generateText(o, "number & unit: ".concat(((UomoFormat)o).getReport_pattern()), ((UomoFormat)o).getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof NumberFormat) { |
| _matched=true; |
| _switchResult = this.generateText(o, "number: ".concat(((NumberFormat)o).getReport_pattern()), ((NumberFormat)o).getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof CurrencyFormat) { |
| _matched=true; |
| _switchResult = this.generateText(o, "currency: ".concat(((CurrencyFormat)o).getReport_pattern()), ((CurrencyFormat)o).getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DateFormat) { |
| _matched=true; |
| _switchResult = this.generateText(o, "date: ".concat(((DateFormat)o).getReport_pattern()), ((DateFormat)o).getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DateTimeFormat) { |
| _matched=true; |
| _switchResult = this.generateText(o, "date & time: ".concat(((DateTimeFormat)o).getReport_pattern()), ((DateTimeFormat)o).getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TimeFormat) { |
| _matched=true; |
| _switchResult = this.generateText(o, "time: ".concat(((TimeFormat)o).getReport_pattern()), ((TimeFormat)o).getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableNumberInterval) { |
| _matched=true; |
| _switchResult = this.generateText(o, "number interval"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableDateDayInterval) { |
| _matched=true; |
| _switchResult = this.generateText(o, "day interval"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableNumberLookup) { |
| _matched=true; |
| _switchResult = this.generateText(o, "number lookup"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableStringLookup) { |
| _matched=true; |
| _switchResult = this.generateText(o, "text lookup"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableDateDayLookup) { |
| _matched=true; |
| _switchResult = this.generateText(o, "day lookup"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableTextColor) { |
| _matched=true; |
| _switchResult = this.generateText(o, "text color", ((TableTextColor)o).getColor().getColor()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableCellColor) { |
| _matched=true; |
| _switchResult = this.generateText(o, "background color", ((TableCellColor)o).getColor().getColor()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableIcon) { |
| _matched=true; |
| _switchResult = this.generateText(o, "icon", ((TableIcon)o).getIcon()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableTrend) { |
| _matched=true; |
| _switchResult = this.generateText(o, "trend icon"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Grid) { |
| _matched=true; |
| _switchResult = this.generateText(o, "grid"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof GridRow) { |
| _matched=true; |
| _switchResult = this.generateText(o, "row"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof GridCell) { |
| _matched=true; |
| _switchResult = this.generateText(o, "cell"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Title) { |
| _matched=true; |
| _switchResult = this.generateText(o, "title", ((Title)o).getText()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof SubTitle) { |
| _matched=true; |
| _switchResult = this.generateText(o, "subtitle", ((SubTitle)o).getText()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof SubSubTitle) { |
| _matched=true; |
| _switchResult = this.generateText(o, "subsubtile", ((SubSubTitle)o).getText()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Label) { |
| _matched=true; |
| _switchResult = this.generateText(o, "label", ((Label)o).getText()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Text) { |
| _matched=true; |
| _switchResult = this.generateText(o, "text"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof AutoText) { |
| _matched=true; |
| _switchResult = this.generateText(o, "auto text", ((AutoText)o).getType().toString()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof org.eclipse.osbp.xtext.reportdsl.Image) { |
| _matched=true; |
| _switchResult = this.generateText(o, "image"); |
| } |
| } |
| if (!_matched) { |
| _switchResult = super.text(o); |
| } |
| return _switchResult; |
| } |
| |
| @Override |
| public Object image(final Object o) { |
| Image _switchResult = null; |
| boolean _matched = false; |
| if (o instanceof ReportModel) { |
| _matched=true; |
| _switchResult = this.getInternalImage("model.png", this.getClass()); |
| } |
| if (!_matched) { |
| if (o instanceof ReportPackage) { |
| _matched=true; |
| _switchResult = this.getInternalImage("package.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof PageTemplates) { |
| _matched=true; |
| _switchResult = this.getInternalImage("master_page.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof SomeFormats) { |
| _matched=true; |
| _switchResult = this.getInternalImage("formatbuilder.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Colors) { |
| _matched=true; |
| _switchResult = this.getInternalImage("color.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Fonts) { |
| _matched=true; |
| _switchResult = this.getInternalImage("font.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Styles) { |
| _matched=true; |
| _switchResult = this.getInternalImage("style.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Medias) { |
| _matched=true; |
| _switchResult = this.getInternalImage("master_page.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof PageTemplate) { |
| _matched=true; |
| _switchResult = this.getInternalImage("master_page.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof ReportDesignFile) { |
| _matched=true; |
| _switchResult = this.getInternalImage("finder_descriptor_obj.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof ReportDesignTemplate) { |
| _matched=true; |
| _switchResult = this.getInternalImage("api_tools.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof PageHeader) { |
| _matched=true; |
| _switchResult = this.getInternalImage("header.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof PageDetail) { |
| _matched=true; |
| _switchResult = this.getInternalImage("details.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof PageFooter) { |
| _matched=true; |
| _switchResult = this.getInternalImage("footer.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof org.eclipse.osbp.xtext.reportdsl.Color) { |
| _matched=true; |
| _switchResult = this.getColorImage(((org.eclipse.osbp.xtext.reportdsl.Color)o)); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof org.eclipse.osbp.xtext.reportdsl.Font) { |
| _matched=true; |
| Image _xtrycatchfinallyexpression = null; |
| try { |
| Image _xblockexpression = null; |
| { |
| this.getFont(((org.eclipse.osbp.xtext.reportdsl.Font)o)); |
| _xblockexpression = this.getInternalImage("font.gif", this.getClass()); |
| } |
| _xtrycatchfinallyexpression = _xblockexpression; |
| } catch (final Throwable _t) { |
| if (_t instanceof Exception) { |
| final Exception e = (Exception)_t; |
| _xtrycatchfinallyexpression = this.getErrorImage(); |
| } else { |
| throw Exceptions.sneakyThrow(_t); |
| } |
| } |
| _switchResult = _xtrycatchfinallyexpression; |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Media) { |
| _matched=true; |
| _switchResult = this.getInternalImage("master_page.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Style) { |
| _matched=true; |
| _switchResult = this.getInternalImage("style.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Report) { |
| _matched=true; |
| _switchResult = this.getInternalImage("dsl_report.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartDefinition) { |
| _matched=true; |
| _switchResult = this.getInternalImage("dsl_datamart.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTable) { |
| _matched=true; |
| _switchResult = this.getInternalImage("dsl_datamart.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTableGroup) { |
| _matched=true; |
| _switchResult = this.getInternalImage("group.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTableGroupHeader) { |
| _matched=true; |
| _switchResult = this.getInternalImage("group_header.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTableGroupFooter) { |
| _matched=true; |
| _switchResult = this.getInternalImage("group_footer.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTableDetail) { |
| _matched=true; |
| _switchResult = this.getInternalImage("detail-area.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTableAttribute) { |
| _matched=true; |
| _switchResult = this.getInternalImage("properties.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableAttribute) { |
| _matched=true; |
| _switchResult = this.getInternalImage("properties.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableAggregation) { |
| _matched=true; |
| _switchResult = this.getInternalImage("aggregate.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof UomoFormat) { |
| _matched=true; |
| _switchResult = this.getInternalImage("length_measure-16x16.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof NumberFormat) { |
| _matched=true; |
| _switchResult = this.getInternalImage("formatbuilder.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof CurrencyFormat) { |
| _matched=true; |
| _switchResult = this.getInternalImage("currency_euro.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DateFormat) { |
| _matched=true; |
| _switchResult = this.getInternalImage("calendar-small.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DateTimeFormat) { |
| _matched=true; |
| _switchResult = this.getInternalImage("datetime.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TimeFormat) { |
| _matched=true; |
| _switchResult = this.getInternalImage("time.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableInterval) { |
| _matched=true; |
| _switchResult = this.getInternalImage("null-attribute-mapping.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableLookup) { |
| _matched=true; |
| _switchResult = this.getInternalImage("enum_alt_obj.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableTextColor) { |
| _matched=true; |
| _switchResult = this.getInternalImage("font_color.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableCellColor) { |
| _matched=true; |
| _switchResult = this.getInternalImage("foreground_fill_color.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableIcon) { |
| _matched=true; |
| _switchResult = this.getInternalImage("img.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableTrend) { |
| _matched=true; |
| _switchResult = this.getInternalImage("trend_rising.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Grid) { |
| _matched=true; |
| _switchResult = this.getInternalImage("gridlayout_obj.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof GridRow) { |
| _matched=true; |
| _switchResult = this.getInternalImage("row.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof GridCell) { |
| _matched=true; |
| _switchResult = this.getInternalImage("cell.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TextElement) { |
| _matched=true; |
| _switchResult = this.getInternalImage("text.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof AutoText) { |
| _matched=true; |
| _switchResult = this.getInternalImage("autotext.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof org.eclipse.osbp.xtext.reportdsl.Image) { |
| _matched=true; |
| _switchResult = this.getInternalImage("img.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| _switchResult = null; |
| } |
| return _switchResult; |
| } |
| } |