| /** |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| * |
| * |
| * This copyright notice shows up in the generated Java code |
| */ |
| package org.eclipse.osbp.xtext.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); |
| String _name = pckg.getName(); |
| String _string = _name.toString(); |
| String _concat = _string.concat("."); |
| String _name_1 = chart.getName(); |
| String _string_1 = _name_1.toString(); |
| String _concat_1 = _concat.concat(_string_1); |
| String _createFilenamePostFix = this.createFilenamePostFix(chart); |
| return _concat_1.concat(_createFilenamePostFix); |
| } |
| |
| private String createFilename(final Chart chart) { |
| String _name = chart.getName(); |
| String _string = _name.toString(); |
| String _createFilenamePostFix = this.createFilenamePostFix(chart); |
| return _string.concat(_createFilenamePostFix); |
| } |
| |
| public String createChartFilename(final Chart chart) { |
| String _createFilename = this.createFilename(chart); |
| return _createFilename.concat("JsChart"); |
| } |
| |
| public String createfullyQualifiedChartFilename(final Chart chart) { |
| String _createfullyQualifiedFilename = this.createfullyQualifiedFilename(chart); |
| return _createfullyQualifiedFilename.concat("JsChart"); |
| } |
| |
| public String createChartJsFilename(final Chart chart) { |
| String _createFilename = this.createFilename(chart); |
| return _createFilename.concat(".js"); |
| } |
| |
| public String createfullyQualifiedStateFilename(final Chart chart) { |
| String _createfullyQualifiedFilename = this.createfullyQualifiedFilename(chart); |
| return _createfullyQualifiedFilename.concat("JsState"); |
| } |
| |
| public String createStateFilename(final Chart chart) { |
| String _createFilename = this.createFilename(chart); |
| return _createFilename.concat("JsState"); |
| } |
| } |