blob: e14acf34ac7a98c83ee79776564269f50b6efd34 [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 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.menu.jvmmodel;
import com.google.common.base.Objects;
import com.vaadin.ui.Accordion;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Locale;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.e4.core.contexts.IContextFunction;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.osbp.bpm.api.IBPMEngine;
import org.eclipse.osbp.bpm.api.IBlipBPMFunctionProvider;
import org.eclipse.osbp.ui.api.contextfunction.IUserMenuProvider;
import org.eclipse.osbp.ui.api.contextfunction.IVaadinDialogProvider;
import org.eclipse.osbp.ui.api.contextfunction.IViewEmbeddedProvider;
import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService;
import org.eclipse.osbp.ui.api.themes.IThemeResourceService;
import org.eclipse.osbp.ui.api.user.IUser;
import org.eclipse.osbp.ui.api.useraccess.IUserAccessService;
import org.eclipse.osbp.utils.annotation.CommonUtils;
import org.eclipse.osbp.utils.constants.GeneratorConstants;
import org.eclipse.osbp.utils.vaadin.YesNoDialog;
import org.eclipse.osbp.xtext.blip.Blip;
import org.eclipse.osbp.xtext.dialogdsl.Dialog;
import org.eclipse.osbp.xtext.menu.MenuEntry;
import org.eclipse.osbp.xtext.menu.MenuPackage;
import org.eclipse.osbp.xtext.menu.common.UserMenuItem;
import org.eclipse.osbp.xtext.perspective.Perspective;
import org.eclipse.osbp.xtext.table.Table;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.Constants;
import org.eclipse.xtext.common.types.JvmAnnotationReference;
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.JvmTypeReference;
import org.eclipse.xtext.common.types.JvmVisibility;
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.Pair;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.eclipse.xtext.xbase.lib.StringExtensions;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.event.EventHandler;
import org.slf4j.Logger;
@SuppressWarnings("all")
public class MenuDslJvmModelInferrer extends AbstractModelInferrer {
@Inject
@Extension
private JvmTypesBuilder _jvmTypesBuilder;
@Inject
@Extension
private IQualifiedNameProvider _iQualifiedNameProvider;
@Inject
@Named(Constants.FILE_EXTENSIONS)
private String fileExtension;
@Inject
@Extension
private CommonUtils _commonUtils;
private String binderClassName = "";
private String contextClassName = "";
private String clsName = "";
protected void _infer(final MenuPackage pkg, final IJvmDeclaredTypeAcceptor acceptor, final boolean isPreIndexingPhase) {
Resource _eResource = pkg.eResource();
URI _uRI = _eResource.getURI();
String _lastSegment = _uRI.lastSegment();
String _replace = _lastSegment.replace(("." + this.fileExtension), "");
String _firstUpper = StringExtensions.toFirstUpper(this.fileExtension);
String _plus = (_replace + _firstUpper);
this.clsName = _plus;
String _name = pkg.getName();
String _plus_1 = (_name + ".");
String _plus_2 = (_plus_1 + this.clsName);
final JvmGenericType cls = this._jvmTypesBuilder.toClass(pkg, _plus_2);
EList<JvmTypeReference> _superTypes = cls.getSuperTypes();
JvmTypeReference _typeRef = this._typeReferenceBuilder.typeRef(IUserMenuProvider.class);
_superTypes.add(_typeRef);
EList<JvmTypeReference> _superTypes_1 = cls.getSuperTypes();
JvmTypeReference _typeRef_1 = this._typeReferenceBuilder.typeRef(IUser.UserLocaleListener.class);
_superTypes_1.add(_typeRef_1);
final Procedure1<JvmGenericType> _function = new Procedure1<JvmGenericType>() {
public void apply(final JvmGenericType it) {
MenuDslJvmModelInferrer.this._jvmTypesBuilder.setDocumentation(it, GeneratorConstants.GENERATED_CLASSES_DOCUMENTATION);
MenuDslJvmModelInferrer.this.toFields(it, pkg);
MenuDslJvmModelInferrer.this.toGetterSetter(it, pkg);
MenuDslJvmModelInferrer.this.toInjectedFields(it, pkg);
MenuDslJvmModelInferrer.this.toConstructor(it, pkg);
MenuDslJvmModelInferrer.this.toOperations(it, pkg);
}
};
acceptor.<JvmGenericType>accept(cls, _function);
String _name_1 = pkg.getName();
String _plus_3 = (_name_1 + ".");
String _plus_4 = (_plus_3 + this.clsName);
String _plus_5 = (_plus_4 + "ContextFunction");
this.contextClassName = _plus_5;
final JvmGenericType contextCls = this._jvmTypesBuilder.toClass(pkg, this.contextClassName);
EList<JvmTypeReference> _superTypes_2 = contextCls.getSuperTypes();
JvmTypeReference _typeRef_2 = this._typeReferenceBuilder.typeRef(IContextFunction.class);
_superTypes_2.add(_typeRef_2);
String _simpleName = contextCls.getSimpleName();
String _firstUpper_1 = StringExtensions.toFirstUpper(_simpleName);
contextCls.setSimpleName(_firstUpper_1);
final Procedure1<JvmGenericType> _function_1 = new Procedure1<JvmGenericType>() {
public void apply(final JvmGenericType it) {
JvmAnnotationReference annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(Component.class);
JvmTypeReference _typeRef = MenuDslJvmModelInferrer.this._typeReferenceBuilder.typeRef(IContextFunction.class);
MenuDslJvmModelInferrer.this._commonUtils.addAnnAttr(annotationRef, pkg, "service", ((JvmTypeReference) _typeRef));
StringConcatenation _builder = new StringConcatenation();
_builder.append(IContextFunction.SERVICE_CONTEXT_KEY, "");
_builder.append("=Menu");
String propContent = _builder.toString();
MenuDslJvmModelInferrer.this._commonUtils.addAnnAttr(annotationRef, pkg, "property", propContent);
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, annotationRef);
QualifiedName _fullyQualifiedName = MenuDslJvmModelInferrer.this._iQualifiedNameProvider.getFullyQualifiedName(pkg);
String _string = _fullyQualifiedName.toString();
it.setPackageName(_string);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.setDocumentation(it, GeneratorConstants.GENERATED_CLASSES_DOCUMENTATION);
MenuDslJvmModelInferrer.this.toContextOperations(it, pkg);
}
};
acceptor.<JvmGenericType>accept(contextCls, _function_1);
}
public void toContextOperations(final JvmGenericType type, final MenuPackage pkg) {
EList<JvmMember> _members = type.getMembers();
JvmTypeReference _typeRef = this._typeReferenceBuilder.typeRef(Object.class);
final Procedure1<JvmOperation> _function = new Procedure1<JvmOperation>() {
public void apply(final JvmOperation it) {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(Override.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
it.setVisibility(JvmVisibility.PUBLIC);
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmTypeReference _typeRef = MenuDslJvmModelInferrer.this._typeReferenceBuilder.typeRef(IEclipseContext.class);
JvmFormalParameter _parameter = MenuDslJvmModelInferrer.this._jvmTypesBuilder.toParameter(pkg, "context", _typeRef);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
EList<JvmFormalParameter> _parameters_1 = it.getParameters();
JvmTypeReference _typeRef_1 = MenuDslJvmModelInferrer.this._typeReferenceBuilder.typeRef(String.class);
JvmFormalParameter _parameter_1 = MenuDslJvmModelInferrer.this._jvmTypesBuilder.toParameter(pkg, "contextKey", _typeRef_1);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1);
final Procedure1<ITreeAppendable> _function = new Procedure1<ITreeAppendable>() {
public void apply(final ITreeAppendable it) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("MApplication application = context.get(MApplication.class);");
_builder.newLine();
_builder.append("IEclipseContext appCtx = application.getContext();");
_builder.newLine();
_builder.append("IUserMenuProvider provider = ContextInjectionFactory.make(");
_builder.append(MenuDslJvmModelInferrer.this.clsName, "");
_builder.append(".class, appCtx);");
_builder.newLineIfNotEmpty();
_builder.append("appCtx.set(IUserMenuProvider.class, provider);");
_builder.newLine();
_builder.append("return provider;");
it.append(_builder);
}
};
MenuDslJvmModelInferrer.this._jvmTypesBuilder.setBody(it, _function);
}
};
JvmOperation _method = this._jvmTypesBuilder.toMethod(pkg, "compute", _typeRef, _function);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members, _method);
}
public void toInjectedFields(final JvmDeclaredType type, final MenuPackage pkg) {
EList<MenuEntry> _entries = pkg.getEntries();
for (final MenuEntry entry : _entries) {
this.iterateFieldEntry(entry, type, pkg);
}
}
public void iterateFieldEntry(final MenuEntry entry, final JvmDeclaredType type, final MenuPackage pkg) {
JvmField field = null;
boolean _or = false;
boolean _isHasTable = entry.isHasTable();
if (_isHasTable) {
_or = true;
} else {
boolean _isHasDialog = entry.isHasDialog();
_or = _isHasDialog;
}
if (_or) {
String name = "";
ArrayList<String> list = CollectionLiterals.<String>newArrayList();
boolean _isHasTable_1 = entry.isHasTable();
if (_isHasTable_1) {
Table _table = entry.getTable();
String _name = _table.getName();
name = _name;
} else {
boolean _isHasDialog_1 = entry.isHasDialog();
if (_isHasDialog_1) {
Dialog _dialog = entry.getDialog();
String _name_1 = _dialog.getName();
name = _name_1;
}
}
boolean _and = false;
boolean _notEquals = (!Objects.equal(name, null));
if (!_notEquals) {
_and = false;
} else {
boolean _isEmpty = name.isEmpty();
boolean _not = (!_isEmpty);
_and = _not;
}
if (_and) {
String _firstUpper = StringExtensions.toFirstUpper(name);
list.add(_firstUpper);
final JvmAnnotationReference annotationRef = this._annotationTypesBuilder.annotationRef(Named.class);
this._commonUtils.addStringValuesToAnnotation(annotationRef, list);
String _firstLower = StringExtensions.toFirstLower(name);
JvmTypeReference _typeRef = this._typeReferenceBuilder.typeRef(IViewEmbeddedProvider.class);
final Procedure1<JvmField> _function = new Procedure1<JvmField>() {
public void apply(final JvmField it) {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(Inject.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
EList<JvmAnnotationReference> _annotations_1 = it.getAnnotations();
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations_1, annotationRef);
}
};
JvmField _field = this._jvmTypesBuilder.toField(pkg, _firstLower, _typeRef, _function);
field = _field;
boolean _notEquals_1 = (!Objects.equal(field, null));
if (_notEquals_1) {
field.setVisibility(JvmVisibility.PRIVATE);
EList<JvmMember> _members = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members, field);
}
}
}
boolean _and_1 = false;
EList<MenuEntry> _subentries = entry.getSubentries();
boolean _notEquals_2 = (!Objects.equal(_subentries, null));
if (!_notEquals_2) {
_and_1 = false;
} else {
EList<MenuEntry> _subentries_1 = entry.getSubentries();
int _size = _subentries_1.size();
boolean _greaterThan = (_size > 0);
_and_1 = _greaterThan;
}
if (_and_1) {
EList<MenuEntry> _subentries_2 = entry.getSubentries();
for (final MenuEntry e : _subentries_2) {
this.iterateFieldEntry(e, type, pkg);
}
}
}
public void toConstructor(final JvmDeclaredType type, final MenuPackage pkg) {
EList<JvmMember> _members = type.getMembers();
final Procedure1<JvmConstructor> _function = new Procedure1<JvmConstructor>() {
public void apply(final JvmConstructor it) {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(Inject.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
final Procedure1<ITreeAppendable> _function = new Procedure1<ITreeAppendable>() {
public void apply(final ITreeAppendable it) {
StringConcatenation _builder = new StringConcatenation();
it.append(_builder);
}
};
MenuDslJvmModelInferrer.this._jvmTypesBuilder.setBody(it, _function);
}
};
JvmConstructor _constructor = this._jvmTypesBuilder.toConstructor(pkg, _function);
this._jvmTypesBuilder.<JvmConstructor>operator_add(_members, _constructor);
}
public void toFields(final JvmGenericType type, final MenuPackage pkg) {
JvmField field = null;
JvmTypeReference _typeRef = this._typeReferenceBuilder.typeRef(Logger.class);
final Procedure1<JvmField> _function = new Procedure1<JvmField>() {
public void apply(final JvmField it) {
final Procedure1<ITreeAppendable> _function = new Procedure1<ITreeAppendable>() {
public void apply(final ITreeAppendable it) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("org.slf4j.LoggerFactory.getLogger(\"menu\")");
it.append(_builder);
}
};
MenuDslJvmModelInferrer.this._jvmTypesBuilder.setInitializer(it, _function);
}
};
JvmField _field = this._jvmTypesBuilder.toField(pkg, "log", _typeRef, _function);
field = _field;
field.setStatic(true);
field.setVisibility(JvmVisibility.PRIVATE);
EList<JvmMember> _members = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members, field);
JvmTypeReference _typeRef_1 = this._typeReferenceBuilder.typeRef(IThemeResourceService.class);
final Procedure1<JvmField> _function_1 = new Procedure1<JvmField>() {
public void apply(final JvmField it) {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(Inject.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
}
};
JvmField _field_1 = this._jvmTypesBuilder.toField(pkg, "themeResourceService", _typeRef_1, _function_1);
field = _field_1;
EList<JvmMember> _members_1 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_1, field);
JvmTypeReference _typeRef_2 = this._typeReferenceBuilder.typeRef(IUserAccessService.class);
final Procedure1<JvmField> _function_2 = new Procedure1<JvmField>() {
public void apply(final JvmField it) {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(Inject.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
}
};
JvmField _field_2 = this._jvmTypesBuilder.toField(pkg, "userAccessService", _typeRef_2, _function_2);
field = _field_2;
EList<JvmMember> _members_2 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_2, field);
JvmTypeReference _typeRef_3 = this._typeReferenceBuilder.typeRef(IDSLMetadataService.class);
final Procedure1<JvmField> _function_3 = new Procedure1<JvmField>() {
public void apply(final JvmField it) {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(Inject.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
}
};
JvmField _field_3 = this._jvmTypesBuilder.toField(pkg, "dslMetadataService", _typeRef_3, _function_3);
field = _field_3;
EList<JvmMember> _members_3 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_3, field);
JvmTypeReference _typeRef_4 = this._typeReferenceBuilder.typeRef(IUser.class);
final Procedure1<JvmField> _function_4 = new Procedure1<JvmField>() {
public void apply(final JvmField it) {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(Inject.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
}
};
JvmField _field_4 = this._jvmTypesBuilder.toField(pkg, "user", _typeRef_4, _function_4);
field = _field_4;
EList<JvmMember> _members_4 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_4, field);
JvmTypeReference _typeRef_5 = this._typeReferenceBuilder.typeRef(Locale.class);
JvmField _field_5 = this._jvmTypesBuilder.toField(pkg, "locale", _typeRef_5);
field = _field_5;
EList<JvmMember> _members_5 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_5, field);
JvmTypeReference _typeRef_6 = this._typeReferenceBuilder.typeRef(IBPMEngine.class);
final Procedure1<JvmField> _function_5 = new Procedure1<JvmField>() {
public void apply(final JvmField it) {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(Inject.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
EList<JvmAnnotationReference> _annotations_1 = it.getAnnotations();
JvmAnnotationReference _annotationRef_1 = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(Optional.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations_1, _annotationRef_1);
}
};
JvmField _field_6 = this._jvmTypesBuilder.toField(pkg, "bpmEngine", _typeRef_6, _function_5);
field = _field_6;
EList<JvmMember> _members_6 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_6, field);
JvmTypeReference _typeRef_7 = this._typeReferenceBuilder.typeRef(Accordion.class);
JvmTypeReference _typeRef_8 = this._typeReferenceBuilder.typeRef(com.vaadin.ui.Component.class);
JvmTypeReference _typeRef_9 = this._typeReferenceBuilder.typeRef(HashMap.class, _typeRef_7, _typeRef_8);
JvmField _field_7 = this._jvmTypesBuilder.toField(pkg, "selectedMap", _typeRef_9);
field = _field_7;
EList<JvmMember> _members_7 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_7, field);
JvmTypeReference _typeRef_10 = this._typeReferenceBuilder.typeRef(VerticalLayout.class);
JvmField _field_8 = this._jvmTypesBuilder.toField(pkg, "menuComponent", _typeRef_10);
field = _field_8;
EList<JvmMember> _members_8 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_8, field);
JvmTypeReference _typeRef_11 = this._typeReferenceBuilder.typeRef(YesNoDialog.class);
JvmField _field_9 = this._jvmTypesBuilder.toField(pkg, "yesnoDialog", _typeRef_11);
field = _field_9;
EList<JvmMember> _members_9 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_9, field);
JvmTypeReference _typeRef_12 = this._typeReferenceBuilder.typeRef(EventHandler.class);
JvmField _field_10 = this._jvmTypesBuilder.toField(pkg, "dispatchYesNo", _typeRef_12);
field = _field_10;
EList<JvmMember> _members_10 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_10, field);
JvmTypeReference _typeRef_13 = this._typeReferenceBuilder.typeRef(String.class);
JvmField _field_11 = this._jvmTypesBuilder.toField(pkg, "startProcessText", _typeRef_13);
field = _field_11;
EList<JvmMember> _members_11 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_11, field);
JvmTypeReference _typeRef_14 = this._typeReferenceBuilder.typeRef(String.class);
JvmField _field_12 = this._jvmTypesBuilder.toField(pkg, "answerYesText", _typeRef_14);
field = _field_12;
EList<JvmMember> _members_12 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_12, field);
JvmTypeReference _typeRef_15 = this._typeReferenceBuilder.typeRef(String.class);
JvmField _field_13 = this._jvmTypesBuilder.toField(pkg, "answerNoText", _typeRef_15);
field = _field_13;
EList<JvmMember> _members_13 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_13, field);
JvmTypeReference _typeRef_16 = this._typeReferenceBuilder.typeRef(boolean.class);
JvmField _field_14 = this._jvmTypesBuilder.toField(pkg, "blipSuccessful", _typeRef_16);
field = _field_14;
EList<JvmMember> _members_14 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_14, field);
JvmTypeReference _typeRef_17 = this._typeReferenceBuilder.typeRef(Window.class);
JvmField _field_15 = this._jvmTypesBuilder.toField(pkg, "yesnoWindow", _typeRef_17);
field = _field_15;
EList<JvmMember> _members_15 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_15, field);
JvmTypeReference _typeRef_18 = this._typeReferenceBuilder.typeRef(IEventBroker.class);
final Procedure1<JvmField> _function_6 = new Procedure1<JvmField>() {
public void apply(final JvmField it) {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(Inject.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
}
};
JvmField _field_16 = this._jvmTypesBuilder.toField(pkg, "eventBroker", _typeRef_18, _function_6);
field = _field_16;
EList<JvmMember> _members_16 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_16, field);
JvmTypeReference _typeRef_19 = this._typeReferenceBuilder.typeRef(TabSheet.Tab.class);
JvmTypeReference _typeRef_20 = this._typeReferenceBuilder.typeRef(String.class);
JvmTypeReference _typeRef_21 = this._typeReferenceBuilder.typeRef(String.class);
JvmTypeReference _typeRef_22 = this._typeReferenceBuilder.typeRef(Pair.class, _typeRef_20, _typeRef_21);
JvmTypeReference _typeRef_23 = this._typeReferenceBuilder.typeRef(HashMap.class, _typeRef_19, _typeRef_22);
JvmField _field_17 = this._jvmTypesBuilder.toField(pkg, "tabs", _typeRef_23);
field = _field_17;
EList<JvmMember> _members_17 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_17, field);
JvmTypeReference _typeRef_24 = this._typeReferenceBuilder.typeRef(UserMenuItem.class);
JvmTypeReference _typeRef_25 = this._typeReferenceBuilder.typeRef(String.class);
JvmTypeReference _typeRef_26 = this._typeReferenceBuilder.typeRef(HashMap.class, _typeRef_24, _typeRef_25);
JvmField _field_18 = this._jvmTypesBuilder.toField(pkg, "items", _typeRef_26);
field = _field_18;
EList<JvmMember> _members_18 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_18, field);
ArrayList<String> list = CollectionLiterals.<String>newArrayList();
list.add("Blip");
final JvmAnnotationReference annotationRef = this._annotationTypesBuilder.annotationRef(Named.class);
this._commonUtils.addStringValuesToAnnotation(annotationRef, list);
JvmTypeReference _typeRef_27 = this._typeReferenceBuilder.typeRef(IBlipBPMFunctionProvider.class);
final Procedure1<JvmField> _function_7 = new Procedure1<JvmField>() {
public void apply(final JvmField it) {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(Inject.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
EList<JvmAnnotationReference> _annotations_1 = it.getAnnotations();
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations_1, annotationRef);
}
};
JvmField _field_19 = this._jvmTypesBuilder.toField(pkg, "blip", _typeRef_27, _function_7);
field = _field_19;
field.setVisibility(JvmVisibility.PRIVATE);
EList<JvmMember> _members_19 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_19, field);
list.clear();
list.add("UserFilter");
final JvmAnnotationReference annotationRef2 = this._annotationTypesBuilder.annotationRef(Named.class);
this._commonUtils.addStringValuesToAnnotation(annotationRef2, list);
JvmTypeReference _typeRef_28 = this._typeReferenceBuilder.typeRef(IVaadinDialogProvider.class);
final Procedure1<JvmField> _function_8 = new Procedure1<JvmField>() {
public void apply(final JvmField it) {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(Inject.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
EList<JvmAnnotationReference> _annotations_1 = it.getAnnotations();
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations_1, annotationRef2);
}
};
JvmField _field_20 = this._jvmTypesBuilder.toField(pkg, "userFilter", _typeRef_28, _function_8);
field = _field_20;
field.setVisibility(JvmVisibility.PRIVATE);
EList<JvmMember> _members_20 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_20, field);
}
/**
* <p>build the getters and setters from class variables.</p>
*/
public void toGetterSetter(final JvmDeclaredType type, final MenuPackage pkg) {
JvmOperation operation = null;
JvmTypeReference _typeRef = this._typeReferenceBuilder.typeRef(String.class);
JvmOperation _getter = this._jvmTypesBuilder.toGetter(pkg, "startProcessText", _typeRef);
operation = _getter;
operation.setVisibility(JvmVisibility.PUBLIC);
EList<JvmMember> _members = type.getMembers();
this._jvmTypesBuilder.<JvmOperation>operator_add(_members, operation);
JvmTypeReference _typeRef_1 = this._typeReferenceBuilder.typeRef(String.class);
JvmOperation _setter = this._jvmTypesBuilder.toSetter(pkg, "startProcessText", _typeRef_1);
operation = _setter;
operation.setVisibility(JvmVisibility.PUBLIC);
EList<JvmMember> _members_1 = type.getMembers();
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_1, operation);
JvmTypeReference _typeRef_2 = this._typeReferenceBuilder.typeRef(String.class);
JvmOperation _getter_1 = this._jvmTypesBuilder.toGetter(pkg, "answerYesText", _typeRef_2);
operation = _getter_1;
operation.setVisibility(JvmVisibility.PUBLIC);
EList<JvmMember> _members_2 = type.getMembers();
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_2, operation);
JvmTypeReference _typeRef_3 = this._typeReferenceBuilder.typeRef(String.class);
JvmOperation _setter_1 = this._jvmTypesBuilder.toSetter(pkg, "answerYesText", _typeRef_3);
operation = _setter_1;
operation.setVisibility(JvmVisibility.PUBLIC);
EList<JvmMember> _members_3 = type.getMembers();
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_3, operation);
JvmTypeReference _typeRef_4 = this._typeReferenceBuilder.typeRef(String.class);
JvmOperation _getter_2 = this._jvmTypesBuilder.toGetter(pkg, "answerNoText", _typeRef_4);
operation = _getter_2;
operation.setVisibility(JvmVisibility.PUBLIC);
EList<JvmMember> _members_4 = type.getMembers();
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_4, operation);
JvmTypeReference _typeRef_5 = this._typeReferenceBuilder.typeRef(String.class);
JvmOperation _setter_2 = this._jvmTypesBuilder.toSetter(pkg, "answerNoText", _typeRef_5);
operation = _setter_2;
operation.setVisibility(JvmVisibility.PUBLIC);
EList<JvmMember> _members_5 = type.getMembers();
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_5, operation);
}
public void toOperations(final JvmDeclaredType type, final MenuPackage pkg) {
EList<JvmMember> _members = type.getMembers();
JvmTypeReference _typeRef = this._typeReferenceBuilder.typeRef(Void.TYPE);
final Procedure1<JvmOperation> _function = new Procedure1<JvmOperation>() {
public void apply(final JvmOperation it) {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(PostConstruct.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
final Procedure1<ITreeAppendable> _function = new Procedure1<ITreeAppendable>() {
public void apply(final ITreeAppendable it) {
StringConcatenation _builder = new StringConcatenation();
CharSequence _init = MenuDslJvmModelInferrer.this.init(pkg);
_builder.append(_init, "");
it.append(_builder);
}
};
MenuDslJvmModelInferrer.this._jvmTypesBuilder.setBody(it, _function);
}
};
JvmOperation _method = this._jvmTypesBuilder.toMethod(pkg, "init", _typeRef, _function);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members, _method);
EList<JvmMember> _members_1 = type.getMembers();
JvmTypeReference _typeRef_1 = this._typeReferenceBuilder.typeRef(VerticalLayout.class);
final Procedure1<JvmOperation> _function_1 = new Procedure1<JvmOperation>() {
public void apply(final JvmOperation it) {
final Procedure1<ITreeAppendable> _function = new Procedure1<ITreeAppendable>() {
public void apply(final ITreeAppendable it) {
StringConcatenation _builder = new StringConcatenation();
CharSequence _createMenu = MenuDslJvmModelInferrer.this.createMenu(pkg);
_builder.append(_createMenu, "");
it.append(_builder);
}
};
MenuDslJvmModelInferrer.this._jvmTypesBuilder.setBody(it, _function);
}
};
JvmOperation _method_1 = this._jvmTypesBuilder.toMethod(pkg, "createMenu", _typeRef_1, _function_1);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_1, _method_1);
EList<JvmMember> _members_2 = type.getMembers();
JvmTypeReference _typeRef_2 = this._typeReferenceBuilder.typeRef(Void.TYPE);
final Procedure1<JvmOperation> _function_2 = new Procedure1<JvmOperation>() {
public void apply(final JvmOperation it) {
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmTypeReference _typeRef = MenuDslJvmModelInferrer.this._typeReferenceBuilder.typeRef(Accordion.class);
JvmFormalParameter _parameter = MenuDslJvmModelInferrer.this._jvmTypesBuilder.toParameter(pkg, "accordion", _typeRef);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
EList<JvmFormalParameter> _parameters_1 = it.getParameters();
JvmTypeReference _typeRef_1 = MenuDslJvmModelInferrer.this._typeReferenceBuilder.typeRef(boolean.class);
JvmFormalParameter _parameter_1 = MenuDslJvmModelInferrer.this._jvmTypesBuilder.toParameter(pkg, "open", _typeRef_1);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1);
final Procedure1<ITreeAppendable> _function = new Procedure1<ITreeAppendable>() {
public void apply(final ITreeAppendable it) {
StringConcatenation _builder = new StringConcatenation();
CharSequence _setIcon = MenuDslJvmModelInferrer.this.setIcon(pkg);
_builder.append(_setIcon, "");
it.append(_builder);
}
};
MenuDslJvmModelInferrer.this._jvmTypesBuilder.setBody(it, _function);
}
};
JvmOperation _method_2 = this._jvmTypesBuilder.toMethod(pkg, "setIcon", _typeRef_2, _function_2);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_2, _method_2);
EList<JvmMember> _members_3 = type.getMembers();
JvmTypeReference _typeRef_3 = this._typeReferenceBuilder.typeRef(VerticalLayout.class);
final Procedure1<JvmOperation> _function_3 = new Procedure1<JvmOperation>() {
public void apply(final JvmOperation it) {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(Override.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
final Procedure1<ITreeAppendable> _function = new Procedure1<ITreeAppendable>() {
public void apply(final ITreeAppendable it) {
StringConcatenation _builder = new StringConcatenation();
CharSequence _menu = MenuDslJvmModelInferrer.this.getMenu(pkg);
_builder.append(_menu, "");
it.append(_builder);
}
};
MenuDslJvmModelInferrer.this._jvmTypesBuilder.setBody(it, _function);
}
};
JvmOperation _method_3 = this._jvmTypesBuilder.toMethod(pkg, "getMenu", _typeRef_3, _function_3);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_3, _method_3);
EList<JvmMember> _members_4 = type.getMembers();
JvmTypeReference _typeRef_4 = this._typeReferenceBuilder.typeRef(Void.TYPE);
final Procedure1<JvmOperation> _function_4 = new Procedure1<JvmOperation>() {
public void apply(final JvmOperation it) {
it.setVisibility(JvmVisibility.PROTECTED);
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(PreDestroy.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
final Procedure1<ITreeAppendable> _function = new Procedure1<ITreeAppendable>() {
public void apply(final ITreeAppendable it) {
StringConcatenation _builder = new StringConcatenation();
CharSequence _unsubscribe = MenuDslJvmModelInferrer.this.unsubscribe(pkg);
_builder.append(_unsubscribe, "");
it.append(_builder);
}
};
MenuDslJvmModelInferrer.this._jvmTypesBuilder.setBody(it, _function);
}
};
JvmOperation _method_4 = this._jvmTypesBuilder.toMethod(pkg, "unsubscribe", _typeRef_4, _function_4);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_4, _method_4);
EList<JvmMember> _members_5 = type.getMembers();
JvmTypeReference _typeRef_5 = this._typeReferenceBuilder.typeRef(Void.TYPE);
final Procedure1<JvmOperation> _function_5 = new Procedure1<JvmOperation>() {
public void apply(final JvmOperation it) {
it.setVisibility(JvmVisibility.PUBLIC);
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = MenuDslJvmModelInferrer.this._annotationTypesBuilder.annotationRef(Override.class);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmTypeReference _typeRef = MenuDslJvmModelInferrer.this._typeReferenceBuilder.typeRef(Locale.class);
JvmFormalParameter _parameter = MenuDslJvmModelInferrer.this._jvmTypesBuilder.toParameter(pkg, "locale", _typeRef);
MenuDslJvmModelInferrer.this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
final Procedure1<ITreeAppendable> _function = new Procedure1<ITreeAppendable>() {
public void apply(final ITreeAppendable it) {
StringConcatenation _builder = new StringConcatenation();
CharSequence _localeChanged = MenuDslJvmModelInferrer.this.localeChanged(pkg);
_builder.append(_localeChanged, "");
it.append(_builder);
}
};
MenuDslJvmModelInferrer.this._jvmTypesBuilder.setBody(it, _function);
}
};
JvmOperation _method_5 = this._jvmTypesBuilder.toMethod(pkg, "localeChanged", _typeRef_5, _function_5);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_5, _method_5);
}
public CharSequence init(final MenuPackage pkg) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("tabs = new HashMap<>();");
_builder.newLine();
_builder.append("items = new HashMap<>();");
_builder.newLine();
_builder.append("user.addUserLocaleListener(this);");
_builder.newLine();
_builder.append("blipSuccessful = blip.initBlip();");
_builder.newLine();
_builder.append("if(!blipSuccessful) {");
_builder.newLine();
_builder.append("\t");
_builder.append("Notification.show(org.apache.commons.lang.StringUtils.join(blip.getErrors().toArray(), \"\\n\"), Notification.TYPE_ERROR_MESSAGE);");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("yesnoDialog = new YesNoDialog();");
_builder.newLine();
_builder.append("startProcessText = \"Start process?\";");
_builder.newLine();
_builder.append("answerYesText = \"yes\";");
_builder.newLine();
_builder.append("answerNoText = \"no\";");
_builder.newLine();
_builder.append("dispatchYesNo = ");
CharSequence _dispatchYesNo = this.dispatchYesNo(pkg);
_builder.append(_dispatchYesNo, "");
_builder.newLineIfNotEmpty();
_builder.append("eventBroker.subscribe(EventBrokerMsg.QUERY_ANSWER, dispatchYesNo);");
_builder.newLine();
_builder.append("menuComponent = createMenu();");
_builder.newLine();
_builder.append("localeChanged(locale);");
return _builder;
}
public CharSequence unsubscribe(final MenuPackage pkg) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("eventBroker.unsubscribe(dispatchYesNo);");
_builder.newLine();
return _builder;
}
public CharSequence getMenu(final MenuPackage pkg) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("return menuComponent;");
_builder.newLine();
return _builder;
}
public CharSequence createMenu(final MenuPackage pkg) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("selectedMap = new HashMap<Accordion,Component>();");
_builder.newLine();
_builder.append("VerticalLayout tabRoot = new VerticalLayout();");
_builder.newLine();
EList<MenuEntry> _entries = pkg.getEntries();
CharSequence _iterateEntries = this.iterateEntries(_entries, "Root", 0, pkg);
_builder.append(_iterateEntries, "");
_builder.newLineIfNotEmpty();
_builder.append("return tabRoot;");
_builder.newLine();
return _builder;
}
public CharSequence iterateEntries(final EList<MenuEntry> entries, final String parentName, final int depth, final MenuPackage pkg) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("// start depth: ");
_builder.append(depth, "");
_builder.newLineIfNotEmpty();
{
boolean _or = false;
boolean _isSubMenuIsAccordion = pkg.isSubMenuIsAccordion();
if (_isSubMenuIsAccordion) {
_or = true;
} else {
_or = (depth == 0);
}
if (_or) {
_builder.append("Accordion acc");
_builder.append(parentName, "");
_builder.append(" = new Accordion();");
_builder.newLineIfNotEmpty();
_builder.append("acc");
_builder.append(parentName, "");
_builder.append(".setWidth(");
{
String _width = pkg.getWidth();
boolean _notEquals = (!Objects.equal(_width, null));
if (_notEquals) {
_builder.append("\"");
String _width_1 = pkg.getWidth();
_builder.append(_width_1, "");
_builder.append("\"");
} else {
_builder.append("\"400px\"");
}
}
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.append("acc");
_builder.append(parentName, "");
_builder.append(".addStyleName(\"os-accordion-level");
_builder.append(depth, "");
_builder.append("\");");
_builder.newLineIfNotEmpty();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("acc");
_builder_1.append(parentName, "");
CharSequence _selectedHandler = this.selectedHandler(_builder_1.toString());
_builder.append(_selectedHandler, "");
_builder.newLineIfNotEmpty();
_builder.append("tab");
_builder.append(parentName, "");
_builder.append(".addComponent(acc");
_builder.append(parentName, "");
_builder.append(");");
_builder.newLineIfNotEmpty();
{
for(final MenuEntry entry : entries) {
{
boolean _isHasUserFilter = entry.isHasUserFilter();
if (_isHasUserFilter) {
_builder.append("if (userAccessService.isSuperuser()) {");
}
}
_builder.newLineIfNotEmpty();
_builder.append("VerticalLayout tab");
String _entryid = entry.getEntryid();
String _firstUpper = StringExtensions.toFirstUpper(_entryid);
_builder.append(_firstUpper, "");
_builder.append(" = new VerticalLayout();");
_builder.newLineIfNotEmpty();
{
boolean _isHasTable = entry.isHasTable();
if (_isHasTable) {
Table _table = entry.getTable();
String _name = _table.getName();
String _firstLower = StringExtensions.toFirstLower(_name);
_builder.append(_firstLower, "");
_builder.append(".createView(tab");
String _entryid_1 = entry.getEntryid();
String _firstUpper_1 = StringExtensions.toFirstUpper(_entryid_1);
_builder.append(_firstUpper_1, "");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.append("tab");
String _entryid_2 = entry.getEntryid();
String _firstUpper_2 = StringExtensions.toFirstUpper(_entryid_2);
_builder.append(_firstUpper_2, "");
_builder.append(".setData(");
Table _table_1 = entry.getTable();
String _name_1 = _table_1.getName();
String _firstLower_1 = StringExtensions.toFirstLower(_name_1);
_builder.append(_firstLower_1, "");
_builder.append(");");
_builder.newLineIfNotEmpty();
} else {
boolean _isHasDialog = entry.isHasDialog();
if (_isHasDialog) {
Dialog _dialog = entry.getDialog();
String _name_2 = _dialog.getName();
String _firstLower_2 = StringExtensions.toFirstLower(_name_2);
_builder.append(_firstLower_2, "");
_builder.append(".createView(tab");
String _entryid_3 = entry.getEntryid();
String _firstUpper_3 = StringExtensions.toFirstUpper(_entryid_3);
_builder.append(_firstUpper_3, "");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.append("tab");
String _entryid_4 = entry.getEntryid();
String _firstUpper_4 = StringExtensions.toFirstUpper(_entryid_4);
_builder.append(_firstUpper_4, "");
_builder.append(".setData(");
Dialog _dialog_1 = entry.getDialog();
String _name_3 = _dialog_1.getName();
String _firstLower_3 = StringExtensions.toFirstLower(_name_3);
_builder.append(_firstLower_3, "");
_builder.append(");");
_builder.newLineIfNotEmpty();
} else {
boolean _isHasUserFilter_1 = entry.isHasUserFilter();
if (_isHasUserFilter_1) {
_builder.append("userFilter.createView(tab");
String _entryid_5 = entry.getEntryid();
String _firstUpper_5 = StringExtensions.toFirstUpper(_entryid_5);
_builder.append(_firstUpper_5, "");
_builder.append(");");
_builder.newLineIfNotEmpty();
} else {
CharSequence _iterateTabs = this.iterateTabs(entry, depth, pkg, null);
_builder.append(_iterateTabs, "");
_builder.newLineIfNotEmpty();
}
}
}
}
_builder.append("acc");
_builder.append(parentName, "");
_builder.append(".addTab(tab");
String _entryid_6 = entry.getEntryid();
String _firstUpper_6 = StringExtensions.toFirstUpper(_entryid_6);
_builder.append(_firstUpper_6, "");
_builder.append(", \"");
String _entryid_7 = entry.getEntryid();
_builder.append(_entryid_7, "");
_builder.append("\", themeResourceService.getThemeResource(\"");
String _collapsedImage = pkg.getCollapsedImage();
_builder.append(_collapsedImage, "");
_builder.append("\", ThemeResourceType.ICON));");
_builder.newLineIfNotEmpty();
_builder.append("tabs.put(acc");
_builder.append(parentName, "");
_builder.append(".getTab(tab");
String _entryid_8 = entry.getEntryid();
String _firstUpper_7 = StringExtensions.toFirstUpper(_entryid_8);
_builder.append(_firstUpper_7, "");
_builder.append("), new Pair(\"");
String _entryid_9 = entry.getEntryid();
_builder.append(_entryid_9, "");
_builder.append("\",\"");
String _descriptionValue = entry.getDescriptionValue();
_builder.append(_descriptionValue, "");
_builder.append("\"));");
_builder.newLineIfNotEmpty();
{
boolean _isHasUserFilter_2 = entry.isHasUserFilter();
if (_isHasUserFilter_2) {
_builder.append("}");
}
}
_builder.newLineIfNotEmpty();
}
}
_builder.append("selectedMap.put(acc");
_builder.append(parentName, "");
_builder.append(", acc");
_builder.append(parentName, "");
_builder.append(".getSelectedTab());");
_builder.newLineIfNotEmpty();
} else {
{
if ((depth == 1)) {
_builder.append("Tree tree");
_builder.append(parentName, "");
_builder.append(" = new Tree();");
_builder.newLineIfNotEmpty();
_builder.append("tree");
_builder.append(parentName, "");
_builder.append(".setWidth(\"300px\");");
_builder.newLineIfNotEmpty();
_builder.append("tree");
_builder.append(parentName, "");
_builder.append(".addStyleName(\"os-menutree-level");
_builder.append(depth, "");
_builder.append("\");");
_builder.newLineIfNotEmpty();
_builder.append("tree");
_builder.append(parentName, "");
_builder.append(".setImmediate(true);");
_builder.newLineIfNotEmpty();
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append("tree");
_builder_2.append(parentName, "");
CharSequence _valueChangeHandler = this.valueChangeHandler(_builder_2.toString());
_builder.append(_valueChangeHandler, "");
_builder.newLineIfNotEmpty();
_builder.append("tab");
_builder.append(parentName, "");
_builder.append(".addComponent(tree");
_builder.append(parentName, "");
_builder.append(");");
_builder.newLineIfNotEmpty();
}
}
{
for(final MenuEntry entry_1 : entries) {
{
boolean _isHasTable_1 = entry_1.isHasTable();
if (_isHasTable_1) {
_builder.append(this.binderClassName, "");
_builder.append(".get");
Table _table_2 = entry_1.getTable();
String _name_4 = _table_2.getName();
String _firstUpper_8 = StringExtensions.toFirstUpper(_name_4);
_builder.append(_firstUpper_8, "");
_builder.append("().createView(tab");
String _entryid_10 = entry_1.getEntryid();
String _firstUpper_9 = StringExtensions.toFirstUpper(_entryid_10);
_builder.append(_firstUpper_9, "");
_builder.append(");");
_builder.newLineIfNotEmpty();
} else {
boolean _isHasDialog_1 = entry_1.isHasDialog();
if (_isHasDialog_1) {
_builder.append(this.binderClassName, "");
_builder.append(".get");
Dialog _dialog_2 = entry_1.getDialog();
String _name_5 = _dialog_2.getName();
String _firstUpper_10 = StringExtensions.toFirstUpper(_name_5);
_builder.append(_firstUpper_10, "");
_builder.append("().createView(tab");
String _entryid_11 = entry_1.getEntryid();
String _firstUpper_11 = StringExtensions.toFirstUpper(_entryid_11);
_builder.append(_firstUpper_11, "");
_builder.append(");");
_builder.newLineIfNotEmpty();
} else {
boolean _isHasUserFilter_3 = entry_1.isHasUserFilter();
if (_isHasUserFilter_3) {
_builder.append(this.binderClassName, "");
_builder.append(".getUserFilter().createView(tab");
String _entryid_12 = entry_1.getEntryid();
String _firstUpper_12 = StringExtensions.toFirstUpper(_entryid_12);
_builder.append(_firstUpper_12, "");
_builder.append(");");
_builder.newLineIfNotEmpty();
} else {
StringConcatenation _builder_3 = new StringConcatenation();
_builder_3.append("tree");
_builder_3.append(parentName, "");
CharSequence _iterateMenu = this.iterateMenu(entry_1, null, depth, pkg, _builder_3.toString());
_builder.append(_iterateMenu, "");
_builder.newLineIfNotEmpty();
}
}
}
}
}
}
}
}
_builder.append("// end depth: ");
_builder.append(depth, "");
_builder.newLineIfNotEmpty();
return _builder;
}
public CharSequence iterateMenu(final MenuEntry entry, final MenuEntry root, final int depth, final MenuPackage pkg, final String treeName) {
StringConcatenation _builder = new StringConcatenation();
{
boolean _isHasProcess = entry.isHasProcess();
if (_isHasProcess) {
_builder.append("if (bpmEngine != null && userAccessService.isPermitted(Permission.forBlipProcess(\"");
Blip _process = entry.getProcess();
String _name = _process.getName();
_builder.append(_name, "");
_builder.append("\", Action.startable)).isPermitted()) {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("UserMenuItem ");
_builder.append(treeName, "\t");
String _entryid = entry.getEntryid();
_builder.append(_entryid, "\t");
_builder.append(" = new UserMenuItem(\"");
String _entryid_1 = entry.getEntryid();
_builder.append(_entryid_1, "\t");
_builder.append("\", \"");
Blip _process_1 = entry.getProcess();
String _name_1 = _process_1.getName();
_builder.append(_name_1, "\t");
_builder.append("\", UserMenuItemType.PROCESS);");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("items.put(");
_builder.append(treeName, "\t");
String _entryid_2 = entry.getEntryid();
_builder.append(_entryid_2, "\t");
_builder.append(", \"");
String _entryid_3 = entry.getEntryid();
_builder.append(_entryid_3, "\t");
_builder.append("\");");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(treeName, "\t");
_builder.append(".addItem(");
_builder.append(treeName, "\t");
String _entryid_4 = entry.getEntryid();
_builder.append(_entryid_4, "\t");
_builder.append(");");
_builder.newLineIfNotEmpty();
{
boolean _and = false;
if (!(depth > 1)) {
_and = false;
} else {
boolean _notEquals = (!Objects.equal(root, null));
_and = _notEquals;
}
if (_and) {
_builder.append("\t");
_builder.append(treeName, "\t");
_builder.append(".setParent(");
_builder.append(treeName, "\t");
String _entryid_5 = entry.getEntryid();
_builder.append(_entryid_5, "\t");
_builder.append(", ");
_builder.append(treeName, "\t");
String _entryid_6 = root.getEntryid();
_builder.append(_entryid_6, "\t");
_builder.append(");");
_builder.newLineIfNotEmpty();
}
}
{
boolean _and_1 = false;
EList<MenuEntry> _subentries = entry.getSubentries();
boolean _notEquals_1 = (!Objects.equal(_subentries, null));
if (!_notEquals_1) {
_and_1 = false;
} else {
EList<MenuEntry> _subentries_1 = entry.getSubentries();
int _size = _subentries_1.size();
boolean _greaterThan = (_size > 0);
_and_1 = _greaterThan;
}
if (_and_1) {
_builder.append("\t");
_builder.append(treeName, "\t");
_builder.append(".setChildrenAllowed(");
_builder.append(treeName, "\t");
String _entryid_7 = entry.getEntryid();
_builder.append(_entryid_7, "\t");
_builder.append(", true);");
_builder.newLineIfNotEmpty();
} else {
_builder.append("\t");
_builder.append(treeName, "\t");
_builder.append(".setChildrenAllowed(");
_builder.append(treeName, "\t");
String _entryid_8 = entry.getEntryid();
_builder.append(_entryid_8, "\t");
_builder.append(", false);");
_builder.newLineIfNotEmpty();
}
}
_builder.append("}");
_builder.newLine();
} else {
boolean _isHasUserFilter = entry.isHasUserFilter();
if (_isHasUserFilter) {
_builder.append("// userFilter");
_builder.newLine();
_builder.append("if (userAccessService.isSuperuser()) {");
_builder.newLine();
_builder.append("\t");
_builder.append("UserMenuItem ");
_builder.append(treeName, "\t");
String _entryid_9 = entry.getEntryid();
_builder.append(_entryid_9, "\t");
_builder.append(" = new UserMenuItem(");
_builder.append(treeName, "\t");
String _entryid_10 = entry.getEntryid();
_builder.append(_entryid_10, "\t");
_builder.append(" , \"\", UserMenuItemType.USERFILTER); ");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("items.put(");
_builder.append(treeName, "\t");
String _entryid_11 = entry.getEntryid();
_builder.append(_entryid_11, "\t");
_builder.append(", \"");
_builder.append(treeName, "\t");
String _entryid_12 = entry.getEntryid();
_builder.append(_entryid_12, "\t");
_builder.append("\");");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("treeTasks.addItem(");
_builder.append(treeName, "\t");
String _entryid_13 = entry.getEntryid();
_builder.append(_entryid_13, "\t");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("treeTasks.setParent(");
_builder.append(treeName, "\t");
String _entryid_14 = entry.getEntryid();
_builder.append(_entryid_14, "\t");
_builder.append(", ");
_builder.append(treeName, "\t");
String _entryid_15 = root.getEntryid();
_builder.append(_entryid_15, "\t");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("treeTasks.setChildrenAllowed(");
_builder.append(treeName, "\t");
String _entryid_16 = entry.getEntryid();
_builder.append(_entryid_16, "\t");
_builder.append(", false);");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
} else {
_builder.append("UserMenuItem ");
_builder.append(treeName, "");
String _entryid_17 = entry.getEntryid();
_builder.append(_entryid_17, "");
_builder.append(" = new UserMenuItem(\"");
String _entryid_18 = entry.getEntryid();
_builder.append(_entryid_18, "");
_builder.append("\", ");
{
boolean _isHasProcess_1 = entry.isHasProcess();
if (_isHasProcess_1) {
_builder.append("\"");
Blip _process_2 = entry.getProcess();
String _name_2 = _process_2.getName();
_builder.append(_name_2, "");
_builder.append("\"");
} else {
boolean _isHasPerspective = entry.isHasPerspective();
if (_isHasPerspective) {
_builder.append("\"");
Perspective _perspective = entry.getPerspective();
QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(_perspective);
_builder.append(_fullyQualifiedName, "");
_builder.append("\"");
} else {
_builder.append("\"\"");
}
}
}
_builder.append(", UserMenuItemType.");
{
boolean _isHasProcess_2 = entry.isHasProcess();
if (_isHasProcess_2) {
_builder.append("PROCESS");
} else {
boolean _isHasPerspective_1 = entry.isHasPerspective();
if (_isHasPerspective_1) {
_builder.append("PERSPECTIVE");
} else {
_builder.append("NONE");
}
}
}
_builder.append("); ");
_builder.newLineIfNotEmpty();
_builder.append("items.put(");
_builder.append(treeName, "");
String _entryid_19 = entry.getEntryid();
_builder.append(_entryid_19, "");
_builder.append(", \"");
String _entryid_20 = entry.getEntryid();
_builder.append(_entryid_20, "");
_builder.append("\");");
_builder.newLineIfNotEmpty();
_builder.append(treeName, "");
_builder.append(".addItem(");
_builder.append(treeName, "");
String _entryid_21 = entry.getEntryid();
_builder.append(_entryid_21, "");
_builder.append(");");
_builder.newLineIfNotEmpty();
{
boolean _and_2 = false;
if (!(depth > 1)) {
_and_2 = false;
} else {
boolean _notEquals_2 = (!Objects.equal(root, null));
_and_2 = _notEquals_2;
}
if (_and_2) {
_builder.append(treeName, "");
_builder.append(".setParent(");
_builder.append(treeName, "");
String _entryid_22 = entry.getEntryid();
_builder.append(_entryid_22, "");
_builder.append(", ");
_builder.append(treeName, "");
String _entryid_23 = root.getEntryid();
_builder.append(_entryid_23, "");
_builder.append(");");
_builder.newLineIfNotEmpty();
}
}
{
boolean _and_3 = false;
EList<MenuEntry> _subentries_2 = entry.getSubentries();
boolean _notEquals_3 = (!Objects.equal(_subentries_2, null));
if (!_notEquals_3) {
_and_3 = false;
} else {
EList<MenuEntry> _subentries_3 = entry.getSubentries();
int _size_1 = _subentries_3.size();
boolean _greaterThan_1 = (_size_1 > 0);
_and_3 = _greaterThan_1;
}
if (_and_3) {
_builder.append(treeName, "");
_builder.append(".setChildrenAllowed(");
_builder.append(treeName, "");
String _entryid_24 = entry.getEntryid();
_builder.append(_entryid_24, "");
_builder.append(", true);");
_builder.newLineIfNotEmpty();
} else {
_builder.append(treeName, "");
_builder.append(".setChildrenAllowed(");
_builder.append(treeName, "");
String _entryid_25 = entry.getEntryid();
_builder.append(_entryid_25, "");
_builder.append(", false);");
_builder.newLineIfNotEmpty();
}
}
}
}
}
{
EList<MenuEntry> _subentries_4 = entry.getSubentries();
for(final MenuEntry e : _subentries_4) {
Object _iterateMenu = this.iterateMenu(e, entry, (depth + 1), pkg, treeName);
_builder.append(_iterateMenu, "");
_builder.newLineIfNotEmpty();
}
}
return _builder;
}
public CharSequence iterateTabs(final MenuEntry root, final int depth, final MenuPackage pkg, final String treeName) {
StringConcatenation _builder = new StringConcatenation();
{
EList<MenuEntry> _subentries = root.getSubentries();
for(final MenuEntry entry : _subentries) {
{
boolean _and = false;
boolean _and_1 = false;
EList<MenuEntry> _subentries_1 = entry.getSubentries();
boolean _notEquals = (!Objects.equal(_subentries_1, null));
if (!_notEquals) {
_and_1 = false;
} else {
EList<MenuEntry> _subentries_2 = entry.getSubentries();
int _size = _subentries_2.size();
boolean _notEquals_1 = (_size != 0);
_and_1 = _notEquals_1;
}
if (!_and_1) {
_and = false;
} else {
boolean _or = false;
if ((depth == 0)) {
_or = true;
} else {
boolean _isSubMenuIsAccordion = pkg.isSubMenuIsAccordion();
_or = _isSubMenuIsAccordion;
}
_and = _or;
}
if (_and) {
EList<MenuEntry> _subentries_3 = entry.getSubentries();
String _entryid = root.getEntryid();
String _firstUpper = StringExtensions.toFirstUpper(_entryid);
Object _iterateEntries = this.iterateEntries(_subentries_3, _firstUpper, (depth + 1), pkg);
_builder.append(_iterateEntries, "");
_builder.newLineIfNotEmpty();
}
}
}
}
return _builder;
}
public CharSequence setIcon(final MenuPackage pkg) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("Tab tab = accordion.getTab(selectedMap.get(accordion));");
_builder.newLine();
_builder.append("if (tab != null) {");
_builder.newLine();
_builder.append("\t");
_builder.append("if(open) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("tab.setIcon(themeResourceService.getThemeResource(\"");
String _expandedImage = pkg.getExpandedImage();
_builder.append(_expandedImage, "\t\t");
_builder.append("\", ThemeResourceType.ICON));");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("} else {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("tab.setIcon(themeResourceService.getThemeResource(\"");
String _collapsedImage = pkg.getCollapsedImage();
_builder.append(_collapsedImage, "\t\t");
_builder.append("\", ThemeResourceType.ICON));");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
return _builder;
}
public CharSequence selectedHandler(final String accName) {
StringConcatenation _builder = new StringConcatenation();
_builder.append(accName, "");
_builder.append(".addSelectedTabChangeListener(new SelectedTabChangeListener() {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("@Override");
_builder.newLine();
_builder.append("\t");
_builder.append("public void selectedTabChange(SelectedTabChangeEvent event) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("setIcon(");
_builder.append(accName, "\t\t");
_builder.append(", false);");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("selectedMap.put(");
_builder.append(accName, "\t\t");
_builder.append(", ");
_builder.append(accName, "\t\t");
_builder.append(".getSelectedTab());");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("setIcon(");
_builder.append(accName, "\t\t");
_builder.append(", true);");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("Component component = accRoot.getSelectedTab();");
_builder.newLine();
_builder.append("\t\t");
_builder.append("if(component instanceof AbstractOrderedLayout) {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("if(((AbstractOrderedLayout)component).getData() instanceof IViewEmbeddedProvider) {");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("IViewEmbeddedProvider view = ((IViewEmbeddedProvider)((AbstractOrderedLayout)component).getData());");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("view.createComponents();");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("eventBroker.send(EventBrokerMsg.AUTOWIRED_ENTITY_PREFIX+userAccessService.getUser().getClass().getSimpleName().replace(\"Dto\", \"\"), userAccessService.getUser());");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("});");
_builder.newLine();
return _builder;
}
public CharSequence valueChangeHandler(final String entryName) {
StringConcatenation _builder = new StringConcatenation();
_builder.append(entryName, "");
_builder.append(".addValueChangeListener(new ValueChangeListener() {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("@Override");
_builder.newLine();
_builder.append("\t");
_builder.append("public void valueChange(ValueChangeEvent event) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("if (");
_builder.append(entryName, "\t\t");
_builder.append(".getValue() != null) {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t");
_builder.append("UserMenuItem item = (UserMenuItem)");
_builder.append(entryName, "\t\t\t");
_builder.append(".getValue();");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t");
_builder.append("if(item.getType() == UserMenuItemType.PROCESS) {");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("log.debug(\"start process \"+item.getId());");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("yesnoWindow = yesnoDialog.init(eventBroker, item, startProcessText, answerYesText, answerNoText);");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("UI.getCurrent().addWindow(yesnoWindow);");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("} ");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("else if(item.getType() == UserMenuItemType.PERSPECTIVE) {");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("log.debug(\"start perspective \"+item.getId());");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("eventBroker.send(EventBrokerMsg.MENU_CLOSE, null);");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("EventBrokerMsg msg = new EventBrokerMsg(0, item.getCallId()); ");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("eventBroker.send(EventBrokerMsg.OPEN_PERSPECTIVE, msg);");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("} ");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("});");
_builder.newLine();
return _builder;
}
public CharSequence dispatchYesNo(final MenuPackage pkg) {
StringConcatenation _builder = new StringConcatenation();
_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("if(yesnoWindow != null) {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("yesnoWindow.close();");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("UI.getCurrent().removeWindow(yesnoWindow);");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("yesnoWindow = null;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("EventBrokerMsg msg = (EventBrokerMsg)event.getProperty(EventUtils.DATA);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("UserMenuItem item = (UserMenuItem)msg.getObject1();");
_builder.newLine();
_builder.append("\t\t");
_builder.append("if(item.getType() == UserMenuItemType.PROCESS && EventBrokerMsg.QUERY_YES.equals(msg.getId())) {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("log.debug(\"start process \"+item.getId());");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("eventBroker.send(EventBrokerMsg.MENU_CLOSE, null);");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("blip.startProcess(item.getCallId());");
_builder.newLine();
_builder.append("\t\t");
_builder.append("} else {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("eventBroker.send(EventBrokerMsg.MENU_CLOSE, null);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("};");
_builder.newLine();
return _builder;
}
public CharSequence localeChanged(final MenuPackage pkg) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("this.locale = locale;");
_builder.newLine();
_builder.append("for(TabSheet.Tab tab: tabs.keySet()) {");
_builder.newLine();
_builder.append("\t");
_builder.append("tab.setCaption(dslMetadataService.translate(locale.toLanguageTag(),tabs.get(tab).getKey()));");
_builder.newLine();
_builder.append("\t");
_builder.append("tab.setDescription(dslMetadataService.translate(locale.toLanguageTag(),tabs.get(tab).getValue()));");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("for(UserMenuItem item: items.keySet()) {");
_builder.newLine();
_builder.append("\t");
_builder.append("item.setI18nId(dslMetadataService.translate(locale.toLanguageTag(),items.get(item)));");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("startProcessText = dslMetadataService.translate(locale.toLanguageTag(),\"Start process?\");");
_builder.newLine();
_builder.append("answerYesText = dslMetadataService.translate(locale.toLanguageTag(),\"yes\");");
_builder.newLine();
_builder.append("answerNoText = dslMetadataService.translate(locale.toLanguageTag(),\"no\");");
_builder.newLine();
return _builder;
}
public void infer(final EObject pkg, final IJvmDeclaredTypeAcceptor acceptor, final boolean isPreIndexingPhase) {
if (pkg instanceof MenuPackage) {
_infer((MenuPackage)pkg, acceptor, isPreIndexingPhase);
return;
} else if (pkg != null) {
_infer(pkg, acceptor, isPreIndexingPhase);
return;
} else {
throw new IllegalArgumentException("Unhandled parameter types: " +
Arrays.<Object>asList(pkg, acceptor, isPreIndexingPhase).toString());
}
}
}