Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.osbp.xtext.table/src/org/eclipse/osbp/xtext/table/jvmmodel/TableModelGenerator.xtend')
-rw-r--r--org.eclipse.osbp.xtext.table/src/org/eclipse/osbp/xtext/table/jvmmodel/TableModelGenerator.xtend250
1 files changed, 250 insertions, 0 deletions
diff --git a/org.eclipse.osbp.xtext.table/src/org/eclipse/osbp/xtext/table/jvmmodel/TableModelGenerator.xtend b/org.eclipse.osbp.xtext.table/src/org/eclipse/osbp/xtext/table/jvmmodel/TableModelGenerator.xtend
new file mode 100644
index 0000000..0080227
--- /dev/null
+++ b/org.eclipse.osbp.xtext.table/src/org/eclipse/osbp/xtext/table/jvmmodel/TableModelGenerator.xtend
@@ -0,0 +1,250 @@
+/**
+ *
+ * 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.table.jvmmodel
+
+import com.vaadin.data.Container
+import com.vaadin.data.Property.ValueChangeListener
+import com.vaadin.server.Page
+import com.vaadin.server.Page.Styles
+import com.vaadin.shared.ui.label.ContentMode
+import com.vaadin.ui.Button
+import com.vaadin.ui.Button.ClickEvent
+import com.vaadin.ui.CustomTable
+import com.vaadin.ui.CustomTable.Align
+import com.vaadin.ui.CustomTable.RowHeaderMode
+import com.vaadin.ui.HorizontalLayout
+import com.vaadin.ui.Label
+import com.vaadin.ui.Notification
+import com.vaadin.ui.Notification.Type
+import com.vaadin.ui.TabSheet
+import com.vaadin.ui.UI
+import java.util.ArrayList
+import java.util.Collection
+import java.util.Date
+import java.util.HashMap
+import java.util.Iterator
+import java.util.List
+import java.util.Locale
+import java.util.Map
+import java.util.Set
+import java.util.TreeSet
+import java.util.UUID
+import java.util.concurrent.Executors
+import java.util.concurrent.TimeUnit
+import javax.inject.Inject
+import org.drools.SystemEventListenerFactory
+import org.drools.event.process.ProcessCompletedEvent
+import org.eclipse.bpmn2.Task
+import org.eclipse.e4.core.contexts.ContextInjectionFactory
+import org.eclipse.e4.core.di.extensions.EventUtils
+import org.eclipse.e4.core.services.events.IEventBroker
+import org.eclipse.e4.ui.model.application.MApplication
+import org.eclipse.emf.ecore.EObject
+import org.eclipse.emf.ecore.resource.Resource
+import org.eclipse.osbp.bpm.api.AbstractBlipBPMFunctionProvider
+import org.eclipse.osbp.bpm.api.IBlipBPMConstants
+import org.eclipse.osbp.bpm.api.IBlipBPMStartInfo
+import org.eclipse.osbp.bpm.api.IBlipBPMWorkloadModifiableItem
+import org.eclipse.osbp.dsl.common.datatypes.IDto
+import org.eclipse.osbp.dsl.dto.lib.impl.DtoServiceAccess
+import org.eclipse.osbp.dsl.dto.lib.services.IDTOServiceWithMutablePersistence
+import org.eclipse.osbp.eventbroker.EventBrokerMsg
+import org.eclipse.osbp.preferences.ProductConfiguration
+import org.eclipse.osbp.ui.api.contextfunction.IViewEmbeddedProvider
+import org.eclipse.osbp.ui.api.datamart.DerivedOlapException
+import org.eclipse.osbp.ui.api.themes.IThemeResourceService
+import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType
+import org.eclipse.osbp.utils.constants.ExtendedDate
+import org.eclipse.osbp.utils.vaadin.SelectUserWindow
+import org.eclipse.osbp.utils.vaadin.ViewLayoutManager
+import org.eclipse.osbp.xtext.basic.generator.BasicDslGeneratorUtils
+import org.eclipse.osbp.xtext.blip.BlipItem
+import org.eclipse.osbp.xtext.datamart.common.AEntityDatamart
+import org.eclipse.osbp.xtext.datamart.common.DatamartFilterGenerator
+import org.eclipse.osbp.xtext.datamart.common.olap.DerivedAxis
+import org.eclipse.osbp.xtext.datamart.common.olap.DerivedHierarchy
+import org.eclipse.osbp.xtext.datamart.common.olap.DerivedLevel
+import org.eclipse.osbp.xtext.datamart.common.olap.DerivedMember
+import org.eclipse.osbp.xtext.datamart.common.olap.DerivedPosition
+import org.eclipse.osbp.xtext.datamart.common.sql.OperativeDtoContainer
+import org.eclipse.osbp.xtext.i18n.I18NModelGenerator
+import org.eclipse.osbp.xtext.table.common.CellSetFilterTable
+import org.eclipse.osbp.xtext.table.common.CellSetIndexedContainer
+import org.eclipse.osbp.xtext.table.common.CellSetPagedFilterTable
+import org.eclipse.osbp.xtext.table.common.CheckboxSelectionCellSetFilterTable
+import org.eclipse.osbp.xtext.table.common.TableFilterDecorator
+import org.eclipse.osbp.xtext.table.common.TableFilterGenerator
+import org.eclipse.osbp.xtext.table.generator.TableGridSourceGenerator
+import org.eclipse.xtext.generator.IFileSystemAccess
+import org.eclipse.xtext.xbase.compiler.GeneratorConfig
+import org.eclipse.xtext.xbase.compiler.ImportManager
+import org.jbpm.task.Status
+import org.jbpm.task.event.TaskEventListener
+import org.jbpm.task.event.entity.TaskUserEvent
+import org.jbpm.task.query.TaskSummary
+import org.jbpm.task.service.Operation
+import org.jbpm.task.service.PermissionDeniedException
+import org.jbpm.task.service.mina.MinaTaskClientConnector
+import org.jbpm.task.service.mina.MinaTaskClientHandler
+import org.osgi.service.event.Event
+import org.osgi.service.event.EventHandler
+import org.vaadin.hene.popupbutton.PopupButton
+
+class TableModelGenerator extends I18NModelGenerator {
+ @Inject TableGridSourceGenerator delegate
+ @Inject extension BasicDslGeneratorUtils
+
+ override createAppendable(EObject context, ImportManager importManager, GeneratorConfig config) {
+ // required to initialize the needed builder to avoid deprecated methods
+ builder = context.eResource
+ // ---------
+ importManager.addImportFor(
+ _typeReferenceBuilder.typeRef(HashMap, _typeReferenceBuilder.typeRef(String), _typeReferenceBuilder.typeRef(String)).
+ type)
+ importManager.addImportFor(
+ _typeReferenceBuilder.typeRef(Map, _typeReferenceBuilder.typeRef(String), _typeReferenceBuilder.typeRef(String)).type)
+ importManager.addImportFor(_typeReferenceBuilder.typeRef(Collection, _typeReferenceBuilder.typeRef(String)).type)
+ addImportFor(importManager, _typeReferenceBuilder
+ , ValueChangeListener
+ , Label
+ , List
+ , Set
+ , TreeSet
+ , Iterator
+ , ArrayList
+ , Page
+ , Styles
+ , DerivedAxis
+ , DerivedPosition
+ , DerivedMember
+ , HorizontalLayout
+ , TabSheet
+ , Notification
+ , ClickEvent
+ , Button
+ , Type
+ , Align
+ , OperativeDtoContainer
+ , DerivedHierarchy
+ , DerivedLevel
+ , DerivedOlapException
+ , IEventBroker
+ , PopupButton
+ , CellSetFilterTable
+ , CellSetPagedFilterTable
+ , CheckboxSelectionCellSetFilterTable
+ , CustomTable
+ , RowHeaderMode
+ , Container
+ , CellSetIndexedContainer
+ , TableFilterDecorator
+ , TableFilterGenerator
+ , Date
+ , ExtendedDate
+ , TimeUnit
+ , EventHandler
+ , Event
+ , EventUtils
+ , ContentMode
+ , EventBrokerMsg
+ , Status
+ , Operation
+ , Executors
+ , TaskSummary
+ , TaskEventListener
+ , TaskUserEvent
+ , ProcessCompletedEvent
+ , PermissionDeniedException
+ , SelectUserWindow
+ , MinaTaskClientConnector
+ , MinaTaskClientHandler
+ , SystemEventListenerFactory
+ , UUID
+ , ProductConfiguration
+ , AEntityDatamart
+ , IViewEmbeddedProvider
+ , MApplication
+ , ContextInjectionFactory
+ , UI
+ , Locale
+ , IThemeResourceService
+ , ThemeResourceType
+ , AbstractBlipBPMFunctionProvider
+ , IBlipBPMConstants
+ , IBlipBPMStartInfo
+ , IBlipBPMWorkloadModifiableItem
+ , IDto
+ , Task
+ , BlipItem
+ , IDTOServiceWithMutablePersistence
+ , DtoServiceAccess
+ , DatamartFilterGenerator
+ , ViewLayoutManager
+ )
+ super.createAppendable(context, importManager, config)
+ }
+
+ override doGenerate(Resource resource, IFileSystemAccess fsa) {
+ // i18n
+ super.addTranslatables("save,cancel,securityMessage,Page,Items per page,showAll,endDate,startDate,setFilter,clearFilter,lesser_than,greater_than,equal_to,ok,reset,[x]")
+ try {
+ super.doGenerate(resource, fsa)
+ }
+ catch (Throwable e) {
+ System.err.println(e);
+ }
+
+ delegate.doGenerate(resource, fsa)
+
+ // val filename = resource.URI.lastSegment
+ // for (dm : resource.contents.filter(typeof(CCTableModel))) {
+ // val plantUML = dm.toPlantUML.toString
+ // if (fsa instanceof IFileSystemAccessExtension3) {
+ // val out = new ByteArrayOutputStream()
+ // new SourceStringReader(plantUML).generateImage(out)
+ // (fsa as IFileSystemAccessExtension3).generateFile(filename + ".png",
+ // new ByteArrayInputStream(out.toByteArray))
+ // } else {
+ // fsa.generateFile(filename + ".txt", plantUML)
+ // }
+ // }
+ }
+
+// def dispatch CharSequence toPlantUML(CCTableModel it) '''
+// @startuml
+// «FOR pkg: packages»
+// «FOR table : pkg.tables»
+// «table.toPlantUML»
+// «ENDFOR»
+// «ENDFOR»
+// @enduml
+// '''
+//
+// def dispatch CharSequence toPlantUML(CCTable it) '''
+// class «name»Table {
+// «IF description»«descriptionValue»«ENDIF»
+// «IF polling»polling every «pollingTime» seconds«ENDIF»
+// }
+//
+// class «(source as CCTableDatamart).datamartRef.name»Class {
+// Datamart
+// }
+// «name»Table -- «(source as CCTableDatamart).datamartRef.name»Class : using
+//
+// '''
+}

Back to the top