| /** |
| * 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 javax.inject.Inject; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.osbp.xtext.chart.Chart; |
| import org.eclipse.osbp.xtext.chart.ChartOption; |
| import org.eclipse.osbp.xtext.chart.ChartPackage; |
| import org.eclipse.osbp.xtext.chart.ChartTree; |
| import org.eclipse.xtext.naming.IQualifiedNameProvider; |
| import org.eclipse.xtext.xbase.lib.Extension; |
| |
| @SuppressWarnings("all") |
| public class D3JsJavaUtil { |
| @Inject |
| @Extension |
| private IQualifiedNameProvider _iQualifiedNameProvider; |
| |
| public ChartTree getChartTreeMap(final Chart chart) { |
| ChartOption _charttype = chart.getCharttype(); |
| if ((_charttype instanceof ChartTree)) { |
| ChartOption _charttype_1 = chart.getCharttype(); |
| return ((ChartTree) _charttype_1); |
| } |
| return null; |
| } |
| |
| public String createFilenamePostFix(final Chart chart) { |
| ChartOption _charttype = chart.getCharttype(); |
| if ((_charttype instanceof ChartTree)) { |
| ChartOption _charttype_1 = chart.getCharttype(); |
| final ChartTree chartTree = ((ChartTree) _charttype_1); |
| boolean _isMap = chartTree.isMap(); |
| if (_isMap) { |
| return "TreeMap"; |
| } else { |
| boolean _isCollapsible = chartTree.isCollapsible(); |
| if (_isCollapsible) { |
| return "CollapsibleTree"; |
| } |
| } |
| } |
| return ""; |
| } |
| |
| public boolean isTreeMap(final Chart chart) { |
| ChartOption _charttype = chart.getCharttype(); |
| if ((_charttype instanceof ChartTree)) { |
| ChartOption _charttype_1 = chart.getCharttype(); |
| final ChartTree chartTree = ((ChartTree) _charttype_1); |
| boolean _isMap = chartTree.isMap(); |
| if (_isMap) { |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| public boolean isCollapsibleTree(final Chart chart) { |
| ChartOption _charttype = chart.getCharttype(); |
| if ((_charttype instanceof ChartTree)) { |
| ChartOption _charttype_1 = chart.getCharttype(); |
| final ChartTree chartTree = ((ChartTree) _charttype_1); |
| boolean _isCollapsible = chartTree.isCollapsible(); |
| if (_isCollapsible) { |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| private String createfullyQualifiedFilename(final Chart chart) { |
| EObject _eContainer = chart.eContainer(); |
| ChartPackage pckg = ((ChartPackage) _eContainer); |
| return pckg.getName().toString().concat(".").concat(chart.getName().toString()).concat(this.createFilenamePostFix(chart)); |
| } |
| |
| private String createFilename(final Chart chart) { |
| return chart.getName().toString().concat(this.createFilenamePostFix(chart)); |
| } |
| |
| public String createChartFilename(final Chart chart) { |
| return this.createFilename(chart).concat("JsChart"); |
| } |
| |
| public String createfullyQualifiedChartFilename(final Chart chart) { |
| return this.createfullyQualifiedFilename(chart).concat("JsChart"); |
| } |
| |
| public String createChartJsFilename(final Chart chart) { |
| return this.createFilename(chart).concat(".js"); |
| } |
| |
| public String createfullyQualifiedStateFilename(final Chart chart) { |
| return this.createfullyQualifiedFilename(chart).concat("JsState"); |
| } |
| |
| public String createStateFilename(final Chart chart) { |
| return this.createFilename(chart).concat("JsState"); |
| } |
| } |