blob: dca1cbbaa25b59037cdc27c00bde15eedd136de9 [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*
* This copyright notice shows up in the generated Java code
*
*/
package org.eclipse.osbp.xtext.chart.jvmmodel
import org.eclipse.osbp.xtext.chart.Chart
import org.eclipse.osbp.xtext.chart.ChartPackage
import org.eclipse.osbp.xtext.chart.ChartTree
class D3JsJavaUtil {
def ChartTree getChartTreeMap(Chart chart){
if (chart.charttype instanceof ChartTree){
return chart.charttype as ChartTree
}
return null;
}
def String createFilenamePostFix(Chart chart){
if (chart.charttype instanceof ChartTree){
val ChartTree chartTree = chart.charttype as ChartTree
if (chartTree.map){
return "TreeMap"
} else if (chartTree.collapsible) {
return "CollapsibleTree"
}
}
return ""
}
def boolean isTreeMap(Chart chart){
if (chart.charttype instanceof ChartTree){
val ChartTree chartTree = chart.charttype as ChartTree
if (chartTree.map){
return true;
}
}
return false;
}
def boolean isCollapsibleTree(Chart chart){
if (chart.charttype instanceof ChartTree){
val ChartTree chartTree = chart.charttype as ChartTree
if (chartTree.collapsible){
return true;
}
}
return false;
}
private def String createfullyQualifiedFilename(Chart chart){
var pckg = chart.eContainer as ChartPackage
return pckg.name.toString.concat(".").concat(chart.name.toString).concat(chart.createFilenamePostFix)
}
private def String createFilename(Chart chart){
return chart.name.toString.concat(chart.createFilenamePostFix)
}
def String createChartFilename(Chart chart){
return chart.createFilename.concat("JsChart")
}
def String createfullyQualifiedChartFilename(Chart chart){
return chart.createfullyQualifiedFilename.concat("JsChart")
}
def String createChartJsFilename(Chart chart){
return chart.createFilename.concat(".js")
}
def String createfullyQualifiedStateFilename(Chart chart){
return chart.createfullyQualifiedFilename.concat("JsState")
}
def String createStateFilename(Chart chart){
return chart.createFilename.concat("JsState")
}
}