| /** |
| * 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 |
| * |
| * |
| * This copyright notice shows up in the generated Java code |
| */ |
| package org.eclipse.osbp.xtext.chart.jvmmodel; |
| |
| import com.ejt.vaadin.sizereporter.ComponentResizeListener; |
| import com.ejt.vaadin.sizereporter.SizeReporter; |
| import com.google.common.base.Objects; |
| import com.vaadin.annotations.JavaScript; |
| import com.vaadin.server.StreamResource; |
| import com.vaadin.shared.ui.JavaScriptComponentState; |
| import com.vaadin.ui.AbstractJavaScriptComponent; |
| import com.vaadin.ui.Component; |
| import com.vaadin.ui.VerticalLayout; |
| import elemental.json.JsonException; |
| import java.util.ArrayList; |
| import java.util.Arrays; |
| import java.util.HashMap; |
| import java.util.HashSet; |
| import java.util.List; |
| import java.util.Locale; |
| import java.util.Set; |
| import java.util.function.Function; |
| import java.util.stream.Collectors; |
| import javax.annotation.PostConstruct; |
| import javax.annotation.PreDestroy; |
| import javax.inject.Inject; |
| import org.dussan.vaadin.dcharts.DCharts; |
| import org.eclipse.e4.core.contexts.IEclipseContext; |
| import org.eclipse.e4.ui.di.Focus; |
| import org.eclipse.e4.ui.model.application.MApplication; |
| import org.eclipse.e4.ui.workbench.IPresentationEngine; |
| import org.eclipse.emf.common.notify.Adapter; |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.osbp.dsl.semantic.common.types.LAttribute; |
| import org.eclipse.osbp.dsl.semantic.entity.LEntity; |
| import org.eclipse.osbp.dsl.semantic.entity.LEntityAttribute; |
| import org.eclipse.osbp.osgi.hybrid.api.AbstractHybridVaaclipseView; |
| import org.eclipse.osbp.runtime.common.event.EventDispatcherEvent; |
| import org.eclipse.osbp.runtime.common.event.IEventDispatcher; |
| import org.eclipse.osbp.ui.api.datamart.DatamartFilter; |
| import org.eclipse.osbp.ui.api.datamart.IDatamartFilterGenerator; |
| import org.eclipse.osbp.ui.api.e4.IE4Focusable; |
| import org.eclipse.osbp.ui.api.layout.IViewLayoutManager; |
| import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService; |
| import org.eclipse.osbp.ui.api.themes.EnumCssClass; |
| import org.eclipse.osbp.ui.api.themes.IThemeResourceService; |
| import org.eclipse.osbp.ui.api.user.IUser; |
| import org.eclipse.osbp.xtext.action.ActionPackage; |
| import org.eclipse.osbp.xtext.action.ActionToolbar; |
| import org.eclipse.osbp.xtext.chart.CanvasFontFamilyEnum; |
| import org.eclipse.osbp.xtext.chart.Chart; |
| import org.eclipse.osbp.xtext.chart.ChartAxis; |
| import org.eclipse.osbp.xtext.chart.ChartBar; |
| import org.eclipse.osbp.xtext.chart.ChartBubble; |
| import org.eclipse.osbp.xtext.chart.ChartDatamart; |
| import org.eclipse.osbp.xtext.chart.ChartDonut; |
| import org.eclipse.osbp.xtext.chart.ChartElement; |
| import org.eclipse.osbp.xtext.chart.ChartGauge; |
| import org.eclipse.osbp.xtext.chart.ChartHighlighter; |
| import org.eclipse.osbp.xtext.chart.ChartInterval; |
| import org.eclipse.osbp.xtext.chart.ChartLegend; |
| import org.eclipse.osbp.xtext.chart.ChartLine; |
| import org.eclipse.osbp.xtext.chart.ChartNumberInterval; |
| import org.eclipse.osbp.xtext.chart.ChartOption; |
| import org.eclipse.osbp.xtext.chart.ChartPackage; |
| import org.eclipse.osbp.xtext.chart.ChartPie; |
| import org.eclipse.osbp.xtext.chart.ChartRangeElement; |
| import org.eclipse.osbp.xtext.chart.ChartSegmentColor; |
| import org.eclipse.osbp.xtext.chart.ChartTree; |
| import org.eclipse.osbp.xtext.chart.SeriesColor; |
| import org.eclipse.osbp.xtext.chart.jvmmodel.D3JsJavaUtil; |
| import org.eclipse.osbp.xtext.cubedsl.CubeLevel; |
| import org.eclipse.osbp.xtext.datamart.common.olap.DerivedCellSet; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartAttribute; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartCube; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartCubeAxis; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartCubeElement; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartDerivedMeasure; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartElement; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartEntity; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartMeasure; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartMember; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartNavigation; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartOwner; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartPackage; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartSource; |
| import org.eclipse.osbp.xtext.datamartdsl.ValueScaleEnum; |
| import org.eclipse.osbp.xtext.datamartdsl.jvmmodel.DatamartDSLJvmModelInferrer; |
| import org.eclipse.osbp.xtext.table.common.PropertyLookup; |
| import org.eclipse.xtend2.lib.StringConcatenation; |
| import org.eclipse.xtext.common.types.JvmAnnotationReference; |
| import org.eclipse.xtext.common.types.JvmAnnotationValue; |
| import org.eclipse.xtext.common.types.JvmConstructor; |
| import org.eclipse.xtext.common.types.JvmDeclaredType; |
| import org.eclipse.xtext.common.types.JvmField; |
| import org.eclipse.xtext.common.types.JvmFormalParameter; |
| import org.eclipse.xtext.common.types.JvmGenericType; |
| import org.eclipse.xtext.common.types.JvmMember; |
| import org.eclipse.xtext.common.types.JvmOperation; |
| import org.eclipse.xtext.common.types.JvmStringAnnotationValue; |
| import org.eclipse.xtext.common.types.JvmTypeReference; |
| import org.eclipse.xtext.common.types.JvmVisibility; |
| import org.eclipse.xtext.common.types.TypesFactory; |
| import org.eclipse.xtext.naming.IQualifiedNameProvider; |
| import org.eclipse.xtext.naming.QualifiedName; |
| import org.eclipse.xtext.xbase.compiler.output.ITreeAppendable; |
| import org.eclipse.xtext.xbase.jvmmodel.AbstractModelInferrer; |
| import org.eclipse.xtext.xbase.jvmmodel.IJvmDeclaredTypeAcceptor; |
| import org.eclipse.xtext.xbase.jvmmodel.JvmTypesBuilder; |
| import org.eclipse.xtext.xbase.lib.CollectionLiterals; |
| import org.eclipse.xtext.xbase.lib.Extension; |
| import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; |
| import org.eclipse.xtext.xbase.lib.StringExtensions; |
| import org.osgi.service.event.EventHandler; |
| import org.slf4j.Logger; |
| |
| /** |
| * <p>Infers a JVM model from the source model.</p> |
| * |
| * <p>The JVM model should contain all elements that would appear in the Java code |
| * which is generated from the source model. Other models link against the JVM model rather than the source model.</p> |
| */ |
| @SuppressWarnings("all") |
| public class ChartDSLJvmModelInferrer extends AbstractModelInferrer { |
| @Inject |
| @Extension |
| private JvmTypesBuilder _jvmTypesBuilder; |
| |
| @Inject |
| @Extension |
| private IQualifiedNameProvider _iQualifiedNameProvider; |
| |
| @Inject |
| @Extension |
| private DatamartDSLJvmModelInferrer datamartInferrer; |
| |
| @Inject |
| @Extension |
| private D3JsJavaUtil _d3JsJavaUtil; |
| |
| @Inject |
| private TypesFactory typesFactory; |
| |
| /** |
| * <p>infer method dispatches the necessary routines to build fields, setter, getter, constructors and methods of the generated code.</p> |
| */ |
| protected void _infer(final ChartPackage pckg, final IJvmDeclaredTypeAcceptor acceptor, final boolean isPreIndexingPhase) { |
| EList<Chart> _charts = pckg.getCharts(); |
| for (final Chart chart : _charts) { |
| { |
| QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(pckg); |
| String _plus = (_fullyQualifiedName + "."); |
| String _name = chart.getName(); |
| String _plus_1 = (_plus + _name); |
| String _plus_2 = (_plus_1 + "Chart"); |
| JvmGenericType cls = this._jvmTypesBuilder.toClass(chart, _plus_2); |
| cls.getSuperTypes().add(this._typeReferenceBuilder.typeRef(AbstractHybridVaaclipseView.class)); |
| cls.getSuperTypes().add(this._typeReferenceBuilder.typeRef(IUser.UserLocaleListener.class)); |
| cls.getSuperTypes().add(this._typeReferenceBuilder.typeRef(IDatamartFilterGenerator.FilterChangeListener.class)); |
| cls.getSuperTypes().add(this._typeReferenceBuilder.typeRef(IEventDispatcher.Receiver.class)); |
| cls.getSuperTypes().add(this._typeReferenceBuilder.typeRef(IE4Focusable.class)); |
| final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> { |
| this._jvmTypesBuilder.setFileHeader(it, this._jvmTypesBuilder.getDocumentation(pckg)); |
| this.toFields(it, chart); |
| this.toConstructor(it, chart); |
| this.toGetterSetter(it, chart); |
| this.toOperations(it, chart); |
| }; |
| acceptor.<JvmGenericType>accept(cls, _function); |
| ChartOption _charttype = chart.getCharttype(); |
| if ((_charttype instanceof ChartTree)) { |
| this.createJsJavaComponent(chart, acceptor); |
| } |
| } |
| } |
| } |
| |
| /** |
| * <p>build the constructors to be used by an e4 application.</p> |
| */ |
| public void toConstructor(final JvmDeclaredType type, final Chart chart) { |
| EList<JvmMember> _members = type.getMembers(); |
| final Procedure1<JvmConstructor> _function = (JvmConstructor it) -> { |
| EList<JvmAnnotationReference> _annotations = it.getAnnotations(); |
| JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Inject.class); |
| this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef); |
| EList<JvmFormalParameter> _parameters = it.getParameters(); |
| JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(chart, "parent", this._typeReferenceBuilder.typeRef(VerticalLayout.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter); |
| EList<JvmFormalParameter> _parameters_1 = it.getParameters(); |
| JvmFormalParameter _parameter_1 = this._jvmTypesBuilder.toParameter(chart, "context", this._typeReferenceBuilder.typeRef(IEclipseContext.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1); |
| EList<JvmFormalParameter> _parameters_2 = it.getParameters(); |
| JvmFormalParameter _parameter_2 = this._jvmTypesBuilder.toParameter(chart, "app", this._typeReferenceBuilder.typeRef(MApplication.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_2, _parameter_2); |
| final Procedure1<ITreeAppendable> _function_1 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("super(parent,context,app);"); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setBody(it, _function_1); |
| }; |
| JvmConstructor _constructor = this._jvmTypesBuilder.toConstructor(chart, _function); |
| this._jvmTypesBuilder.<JvmConstructor>operator_add(_members, _constructor); |
| } |
| |
| /** |
| * <p>build the class variables.</p> |
| */ |
| public void toFields(final JvmDeclaredType type, final Chart chart) { |
| JvmField field = null; |
| final Procedure1<JvmField> _function = (JvmField it) -> { |
| final Procedure1<ITreeAppendable> _function_1 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("org.slf4j.LoggerFactory.getLogger(\"charts\")"); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setInitializer(it, _function_1); |
| }; |
| field = this._jvmTypesBuilder.toField(chart, "log", this._typeReferenceBuilder.typeRef(Logger.class), _function); |
| field.setStatic(true); |
| field.setVisibility(JvmVisibility.PRIVATE); |
| EList<JvmMember> _members = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members, field); |
| final Procedure1<JvmField> _function_1 = (JvmField it) -> { |
| EList<JvmAnnotationReference> _annotations = it.getAnnotations(); |
| JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Inject.class); |
| this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef); |
| }; |
| field = this._jvmTypesBuilder.toField(chart, "user", this._typeReferenceBuilder.typeRef(IUser.class), _function_1); |
| EList<JvmMember> _members_1 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_1, field); |
| final Procedure1<JvmField> _function_2 = (JvmField it) -> { |
| EList<JvmAnnotationReference> _annotations = it.getAnnotations(); |
| JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Inject.class); |
| this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef); |
| }; |
| field = this._jvmTypesBuilder.toField(chart, "eclipseContext", this._typeReferenceBuilder.typeRef(IEclipseContext.class), _function_2); |
| EList<JvmMember> _members_2 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_2, field); |
| field = this._jvmTypesBuilder.toField(chart, "coordinateSystem", this._typeReferenceBuilder.typeRef(ArrayList.class, this._typeReferenceBuilder.typeRef(Integer.class))); |
| EList<JvmMember> _members_3 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_3, field); |
| field = this._jvmTypesBuilder.toField(chart, "filterGenerator", this._typeReferenceBuilder.typeRef(IDatamartFilterGenerator.class)); |
| EList<JvmMember> _members_4 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_4, field); |
| field = this._jvmTypesBuilder.toField(chart, "layoutManager", this._typeReferenceBuilder.typeRef(IViewLayoutManager.class)); |
| EList<JvmMember> _members_5 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_5, field); |
| String _sourceDataMartRefName = this.getSourceDataMartRefName(chart); |
| boolean _tripleNotEquals = (_sourceDataMartRefName != null); |
| if (_tripleNotEquals) { |
| EObject _eContainer = chart.getSource().getDatamartRef().eContainer(); |
| String packageName = this._iQualifiedNameProvider.getFullyQualifiedName(((DatamartPackage) _eContainer)).toString(); |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append(packageName); |
| _builder.append("."); |
| String _string = chart.getSource().getDatamartRef().getName().toString(); |
| _builder.append(_string); |
| _builder.append("Datamart"); |
| field = this._jvmTypesBuilder.toField(chart, "datamartInstance", this._typeReferenceBuilder.typeRef(_builder.toString())); |
| EList<JvmMember> _members_6 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_6, field); |
| } |
| field = this._jvmTypesBuilder.toField(chart, "dataComponent", this._typeReferenceBuilder.typeRef(Component.class)); |
| EList<JvmMember> _members_7 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_7, field); |
| field = this._jvmTypesBuilder.toField(chart, "attributeLookupMap", this._typeReferenceBuilder.typeRef(HashMap.class, this._typeReferenceBuilder.typeRef(String.class), this._typeReferenceBuilder.typeRef(PropertyLookup.class))); |
| EList<JvmMember> _members_8 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_8, field); |
| field = this._jvmTypesBuilder.toField(chart, "charts", this._typeReferenceBuilder.typeRef(ArrayList.class, this._typeReferenceBuilder.typeRef(DCharts.class))); |
| EList<JvmMember> _members_9 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_9, field); |
| field = this._jvmTypesBuilder.toField(chart, "refreshView", this._typeReferenceBuilder.typeRef(EventHandler.class)); |
| EList<JvmMember> _members_10 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_10, field); |
| final Procedure1<JvmField> _function_3 = (JvmField it) -> { |
| EList<JvmAnnotationReference> _annotations = it.getAnnotations(); |
| JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Inject.class); |
| this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef); |
| }; |
| field = this._jvmTypesBuilder.toField(chart, "dslMetadataService", this._typeReferenceBuilder.typeRef(IDSLMetadataService.class), _function_3); |
| EList<JvmMember> _members_11 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_11, field); |
| final Procedure1<JvmField> _function_4 = (JvmField it) -> { |
| EList<JvmAnnotationReference> _annotations = it.getAnnotations(); |
| JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Inject.class); |
| this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef); |
| }; |
| field = this._jvmTypesBuilder.toField(chart, "eventDispatcher", this._typeReferenceBuilder.typeRef(IEventDispatcher.class), _function_4); |
| EList<JvmMember> _members_12 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_12, field); |
| final Procedure1<JvmField> _function_5 = (JvmField it) -> { |
| EList<JvmAnnotationReference> _annotations = it.getAnnotations(); |
| JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Inject.class); |
| this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef); |
| }; |
| field = this._jvmTypesBuilder.toField(chart, "renderingEngine", this._typeReferenceBuilder.typeRef(IPresentationEngine.class), _function_5); |
| EList<JvmMember> _members_13 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_13, field); |
| final Procedure1<JvmField> _function_6 = (JvmField it) -> { |
| EList<JvmAnnotationReference> _annotations = it.getAnnotations(); |
| JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Inject.class); |
| this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef); |
| }; |
| field = this._jvmTypesBuilder.toField(chart, "themeResourceService", this._typeReferenceBuilder.typeRef(IThemeResourceService.class), _function_6); |
| EList<JvmMember> _members_14 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_14, field); |
| if (((chart.getToolbar() != null) && (chart.getToolbar().eContainer() != null))) { |
| EObject _eContainer_1 = chart.getToolbar().eContainer(); |
| String packageName_1 = this._iQualifiedNameProvider.getFullyQualifiedName(((ActionPackage) _eContainer_1)).toString(); |
| field = this._jvmTypesBuilder.toField(chart, "toolbarUUID", this._typeReferenceBuilder.typeRef(String.class)); |
| EList<JvmMember> _members_15 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_15, field); |
| StringConcatenation _builder_1 = new StringConcatenation(); |
| _builder_1.append(packageName_1); |
| _builder_1.append("."); |
| String _firstUpper = StringExtensions.toFirstUpper(chart.getToolbar().getName().toString()); |
| _builder_1.append(_firstUpper); |
| _builder_1.append("Toolbar"); |
| field = this._jvmTypesBuilder.toField(chart, "toolbarClass", this._typeReferenceBuilder.typeRef(_builder_1.toString())); |
| EList<JvmMember> _members_16 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_16, field); |
| } |
| field = this._jvmTypesBuilder.toField(chart, "panelWidth", this._typeReferenceBuilder.typeRef(int.class)); |
| EList<JvmMember> _members_17 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_17, field); |
| field = this._jvmTypesBuilder.toField(chart, "panelHeight", this._typeReferenceBuilder.typeRef(int.class)); |
| EList<JvmMember> _members_18 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_18, field); |
| field = this._jvmTypesBuilder.toField(chart, "splitAdapter", this._typeReferenceBuilder.typeRef(Adapter.Internal.class)); |
| EList<JvmMember> _members_19 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_19, field); |
| field = this._jvmTypesBuilder.toField(chart, "resizeListener", this._typeReferenceBuilder.typeRef(ComponentResizeListener.class)); |
| EList<JvmMember> _members_20 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_20, field); |
| field = this._jvmTypesBuilder.toField(chart, "sizeReporter", this._typeReferenceBuilder.typeRef(SizeReporter.class)); |
| EList<JvmMember> _members_21 = type.getMembers(); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_21, field); |
| } |
| |
| /** |
| * <p>build the getters and setters from class variables.</p> |
| */ |
| public void toGetterSetter(final JvmDeclaredType type, final Chart chart) { |
| JvmOperation operation = null; |
| operation = this._jvmTypesBuilder.toGetter(chart, "coordinateSystem", this._typeReferenceBuilder.typeRef(ArrayList.class, this._typeReferenceBuilder.typeRef(Integer.class))); |
| operation.setVisibility(JvmVisibility.PUBLIC); |
| EList<JvmMember> _members = type.getMembers(); |
| this._jvmTypesBuilder.<JvmOperation>operator_add(_members, operation); |
| } |
| |
| /** |
| * <p>build the methods.</p> |
| */ |
| public void toOperations(final JvmDeclaredType type, final Chart chart) { |
| EList<JvmMember> _members = type.getMembers(); |
| final Procedure1<JvmOperation> _function = (JvmOperation it) -> { |
| EList<JvmAnnotationReference> _annotations = it.getAnnotations(); |
| JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(PostConstruct.class); |
| this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef); |
| final Procedure1<ITreeAppendable> _function_1 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("super.initView();"); |
| _builder.newLine(); |
| _builder.append("user.addUserLocaleListener(this);"); |
| _builder.newLine(); |
| _builder.append("filterGenerator.addFilterChangeListener(this);"); |
| _builder.newLine(); |
| _builder.append("// to resize the chart according to split positions of partsashcontainer - setContainerData is tracked"); |
| _builder.newLine(); |
| _builder.append("((EObject)getPart()).eAdapters().add(splitAdapter);"); |
| _builder.newLine(); |
| _builder.append("sizeReporter.addResizeListener(resizeListener);"); |
| _builder.newLine(); |
| _builder.append("eventDispatcher.addEventReceiver(this);"); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setBody(it, _function_1); |
| }; |
| JvmOperation _method = this._jvmTypesBuilder.toMethod(chart, "activate", this._typeReferenceBuilder.typeRef(Void.TYPE), _function); |
| this._jvmTypesBuilder.<JvmOperation>operator_add(_members, _method); |
| EList<JvmMember> _members_1 = type.getMembers(); |
| final Procedure1<JvmOperation> _function_1 = (JvmOperation it) -> { |
| EList<JvmAnnotationReference> _annotations = it.getAnnotations(); |
| JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(PreDestroy.class); |
| this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef); |
| final Procedure1<ITreeAppendable> _function_2 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("user.removeUserLocaleListener(this);"); |
| _builder.newLine(); |
| _builder.append("filterGenerator.removeFilterChangeListener(this);"); |
| _builder.newLine(); |
| _builder.append("((EObject)getPart()).eAdapters().remove(splitAdapter);"); |
| _builder.newLine(); |
| _builder.append("sizeReporter.removeResizeListener(resizeListener);"); |
| _builder.newLine(); |
| _builder.append("eventDispatcher.removeEventReceiver(this);"); |
| _builder.newLine(); |
| _builder.append("super.destroyView();"); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setBody(it, _function_2); |
| }; |
| JvmOperation _method_1 = this._jvmTypesBuilder.toMethod(chart, "deactivate", this._typeReferenceBuilder.typeRef(Void.TYPE), _function_1); |
| this._jvmTypesBuilder.<JvmOperation>operator_add(_members_1, _method_1); |
| EList<JvmMember> _members_2 = type.getMembers(); |
| final Procedure1<JvmOperation> _function_2 = (JvmOperation it) -> { |
| EList<JvmFormalParameter> _parameters = it.getParameters(); |
| JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(chart, "parent", this._typeReferenceBuilder.typeRef(VerticalLayout.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter); |
| final Procedure1<ITreeAppendable> _function_3 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| String _createView = this.createView(chart); |
| _builder.append(_createView); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setBody(it, _function_3); |
| }; |
| JvmOperation _method_2 = this._jvmTypesBuilder.toMethod(chart, "createView", this._typeReferenceBuilder.typeRef(Void.TYPE), _function_2); |
| this._jvmTypesBuilder.<JvmOperation>operator_add(_members_2, _method_2); |
| EList<JvmMember> _members_3 = type.getMembers(); |
| final Procedure1<JvmOperation> _function_3 = (JvmOperation it) -> { |
| final Procedure1<ITreeAppendable> _function_4 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| String _createComponents = this.createComponents(chart); |
| _builder.append(_createComponents); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setBody(it, _function_4); |
| }; |
| JvmOperation _method_3 = this._jvmTypesBuilder.toMethod(chart, "createComponents", this._typeReferenceBuilder.typeRef(Void.TYPE), _function_3); |
| this._jvmTypesBuilder.<JvmOperation>operator_add(_members_3, _method_3); |
| EList<JvmMember> _members_4 = type.getMembers(); |
| final Procedure1<JvmOperation> _function_4 = (JvmOperation it) -> { |
| EList<JvmFormalParameter> _parameters = it.getParameters(); |
| JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(chart, "cellSet", this._typeReferenceBuilder.typeRef(DerivedCellSet.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter); |
| EList<JvmFormalParameter> _parameters_1 = it.getParameters(); |
| JvmFormalParameter _parameter_1 = this._jvmTypesBuilder.toParameter(chart, "axisNo", this._typeReferenceBuilder.typeRef(Integer.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1); |
| final Procedure1<ITreeAppendable> _function_5 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| String _createTabSheet = this.createTabSheet(chart); |
| _builder.append(_createTabSheet); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setBody(it, _function_5); |
| }; |
| JvmOperation _method_4 = this._jvmTypesBuilder.toMethod(chart, "createTabSheet", this._typeReferenceBuilder.typeRef(Component.class), _function_4); |
| this._jvmTypesBuilder.<JvmOperation>operator_add(_members_4, _method_4); |
| ChartOption _charttype = chart.getCharttype(); |
| boolean _not = (!(_charttype instanceof ChartTree)); |
| if (_not) { |
| EList<JvmMember> _members_5 = type.getMembers(); |
| final Procedure1<JvmOperation> _function_5 = (JvmOperation it) -> { |
| EList<JvmFormalParameter> _parameters = it.getParameters(); |
| JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(chart, "cellSet", this._typeReferenceBuilder.typeRef(DerivedCellSet.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter); |
| final Procedure1<ITreeAppendable> _function_6 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| String _createChart = this.createChart(chart); |
| _builder.append(_createChart); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setBody(it, _function_6); |
| }; |
| JvmOperation _method_5 = this._jvmTypesBuilder.toMethod(chart, "createChart", this._typeReferenceBuilder.typeRef(Component.class), _function_5); |
| this._jvmTypesBuilder.<JvmOperation>operator_add(_members_5, _method_5); |
| } |
| ChartOption _charttype_1 = chart.getCharttype(); |
| if ((_charttype_1 instanceof ChartTree)) { |
| EList<JvmMember> _members_6 = type.getMembers(); |
| final Procedure1<JvmOperation> _function_6 = (JvmOperation it) -> { |
| EList<JvmTypeReference> _exceptions = it.getExceptions(); |
| JvmTypeReference _typeRef = this._typeReferenceBuilder.typeRef(JsonException.class); |
| this._jvmTypesBuilder.<JvmTypeReference>operator_add(_exceptions, _typeRef); |
| EList<JvmFormalParameter> _parameters = it.getParameters(); |
| JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(chart, "cxCellSet", this._typeReferenceBuilder.typeRef(DerivedCellSet.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter); |
| final Procedure1<ITreeAppendable> _function_7 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| CharSequence _createD3Chart = this.createD3Chart(chart); |
| _builder.append(_createD3Chart); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setBody(it, _function_7); |
| }; |
| JvmOperation _method_6 = this._jvmTypesBuilder.toMethod(chart, "createD3Chart", this._typeReferenceBuilder.typeRef(Component.class), _function_6); |
| this._jvmTypesBuilder.<JvmOperation>operator_add(_members_6, _method_6); |
| } |
| EList<JvmMember> _members_7 = type.getMembers(); |
| final Procedure1<JvmOperation> _function_7 = (JvmOperation it) -> { |
| EList<JvmAnnotationReference> _annotations = it.getAnnotations(); |
| JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Focus.class); |
| this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef); |
| final Procedure1<ITreeAppendable> _function_8 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("Component parent = getParent();"); |
| _builder.newLine(); |
| _builder.append("while(!(parent instanceof Panel) && parent != null) {"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("parent = parent.getParent();"); |
| _builder.newLine(); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("if(parent != null) {"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("((Panel)parent).focus();"); |
| _builder.newLine(); |
| _builder.append("}"); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setBody(it, _function_8); |
| }; |
| JvmOperation _method_7 = this._jvmTypesBuilder.toMethod(chart, "setFocus", this._typeReferenceBuilder.typeRef(Void.TYPE), _function_7); |
| this._jvmTypesBuilder.<JvmOperation>operator_add(_members_7, _method_7); |
| EList<JvmMember> _members_8 = type.getMembers(); |
| final Procedure1<JvmOperation> _function_8 = (JvmOperation it) -> { |
| it.setVisibility(JvmVisibility.PUBLIC); |
| EList<JvmAnnotationReference> _annotations = it.getAnnotations(); |
| JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Override.class); |
| this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef); |
| EList<JvmFormalParameter> _parameters = it.getParameters(); |
| JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(chart, "locale", this._typeReferenceBuilder.typeRef(Locale.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter); |
| final Procedure1<ITreeAppendable> _function_9 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| CharSequence _localeChanged = this.localeChanged(chart); |
| _builder.append(_localeChanged); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setBody(it, _function_9); |
| }; |
| JvmOperation _method_8 = this._jvmTypesBuilder.toMethod(chart, "localeChanged", this._typeReferenceBuilder.typeRef(Void.TYPE), _function_8); |
| this._jvmTypesBuilder.<JvmOperation>operator_add(_members_8, _method_8); |
| EList<JvmMember> _members_9 = type.getMembers(); |
| final Procedure1<JvmOperation> _function_9 = (JvmOperation it) -> { |
| EList<JvmFormalParameter> _parameters = it.getParameters(); |
| JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(chart, "changedFilter", this._typeReferenceBuilder.typeRef(DatamartFilter.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter); |
| it.setVisibility(JvmVisibility.PUBLIC); |
| EList<JvmAnnotationReference> _annotations = it.getAnnotations(); |
| JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Override.class); |
| this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef); |
| final Procedure1<ITreeAppendable> _function_10 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("renderData();"); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setBody(it, _function_10); |
| }; |
| JvmOperation _method_9 = this._jvmTypesBuilder.toMethod(chart, "filterChanged", this._typeReferenceBuilder.typeRef(Void.TYPE), _function_9); |
| this._jvmTypesBuilder.<JvmOperation>operator_add(_members_9, _method_9); |
| EList<JvmMember> _members_10 = type.getMembers(); |
| final Procedure1<JvmOperation> _function_10 = (JvmOperation it) -> { |
| it.setVisibility(JvmVisibility.PUBLIC); |
| EList<JvmAnnotationReference> _annotations = it.getAnnotations(); |
| JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Override.class); |
| this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef); |
| EList<JvmFormalParameter> _parameters = it.getParameters(); |
| JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(chart, "event", this._typeReferenceBuilder.typeRef(EventDispatcherEvent.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter); |
| final Procedure1<ITreeAppendable> _function_11 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| String _receiveEvent = this.receiveEvent(chart); |
| _builder.append(_receiveEvent); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setBody(it, _function_11); |
| }; |
| JvmOperation _method_10 = this._jvmTypesBuilder.toMethod(chart, "receiveEvent", this._typeReferenceBuilder.typeRef(Void.TYPE), _function_10); |
| this._jvmTypesBuilder.<JvmOperation>operator_add(_members_10, _method_10); |
| EList<JvmMember> _members_11 = type.getMembers(); |
| final Procedure1<JvmOperation> _function_11 = (JvmOperation it) -> { |
| it.setVisibility(JvmVisibility.PRIVATE); |
| EList<JvmFormalParameter> _parameters = it.getParameters(); |
| JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(chart, "chart", this._typeReferenceBuilder.typeRef(DCharts.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter); |
| EList<JvmFormalParameter> _parameters_1 = it.getParameters(); |
| JvmFormalParameter _parameter_1 = this._jvmTypesBuilder.toParameter(chart, "layoutManager", this._typeReferenceBuilder.typeRef(IViewLayoutManager.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1); |
| final Procedure1<ITreeAppendable> _function_12 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| CharSequence _chartResource = this.chartResource(chart); |
| _builder.append(_chartResource); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setBody(it, _function_12); |
| }; |
| JvmOperation _method_11 = this._jvmTypesBuilder.toMethod(chart, "getChartResource", this._typeReferenceBuilder.typeRef(StreamResource.class), _function_11); |
| this._jvmTypesBuilder.<JvmOperation>operator_add(_members_11, _method_11); |
| } |
| |
| public String getSourceDataMartRefName(final Chart chart) { |
| if ((((chart.getSource() != null) && (chart.getSource().getDatamartRef() != null)) && (chart.getSource().getDatamartRef().getName() != null))) { |
| return chart.getSource().getDatamartRef().getName().toString(); |
| } else { |
| return null; |
| } |
| } |
| |
| /** |
| * <p>build the main method to be called from e4.</p> |
| */ |
| public String createView(final Chart chart) { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("eclipseContext.set(IE4Focusable.class, this);"); |
| _builder.newLine(); |
| _builder.append("charts = new ArrayList<DCharts>();"); |
| _builder.newLine(); |
| _builder.append("coordinateSystem = new ArrayList<Integer>();"); |
| _builder.newLine(); |
| _builder.append("parent.setPrimaryStyleName(\"osbp\"); // <== is THIS necessary any more???"); |
| _builder.newLine(); |
| _builder.append("parent.addStyleName(\""); |
| String _styleName = EnumCssClass.VIEW.styleName(); |
| _builder.append(_styleName); |
| _builder.append("\");"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("parent.addStyleName(\""); |
| String _styleName_1 = EnumCssClass.CHART_VIEW.styleName(); |
| _builder.append(_styleName_1); |
| _builder.append("\");"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("parent.setSizeFull();"); |
| _builder.newLine(); |
| _builder.append("layoutManager = new ViewLayoutManager();"); |
| _builder.newLine(); |
| _builder.append("layoutManager.init(parent);"); |
| _builder.newLine(); |
| _builder.append("splitAdapter = new AdapterImpl() {"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("@Override"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("public void notifyChanged(Notification notification) {"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("if (notification.getEventType()==Notification.SET && "); |
| _builder.newLine(); |
| _builder.append("\t\t\t\t"); |
| _builder.append("notification.getFeatureID(UIElementImpl.class) == UiPackageImpl.UI_ELEMENT__CONTAINER_DATA)"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("{"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("log.debug(\"render due to split position changed\");"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("renderData();"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("};"); |
| _builder.newLine(); |
| _builder.append("sizeReporter = new SizeReporter(layoutManager.getDataArea());"); |
| _builder.newLine(); |
| _builder.append("resizeListener = new ComponentResizeListener() {"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("@Override"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("public void sizeChanged(ComponentResizeEvent event) {"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("boolean changed = false;"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("if (panelWidth != event.getWidth()) {"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("changed = true;"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("panelWidth = event.getWidth();"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("if (panelHeight != event.getHeight()) {"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("changed = true;"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("panelHeight = event.getHeight();"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("if (changed) {"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("log.debug(\"Panel size changed : \" + event.getWidth() + \" x \" + event.getHeight());"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("renderData();"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("};"); |
| _builder.newLine(); |
| _builder.append("datamartInstance = new "); |
| String _sourceDataMartRefName = this.getSourceDataMartRefName(chart); |
| _builder.append(_sourceDataMartRefName); |
| _builder.append("Datamart();"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("datamartInstance.setUser(user);"); |
| _builder.newLine(); |
| _builder.append("filterGenerator = new DatamartFilterGenerator(datamartInstance, eclipseContext, "); |
| boolean _booleanValue = Boolean.valueOf(chart.getSource().getDatamartRef().isShowCaption()).booleanValue(); |
| _builder.append(_booleanValue); |
| _builder.append(", "); |
| int _max = Integer.max(10, chart.getSource().getDatamartRef().getNumMultiRows()); |
| _builder.append(_max); |
| _builder.append(");"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("filterGenerator.createUIFilters(layoutManager);"); |
| _builder.newLine(); |
| _builder.append("attributeLookupMap = new HashMap<String,PropertyLookup>();"); |
| _builder.newLine(); |
| String body = _builder.toString(); |
| ActionToolbar _toolbar = chart.getToolbar(); |
| boolean _tripleNotEquals = (_toolbar != null); |
| if (_tripleNotEquals) { |
| StringConcatenation _builder_1 = new StringConcatenation(); |
| _builder_1.append(body); |
| _builder_1.newLineIfNotEmpty(); |
| _builder_1.append("toolbarUUID = UUID.randomUUID().toString();"); |
| _builder_1.newLine(); |
| _builder_1.append("toolbarClass = new "); |
| String _firstUpper = StringExtensions.toFirstUpper(chart.getToolbar().getName().toString()); |
| _builder_1.append(_firstUpper); |
| _builder_1.append("Toolbar();"); |
| _builder_1.newLineIfNotEmpty(); |
| _builder_1.append("toolbarClass.createToolbar(eclipseContext, renderingEngine, themeResourceService, toolbarUUID);"); |
| body = _builder_1.toString(); |
| } |
| StringConcatenation _builder_2 = new StringConcatenation(); |
| _builder_2.append(body); |
| _builder_2.newLineIfNotEmpty(); |
| _builder_2.append("refreshView = "); |
| String _refreshView = this.refreshView(chart); |
| _builder_2.append(_refreshView); |
| _builder_2.newLineIfNotEmpty(); |
| body = _builder_2.toString(); |
| return body; |
| } |
| |
| /** |
| * <p>create a handler for external triggered refresh requests.</p> |
| */ |
| public String refreshView(final Chart chart) { |
| String body = ""; |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append(body); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("new EventHandler() {"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("@Override"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("public void handleEvent(Event event) {"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("renderData();"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("};"); |
| _builder.newLine(); |
| body = _builder.toString(); |
| return body; |
| } |
| |
| /** |
| * <p>build the data components.</p> |
| */ |
| public String createComponents(final Chart chart) { |
| String body = ""; |
| ChartDatamart _source = chart.getSource(); |
| boolean _tripleNotEquals = (_source != null); |
| if (_tripleNotEquals) { |
| ChartDatamart _source_1 = chart.getSource(); |
| DatamartSource _source_2 = ((ChartDatamart) _source_1).getDatamartRef().getSource(); |
| boolean isCube = (_source_2 instanceof DatamartCube); |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append(body); |
| _builder.append("// get the results"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("if (panelWidth == 0 && panelHeight == 0) {"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("return;"); |
| _builder.newLine(); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("final DerivedCellSet cellSet = datamartInstance.getResults("); |
| { |
| if ((!isCube)) { |
| _builder.append("false, getTaskOperativeDtoClass(), getTaskInitialOperativeDtos()"); |
| } |
| } |
| _builder.append(");"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("getCoordinateSystem().clear();"); |
| _builder.newLine(); |
| _builder.append("charts.clear();"); |
| _builder.newLine(); |
| _builder.append("if (cellSet == null) {"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("promptSecurityMessage(dslMetadataService.translate(user.getLocale().toLanguageTag(), \"securityMessage\"), layoutManager.getDataArea());"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("return;"); |
| _builder.newLine(); |
| _builder.append("} else {"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("layoutManager.getDataArea().removeAllComponents();"); |
| _builder.newLine(); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("// generate a new result component"); |
| _builder.newLine(); |
| _builder.append("if (cellSet != null) {"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("// create a multidimensional coordinate system against the cellSet"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("for\t(int axis = 0; axis < cellSet.getAxes().size(); axis++) {"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("getCoordinateSystem().add(0);"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("// remove any previous component"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("if\t(dataComponent != null) {"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("layoutManager.getDataArea().removeComponent(dataComponent);"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("dataComponent = null;"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("if (cellSet.getAxes().size() < 2) {"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("log.error(\"at least 2 axes from referenced datamart "); |
| String _name = chart.getSource().getDatamartRef().getName(); |
| _builder.append(_name, "\t\t"); |
| _builder.append(" are needed to render "); |
| String _name_1 = chart.getName(); |
| _builder.append(_name_1, "\t\t"); |
| _builder.append("\");"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("\t"); |
| _builder.append("} else {"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("dataComponent = createTabSheet(cellSet, cellSet.getAxes().size());"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("if(dataComponent != null) {"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("dataComponent.setSizeFull();"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("dataComponent.setId(\"dataComponent\");"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("dataComponent.addStyleName(\""); |
| String _styleName = EnumCssClass.DATA_COMPONENT.styleName(); |
| _builder.append(_styleName, "\t\t\t"); |
| _builder.append("\");"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("\t\t\t"); |
| _builder.append("layoutManager.getDataArea().addComponent(dataComponent);"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("layoutManager.getDataArea().setExpandRatio(dataComponent, 1);"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("getParent().markAsDirtyRecursive();"); |
| _builder.newLine(); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("else {"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("log.error(\"referenced datamart "); |
| String _name_2 = chart.getSource().getDatamartRef().getName(); |
| _builder.append(_name_2, "\t"); |
| _builder.append(" generates no results\");"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("}"); |
| _builder.newLine(); |
| body = _builder.toString(); |
| } else { |
| StringConcatenation _builder_1 = new StringConcatenation(); |
| _builder_1.append(body); |
| _builder_1.newLineIfNotEmpty(); |
| _builder_1.append("// generate a new result component"); |
| _builder_1.newLine(); |
| _builder_1.append("try {"); |
| _builder_1.newLine(); |
| _builder_1.append("\t"); |
| _builder_1.append("// remove any previous component"); |
| _builder_1.newLine(); |
| _builder_1.append("\t"); |
| _builder_1.append("if\t(dataComponent != null) {"); |
| _builder_1.newLine(); |
| _builder_1.append("\t\t"); |
| _builder_1.append("layoutManager.getDataArea().removeComponent(dataComponent);"); |
| _builder_1.newLine(); |
| _builder_1.append("\t\t"); |
| _builder_1.append("dataComponent = null;"); |
| _builder_1.newLine(); |
| _builder_1.append("\t"); |
| _builder_1.append("}\t\t\t\t"); |
| _builder_1.newLine(); |
| _builder_1.append("\t"); |
| _builder_1.append("dataComponent = createTabSheet(null, 2);"); |
| _builder_1.newLine(); |
| _builder_1.append("\t"); |
| _builder_1.append("dataComponent.setSizeFull();"); |
| _builder_1.newLine(); |
| _builder_1.append("\t"); |
| _builder_1.append("dataComponent.setId(\"dataComponent\");"); |
| _builder_1.newLine(); |
| _builder_1.append("\t"); |
| _builder_1.append("dataComponent.addStyleName(\""); |
| String _styleName_1 = EnumCssClass.DATA_COMPONENT.styleName(); |
| _builder_1.append(_styleName_1, "\t"); |
| _builder_1.append("\");"); |
| _builder_1.newLineIfNotEmpty(); |
| _builder_1.append("\t"); |
| _builder_1.append("layoutManager.getDataArea().addComponent(dataComponent);"); |
| _builder_1.newLine(); |
| _builder_1.append("\t"); |
| _builder_1.append("layoutManager.getDataArea().setExpandRatio(dataComponent, 1);"); |
| _builder_1.newLine(); |
| _builder_1.append("} catch (DerivedOlapException e) {"); |
| _builder_1.newLine(); |
| _builder_1.append("\t"); |
| _builder_1.append("log.error(e.getLocalizedMessage());"); |
| _builder_1.newLine(); |
| _builder_1.append("}"); |
| _builder_1.newLine(); |
| body = _builder_1.toString(); |
| } |
| return body; |
| } |
| |
| /** |
| * <p>if more than 2 axes (dimensions) are found in the cellSet, build recursive tabsheets as long as the remaining axes are more than 2.</p> |
| */ |
| public String createTabSheet(final Chart chart) { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("// either create a recursive tabsheet or a chart"); |
| _builder.newLine(); |
| _builder.append("Component component = null;"); |
| _builder.newLine(); |
| _builder.append("if\t(axisNo == 2) {"); |
| _builder.newLine(); |
| String body = _builder.toString(); |
| ChartOption _charttype = chart.getCharttype(); |
| if ((_charttype instanceof ChartTree)) { |
| StringConcatenation _builder_1 = new StringConcatenation(); |
| _builder_1.append(body); |
| _builder_1.newLineIfNotEmpty(); |
| _builder_1.append("\t"); |
| _builder_1.append("try {"); |
| _builder_1.newLine(); |
| _builder_1.append("\t\t"); |
| _builder_1.append("component = createD3Chart(cellSet);"); |
| _builder_1.newLine(); |
| _builder_1.append("\t"); |
| _builder_1.append("} catch (JsonException e) {"); |
| _builder_1.newLine(); |
| _builder_1.append("\t\t"); |
| _builder_1.append("log.error(e.getLocalizedMessage());"); |
| _builder_1.newLine(); |
| _builder_1.append("\t"); |
| _builder_1.append("}"); |
| _builder_1.newLine(); |
| body = _builder_1.toString(); |
| } else { |
| StringConcatenation _builder_2 = new StringConcatenation(); |
| _builder_2.append(body); |
| _builder_2.newLineIfNotEmpty(); |
| _builder_2.append("\t"); |
| _builder_2.append("component = createChart(cellSet);"); |
| _builder_2.newLine(); |
| body = _builder_2.toString(); |
| } |
| StringConcatenation _builder_3 = new StringConcatenation(); |
| _builder_3.append(body); |
| _builder_3.newLineIfNotEmpty(); |
| _builder_3.append("}"); |
| _builder_3.newLine(); |
| _builder_3.append("else {\t\t"); |
| _builder_3.newLine(); |
| _builder_3.append("\t"); |
| _builder_3.append("Integer axis = axisNo-1;"); |
| _builder_3.newLine(); |
| _builder_3.append("\t"); |
| _builder_3.append("TabSheet tabsheet = new TabSheet();"); |
| _builder_3.newLine(); |
| _builder_3.append("\t"); |
| _builder_3.append("tabsheet.setSizeFull();"); |
| _builder_3.newLine(); |
| _builder_3.append("\t"); |
| _builder_3.append("DerivedAxis tabAxis = cellSet.getAxes().get(axis);"); |
| _builder_3.newLine(); |
| _builder_3.append("\t"); |
| _builder_3.append("// create a tab page for all tab axis members"); |
| _builder_3.newLine(); |
| _builder_3.append("\t"); |
| _builder_3.append("int tabNo = 0;"); |
| _builder_3.newLine(); |
| _builder_3.append("\t"); |
| _builder_3.append("for\t(DerivedPosition column : tabAxis.getPositions()) {"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t"); |
| _builder_3.append("// create the title for the axis"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t"); |
| _builder_3.append("String title = null;"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t"); |
| _builder_3.append("for (DerivedMember member : column.getMembers()) {"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t\t"); |
| _builder_3.append("if\t(title == null) {"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t\t\t"); |
| _builder_3.append("title = dslMetadataService.translate(user.getLocale().toLanguageTag(), member.getCaption());"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t\t"); |
| _builder_3.append("}"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t\t"); |
| _builder_3.append("else {"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t\t\t"); |
| _builder_3.append("title += \" / \"+dslMetadataService.translate(user.getLocale().toLanguageTag(), member.getCaption());"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t\t"); |
| _builder_3.append("}"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t"); |
| _builder_3.append("}"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t"); |
| _builder_3.append("// position the data to this coordinate"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t"); |
| _builder_3.append("getCoordinateSystem().set(axis, tabNo);"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t"); |
| _builder_3.append("component = createTabSheet(cellSet, axis);"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t"); |
| _builder_3.append("// set the caption"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t"); |
| _builder_3.append("if (component != null) {"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t\t"); |
| _builder_3.append("component.setCaption(title);"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t\t"); |
| _builder_3.append("// add the component as a tab page"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t\t"); |
| _builder_3.append("tabsheet.addComponent(component);"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t"); |
| _builder_3.append("}"); |
| _builder_3.newLine(); |
| _builder_3.append("\t\t"); |
| _builder_3.append("tabNo++;"); |
| _builder_3.newLine(); |
| _builder_3.append("\t"); |
| _builder_3.append("}"); |
| _builder_3.newLine(); |
| _builder_3.append("\t"); |
| _builder_3.append("component = tabsheet;"); |
| _builder_3.newLine(); |
| _builder_3.append("}"); |
| _builder_3.newLine(); |
| _builder_3.append("return component;"); |
| body = _builder_3.toString(); |
| return body; |
| } |
| |
| /** |
| * <p>build the chart components.</p> |
| */ |
| public String createChart(final Chart chart) { |
| String body = ""; |
| String postfix = ""; |
| String chartType = ""; |
| boolean hasAxis = true; |
| HashMap<String, String> multipleAxes = CollectionLiterals.<String, String>newHashMap(); |
| ChartAxis category_axis = null; |
| ChartAxis data_axis = null; |
| ChartAxis inner_axis = null; |
| ChartAxis outer_axis = null; |
| boolean axisSwitch = false; |
| String axisPrefix = "XY"; |
| EObject _eContainer = chart.eContainer(); |
| CanvasFontFamilyEnum fontFamily = ((ChartPackage) _eContainer).getDefaultFontFamily(); |
| ChartOption _charttype = chart.getCharttype(); |
| if ((_charttype instanceof ChartBar)) { |
| ChartOption _charttype_1 = chart.getCharttype(); |
| boolean _isSwapped = ((ChartBar) _charttype_1).isSwapped(); |
| if (_isSwapped) { |
| axisPrefix = "YX"; |
| axisSwitch = true; |
| } |
| } |
| EList<ChartElement> _elements = chart.getSource().getElements(); |
| for (final ChartElement element : _elements) { |
| if ((element instanceof ChartAxis)) { |
| ChartAxis axis = ((ChartAxis) element); |
| if ((axis.getAxis().getName().getName().equals("COLUMNS") || axis.getAxis().getName().getName().equals("ROWS"))) { |
| if (((axis.getRenderType().getName().equals("LOG") || axis.getRenderType().getName().equals("LINEAR")) || axis.getRenderType().getName().equals("PYRAMID"))) { |
| data_axis = axis; |
| } |
| if ((axis.getRenderType().getName().equals("CATEGORY") || axis.getRenderType().getName().equals("DATE"))) { |
| category_axis = axis; |
| } |
| } |
| } |
| } |
| ChartOption _charttype_2 = chart.getCharttype(); |
| if ((_charttype_2 instanceof ChartBar)) { |
| chartType = "BAR"; |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("_"); |
| _builder.append(chartType); |
| postfix = _builder.toString(); |
| inner_axis = category_axis; |
| outer_axis = data_axis; |
| } else { |
| ChartOption _charttype_3 = chart.getCharttype(); |
| if ((_charttype_3 instanceof ChartBubble)) { |
| chartType = "BUBBLE"; |
| StringConcatenation _builder_1 = new StringConcatenation(); |
| _builder_1.append("_"); |
| _builder_1.append(chartType); |
| postfix = _builder_1.toString(); |
| hasAxis = true; |
| inner_axis = data_axis; |
| outer_axis = category_axis; |
| } else { |
| ChartOption _charttype_4 = chart.getCharttype(); |
| if ((_charttype_4 instanceof ChartDonut)) { |
| chartType = "DONUT"; |
| hasAxis = false; |
| inner_axis = category_axis; |
| outer_axis = data_axis; |
| } else { |
| ChartOption _charttype_5 = chart.getCharttype(); |
| if ((_charttype_5 instanceof ChartLine)) { |
| chartType = "LINE"; |
| inner_axis = category_axis; |
| outer_axis = data_axis; |
| } else { |
| ChartOption _charttype_6 = chart.getCharttype(); |
| if ((_charttype_6 instanceof ChartPie)) { |
| chartType = "PIE"; |
| hasAxis = false; |
| inner_axis = data_axis; |
| outer_axis = category_axis; |
| } else { |
| ChartOption _charttype_7 = chart.getCharttype(); |
| if ((_charttype_7 instanceof ChartGauge)) { |
| chartType = "METER_GAUGE"; |
| hasAxis = false; |
| inner_axis = data_axis; |
| outer_axis = category_axis; |
| } |
| } |
| } |
| } |
| } |
| } |
| StringConcatenation _builder_2 = new StringConcatenation(); |
| _builder_2.append("List<Integer> coordinate = new ArrayList<Integer>(getCoordinateSystem());"); |
| _builder_2.newLine(); |
| body = _builder_2.toString(); |
| StringConcatenation _builder_3 = new StringConcatenation(); |
| _builder_3.append(body); |
| _builder_3.append("// create a label series"); |
| _builder_3.newLineIfNotEmpty(); |
| _builder_3.append("List<String> "); |
| String _literal = data_axis.getAxis().getName().getLiteral(); |
| _builder_3.append(_literal); |
| _builder_3.append("TitlesArray = new ArrayList<String>();"); |
| _builder_3.newLineIfNotEmpty(); |
| _builder_3.append("for\t(DerivedPosition pos : cellSet.getAxes().get("); |
| int _value = data_axis.getAxis().getName().getValue(); |
| _builder_3.append(_value); |
| _builder_3.append(").getPositions()) {"); |
| _builder_3.newLineIfNotEmpty(); |
| body = _builder_3.toString(); |
| StringConcatenation _builder_4 = new StringConcatenation(); |
| _builder_4.append(body); |
| _builder_4.newLineIfNotEmpty(); |
| _builder_4.append("\t"); |
| _builder_4.append("String title = null;"); |
| _builder_4.newLine(); |
| _builder_4.append("\t"); |
| _builder_4.append("for (DerivedMember member : pos.getMembers()) {"); |
| _builder_4.newLine(); |
| _builder_4.append("\t\t"); |
| _builder_4.append("if(member.getType() == MemberType.MEASURE || member.getType() == MemberType.FORMULA) {"); |
| _builder_4.newLine(); |
| _builder_4.append("\t\t\t"); |
| _builder_4.append("if\t(title == null) {"); |
| _builder_4.newLine(); |
| _builder_4.append("\t\t\t\t"); |
| _builder_4.append("title = dslMetadataService.translate(user.getLocale().toLanguageTag(), member.getCaption());"); |
| _builder_4.newLine(); |
| _builder_4.append("\t\t\t"); |
| _builder_4.append("}"); |
| _builder_4.newLine(); |
| _builder_4.append("\t\t\t"); |
| _builder_4.append("else {"); |
| _builder_4.newLine(); |
| _builder_4.append("\t\t\t\t"); |
| _builder_4.append("title += \" \"+dslMetadataService.translate(user.getLocale().toLanguageTag(), member.getCaption());"); |
| _builder_4.newLine(); |
| _builder_4.append("\t\t\t"); |
| _builder_4.append("}"); |
| _builder_4.newLine(); |
| _builder_4.append("\t\t"); |
| _builder_4.append("}"); |
| _builder_4.newLine(); |
| _builder_4.append("\t"); |
| _builder_4.append("}"); |
| _builder_4.newLine(); |
| _builder_4.append("\t"); |
| _builder_4.append("if(title != null) {"); |
| _builder_4.newLine(); |
| _builder_4.append("\t\t"); |
| String _literal_1 = data_axis.getAxis().getName().getLiteral(); |
| _builder_4.append(_literal_1, "\t\t"); |
| _builder_4.append("TitlesArray.add(title);"); |
| _builder_4.newLineIfNotEmpty(); |
| _builder_4.append("\t"); |
| _builder_4.append("}"); |
| _builder_4.newLine(); |
| _builder_4.append("}"); |
| _builder_4.newLine(); |
| body = _builder_4.toString(); |
| if (hasAxis) { |
| StringConcatenation _builder_5 = new StringConcatenation(); |
| _builder_5.append(body); |
| _builder_5.append("Series "); |
| String _literal_2 = data_axis.getAxis().getName().getLiteral(); |
| _builder_5.append(_literal_2); |
| _builder_5.append("Series = new Series();"); |
| _builder_5.newLineIfNotEmpty(); |
| body = _builder_5.toString(); |
| StringConcatenation _builder_6 = new StringConcatenation(); |
| _builder_6.append(body); |
| _builder_6.append("if ("); |
| String _literal_3 = data_axis.getAxis().getName().getLiteral(); |
| _builder_6.append(_literal_3); |
| _builder_6.append("TitlesArray.size() > 0) {"); |
| _builder_6.newLineIfNotEmpty(); |
| body = _builder_6.toString(); |
| boolean showMarker = false; |
| ChartOption _charttype_8 = chart.getCharttype(); |
| if ((_charttype_8 instanceof ChartLine)) { |
| ChartOption _charttype_9 = chart.getCharttype(); |
| showMarker = ((ChartLine) _charttype_9).isShowMarker(); |
| } |
| StringConcatenation _builder_7 = new StringConcatenation(); |
| _builder_7.append(body); |
| String _createLabelSeries = this.createLabelSeries(chart, data_axis, multipleAxes, axisPrefix, showMarker); |
| _builder_7.append(_createLabelSeries); |
| body = _builder_7.toString(); |
| StringConcatenation _builder_8 = new StringConcatenation(); |
| _builder_8.append(body); |
| _builder_8.append("}"); |
| _builder_8.newLineIfNotEmpty(); |
| body = _builder_8.toString(); |
| } |
| StringConcatenation _builder_9 = new StringConcatenation(); |
| _builder_9.append(body); |
| _builder_9.append("// create the data series ticks"); |
| _builder_9.newLineIfNotEmpty(); |
| _builder_9.append("String "); |
| String _literal_4 = category_axis.getAxis().getName().getLiteral(); |
| _builder_9.append(_literal_4); |
| _builder_9.append("AxisLabel = \"\";"); |
| _builder_9.newLineIfNotEmpty(); |
| _builder_9.append("Boolean "); |
| String _literal_5 = category_axis.getAxis().getName().getLiteral(); |
| _builder_9.append(_literal_5); |
| _builder_9.append("AxisLabelSet = false;"); |
| _builder_9.newLineIfNotEmpty(); |
| _builder_9.append("List<String> "); |
| String _literal_6 = category_axis.getAxis().getName().getLiteral(); |
| _builder_9.append(_literal_6); |
| _builder_9.append("TitlesArray = new ArrayList<String>();"); |
| _builder_9.newLineIfNotEmpty(); |
| _builder_9.append("for\t(DerivedPosition pos : cellSet.getAxes().get("); |
| int _value_1 = category_axis.getAxis().getName().getValue(); |
| _builder_9.append(_value_1); |
| _builder_9.append(").getPositions()) {"); |
| _builder_9.newLineIfNotEmpty(); |
| _builder_9.append("\t"); |
| _builder_9.append("String title = \"\";"); |
| _builder_9.newLine(); |
| _builder_9.append("\t"); |
| _builder_9.append("for (DerivedMember member : pos.getMembers()) {"); |
| _builder_9.newLine(); |
| _builder_9.append("\t\t"); |
| _builder_9.append("if(member.getType() == MemberType.REGULAR) {"); |
| _builder_9.newLine(); |
| _builder_9.append("\t \t"); |
| _builder_9.append("String[] tokens = member.getUniqueName().split(\"\\\\]\\\\.\\\\[\");"); |
| _builder_9.newLine(); |
| _builder_9.append("\t \t"); |
| _builder_9.append("if (!"); |
| String _literal_7 = category_axis.getAxis().getName().getLiteral(); |
| _builder_9.append(_literal_7, "\t \t"); |
| _builder_9.append("AxisLabelSet) {"); |
| _builder_9.newLineIfNotEmpty(); |
| _builder_9.append("\t \t\t"); |
| _builder_9.append("if ("); |
| String _literal_8 = category_axis.getAxis().getName().getLiteral(); |
| _builder_9.append(_literal_8, "\t \t\t"); |
| _builder_9.append("AxisLabel.length() > 0) {"); |
| _builder_9.newLineIfNotEmpty(); |
| _builder_9.append("\t \t\t\t"); |
| String _literal_9 = category_axis.getAxis().getName().getLiteral(); |
| _builder_9.append(_literal_9, "\t \t\t\t"); |
| _builder_9.append("AxisLabel += \" / \";"); |
| _builder_9.newLineIfNotEmpty(); |
| _builder_9.append("\t \t\t"); |
| _builder_9.append("}"); |
| _builder_9.newLine(); |
| _builder_9.append("\t \t\t"); |
| String _literal_10 = category_axis.getAxis().getName().getLiteral(); |
| _builder_9.append(_literal_10, "\t \t\t"); |
| _builder_9.append("AxisLabel += dslMetadataService.translate(user.getLocale().toLanguageTag(), member.getLevel().getName());"); |
| _builder_9.newLineIfNotEmpty(); |
| _builder_9.append("\t \t"); |
| _builder_9.append("}"); |
| _builder_9.newLine(); |
| _builder_9.append("\t \t"); |
| _builder_9.append("int start = 1;"); |
| _builder_9.newLine(); |
| _builder_9.append("\t \t"); |
| _builder_9.append("// if shortlabel is configured, use only last level name"); |
| _builder_9.newLine(); |
| _builder_9.append("\t \t"); |
| _builder_9.append("if ("); |
| boolean _booleanValue = Boolean.valueOf(category_axis.isShortLabel()).booleanValue(); |
| _builder_9.append(_booleanValue, "\t \t"); |
| _builder_9.append(") {"); |
| _builder_9.newLineIfNotEmpty(); |
| _builder_9.append("\t \t\t"); |
| _builder_9.append("start = tokens.length-1;"); |
| _builder_9.newLine(); |
| _builder_9.append("\t \t"); |
| _builder_9.append("}"); |
| _builder_9.newLine(); |
| _builder_9.append("\t \t"); |
| _builder_9.append("for\t(int token = start; token < tokens.length; token++) {"); |
| _builder_9.newLine(); |
| _builder_9.append("\t \t\t"); |
| _builder_9.append("title += dslMetadataService.translate(user.getLocale().toLanguageTag(), tokens[token])+\" \";"); |
| _builder_9.newLine(); |
| _builder_9.append("\t \t"); |
| _builder_9.append("}"); |
| _builder_9.newLine(); |
| _builder_9.append("\t "); |
| _builder_9.append("}"); |
| _builder_9.newLine(); |
| _builder_9.append("\t"); |
| _builder_9.append("}"); |
| _builder_9.newLine(); |
| _builder_9.append("\t"); |
| _builder_9.append("if(title != null) {"); |
| _builder_9.newLine(); |
| _builder_9.append("\t\t"); |
| String _literal_11 = category_axis.getAxis().getName().getLiteral(); |
| _builder_9.append(_literal_11, "\t\t"); |
| _builder_9.append("AxisLabelSet = true;"); |
| _builder_9.newLineIfNotEmpty(); |
| _builder_9.append("\t\t"); |
| String _literal_12 = category_axis.getAxis().getName().getLiteral(); |
| _builder_9.append(_literal_12, "\t\t"); |
| _builder_9.append("TitlesArray.add(title.trim().replace(\"[\", \"\").replace(\"]\", \"\"));"); |
| _builder_9.newLineIfNotEmpty(); |
| _builder_9.append("\t"); |
| _builder_9.append("}"); |
| _builder_9.newLine(); |
| _builder_9.append("}"); |
| _builder_9.newLine(); |
| body = _builder_9.toString(); |
| if (hasAxis) { |
| StringConcatenation _builder_10 = new StringConcatenation(); |
| _builder_10.append(body); |
| _builder_10.append("Ticks "); |
| String _literal_13 = category_axis.getAxis().getName().getLiteral(); |
| _builder_10.append(_literal_13); |
| _builder_10.append("Ticks = new Ticks();"); |
| _builder_10.newLineIfNotEmpty(); |
| String _literal_14 = category_axis.getAxis().getName().getLiteral(); |
| _builder_10.append(_literal_14); |
| _builder_10.append("Ticks.add("); |
| String _literal_15 = category_axis.getAxis().getName().getLiteral(); |
| _builder_10.append(_literal_15); |
| _builder_10.append("TitlesArray.toArray());"); |
| _builder_10.newLineIfNotEmpty(); |
| body = _builder_10.toString(); |
| } |
| StringConcatenation _builder_11 = new StringConcatenation(); |
| _builder_11.append(body); |
| _builder_11.newLineIfNotEmpty(); |
| _builder_11.append("if("); |
| String _literal_16 = category_axis.getAxis().getName().getLiteral(); |
| _builder_11.append(_literal_16); |
| _builder_11.append("TitlesArray.isEmpty()) {"); |
| _builder_11.newLineIfNotEmpty(); |
| _builder_11.append("\t"); |
| _builder_11.append("return null;"); |
| _builder_11.newLine(); |
| _builder_11.append("}"); |
| _builder_11.newLine(); |
| _builder_11.append("// copy cellset data to data series"); |
| _builder_11.newLine(); |
| _builder_11.append("DataSeries dataSeries = new DataSeries();"); |
| _builder_11.newLine(); |
| body = _builder_11.toString(); |
| ChartOption _charttype_10 = chart.getCharttype(); |
| if ((_charttype_10 instanceof ChartBubble)) { |
| StringConcatenation _builder_12 = new StringConcatenation(); |
| _builder_12.append(body); |
| _builder_12.append("dataSeries.newSeries();"); |
| _builder_12.newLineIfNotEmpty(); |
| body = _builder_12.toString(); |
| } |
| StringConcatenation _builder_13 = new StringConcatenation(); |
| _builder_13.append(body); |
| _builder_13.append("int "); |
| String _literal_17 = outer_axis.getAxis().getName().getLiteral(); |
| _builder_13.append(_literal_17); |
| _builder_13.append("No = 0;"); |
| _builder_13.newLineIfNotEmpty(); |
| body = _builder_13.toString(); |
| StringConcatenation _builder_14 = new StringConcatenation(); |
| _builder_14.append(body); |
| _builder_14.append("for\t(DerivedPosition "); |
| String _literal_18 = outer_axis.getAxis().getName().getLiteral(); |
| _builder_14.append(_literal_18); |
| _builder_14.append("Pos : cellSet.getAxes().get("); |
| int _value_2 = outer_axis.getAxis().getName().getValue(); |
| _builder_14.append(_value_2); |
| _builder_14.append(").getPositions()) {"); |
| _builder_14.newLineIfNotEmpty(); |
| body = _builder_14.toString(); |
| StringConcatenation _builder_15 = new StringConcatenation(); |
| _builder_15.append(body); |
| _builder_15.append("\tcoordinate.set("); |
| int _value_3 = outer_axis.getAxis().getName().getValue(); |
| _builder_15.append(_value_3); |
| _builder_15.append(", "); |
| String _literal_19 = outer_axis.getAxis().getName().getLiteral(); |
| _builder_15.append(_literal_19); |
| _builder_15.append("No);"); |
| _builder_15.newLineIfNotEmpty(); |
| body = _builder_15.toString(); |
| ChartOption _charttype_11 = chart.getCharttype(); |
| if ((_charttype_11 instanceof ChartDonut)) { |
| StringConcatenation _builder_16 = new StringConcatenation(); |
| _builder_16.append(body); |
| _builder_16.append("\tdataSeries.newSeries();"); |
| _builder_16.newLineIfNotEmpty(); |
| body = _builder_16.toString(); |
| } |
| if (((!(chart.getCharttype() instanceof ChartPie)) && (!(chart.getCharttype() instanceof ChartDonut)))) { |
| StringConcatenation _builder_17 = new StringConcatenation(); |
| _builder_17.append(body); |
| _builder_17.append("\tArrayList<Object> "); |
| String _literal_20 = inner_axis.getAxis().getName().getLiteral(); |
| _builder_17.append(_literal_20); |
| _builder_17.append("DataSeries = new ArrayList<Object>();"); |
| _builder_17.newLineIfNotEmpty(); |
| body = _builder_17.toString(); |
| } |
| boolean _equals = Objects.equal(outer_axis, data_axis); |
| if (_equals) { |
| StringConcatenation _builder_18 = new StringConcatenation(); |
| _builder_18.append(body); |
| _builder_18.append("\tif("); |
| String _literal_21 = outer_axis.getAxis().getName().getLiteral(); |
| _builder_18.append(_literal_21); |
| _builder_18.append("Pos.getMembers().get(0).getType() == MemberType.MEASURE || "); |
| String _literal_22 = outer_axis.getAxis().getName().getLiteral(); |
| _builder_18.append(_literal_22); |
| _builder_18.append("Pos.getMembers().get(0).getType() == MemberType.FORMULA) {"); |
| _builder_18.newLineIfNotEmpty(); |
| body = _builder_18.toString(); |
| } else { |
| StringConcatenation _builder_19 = new StringConcatenation(); |
| _builder_19.append(body); |
| _builder_19.append("\tif("); |
| String _literal_23 = outer_axis.getAxis().getName().getLiteral(); |
| _builder_19.append(_literal_23); |
| _builder_19.append("Pos.getMembers().get(0).getType() == MemberType.REGULAR) {"); |
| _builder_19.newLineIfNotEmpty(); |
| body = _builder_19.toString(); |
| } |
| StringConcatenation _builder_20 = new StringConcatenation(); |
| _builder_20.append(body); |
| _builder_20.append("\t\tint "); |
| String _literal_24 = inner_axis.getAxis().getName().getLiteral(); |
| _builder_20.append(_literal_24); |
| _builder_20.append("No = 0;"); |
| _builder_20.newLineIfNotEmpty(); |
| body = _builder_20.toString(); |
| StringConcatenation _builder_21 = new StringConcatenation(); |
| _builder_21.append(body); |
| _builder_21.append("\t\tfor\t(DerivedPosition "); |
| String _literal_25 = inner_axis.getAxis().getName().getLiteral(); |
| _builder_21.append(_literal_25); |
| _builder_21.append("Pos : cellSet.getAxes().get("); |
| int _value_4 = inner_axis.getAxis().getName().getValue(); |
| _builder_21.append(_value_4); |
| _builder_21.append(").getPositions()) {"); |
| _builder_21.newLineIfNotEmpty(); |
| body = _builder_21.toString(); |
| boolean _equals_1 = Objects.equal(inner_axis, data_axis); |
| if (_equals_1) { |
| StringConcatenation _builder_22 = new StringConcatenation(); |
| _builder_22.append(body); |
| _builder_22.append("\t\t\tif("); |
| String _literal_26 = inner_axis.getAxis().getName().getLiteral(); |
| _builder_22.append(_literal_26); |
| _builder_22.append("Pos.getMembers().get(0).getType() == MemberType.MEASURE || "); |
| String _literal_27 = inner_axis.getAxis().getName().getLiteral(); |
| _builder_22.append(_literal_27); |
| _builder_22.append("Pos.getMembers().get(0).getType() == MemberType.FORMULA) {"); |
| _builder_22.newLineIfNotEmpty(); |
| body = _builder_22.toString(); |
| } else { |
| StringConcatenation _builder_23 = new StringConcatenation(); |
| _builder_23.append(body); |
| _builder_23.append("\t\t\tif("); |
| String _literal_28 = inner_axis.getAxis().getName().getLiteral(); |
| _builder_23.append(_literal_28); |
| _builder_23.append("Pos.getMembers().get(0).getType() == MemberType.REGULAR) {"); |
| _builder_23.newLineIfNotEmpty(); |
| body = _builder_23.toString(); |
| } |
| ChartOption _charttype_12 = chart.getCharttype(); |
| if ((_charttype_12 instanceof ChartPie)) { |
| StringConcatenation _builder_24 = new StringConcatenation(); |
| _builder_24.append(body); |
| _builder_24.append("\t\t\t\tdataSeries.newSeries();"); |
| _builder_24.newLineIfNotEmpty(); |
| body = _builder_24.toString(); |
| } |
| StringConcatenation _builder_25 = new StringConcatenation(); |
| _builder_25.append(body); |
| _builder_25.append("\t\t\t\tcoordinate.set("); |
| int _value_5 = inner_axis.getAxis().getName().getValue(); |
| _builder_25.append(_value_5); |
| _builder_25.append(", "); |
| String _literal_29 = inner_axis.getAxis().getName().getLiteral(); |
| _builder_25.append(_literal_29); |
| _builder_25.append("No);"); |
| _builder_25.newLineIfNotEmpty(); |
| body = _builder_25.toString(); |
| StringConcatenation _builder_26 = new StringConcatenation(); |
| _builder_26.append(body); |
| _builder_26.newLineIfNotEmpty(); |
| _builder_26.append("\t\t\t\t"); |
| _builder_26.append("Object value = null;"); |
| _builder_26.newLine(); |
| _builder_26.append("\t\t\t\t"); |
| _builder_26.append("DerivedCell cell = cellSet.getCell(coordinate);"); |
| _builder_26.newLine(); |
| _builder_26.append("\t\t\t\t"); |
| _builder_26.append("if (cell != null) {"); |
| _builder_26.newLine(); |
| _builder_26.append("\t\t\t\t\t"); |
| _builder_26.append("value = cell.getValue();"); |
| _builder_26.newLine(); |
| _builder_26.append("\t\t\t\t"); |
| _builder_26.append("}"); |
| _builder_26.newLine(); |
| body = _builder_26.toString(); |
| if (((chart.getCharttype() instanceof ChartPie) || (chart.getCharttype() instanceof ChartDonut))) { |
| StringConcatenation _builder_27 = new StringConcatenation(); |
| _builder_27.append(body); |
| _builder_27.append("\t\t\t\tdataSeries.add("); |
| String _literal_30 = outer_axis.getAxis().getName().getLiteral(); |
| _builder_27.append(_literal_30); |
| _builder_27.append("TitlesArray.get("); |
| String _literal_31 = outer_axis.getAxis().getName().getLiteral(); |
| _builder_27.append(_literal_31); |
| _builder_27.append("No),(value == null ? 0.0 : value));"); |
| _builder_27.newLineIfNotEmpty(); |
| body = _builder_27.toString(); |
| } else { |
| StringConcatenation _builder_28 = new StringConcatenation(); |
| _builder_28.append(body); |
| _builder_28.append("\t\t\t\t"); |
| String _literal_32 = inner_axis.getAxis().getName().getLiteral(); |
| _builder_28.append(_literal_32); |
| _builder_28.append("DataSeries.add(value == null ? 0.0 : value);"); |
| _builder_28.newLineIfNotEmpty(); |
| body = _builder_28.toString(); |
| } |
| StringConcatenation _builder_29 = new StringConcatenation(); |
| _builder_29.append(body); |
| _builder_29.append("\t\t\t\t"); |
| String _literal_33 = inner_axis.getAxis().getName().getLiteral(); |
| _builder_29.append(_literal_33); |
| _builder_29.append("No ++;"); |
| _builder_29.newLineIfNotEmpty(); |
| _builder_29.append("\t\t\t"); |
| _builder_29.append("}"); |
| _builder_29.newLine(); |
| _builder_29.append("\t\t"); |
| _builder_29.append("}"); |
| _builder_29.newLine(); |
| body = _builder_29.toString(); |
| if (((!(chart.getCharttype() instanceof ChartPie)) && (!(chart.getCharttype() instanceof ChartDonut)))) { |
| ChartOption _charttype_13 = chart.getCharttype(); |
| if ((_charttype_13 instanceof ChartBubble)) { |
| StringConcatenation _builder_30 = new StringConcatenation(); |
| _builder_30.append(body); |
| _builder_30.append("\t\t\t"); |
| String _literal_34 = inner_axis.getAxis().getName().getLiteral(); |
| _builder_30.append(_literal_34); |
| _builder_30.append("DataSeries.add("); |
| String _literal_35 = outer_axis.getAxis().getName().getLiteral(); |
| _builder_30.append(_literal_35); |
| _builder_30.append("TitlesArray.get("); |
| String _literal_36 = outer_axis.getAxis().getName().getLiteral(); |
| _builder_30.append(_literal_36); |
| _builder_30.append("No));"); |
| _builder_30.newLineIfNotEmpty(); |
| body = _builder_30.toString(); |
| } |
| StringConcatenation _builder_31 = new StringConcatenation(); |
| _builder_31.append(body); |
| _builder_31.append("\t\tdataSeries.add("); |
| String _literal_37 = inner_axis.getAxis().getName().getLiteral(); |
| _builder_31.append(_literal_37); |
| _builder_31.append("DataSeries.toArray());"); |
| _builder_31.newLineIfNotEmpty(); |
| body = _builder_31.toString(); |
| } |
| StringConcatenation _builder_32 = new StringConcatenation(); |
| _builder_32.append(body); |
| _builder_32.append("\t}"); |
| _builder_32.newLineIfNotEmpty(); |
| _builder_32.append("\t"); |
| String _literal_38 = outer_axis.getAxis().getName().getLiteral(); |
| _builder_32.append(_literal_38, "\t"); |
| _builder_32.append("No ++;"); |
| _builder_32.newLineIfNotEmpty(); |
| _builder_32.append("}"); |
| _builder_32.newLine(); |
| body = _builder_32.toString(); |
| StringConcatenation _builder_33 = new StringConcatenation(); |
| _builder_33.append(body); |
| _builder_33.append("SeriesDefaults seriesDefaults = new SeriesDefaults()"); |
| _builder_33.newLineIfNotEmpty(); |
| _builder_33.append("\t"); |
| _builder_33.append(".setRenderer(SeriesRenderers."); |
| _builder_33.append(chartType, "\t"); |
| _builder_33.append(");"); |
| _builder_33.newLineIfNotEmpty(); |
| body = _builder_33.toString(); |
| ChartOption _charttype_14 = chart.getCharttype(); |
| if ((_charttype_14 instanceof ChartLine)) { |
| StringConcatenation _builder_34 = new StringConcatenation(); |
| _builder_34.append(body); |
| _builder_34.append("seriesDefaults.setFillToZero("); |
| ChartOption _charttype_15 = chart.getCharttype(); |
| String _string = Boolean.valueOf(Boolean.valueOf(((ChartLine) _charttype_15).isFillToZero()).booleanValue()).toString(); |
| _builder_34.append(_string); |
| _builder_34.append(").setFill("); |
| ChartOption _charttype_16 = chart.getCharttype(); |
| String _string_1 = Boolean.valueOf(((ChartLine) _charttype_16).isFillArea()).toString(); |
| _builder_34.append(_string_1); |
| _builder_34.append(");"); |
| _builder_34.newLineIfNotEmpty(); |
| body = _builder_34.toString(); |
| ChartOption _charttype_17 = chart.getCharttype(); |
| boolean _isTrendLine = ((ChartLine) _charttype_17).isTrendLine(); |
| if (_isTrendLine) { |
| StringConcatenation _builder_35 = new StringConcatenation(); |
| _builder_35.append(body); |
| _builder_35.append("seriesDefaults.setTrendline("); |
| _builder_35.newLineIfNotEmpty(); |
| _builder_35.append("\t"); |
| _builder_35.append("new Trendline().setShow(true).setLineWidth(1));"); |
| _builder_35.newLine(); |
| body = _builder_35.toString(); |
| } |
| } |
| StringConcatenation _builder_36 = new StringConcatenation(); |
| _builder_36.append(body); |
| _builder_36.append("Options options = new Options()"); |
| _builder_36.newLineIfNotEmpty(); |
| _builder_36.append("\t"); |
| _builder_36.append(".setSeriesDefaults(seriesDefaults);"); |
| _builder_36.newLine(); |
| body = _builder_36.toString(); |
| ChartOption _charttype_18 = chart.getCharttype(); |
| if ((_charttype_18 instanceof ChartPie)) { |
| StringConcatenation _builder_37 = new StringConcatenation(); |
| _builder_37.append(body); |
| _builder_37.append("seriesDefaults.setRendererOptions(new PieRenderer()"); |
| _builder_37.newLineIfNotEmpty(); |
| _builder_37.append("\t"); |
| _builder_37.append(".setShowDataLabels(true).setFill("); |
| ChartOption _charttype_19 = chart.getCharttype(); |
| boolean _isEmpty = ((ChartPie) _charttype_19).isEmpty(); |
| String _string_2 = Boolean.valueOf((!_isEmpty)).toString(); |
| _builder_37.append(_string_2, "\t"); |
| _builder_37.append("));"); |
| _builder_37.newLineIfNotEmpty(); |
| body = _builder_37.toString(); |
| } else { |
| ChartOption _charttype_20 = chart.getCharttype(); |
| if ((_charttype_20 instanceof ChartDonut)) { |
| StringConcatenation _builder_38 = new StringConcatenation(); |
| _builder_38.append(body); |
| _builder_38.append("seriesDefaults.setRendererOptions(new DonutRenderer()"); |
| _builder_38.newLineIfNotEmpty(); |
| _builder_38.append("\t"); |
| _builder_38.append(".setShowDataLabels(true)"); |
| _builder_38.newLine(); |
| _builder_38.append("\t"); |
| _builder_38.append(".setStartAngle(-90)"); |
| _builder_38.newLine(); |
| _builder_38.append("\t"); |
| _builder_38.append(".setSliceMargin(3));"); |
| _builder_38.newLine(); |
| body = _builder_38.toString(); |
| } else { |
| ChartOption _charttype_21 = chart.getCharttype(); |
| if ((_charttype_21 instanceof ChartBubble)) { |
| StringConcatenation _builder_39 = new StringConcatenation(); |
| _builder_39.append(body); |
| _builder_39.append("seriesDefaults.setRendererOptions(new BubbleRenderer()"); |
| _builder_39.newLineIfNotEmpty(); |
| _builder_39.append("\t"); |
| _builder_39.append(".setVaryBubbleColors(true)"); |
| _builder_39.newLine(); |
| _builder_39.append("\t"); |
| { |
| ChartOption _charttype_22 = chart.getCharttype(); |
| boolean _isMultiplier = ((ChartBubble) _charttype_22).isMultiplier(); |
| if (_isMultiplier) { |
| _builder_39.append(".setAutoscaleMultiplier("); |
| ChartOption _charttype_23 = chart.getCharttype(); |
| String _multiplierValue = ((ChartBubble) _charttype_23).getMultiplierValue(); |
| _builder_39.append(_multiplierValue, "\t"); |
| _builder_39.append("f)"); |
| } |
| } |
| _builder_39.newLineIfNotEmpty(); |
| _builder_39.append(" "); |
| { |
| ChartOption _charttype_24 = chart.getCharttype(); |
| boolean _isTransparent = ((ChartBubble) _charttype_24).isTransparent(); |
| if (_isTransparent) { |
| _builder_39.append(".setHighlightAlpha(0.8f).setBubbleAlpha(0.6f)"); |
| } |
| } |
| _builder_39.newLineIfNotEmpty(); |
| _builder_39.append("\t"); |
| { |
| ChartOption _charttype_25 = chart.getCharttype(); |
| boolean _isGradient = ((ChartBubble) _charttype_25).isGradient(); |
| if (_isGradient) { |
| _builder_39.append(".setBubbleGradients(true)"); |
| } |
| } |
| _builder_39.newLineIfNotEmpty(); |
| _builder_39.append("\t"); |
| _builder_39.append(".setShowLabels(false)"); |
| _builder_39.newLine(); |
| _builder_39.append("\t"); |
| _builder_39.append(".setAutoscaleBubbles(true));"); |
| _builder_39.newLine(); |
| body = _builder_39.toString(); |
| } else { |
| ChartOption _charttype_26 = chart.getCharttype(); |
| if ((_charttype_26 instanceof ChartGauge)) { |
| String intervalValues = ""; |
| String intervalColors = ""; |
| ChartOption _charttype_27 = chart.getCharttype(); |
| boolean _isHasIntervals = ((ChartGauge) _charttype_27).isHasIntervals(); |
| if (_isHasIntervals) { |
| ChartOption _charttype_28 = chart.getCharttype(); |
| EList<ChartInterval> _intervals = ((ChartGauge) _charttype_28).getIntervals(); |
| for (final ChartInterval interval : _intervals) { |
| if ((interval instanceof ChartNumberInterval)) { |
| StringConcatenation _builder_40 = new StringConcatenation(); |
| _builder_40.append(intervalValues); |
| { |
| int _length = intervalValues.length(); |
| boolean _greaterThan = (_length > 0); |
| if (_greaterThan) { |
| _builder_40.append(","); |
| } |
| } |
| int _numberIntervalValue = ((ChartNumberInterval) interval).getNumberIntervalValue(); |
| _builder_40.append(_numberIntervalValue); |
| _builder_40.append("f"); |
| intervalValues = _builder_40.toString(); |
| ChartRangeElement _numberRange = ((ChartNumberInterval) interval).getNumberRange(); |
| if ((_numberRange instanceof ChartSegmentColor)) { |
| StringConcatenation _builder_41 = new StringConcatenation(); |
| _builder_41.append(intervalColors); |
| { |
| int _length_1 = intervalColors.length(); |
| boolean _greaterThan_1 = (_length_1 > 0); |
| if (_greaterThan_1) { |
| _builder_41.append(","); |
| } |
| } |
| _builder_41.append("\""); |
| ChartRangeElement _numberRange_1 = ((ChartNumberInterval) interval).getNumberRange(); |
| String _hex = this.toHex(((ChartSegmentColor) _numberRange_1).getRgb()); |
| _builder_41.append(_hex); |
| _builder_41.append("\""); |
| intervalColors = _builder_41.toString(); |
| } |
| } |
| } |
| } |
| StringConcatenation _builder_42 = new StringConcatenation(); |
| _builder_42.append(body); |
| _builder_42.append("seriesDefaults.setRendererOptions(new MeterGaugeRenderer()"); |
| _builder_42.newLineIfNotEmpty(); |
| _builder_42.append("\t"); |
| _builder_42.append(".setShowTickLabels("); |
| ChartOption _charttype_29 = chart.getCharttype(); |
| String _string_3 = Boolean.valueOf(((ChartGauge) _charttype_29).isHasTicks()).toString(); |
| _builder_42.append(_string_3, "\t"); |
| _builder_42.append(")"); |
| _builder_42.newLineIfNotEmpty(); |
| _builder_42.append("\t"); |
| { |
| ChartOption _charttype_30 = chart.getCharttype(); |
| boolean _isLabeled = ((ChartGauge) _charttype_30).isLabeled(); |
| if (_isLabeled) { |
| _builder_42.append(".setLabel(\""); |
| ChartOption _charttype_31 = chart.getCharttype(); |
| String _labelValue = ((ChartGauge) _charttype_31).getLabelValue(); |
| _builder_42.append(_labelValue, "\t"); |
| _builder_42.append("\")"); |
| } |
| } |
| _builder_42.newLineIfNotEmpty(); |
| _builder_42.append("\t"); |
| { |
| ChartOption _charttype_32 = chart.getCharttype(); |
| boolean _isHasIntervals_1 = ((ChartGauge) _charttype_32).isHasIntervals(); |
| if (_isHasIntervals_1) { |
| _builder_42.append(".setIntervals("); |
| _builder_42.append(intervalValues, "\t"); |
| _builder_42.append(")"); |
| } |
| } |
| _builder_42.newLineIfNotEmpty(); |
| _builder_42.append("\t"); |
| { |
| ChartOption _charttype_33 = chart.getCharttype(); |
| boolean _isHasIntervals_2 = ((ChartGauge) _charttype_33).isHasIntervals(); |
| if (_isHasIntervals_2) { |
| _builder_42.append(".setIntervalColors("); |
| _builder_42.append(intervalColors, "\t"); |
| _builder_42.append(")"); |
| } |
| } |
| _builder_42.append(");"); |
| _builder_42.newLineIfNotEmpty(); |
| body = _builder_42.toString(); |
| } else { |
| ChartOption _charttype_34 = chart.getCharttype(); |
| if ((_charttype_34 instanceof ChartBar)) { |
| StringConcatenation _builder_43 = new StringConcatenation(); |
| _builder_43.append(body); |
| _builder_43.append("seriesDefaults.setFillToZero(true);"); |
| _builder_43.newLineIfNotEmpty(); |
| _builder_43.append("seriesDefaults.setRendererOptions(new BarRenderer()"); |
| _builder_43.newLine(); |
| _builder_43.append(" "); |
| { |
| if (axisSwitch) { |
| _builder_43.append(".setBarDirection(BarDirections.HOTIZONTAL));"); |
| } else { |
| _builder_43.append(".setBarDirection(BarDirections.VERTICAL));"); |
| } |
| } |
| _builder_43.newLineIfNotEmpty(); |
| body = _builder_43.toString(); |
| ChartOption _charttype_35 = chart.getCharttype(); |
| boolean _isStacked = ((ChartBar) _charttype_35).isStacked(); |
| if (_isStacked) { |
| StringConcatenation _builder_44 = new StringConcatenation(); |
| _builder_44.append(body); |
| _builder_44.append("options.setStackSeries(true);"); |
| _builder_44.newLineIfNotEmpty(); |
| body = _builder_44.toString(); |
| } |
| ChartOption _charttype_36 = chart.getCharttype(); |
| boolean _isShadow = ((ChartBar) _charttype_36).isShadow(); |
| if (_isShadow) { |
| StringConcatenation _builder_45 = new StringConcatenation(); |
| _builder_45.append(body); |
| _builder_45.append("seriesDefaults.setShadow(true).setShadowAlpha(0.05f);"); |
| _builder_45.newLineIfNotEmpty(); |
| body = _builder_45.toString(); |
| } |
| ChartOption _charttype_37 = chart.getCharttype(); |
| boolean _isAnimated = ((ChartBar) _charttype_37).isAnimated(); |
| if (_isAnimated) { |
| StringConcatenation _builder_46 = new StringConcatenation(); |
| _builder_46.append(body); |
| _builder_46.append("options.setAnimate(true);"); |
| _builder_46.newLineIfNotEmpty(); |
| body = _builder_46.toString(); |
| } |
| } |
| } |
| } |
| } |
| } |
| EObject _eContainer_1 = chart.eContainer(); |
| boolean _isHasColors = ((ChartPackage) _eContainer_1).isHasColors(); |
| if (_isHasColors) { |
| StringConcatenation _builder_47 = new StringConcatenation(); |
| _builder_47.append(body); |
| _builder_47.newLineIfNotEmpty(); |
| _builder_47.append("String[] seriesColors = "); |
| EObject _eContainer_2 = chart.eContainer(); |
| final Function<SeriesColor, String> _function = (SeriesColor it) -> { |
| StringConcatenation _builder_48 = new StringConcatenation(); |
| _builder_48.append("\""); |
| String _hex_1 = this.toHex(it.getRgb()); |
| _builder_48.append(_hex_1); |
| _builder_48.append("\""); |
| return _builder_48.toString(); |
| }; |
| String _collect = ((ChartPackage) _eContainer_2).getColors().stream().<String>map(_function).collect(Collectors.joining(",", "{", "}")); |
| _builder_47.append(_collect); |
| _builder_47.append(";"); |
| _builder_47.newLineIfNotEmpty(); |
| _builder_47.append("options.setSeriesColors(seriesColors);"); |
| _builder_47.newLine(); |
| body = _builder_47.toString(); |
| } |
| if (hasAxis) { |
| StringConcatenation _builder_48 = new StringConcatenation(); |
| _builder_48.append(body); |
| _builder_48.append("Axes axes = new Axes();"); |
| _builder_48.newLineIfNotEmpty(); |
| body = _builder_48.toString(); |
| ChartOption _charttype_38 = chart.getCharttype(); |
| if ((_charttype_38 instanceof ChartBubble)) { |
| StringConcatenation _builder_49 = new StringConcatenation(); |
| _builder_49.append(body); |
| _builder_49.newLineIfNotEmpty(); |
| CharSequence _canvasAxisRenderer = this.canvasAxisRenderer(data_axis, "x", "Tick", fontFamily); |
| _builder_49.append(_canvasAxisRenderer); |
| _builder_49.newLineIfNotEmpty(); |
| CharSequence _canvasAxisRenderer_1 = this.canvasAxisRenderer(data_axis, "x", "Label", fontFamily); |
| _builder_49.append(_canvasAxisRenderer_1); |
| _builder_49.newLineIfNotEmpty(); |
| _builder_49.append("if ("); |
| String _literal_39 = data_axis.getAxis().getName().getLiteral(); |
| _builder_49.append(_literal_39); |
| _builder_49.append("TitlesArray.size() > 0) {"); |
| _builder_49.newLineIfNotEmpty(); |
| _builder_49.append("\t"); |
| _builder_49.append("axes.addAxis(new XYaxis(XYaxes."); |
| char _charAt = axisPrefix.charAt(0); |
| _builder_49.append(_charAt, "\t"); |
| _builder_49.append(").setLabel("); |
| String _literal_40 = data_axis.getAxis().getName().getLiteral(); |
| _builder_49.append(_literal_40, "\t"); |
| _builder_49.append("TitlesArray.get(0)).setTickOptions(xTickRenderer).setLabelOptions(xLabelRenderer));"); |
| _builder_49.newLineIfNotEmpty(); |
| _builder_49.append("\t"); |
| _builder_49.append("axes.addAxis(new XYaxis(XYaxes."); |
| char _charAt_1 = axisPrefix.charAt(1); |
| _builder_49.append(_charAt_1, "\t"); |
| _builder_49.append(").setLabel("); |
| String _literal_41 = data_axis.getAxis().getName().getLiteral(); |
| _builder_49.append(_literal_41, "\t"); |
| _builder_49.append("TitlesArray.get(1)).setTickOptions(xTickRenderer).setLabelOptions(xLabelRenderer));"); |
| _builder_49.newLineIfNotEmpty(); |
| _builder_49.append("\t"); |
| _builder_49.append("axes.addAxis(new XYaxis(XYaxes."); |
| char _charAt_2 = axisPrefix.charAt(1); |
| _builder_49.append(_charAt_2, "\t"); |
| _builder_49.append("2).setLabel("); |
| String _literal_42 = data_axis.getAxis().getName().getLiteral(); |
| _builder_49.append(_literal_42, "\t"); |
| _builder_49.append("TitlesArray.get(2)).setTickOptions(xTickRenderer).setLabelOptions(xLabelRenderer));"); |
| _builder_49.newLineIfNotEmpty(); |
| _builder_49.append("}"); |
| _builder_49.newLine(); |
| body = _builder_49.toString(); |
| } else { |
| StringConcatenation _builder_50 = new StringConcatenation(); |
| _builder_50.append(body); |
| _builder_50.newLineIfNotEmpty(); |
| CharSequence _canvasAxisRenderer_2 = this.canvasAxisRenderer(category_axis, "x", "Tick", fontFamily); |
| _builder_50.append(_canvasAxisRenderer_2); |
| _builder_50.newLineIfNotEmpty(); |
| CharSequence _canvasAxisRenderer_3 = this.canvasAxisRenderer(category_axis, "x", "Label", fontFamily); |
| _builder_50.append(_canvasAxisRenderer_3); |
| _builder_50.newLineIfNotEmpty(); |
| _builder_50.append("axes.addAxis(new XYaxis(XYaxes."); |
| char _charAt_3 = axisPrefix.charAt(0); |
| _builder_50.append(_charAt_3); |
| _builder_50.append(")"); |
| _builder_50.newLineIfNotEmpty(); |
| _builder_50.append("\t"); |
| _builder_50.append(".setRenderer(AxisRenderers."); |
| String _string_4 = category_axis.getRenderType().name().toString(); |
| _builder_50.append(_string_4, "\t"); |
| _builder_50.append(")"); |
| _builder_50.newLineIfNotEmpty(); |
| _builder_50.append("\t"); |
| _builder_50.append(".setLabel("); |
| String _literal_43 = category_axis.getAxis().getName().getLiteral(); |
| _builder_50.append(_literal_43, "\t"); |
| _builder_50.append("AxisLabel)"); |
| _builder_50.newLineIfNotEmpty(); |
| _builder_50.append("\t"); |
| _builder_50.append(".setTicks("); |
| String _literal_44 = category_axis.getAxis().getName().getLiteral(); |
| _builder_50.append(_literal_44, "\t"); |
| _builder_50.append("Ticks)"); |
| _builder_50.newLineIfNotEmpty(); |
| _builder_50.append("\t"); |
| _builder_50.append(".setTickOptions(xTickRenderer)"); |
| _builder_50.newLine(); |
| _builder_50.append("\t"); |
| _builder_50.append(".setLabelOptions(xLabelRenderer));"); |
| _builder_50.newLine(); |
| body = _builder_50.toString(); |
| StringConcatenation _builder_51 = new StringConcatenation(); |
| _builder_51.append(body); |
| _builder_51.newLineIfNotEmpty(); |
| CharSequence _canvasAxisRenderer_4 = this.canvasAxisRenderer(data_axis, "y", "Tick", fontFamily); |
| _builder_51.append(_canvasAxisRenderer_4); |
| _builder_51.newLineIfNotEmpty(); |
| _builder_51.append("axes.addAxis(new XYaxis(XYaxes."); |
| char _charAt_4 = axisPrefix.charAt(1); |
| _builder_51.append(_charAt_4); |
| _builder_51.append(")"); |
| _builder_51.newLineIfNotEmpty(); |
| _builder_51.append("\t"); |
| _builder_51.append(".setPad(1.05f)"); |
| _builder_51.newLine(); |
| _builder_51.append("\t"); |
| _builder_51.append(".setTickOptions(yTickRenderer));"); |
| _builder_51.newLine(); |
| body = _builder_51.toString(); |
| Set<String> _keySet = multipleAxes.keySet(); |
| for (final String axisKey : _keySet) { |
| boolean _equals_2 = axisKey.equals("1"); |
| boolean _not = (!_equals_2); |
| if (_not) { |
| StringConcatenation _builder_52 = new StringConcatenation(); |
| _builder_52.append(body); |
| String _get = multipleAxes.get(axisKey); |
| _builder_52.append(_get); |
| body = _builder_52.toString(); |
| } |
| } |
| int _size = multipleAxes.keySet().size(); |
| boolean _greaterThan_2 = (_size > 0); |
| if (_greaterThan_2) { |
| StringConcatenation _builder_53 = new StringConcatenation(); |
| _builder_53.append(body); |
| _builder_53.append("LinearAxisRenderer linearAxisRenderer = new LinearAxisRenderer();"); |
| _builder_53.newLineIfNotEmpty(); |
| _builder_53.append("linearAxisRenderer.setAlignTicks(true);"); |
| _builder_53.newLine(); |
| _builder_53.append("AxesDefaults axesDefaults = new AxesDefaults()"); |
| _builder_53.newLine(); |
| _builder_53.append("\t"); |
| _builder_53.append(".setUseSeriesColor(true)"); |
| _builder_53.newLine(); |
| _builder_53.append("\t"); |
| _builder_53.append(".setBorderWidth(3)\t"); |
| _builder_53.newLine(); |
| _builder_53.append("\t"); |
| _builder_53.append(".setRendererOptions(linearAxisRenderer);"); |
| _builder_53.newLine(); |
| _builder_53.append("options.setAxesDefaults(axesDefaults);"); |
| _builder_53.newLine(); |
| body = _builder_53.toString(); |
| } |
| } |
| StringConcatenation _builder_54 = new StringConcatenation(); |
| _builder_54.append(body); |
| _builder_54.append("options.setAxes(axes);"); |
| _builder_54.newLineIfNotEmpty(); |
| body = _builder_54.toString(); |
| } |
| boolean hadLegend = false; |
| EList<ChartElement> _elements_1 = chart.getSource().getElements(); |
| for (final ChartElement element_1 : _elements_1) { |
| if ((element_1 instanceof ChartLegend)) { |
| ChartLegend legend = ((ChartLegend) element_1); |
| boolean _isNoLegend = legend.isNoLegend(); |
| if (_isNoLegend) { |
| hadLegend = true; |
| } else { |
| hadLegend = true; |
| StringConcatenation _builder_55 = new StringConcatenation(); |
| _builder_55.append(body); |
| _builder_55.newLineIfNotEmpty(); |
| _builder_55.append("Legend legend = new Legend().setShow("); |
| String _string_5 = Boolean.valueOf(Boolean.valueOf((legend != null)).booleanValue()).toString(); |
| _builder_55.append(_string_5); |
| _builder_55.append(");"); |
| _builder_55.newLineIfNotEmpty(); |
| _builder_55.append("legend.setPlacement(LegendPlacements."); |
| String _name = legend.getPlacement().name(); |
| _builder_55.append(_name); |
| _builder_55.append(");"); |
| _builder_55.newLineIfNotEmpty(); |
| body = _builder_55.toString(); |
| boolean _isToggle = legend.isToggle(); |
| if (_isToggle) { |
| StringConcatenation _builder_56 = new StringConcatenation(); |
| _builder_56.append(body); |
| _builder_56.newLineIfNotEmpty(); |
| _builder_56.append("EnhancedLegendRenderer renderer = new EnhancedLegendRenderer();"); |
| _builder_56.newLine(); |
| _builder_56.append("renderer.setSeriesToggle(SeriesToggles."); |
| String _name_1 = legend.getToggleType().getName(); |
| _builder_56.append(_name_1); |
| _builder_56.append(");"); |
| _builder_56.newLineIfNotEmpty(); |
| _builder_56.append("renderer.setSeriesToggleReplot("); |
| String _string_6 = Boolean.valueOf(Boolean.valueOf(legend.isReplot()).booleanValue()).toString(); |
| _builder_56.append(_string_6); |
| _builder_56.append(");"); |
| _builder_56.newLineIfNotEmpty(); |
| _builder_56.append("legend.setRendererOptions(renderer);"); |
| _builder_56.newLine(); |
| { |
| String _textColor = legend.getTextColor(); |
| boolean _tripleNotEquals = (_textColor != null); |
| if (_tripleNotEquals) { |
| _builder_56.append("legend.setTextColor(\""); |
| String _hex_1 = this.toHex(legend.getTextColor()); |
| _builder_56.append(_hex_1); |
| _builder_56.append("\");"); |
| } |
| } |
| _builder_56.newLineIfNotEmpty(); |
| { |
| int _fontSize = legend.getFontSize(); |
| boolean _tripleNotEquals_1 = (_fontSize != 0); |
| if (_tripleNotEquals_1) { |
| _builder_56.append("legend.setFontSize(\""); |
| int _fontSize_1 = legend.getFontSize(); |
| _builder_56.append(_fontSize_1); |
| _builder_56.append("pt\");"); |
| } |
| } |
| _builder_56.newLineIfNotEmpty(); |
| { |
| boolean _equals_3 = fontFamily.equals(CanvasFontFamilyEnum.DEFAULT); |
| boolean _not_1 = (!_equals_3); |
| if (_not_1) { |
| _builder_56.append("legend.setFontFamily(\""); |
| String _literal_45 = fontFamily.getLiteral(); |
| _builder_56.append(_literal_45); |
| _builder_56.append("\");"); |
| } |
| } |
| _builder_56.newLineIfNotEmpty(); |
| body = _builder_56.toString(); |
| } |
| StringConcatenation _builder_57 = new StringConcatenation(); |
| _builder_57.append(body); |
| _builder_57.append("options.setLegend(legend);"); |
| _builder_57.newLineIfNotEmpty(); |
| body = _builder_57.toString(); |
| } |
| } |
| } |
| if ((!hadLegend)) { |
| StringConcatenation _builder_58 = new StringConcatenation(); |
| _builder_58.append(body); |
| _builder_58.newLineIfNotEmpty(); |
| _builder_58.append("Legend legend = new Legend().setShow(true);"); |
| _builder_58.newLine(); |
| _builder_58.append("legend.setPlacement(LegendPlacements.OUTSIDE_GRID);"); |
| _builder_58.newLine(); |
| _builder_58.append("EnhancedLegendRenderer renderer = new EnhancedLegendRenderer();"); |
| _builder_58.newLine(); |
| _builder_58.append("renderer.setSeriesToggle(SeriesToggles.FAST);"); |
| _builder_58.newLine(); |
| _builder_58.append("renderer.setSeriesToggleReplot(true);"); |
| _builder_58.newLine(); |
| _builder_58.append("legend.setRendererOptions(renderer);"); |
| _builder_58.newLine(); |
| { |
| boolean _equals_4 = fontFamily.equals(CanvasFontFamilyEnum.DEFAULT); |
| boolean _not_2 = (!_equals_4); |
| if (_not_2) { |
| _builder_58.append("legend.setFontFamily(\""); |
| String _literal_46 = fontFamily.getLiteral(); |
| _builder_58.append(_literal_46); |
| _builder_58.append("\");"); |
| } |
| } |
| _builder_58.newLineIfNotEmpty(); |
| _builder_58.append("options.setLegend(legend);"); |
| _builder_58.newLine(); |
| body = _builder_58.toString(); |
| } |
| boolean hadHighlighter = false; |
| EList<ChartElement> _elements_2 = chart.getSource().getElements(); |
| for (final ChartElement element_2 : _elements_2) { |
| if ((element_2 instanceof ChartHighlighter)) { |
| hadHighlighter = true; |
| ChartHighlighter highlighter = ((ChartHighlighter) element_2); |
| StringConcatenation _builder_59 = new StringConcatenation(); |
| _builder_59.append(body); |
| _builder_59.newLineIfNotEmpty(); |
| _builder_59.append("Highlighter highlighter = new Highlighter().setShow("); |
| String _string_7 = Boolean.valueOf(Boolean.valueOf((highlighter != null)).booleanValue()).toString(); |
| _builder_59.append(_string_7); |
| _builder_59.append(");"); |
| _builder_59.newLineIfNotEmpty(); |
| _builder_59.append("highlighter.setShowTooltip(true)"); |
| _builder_59.newLine(); |
| _builder_59.append("\t"); |
| _builder_59.append(".setTooltipAlwaysVisible("); |
| String _string_8 = Boolean.valueOf(Boolean.valueOf(highlighter.isTooltipAlways()).booleanValue()).toString(); |
| _builder_59.append(_string_8, "\t"); |
| _builder_59.append(")"); |
| _builder_59.newLineIfNotEmpty(); |
| _builder_59.append("\t"); |
| _builder_59.append(".setKeepTooltipInsideChart("); |
| String _string_9 = Boolean.valueOf(Boolean.valueOf(highlighter.isInsideChart()).booleanValue()).toString(); |
| _builder_59.append(_string_9, "\t"); |
| _builder_59.append(")"); |
| _builder_59.newLineIfNotEmpty(); |
| _builder_59.append("\t"); |
| _builder_59.append(".setTooltipLocation(TooltipLocations."); |
| String _name_2 = highlighter.getLocation().name(); |
| _builder_59.append(_name_2, "\t"); |
| _builder_59.append(")"); |
| _builder_59.newLineIfNotEmpty(); |
| _builder_59.append("\t"); |
| _builder_59.append(".setBringSeriesToFront(true)"); |
| _builder_59.newLine(); |
| _builder_59.append("\t"); |
| _builder_59.append(".setFadeTooltip(true)"); |
| _builder_59.newLine(); |
| _builder_59.append("\t"); |
| _builder_59.append(".setShowMarker(true);"); |
| _builder_59.newLine(); |
| _builder_59.append("highlighter.setTooltipAxes(TooltipAxes."); |
| _builder_59.append(axisPrefix); |
| _builder_59.append(postfix); |
| _builder_59.append(");"); |
| _builder_59.newLineIfNotEmpty(); |
| _builder_59.append("options.setHighlighter(highlighter);"); |
| _builder_59.newLine(); |
| body = _builder_59.toString(); |
| } |
| } |
| if ((!hadHighlighter)) { |
| StringConcatenation _builder_60 = new StringConcatenation(); |
| _builder_60.append(body); |
| _builder_60.newLineIfNotEmpty(); |
| _builder_60.append("Highlighter highlighter = new Highlighter().setShow(true);"); |
| _builder_60.newLine(); |
| _builder_60.append("highlighter.setShowTooltip(true)"); |
| _builder_60.newLine(); |
| _builder_60.append("\t"); |
| _builder_60.append(".setTooltipAlwaysVisible(true)"); |
| _builder_60.newLine(); |
| _builder_60.append("\t"); |
| _builder_60.append(".setKeepTooltipInsideChart(true)"); |
| _builder_60.newLine(); |
| _builder_60.append("\t"); |
| _builder_60.append(".setTooltipLocation(TooltipLocations.NORTH_EAST)"); |
| _builder_60.newLine(); |
| _builder_60.append("\t"); |
| _builder_60.append(".setBringSeriesToFront(true)"); |
| _builder_60.newLine(); |
| _builder_60.append("\t"); |
| _builder_60.append(".setFadeTooltip(true)"); |
| _builder_60.newLine(); |
| _builder_60.append("\t"); |
| _builder_60.append(".setShowMarker(true);"); |
| _builder_60.newLine(); |
| _builder_60.append("highlighter.setTooltipAxes(TooltipAxes."); |
| _builder_60.append(axisPrefix); |
| _builder_60.append(postfix); |
| _builder_60.append(");"); |
| _builder_60.newLineIfNotEmpty(); |
| _builder_60.append("options.setHighlighter(highlighter);"); |
| _builder_60.newLine(); |
| body = _builder_60.toString(); |
| } |
| ChartOption _charttype_39 = chart.getCharttype(); |
| if ((_charttype_39 instanceof ChartLine)) { |
| ChartOption _charttype_40 = chart.getCharttype(); |
| boolean _isCursor = ((ChartLine) _charttype_40).isCursor(); |
| if (_isCursor) { |
| StringConcatenation _builder_61 = new StringConcatenation(); |
| _builder_61.append(body); |
| _builder_61.append("Cursor cursor = new Cursor()"); |
| _builder_61.newLineIfNotEmpty(); |
| _builder_61.append("\t"); |
| _builder_61.append(".setShow(true)"); |
| _builder_61.newLine(); |
| _builder_61.append("\t"); |
| _builder_61.append(".setZoom("); |
| ChartOption _charttype_41 = chart.getCharttype(); |
| String _string_10 = Boolean.valueOf(((ChartLine) _charttype_41).isZoom()).toString(); |
| _builder_61.append(_string_10, "\t"); |
| _builder_61.append(")"); |
| _builder_61.newLineIfNotEmpty(); |
| _builder_61.append("\t"); |
| _builder_61.append(".setShowTooltip("); |
| ChartOption _charttype_42 = chart.getCharttype(); |
| String _string_11 = Boolean.valueOf(((ChartLine) _charttype_42).isTooltip()).toString(); |
| _builder_61.append(_string_11, "\t"); |
| _builder_61.append(");"); |
| _builder_61.newLineIfNotEmpty(); |
| _builder_61.append("options.setCursor(cursor);"); |
| _builder_61.newLine(); |
| body = _builder_61.toString(); |
| } |
| ChartOption _charttype_43 = chart.getCharttype(); |
| boolean _isAnimated_1 = ((ChartLine) _charttype_43).isAnimated(); |
| if (_isAnimated_1) { |
| StringConcatenation _builder_62 = new StringConcatenation(); |
| _builder_62.append(body); |
| _builder_62.append("options.setAnimate(true);"); |
| _builder_62.newLineIfNotEmpty(); |
| body = _builder_62.toString(); |
| } |
| } |
| if (hasAxis) { |
| StringConcatenation _builder_63 = new StringConcatenation(); |
| _builder_63.append(body); |
| _builder_63.append("options.setSeries("); |
| String _literal_47 = data_axis.getAxis().getName().getLiteral(); |
| _builder_63.append(_literal_47); |
| _builder_63.append("Series);"); |
| _builder_63.newLineIfNotEmpty(); |
| body = _builder_63.toString(); |
| } |
| StringConcatenation _builder_64 = new StringConcatenation(); |
| _builder_64.append(body); |
| _builder_64.append("DCharts chart = new DCharts();"); |
| _builder_64.newLineIfNotEmpty(); |
| _builder_64.append("chart.setDataSeries(dataSeries);"); |
| _builder_64.newLine(); |
| _builder_64.append("chart.setOptions(options);"); |
| _builder_64.newLine(); |
| _builder_64.append("chart.setEnableChartImageChangeEvent(true);"); |
| _builder_64.newLine(); |
| body = _builder_64.toString(); |
| StringConcatenation _builder_65 = new StringConcatenation(); |
| _builder_65.append(body); |
| _builder_65.append("chart.setId(\"chart\");"); |
| _builder_65.newLineIfNotEmpty(); |
| _builder_65.append("chart.setImmediate(true);"); |
| _builder_65.newLine(); |
| _builder_65.append("chart.show();"); |
| _builder_65.newLine(); |
| _builder_65.append("charts.add(chart);"); |
| _builder_65.newLine(); |
| body = _builder_65.toString(); |
| if (((chart.getToolbar() != null) && (chart.getToolbar().eContainer() != null))) { |
| StringConcatenation _builder_66 = new StringConcatenation(); |
| _builder_66.append(body); |
| _builder_66.newLineIfNotEmpty(); |
| _builder_66.append("for (MToolBarElement element : toolbarClass.getToolBar().getChildren()) {"); |
| _builder_66.newLine(); |
| _builder_66.append("\t"); |
| _builder_66.append("Object widget = element.getWidget();"); |
| _builder_66.newLine(); |
| _builder_66.append("\t"); |
| _builder_66.append("if (widget instanceof Button) {"); |
| _builder_66.newLine(); |
| _builder_66.append("\t\t"); |
| _builder_66.append("List<String> tags = element.getTags();"); |
| _builder_66.newLine(); |
| _builder_66.append("\t\t"); |
| _builder_66.append("if (tags.contains(ChartActionEnum.CHART_ACTION_DOWNLOAD.getLiteral())) {"); |
| _builder_66.newLine(); |
| _builder_66.append("\t\t\t"); |
| _builder_66.append("FileDownloader fileDownloader = new FileDownloader(getChartResource(chart, layoutManager));"); |
| _builder_66.newLine(); |
| _builder_66.append("\t\t\t"); |
| _builder_66.append("fileDownloader.extend((Button) widget);"); |
| _builder_66.newLine(); |
| _builder_66.append("\t\t"); |
| _builder_66.append("}"); |
| _builder_66.newLine(); |
| _builder_66.append("\t"); |
| _builder_66.append("}"); |
| _builder_66.newLine(); |
| _builder_66.append("}"); |
| body = _builder_66.toString(); |
| } |
| StringConcatenation _builder_67 = new StringConcatenation(); |
| _builder_67.append(body); |
| _builder_67.append("return chart;"); |
| body = _builder_67.toString(); |
| return body; |
| } |
| |
| public CharSequence canvasAxisRenderer(final ChartAxis axis, final String axisName, final String typeName, final CanvasFontFamilyEnum fontFamily) { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("CanvasAxis"); |
| _builder.append(typeName); |
| _builder.append("Renderer "); |
| _builder.append(axisName); |
| _builder.append(typeName); |
| _builder.append("Renderer = new CanvasAxis"); |
| _builder.append(typeName); |
| _builder.append("Renderer();"); |
| _builder.newLineIfNotEmpty(); |
| { |
| boolean _equals = "Tick".equals(typeName); |
| if (_equals) { |
| _builder.append(axisName); |
| _builder.append(typeName); |
| _builder.append("Renderer.setTextColor("); |
| { |
| String _tickTextColor = axis.getTickTextColor(); |
| boolean _tripleNotEquals = (_tickTextColor != null); |
| if (_tripleNotEquals) { |
| _builder.append("\""); |
| String _hex = this.toHex(axis.getTickTextColor()); |
| _builder.append(_hex); |
| _builder.append("\""); |
| } else { |
| _builder.append("\"#202020\""); |
| } |
| } |
| _builder.append(");"); |
| _builder.newLineIfNotEmpty(); |
| { |
| int _tickFontSize = axis.getTickFontSize(); |
| boolean _tripleNotEquals_1 = (_tickFontSize != 0); |
| if (_tripleNotEquals_1) { |
| _builder.append(axisName); |
| _builder.append(typeName); |
| _builder.append("Renderer.setFontSize(\""); |
| int _tickFontSize_1 = axis.getTickFontSize(); |
| _builder.append(_tickFontSize_1); |
| _builder.append("pt\");"); |
| } |
| } |
| _builder.newLineIfNotEmpty(); |
| { |
| int _tickAngle = axis.getTickAngle(); |
| boolean _notEquals = (_tickAngle != 0); |
| if (_notEquals) { |
| _builder.append(axisName); |
| _builder.append(typeName); |
| _builder.append("Renderer.setAngle("); |
| int _tickAngle_1 = axis.getTickAngle(); |
| _builder.append(_tickAngle_1); |
| _builder.append(");"); |
| } |
| } |
| _builder.newLineIfNotEmpty(); |
| } else { |
| _builder.append(axisName); |
| _builder.append(typeName); |
| _builder.append("Renderer.setTextColor("); |
| { |
| String _labelTextColor = axis.getLabelTextColor(); |
| boolean _tripleNotEquals_2 = (_labelTextColor != null); |
| if (_tripleNotEquals_2) { |
| _builder.append("\""); |
| String _hex_1 = this.toHex(axis.getLabelTextColor()); |
| _builder.append(_hex_1); |
| _builder.append("\""); |
| } else { |
| _builder.append("\"#202020\""); |
| } |
| } |
| _builder.append(");"); |
| _builder.newLineIfNotEmpty(); |
| { |
| int _labelFontSize = axis.getLabelFontSize(); |
| boolean _tripleNotEquals_3 = (_labelFontSize != 0); |
| if (_tripleNotEquals_3) { |
| _builder.append(axisName); |
| _builder.append(typeName); |
| _builder.append("Renderer.setFontSize(\""); |
| int _labelFontSize_1 = axis.getLabelFontSize(); |
| _builder.append(_labelFontSize_1); |
| _builder.append("pt\");"); |
| } |
| } |
| _builder.newLineIfNotEmpty(); |
| { |
| int _labelAngle = axis.getLabelAngle(); |
| boolean _notEquals_1 = (_labelAngle != 0); |
| if (_notEquals_1) { |
| _builder.append(axisName); |
| _builder.append(typeName); |
| _builder.append("Renderer.setAngle("); |
| int _labelAngle_1 = axis.getLabelAngle(); |
| _builder.append(_labelAngle_1); |
| _builder.append(");"); |
| } |
| } |
| _builder.newLineIfNotEmpty(); |
| } |
| } |
| { |
| boolean _equals_1 = fontFamily.equals(CanvasFontFamilyEnum.DEFAULT); |
| boolean _not = (!_equals_1); |
| if (_not) { |
| _builder.append(axisName); |
| _builder.append(typeName); |
| _builder.append("Renderer.setEnableFontSupport(true);"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append(axisName); |
| _builder.append(typeName); |
| _builder.append("Renderer.setFontFamily(\""); |
| String _literal = fontFamily.getLiteral(); |
| _builder.append(_literal); |
| _builder.append("\");"); |
| _builder.newLineIfNotEmpty(); |
| } |
| } |
| return _builder; |
| } |
| |
| /** |
| * <p>helper method to convert a rgb string to a hex string.</p> |
| */ |
| public String toHex(final String rgb) { |
| String colorHex = "#"; |
| String[] _split = rgb.split(","); |
| for (final String color : _split) { |
| { |
| Integer i = new Integer(color); |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append(colorHex); |
| String _format = String.format("%02x", i); |
| _builder.append(_format); |
| colorHex = _builder.toString(); |
| } |
| } |
| return colorHex; |
| } |
| |
| /** |
| * <p>build the label series. Create multiple y-axes when the underlying datamart presents different scales.</p> |
| * |
| * <p>scales are used to display line charts together for comparison reason but they are of different scalings.</p> |
| */ |
| public String createLabelSeries(final Chart chart, final ChartAxis data_axis, final HashMap<String, String> multipleAxes, final String axisPrefix, final boolean showMarker) { |
| String body = ""; |
| int msrCnt = 0; |
| ChartDatamart _source = chart.getSource(); |
| DatamartSource _source_1 = ((ChartDatamart) _source).getDatamartRef().getSource(); |
| if ((_source_1 instanceof DatamartCube)) { |
| ChartDatamart _source_2 = chart.getSource(); |
| DatamartSource _source_3 = ((ChartDatamart) _source_2).getDatamartRef().getSource(); |
| EList<DatamartCubeElement> _axisslicer = ((DatamartCube) _source_3).getAxisslicer(); |
| for (final DatamartCubeElement axisOrSlicer : _axisslicer) { |
| if ((axisOrSlicer instanceof DatamartCubeAxis)) { |
| EList<DatamartElement> _elements = ((DatamartCubeAxis) axisOrSlicer).getElements(); |
| for (final DatamartElement element : _elements) { |
| { |
| if ((element instanceof DatamartDerivedMeasure)) { |
| boolean _isScaled = ((DatamartDerivedMeasure) element).isScaled(); |
| if (_isScaled) { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append(body); |
| String _createScale = this.createScale(((DatamartDerivedMeasure) element).getScale(), data_axis, multipleAxes, msrCnt, axisPrefix, showMarker); |
| _builder.append(_createScale); |
| body = _builder.toString(); |
| msrCnt = (msrCnt + 1); |
| } |
| } |
| if ((element instanceof DatamartMeasure)) { |
| boolean _isScaled_1 = ((DatamartMeasure) element).isScaled(); |
| if (_isScaled_1) { |
| StringConcatenation _builder_1 = new StringConcatenation(); |
| _builder_1.append(body); |
| String _createScale_1 = this.createScale(((DatamartMeasure) element).getScale(), data_axis, multipleAxes, msrCnt, axisPrefix, showMarker); |
| _builder_1.append(_createScale_1); |
| body = _builder_1.toString(); |
| msrCnt = (msrCnt + 1); |
| } |
| } |
| } |
| } |
| } |
| } |
| } else { |
| ChartDatamart _source_4 = chart.getSource(); |
| DatamartSource _source_5 = ((ChartDatamart) _source_4).getDatamartRef().getSource(); |
| if ((_source_5 instanceof DatamartEntity)) { |
| ChartDatamart _source_6 = chart.getSource(); |
| DatamartSource _source_7 = ((ChartDatamart) _source_6).getDatamartRef().getSource(); |
| DatamartEntity entity = ((DatamartEntity) _source_7); |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append(body); |
| String _entityScale = this.entityScale(entity, data_axis, multipleAxes, msrCnt, axisPrefix, showMarker); |
| _builder.append(_entityScale); |
| body = _builder.toString(); |
| } |
| } |
| int _size = multipleAxes.keySet().size(); |
| boolean _equals = (_size == 0); |
| if (_equals) { |
| StringConcatenation _builder_1 = new StringConcatenation(); |
| _builder_1.append(body); |
| _builder_1.append("\tfor (String title : "); |
| String _literal = data_axis.getAxis().getName().getLiteral(); |
| _builder_1.append(_literal); |
| _builder_1.append("TitlesArray) {"); |
| _builder_1.newLineIfNotEmpty(); |
| _builder_1.append("\t\t"); |
| String _literal_1 = data_axis.getAxis().getName().getLiteral(); |
| _builder_1.append(_literal_1, "\t\t"); |
| _builder_1.append("Series.addSeries(new XYseries().setLabel(title).setShowMarker("); |
| String _string = Boolean.valueOf(showMarker).toString(); |
| _builder_1.append(_string, "\t\t"); |
| _builder_1.append("));"); |
| _builder_1.newLineIfNotEmpty(); |
| _builder_1.append("\t"); |
| _builder_1.append("}"); |
| _builder_1.newLine(); |
| body = _builder_1.toString(); |
| } |
| return body; |
| } |
| |
| /** |
| * <p>helper method for scales coming from datamart entities not from cubes.</p> |
| */ |
| public String entityScale(final DatamartEntity entity, final ChartAxis data_axis, final HashMap<String, String> multipleAxes, final int msrCnt, final String axisPrefix, final boolean showMarker) { |
| int counter = msrCnt; |
| String body = ""; |
| EList<DatamartAttribute> _attributes = entity.getAttributes(); |
| for (final DatamartAttribute attribute : _attributes) { |
| if ((attribute instanceof DatamartAttribute)) { |
| boolean _isScaled = attribute.isScaled(); |
| if (_isScaled) { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append(body); |
| String _createScale = this.createScale(attribute.getScale(), data_axis, multipleAxes, counter, axisPrefix, showMarker); |
| _builder.append(_createScale); |
| body = _builder.toString(); |
| counter = (counter + 1); |
| } |
| } |
| } |
| EList<DatamartNavigation> _navigations = entity.getNavigations(); |
| for (final DatamartNavigation navigation : _navigations) { |
| { |
| if ((navigation instanceof DatamartMember)) { |
| StringConcatenation _builder_1 = new StringConcatenation(); |
| _builder_1.append(body); |
| String _entityScale = this.entityScale(((DatamartMember) navigation).getDatamartEntity(), data_axis, multipleAxes, counter, axisPrefix, showMarker); |
| _builder_1.append(_entityScale); |
| body = _builder_1.toString(); |
| } |
| if ((navigation instanceof DatamartOwner)) { |
| StringConcatenation _builder_2 = new StringConcatenation(); |
| _builder_2.append(body); |
| String _entityScale_1 = this.entityScale(((DatamartOwner) navigation).getDatamartEntity(), data_axis, multipleAxes, counter, axisPrefix, showMarker); |
| _builder_2.append(_entityScale_1); |
| body = _builder_2.toString(); |
| } |
| } |
| } |
| return body; |
| } |
| |
| /** |
| * <p>helper method for scales.</p> |
| */ |
| public String createScale(final ValueScaleEnum scale, final ChartAxis data_axis, final HashMap<String, String> multipleAxes, final int msrCnt, final String axisPrefix, final boolean showMarker) { |
| String multipleBody = ""; |
| String body = ""; |
| int scaleOrdinal = scale.ordinal(); |
| String scaleName = scale.toString(); |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append(body); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("\t"); |
| String _literal = data_axis.getAxis().getName().getLiteral(); |
| _builder.append(_literal, "\t"); |
| _builder.append("Series.addSeries(new XYseries("); |
| char _charAt = axisPrefix.charAt(1); |
| _builder.append(_charAt, "\t"); |
| _builder.append("axes."); |
| char _charAt_1 = axisPrefix.charAt(1); |
| _builder.append(_charAt_1, "\t"); |
| { |
| if ((scaleOrdinal != 0)) { |
| _builder.append((scaleOrdinal + 1), "\t"); |
| } |
| } |
| _builder.append(").setLabel("); |
| String _literal_1 = data_axis.getAxis().getName().getLiteral(); |
| _builder.append(_literal_1, "\t"); |
| _builder.append("TitlesArray.get("); |
| _builder.append(msrCnt, "\t"); |
| _builder.append(")).setShowMarker("); |
| String _string = Boolean.valueOf(showMarker).toString(); |
| _builder.append(_string, "\t"); |
| _builder.append("));"); |
| _builder.newLineIfNotEmpty(); |
| body = _builder.toString(); |
| boolean _contains = multipleAxes.keySet().contains(scaleName); |
| boolean _not = (!_contains); |
| if (_not) { |
| StringConcatenation _builder_1 = new StringConcatenation(); |
| _builder_1.append("axes.addAxis(new XYaxis(XYaxes."); |
| char _charAt_2 = axisPrefix.charAt(1); |
| _builder_1.append(_charAt_2); |
| { |
| if ((scaleOrdinal != 0)) { |
| _builder_1.append((scaleOrdinal + 1)); |
| } |
| } |
| _builder_1.append(").setTickOptions(yTickRenderer"); |
| { |
| int _tickAngle = data_axis.getTickAngle(); |
| boolean _notEquals = (_tickAngle != 0); |
| if (_notEquals) { |
| _builder_1.append(".setAngle("); |
| int _tickAngle_1 = data_axis.getTickAngle(); |
| _builder_1.append(_tickAngle_1); |
| _builder_1.append(")"); |
| } |
| } |
| _builder_1.append("));"); |
| _builder_1.newLineIfNotEmpty(); |
| multipleBody = _builder_1.toString(); |
| multipleAxes.put(scaleName, multipleBody); |
| } |
| return body; |
| } |
| |
| /** |
| * <p>helper method to get a attribute name or its alias if present of a entity's attribute object.</p> |
| */ |
| public String getAttributeName(final DatamartAttribute attribute) { |
| LEntityAttribute _attributeRef = attribute.getAttributeRef(); |
| return ((LAttribute) _attributeRef).getName().toUpperCase(); |
| } |
| |
| /** |
| * <p>helper method to get a level name of a hierarchy's level object.</p> |
| */ |
| public String getLevelName(final CubeLevel level) { |
| return level.getName(); |
| } |
| |
| public String filterChanged(final Chart chart) { |
| String body = ""; |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append(body); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("if(changedFilter != null) {"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("MPerspective perspective = getContext().get(MPerspective.class);"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("EventDispatcherEvent evnt = new EventDispatcherEvent(perspective, EventDispatcherCommand.SELECT, changedFilter.getName(), \""); |
| String _name = chart.getName(); |
| _builder.append(_name, "\t"); |
| _builder.append("\");"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("\t"); |
| _builder.append("evnt.addData(changedFilter.getSelectedData());"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("eventDispatcher.sendEvent(evnt);"); |
| _builder.newLine(); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("renderData();"); |
| _builder.newLine(); |
| body = _builder.toString(); |
| return body; |
| } |
| |
| public Set<LEntity> findRequestedEntities(final Chart chart) { |
| HashSet<LEntity> entities = new HashSet<LEntity>(); |
| ChartDatamart _source = chart.getSource(); |
| entities.addAll(this.datamartInferrer.findAllEntities(((ChartDatamart) _source).getDatamartRef())); |
| return entities; |
| } |
| |
| public String receiveEvent(final Chart chart) { |
| String body = ""; |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append(body); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("switch(event.getCommand()) {"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("case SELECT:"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("MPerspective perspective = getContext().get(MPerspective.class);"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("if(event.getPerspective() == null || (perspective != null && event.getPerspective().equals(perspective))){"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("if(!event.getSender().equals(\""); |
| QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(chart); |
| _builder.append(_fullyQualifiedName, "\t\t\t"); |
| _builder.append("\")) {"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("\t\t\t\t"); |
| _builder.append("if(filterGenerator.selectItem(event, "); |
| boolean _booleanValue = Boolean.valueOf(chart.isSelectById()).booleanValue(); |
| _builder.append(_booleanValue, "\t\t\t\t"); |
| _builder.append(")) {"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("\t\t\t\t\t"); |
| _builder.append("renderData();"); |
| _builder.newLine(); |
| _builder.append("\t\t\t\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("break;"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("case SAVE:"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("case DELETE:"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("if(!event.getSender().equals(\""); |
| QualifiedName _fullyQualifiedName_1 = this._iQualifiedNameProvider.getFullyQualifiedName(chart); |
| _builder.append(_fullyQualifiedName_1, "\t\t"); |
| _builder.append("\")) {"); |
| _builder.newLineIfNotEmpty(); |
| { |
| Set<LEntity> _findRequestedEntities = this.findRequestedEntities(chart); |
| for(final LEntity e : _findRequestedEntities) { |
| _builder.append("\t\t\t"); |
| _builder.append("if(event.getTopic().equals(\""); |
| QualifiedName _fullyQualifiedName_2 = this._iQualifiedNameProvider.getFullyQualifiedName(e); |
| _builder.append(_fullyQualifiedName_2, "\t\t\t"); |
| _builder.append("\")){"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("\t\t\t"); |
| _builder.append("\t"); |
| _builder.append("datamartInstance.clearCache();"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("\t"); |
| _builder.append("renderData();"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| } |
| } |
| _builder.append("\t\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("break;"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("case REFRESH:"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("if(!event.getSender().equals(\""); |
| QualifiedName _fullyQualifiedName_3 = this._iQualifiedNameProvider.getFullyQualifiedName(chart); |
| _builder.append(_fullyQualifiedName_3, "\t\t"); |
| _builder.append("\")) {"); |
| _builder.newLineIfNotEmpty(); |
| { |
| Set<LEntity> _findRequestedEntities_1 = this.findRequestedEntities(chart); |
| for(final LEntity e_1 : _findRequestedEntities_1) { |
| _builder.append("\t\t\t"); |
| _builder.append("if(event.getTopic().equals(\""); |
| QualifiedName _fullyQualifiedName_4 = this._iQualifiedNameProvider.getFullyQualifiedName(e_1); |
| _builder.append(_fullyQualifiedName_4, "\t\t\t"); |
| _builder.append("\")){"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("\t\t\t"); |
| _builder.append("\t"); |
| _builder.append("datamartInstance.clearCache();"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("\t"); |
| _builder.append("renderData();"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| } |
| } |
| _builder.append("\t\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("/* must be activated if sure that the filter is to be refreshed"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("if (filterGenerator != null) {"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("filterGenerator.updateFilter();"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("}*/"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("break;"); |
| _builder.newLine(); |
| _builder.append("}"); |
| _builder.newLine(); |
| body = _builder.toString(); |
| return body; |
| } |
| |
| public CharSequence localeChanged(final Chart chart) { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("if(charts != null) {"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("for(DCharts chart:charts) {"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("chart.setLocale(locale);"); |
| _builder.newLine(); |
| { |
| if ((chart.getSource().getDatamartRef().isDescription() && |
| (chart.getSource().getDatamartRef().getDescriptionValue() != null))) { |
| _builder.append("\t\t"); |
| _builder.append("chart.setDescription(dslMetadataService.translate(locale.toLanguageTag(), \""); |
| String _descriptionValue = chart.getSource().getDatamartRef().getDescriptionValue(); |
| _builder.append(_descriptionValue, "\t\t"); |
| _builder.append("\"));"); |
| _builder.newLineIfNotEmpty(); |
| } |
| } |
| _builder.append("\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("if(layoutManager != null) {"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("layoutManager.setLabelValue(dslMetadataService.translate(locale.toLanguageTag(), \""); |
| String _name = chart.getName(); |
| _builder.append(_name, "\t"); |
| _builder.append("\"));"); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("}"); |
| _builder.newLine(); |
| return _builder; |
| } |
| |
| public CharSequence chartResource(final Chart chart) { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("return new StreamResource(new StreamSource() {"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("private static final long serialVersionUID = -6463786579404065302L;"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("@Override"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("public InputStream getStream() {"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("try {"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("ByteArrayOutputStream bos = new ByteArrayOutputStream();"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("ImageIO.write(chart.getChartImage(), chart.getChartImageFormat()"); |
| _builder.newLine(); |
| _builder.append("\t\t\t\t\t"); |
| _builder.append(".getFormat(), bos);"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("return new ByteArrayInputStream(bos.toByteArray());"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("} catch (Exception e) {"); |
| _builder.newLine(); |
| _builder.append("\t\t\t"); |
| _builder.append("return new ByteArrayInputStream(\"\".getBytes());"); |
| _builder.newLine(); |
| _builder.append("\t\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("\t"); |
| _builder.append("}"); |
| _builder.newLine(); |
| _builder.append("}, layoutManager.getCaption() + chart.getChartImageFormat().getFormatExtension());"); |
| _builder.newLine(); |
| return _builder; |
| } |
| |
| public void createJsJavaComponent(final Chart chart, final IJvmDeclaredTypeAcceptor acceptor) { |
| final String stateClassName = this._d3JsJavaUtil.createStateFilename(chart); |
| JvmGenericType chart_cls = this._jvmTypesBuilder.toClass(chart, this._d3JsJavaUtil.createfullyQualifiedChartFilename(chart)); |
| JvmGenericType state_cls = this._jvmTypesBuilder.toClass(chart, this._d3JsJavaUtil.createfullyQualifiedStateFilename(chart)); |
| ChartOption _charttype = chart.getCharttype(); |
| if ((_charttype instanceof ChartTree)) { |
| ChartOption _charttype_1 = chart.getCharttype(); |
| final ChartTree chartTree = ((ChartTree) _charttype_1); |
| final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> { |
| EList<JvmTypeReference> _superTypes = it.getSuperTypes(); |
| JvmTypeReference _typeRef = this._typeReferenceBuilder.typeRef(AbstractJavaScriptComponent.class); |
| this._jvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _typeRef); |
| JvmAnnotationReference jsAnnotationRef = this._jvmTypesBuilder.toAnnotation(chartTree, JavaScript.class); |
| ArrayList<String> jsAnnotationList = CollectionLiterals.<String>newArrayList( |
| "theme://plugin/org.eclipse.osbp.utils.js/org/eclipse/osbp/utils/js/d3.js", |
| "theme://plugin/org.eclipse.osbp.utils.js/org/eclipse/osbp/utils/js/d3-scale-chromatic.js", |
| this._d3JsJavaUtil.createChartJsFilename(chart)); |
| this.addStringValuesToAnnotation(jsAnnotationRef, jsAnnotationList); |
| EList<JvmAnnotationReference> _annotations = it.getAnnotations(); |
| this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, jsAnnotationRef); |
| boolean _isMap = chartTree.isMap(); |
| if (_isMap) { |
| this.toTreeMapConstructor(it, chart); |
| } else { |
| boolean _isCollapsible = chartTree.isCollapsible(); |
| if (_isCollapsible) { |
| this.toChartConstructor(it, chart); |
| } |
| } |
| this.toChartOperations(it, chart, stateClassName); |
| }; |
| acceptor.<JvmGenericType>accept(chart_cls).initializeLater(_function); |
| final Procedure1<JvmGenericType> _function_1 = (JvmGenericType it) -> { |
| EList<JvmTypeReference> _superTypes = it.getSuperTypes(); |
| JvmTypeReference _typeRef = this._typeReferenceBuilder.typeRef(JavaScriptComponentState.class); |
| this._jvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _typeRef); |
| boolean _isMap = chartTree.isMap(); |
| if (_isMap) { |
| this.toTreeMapStateFields(it, chart); |
| } else { |
| boolean _isCollapsible = chartTree.isCollapsible(); |
| if (_isCollapsible) { |
| this.toChartStateFields(it, chart); |
| } |
| } |
| }; |
| acceptor.<JvmGenericType>accept(state_cls).initializeLater(_function_1); |
| } |
| } |
| |
| public void toChartOperations(final JvmDeclaredType type, final Chart chart, final String stateClassName) { |
| EList<JvmMember> _members = type.getMembers(); |
| final Procedure1<JvmOperation> _function = (JvmOperation it) -> { |
| final Procedure1<ITreeAppendable> _function_1 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("return ("); |
| _builder.append(stateClassName); |
| _builder.append(") super.getState();"); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setBody(it, _function_1); |
| }; |
| JvmOperation _method = this._jvmTypesBuilder.toMethod(chart, "getState", this._typeReferenceBuilder.typeRef(stateClassName), _function); |
| this._jvmTypesBuilder.<JvmOperation>operator_add(_members, _method); |
| } |
| |
| public CharSequence getD3StateVars() { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("getState().jsonData = _jsonData;"); |
| _builder.newLine(); |
| _builder.append("getState().htmlTagId=_htmlTagId;"); |
| _builder.newLine(); |
| _builder.append("getState().panelWidth = new Integer(width).toString();"); |
| _builder.newLine(); |
| _builder.append("getState().panelHeight = new Integer(height).toString();"); |
| _builder.newLine(); |
| return _builder; |
| } |
| |
| public JvmConstructor getChartConstructor(final JvmDeclaredType type, final Chart chart) { |
| final Procedure1<JvmConstructor> _function = (JvmConstructor it) -> { |
| EList<JvmFormalParameter> _parameters = it.getParameters(); |
| JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(chart, "_htmlTagId", this._typeReferenceBuilder.typeRef(String.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter); |
| EList<JvmFormalParameter> _parameters_1 = it.getParameters(); |
| JvmFormalParameter _parameter_1 = this._jvmTypesBuilder.toParameter(chart, "_jsonData", this._typeReferenceBuilder.typeRef(String.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1); |
| EList<JvmFormalParameter> _parameters_2 = it.getParameters(); |
| JvmFormalParameter _parameter_2 = this._jvmTypesBuilder.toParameter(chart, "width", this._typeReferenceBuilder.typeRef(int.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_2, _parameter_2); |
| EList<JvmFormalParameter> _parameters_3 = it.getParameters(); |
| JvmFormalParameter _parameter_3 = this._jvmTypesBuilder.toParameter(chart, "height", this._typeReferenceBuilder.typeRef(int.class)); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_3, _parameter_3); |
| final Procedure1<ITreeAppendable> _function_1 = (ITreeAppendable it_1) -> { |
| it_1.append(this.getD3StateVars()); |
| }; |
| this._jvmTypesBuilder.setBody(it, _function_1); |
| }; |
| return this._jvmTypesBuilder.toConstructor(chart, _function); |
| } |
| |
| public void toTreeMapConstructor(final JvmDeclaredType type, final Chart chart) { |
| JvmConstructor constructor = this.getChartConstructor(type, chart); |
| EList<JvmFormalParameter> _parameters = constructor.getParameters(); |
| JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(chart, "dataColumns", this._typeReferenceBuilder.typeRef(List.class, this._typeReferenceBuilder.typeRef(String.class))); |
| this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter); |
| final Procedure1<ITreeAppendable> _function = (ITreeAppendable it) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| CharSequence _d3StateVars = this.getD3StateVars(); |
| _builder.append(_d3StateVars); |
| _builder.newLineIfNotEmpty(); |
| _builder.append("getState().dataColumnList = dataColumns;"); |
| it.append(_builder); |
| }; |
| this._jvmTypesBuilder.setBody(constructor, _function); |
| EList<JvmMember> _members = type.getMembers(); |
| this._jvmTypesBuilder.<JvmConstructor>operator_add(_members, constructor); |
| } |
| |
| public void toChartConstructor(final JvmDeclaredType type, final Chart chart) { |
| JvmConstructor constructor = this.getChartConstructor(type, chart); |
| EList<JvmMember> _members = type.getMembers(); |
| this._jvmTypesBuilder.<JvmConstructor>operator_add(_members, constructor); |
| } |
| |
| public void addStringValuesToAnnotation(final JvmAnnotationReference annotationRef, final ArrayList<String> annotationStringList) { |
| JvmStringAnnotationValue value = this.typesFactory.createJvmStringAnnotationValue(); |
| for (final String annotationString : annotationStringList) { |
| EList<String> _values = value.getValues(); |
| this._jvmTypesBuilder.<String>operator_add(_values, annotationString); |
| } |
| EList<JvmAnnotationValue> _explicitValues = annotationRef.getExplicitValues(); |
| this._jvmTypesBuilder.<JvmStringAnnotationValue>operator_add(_explicitValues, value); |
| } |
| |
| public void toTreeMapStateFields(final JvmDeclaredType type, final Chart chart) { |
| this.toChartStateFields(type, chart); |
| EList<JvmMember> _members = type.getMembers(); |
| final Procedure1<JvmField> _function = (JvmField it) -> { |
| it.setVisibility(JvmVisibility.PUBLIC); |
| final Procedure1<ITreeAppendable> _function_1 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("new ArrayList<String>()"); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setInitializer(it, _function_1); |
| }; |
| JvmField _field = this._jvmTypesBuilder.toField(chart, "dataColumnList", this._typeReferenceBuilder.typeRef(List.class, this._typeReferenceBuilder.typeRef(String.class)), _function); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members, _field); |
| } |
| |
| public void toChartStateFields(final JvmDeclaredType type, final Chart chart) { |
| EList<JvmMember> _members = type.getMembers(); |
| final Procedure1<JvmField> _function = (JvmField it) -> { |
| it.setVisibility(JvmVisibility.PUBLIC); |
| final Procedure1<ITreeAppendable> _function_1 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("\"\""); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setInitializer(it, _function_1); |
| }; |
| JvmField _field = this._jvmTypesBuilder.toField(chart, "jsonData", this._typeReferenceBuilder.typeRef(String.class), _function); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members, _field); |
| EList<JvmMember> _members_1 = type.getMembers(); |
| final Procedure1<JvmField> _function_1 = (JvmField it) -> { |
| it.setVisibility(JvmVisibility.PUBLIC); |
| final Procedure1<ITreeAppendable> _function_2 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("\"\""); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setInitializer(it, _function_2); |
| }; |
| JvmField _field_1 = this._jvmTypesBuilder.toField(chart, "htmlTagId", this._typeReferenceBuilder.typeRef(String.class), _function_1); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_1, _field_1); |
| EList<JvmMember> _members_2 = type.getMembers(); |
| final Procedure1<JvmField> _function_2 = (JvmField it) -> { |
| it.setVisibility(JvmVisibility.PUBLIC); |
| final Procedure1<ITreeAppendable> _function_3 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("\"\""); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setInitializer(it, _function_3); |
| }; |
| JvmField _field_2 = this._jvmTypesBuilder.toField(chart, "panelWidth", this._typeReferenceBuilder.typeRef(String.class), _function_2); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_2, _field_2); |
| EList<JvmMember> _members_3 = type.getMembers(); |
| final Procedure1<JvmField> _function_3 = (JvmField it) -> { |
| it.setVisibility(JvmVisibility.PUBLIC); |
| final Procedure1<ITreeAppendable> _function_4 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("\"\""); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setInitializer(it, _function_4); |
| }; |
| JvmField _field_3 = this._jvmTypesBuilder.toField(chart, "panelHeight", this._typeReferenceBuilder.typeRef(String.class), _function_3); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_3, _field_3); |
| EList<JvmMember> _members_4 = type.getMembers(); |
| final Procedure1<JvmField> _function_4 = (JvmField it) -> { |
| it.setVisibility(JvmVisibility.PUBLIC); |
| final Procedure1<ITreeAppendable> _function_5 = (ITreeAppendable it_1) -> { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("\"\""); |
| it_1.append(_builder); |
| }; |
| this._jvmTypesBuilder.setInitializer(it, _function_5); |
| }; |
| JvmField _field_4 = this._jvmTypesBuilder.toField(chart, "inputValue", this._typeReferenceBuilder.typeRef(String.class), _function_4); |
| this._jvmTypesBuilder.<JvmField>operator_add(_members_4, _field_4); |
| } |
| |
| public CharSequence createD3Chart(final Chart chart) { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("CellSetToD3JsonConverter jsonConverter = new CellSetToD3JsonConverter();"); |
| _builder.newLine(); |
| _builder.append("return new "); |
| final String d3ChartFileName = this._d3JsJavaUtil.createChartFilename(chart); |
| _builder.append(d3ChartFileName); |
| _builder.append("(\""); |
| _builder.append(d3ChartFileName); |
| _builder.append("\", jsonConverter.getD3JsonString(cxCellSet, "); |
| { |
| if (((chart.getCharttype() instanceof ChartTree) && ((ChartTree) chart.getCharttype()).isCollapsible())) { |
| _builder.append("true"); |
| } else { |
| _builder.append("false"); |
| } |
| } |
| _builder.append("), panelWidth, panelHeight"); |
| { |
| boolean _isTreeMap = this._d3JsJavaUtil.isTreeMap(chart); |
| if (_isTreeMap) { |
| _builder.append(", jsonConverter.getDataColumnNameList(cxCellSet)"); |
| } |
| } |
| _builder.append(");"); |
| return _builder; |
| } |
| |
| public void infer(final EObject pckg, final IJvmDeclaredTypeAcceptor acceptor, final boolean isPreIndexingPhase) { |
| if (pckg instanceof ChartPackage) { |
| _infer((ChartPackage)pckg, acceptor, isPreIndexingPhase); |
| return; |
| } else if (pckg != null) { |
| _infer(pckg, acceptor, isPreIndexingPhase); |
| return; |
| } else { |
| throw new IllegalArgumentException("Unhandled parameter types: " + |
| Arrays.<Object>asList(pckg, acceptor, isPreIndexingPhase).toString()); |
| } |
| } |
| } |