catch up with branch daily
Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
diff --git a/org.eclipse.osbp.ecview.extension.editparts.emf/src/org/eclipse/osbp/ecview/extension/editparts/emf/visibility/AuthorizationVisibilityProcessor.java b/org.eclipse.osbp.ecview.extension.editparts.emf/src/org/eclipse/osbp/ecview/extension/editparts/emf/visibility/AuthorizationVisibilityProcessor.java
index 937ed9c..b35add9 100644
--- a/org.eclipse.osbp.ecview.extension.editparts.emf/src/org/eclipse/osbp/ecview/extension/editparts/emf/visibility/AuthorizationVisibilityProcessor.java
+++ b/org.eclipse.osbp.ecview.extension.editparts.emf/src/org/eclipse/osbp/ecview/extension/editparts/emf/visibility/AuthorizationVisibilityProcessor.java
@@ -41,8 +41,7 @@
/**
* The Class AuthorizationVisibilityProcessor.
*/
-public class AuthorizationVisibilityProcessor implements IVisibilityProcessor,
- ILifecycleHandler {
+public class AuthorizationVisibilityProcessor implements IVisibilityProcessor, ILifecycleHandler {
/** The handlers. */
private Set<Handler> handlers = new HashSet<>();
@@ -80,8 +79,7 @@
handlers.add(new Handler(manager, target));
}
}
- lifecycleService = context
- .getService(ILifecycleService.class.getName());
+ lifecycleService = context.getService(ILifecycleService.class.getName());
lifecycleService.addHandler(this);
/*
@@ -101,8 +99,7 @@
* @param yVP
* the y vp
*/
- public void setup(IViewContext context,
- YAuthorizationVisibilityProcessor yVP) {
+ public void setup(IViewContext context, YAuthorizationVisibilityProcessor yVP) {
yView = (YView) context.getViewEditpart().getModel();
@@ -117,8 +114,7 @@
*/
private List<YEmbeddable> collectAllEmbeddables() {
List<YEmbeddable> yEmbeddables = new ArrayList<>();
- TreeIterator<EObject> iter = EcoreUtil
- .getAllProperContents(yView, true);
+ TreeIterator<EObject> iter = EcoreUtil.getAllProperContents(yView, true);
while (iter.hasNext()) {
EObject eObject = iter.next();
if (eObject instanceof YEmbeddable) {
@@ -211,9 +207,8 @@
/*
* (non-Javadoc)
*
- * @see
- * org.eclipse.osbp.ecview.core.common.visibility.IVisibilityProcessor#setInput
- * (java.lang.Object)
+ * @see org.eclipse.osbp.ecview.core.common.visibility.IVisibilityProcessor#
+ * setInput (java.lang.Object)
*/
@Override
public void setInput(Object input) {
@@ -226,8 +221,7 @@
* Do fire.
*/
public void doFire() {
- IUserAccessService userAccessService = context
- .getService(IUserAccessService.class.getName());
+ IUserAccessService userAccessService = context.getService(IUserAccessService.class.getName());
for (Handler handler : handlers) {
handler.handle(userAccessService);
}
@@ -283,26 +277,30 @@
}
target.setVisible(false);
- target.setEditable(false);
+ target.setEditable(!model.isReadonly());
target.setEnabled(false);
if (userAccessService == null) {
target.setVisible(true);
} else {
- if(userAccessService.isGranted(Group.DTO, Action.READABLE, dtoName)) {
- target.setVisible(true);
- target.setEditable(true);
- target.setEnabled(true);
- boolean nameVisible = !userAccessService.isVetoed(Group.DTO, Action.INVISIBLE, dtoName, dtoProperty);
- if (nameVisible) {
- boolean nameEnabled = !userAccessService.isVetoed(Group.DTO, Action.DISABLED, dtoName, dtoProperty);
- if (nameEnabled) {
- boolean nameEditable = !userAccessService.isVetoed(Group.DTO, Action.NONEDITABLE, dtoName, dtoProperty);
- target.setEditable(nameEditable);
- } else {
- target.setEnabled(nameEnabled);
+ boolean dtoGrant = userAccessService.isGranted(Group.DTO, Action.READABLE, dtoName);
+ if (dtoGrant) {
+ target.setVisible(!userAccessService.isVetoed(Group.DTO, Action.INVISIBLE, dtoName, dtoProperty));
+ if (!model.isReadonly()) {
+ target.setEditable(
+ !userAccessService.isVetoed(Group.DTO, Action.NONEDITABLE, dtoName, dtoProperty));
+ }
+ target.setEnabled(!userAccessService.isVetoed(Group.DTO, Action.DISABLED, dtoName, dtoProperty));
+ } else {
+ boolean beanGrant = userAccessService.isGranted(Group.BEAN, Action.READABLE, dtoName);
+ if (beanGrant) {
+ target.setVisible(
+ !userAccessService.isVetoed(Group.BEAN, Action.INVISIBLE, dtoName, dtoProperty));
+ if (!model.isReadonly()) {
+ target.setEditable(
+ !userAccessService.isVetoed(Group.BEAN, Action.NONEDITABLE, dtoName, dtoProperty));
}
- } else {
- target.setVisible(nameVisible);
+ target.setEnabled(
+ !userAccessService.isVetoed(Group.BEAN, Action.DISABLED, dtoName, dtoProperty));
}
}
}
diff --git a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/memento/presentation/CxGridMementoActionBarContributor.java b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/memento/presentation/CxGridMementoActionBarContributor.java
index d13dacb..b743032 100644
--- a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/memento/presentation/CxGridMementoActionBarContributor.java
+++ b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/memento/presentation/CxGridMementoActionBarContributor.java
@@ -64,13 +64,6 @@
extends EditingDomainActionBarContributor
implements ISelectionChangedListener {
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "All rights reserved by Loetz GmbH&Co.KG Heidelberg 2015.\n\nContributors:\n Florian Pirchner - initial API and implementation";
-
- /**
* This keeps track of the active editor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/memento/presentation/CxGridMementoEditor.java b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/memento/presentation/CxGridMementoEditor.java
index 473a23a..ed5b23a 100644
--- a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/memento/presentation/CxGridMementoEditor.java
+++ b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/memento/presentation/CxGridMementoEditor.java
@@ -204,13 +204,6 @@
extends MultiPageEditorPart
implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker {
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "All rights reserved by Loetz GmbH&Co.KG Heidelberg 2015.\n\nContributors:\n Florian Pirchner - initial API and implementation";
-
- /**
* This keeps track of the editing domain that is used to track all changes to the model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -1001,7 +994,7 @@
* @generated
*/
public void createModel() {
- URI resourceURI = EditUIUtil.getURI(getEditorInput());
+ URI resourceURI = EditUIUtil.getURI(getEditorInput(), editingDomain.getResourceSet().getURIConverter());
Exception exception = null;
Resource resource = null;
try {
@@ -1029,10 +1022,11 @@
* @generated
*/
public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
- if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
+ boolean hasErrors = !resource.getErrors().isEmpty();
+ if (hasErrors || !resource.getWarnings().isEmpty()) {
BasicDiagnostic basicDiagnostic =
new BasicDiagnostic
- (Diagnostic.ERROR,
+ (hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING,
"org.eclipse.osbp.ecview.extension.grid.model.editor",
0,
getString("_UI_CreateModelError_message", resource.getURI()),
diff --git a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/memento/presentation/CxGridMementoModelWizard.java b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/memento/presentation/CxGridMementoModelWizard.java
index 296c0a8..9f39cf7 100644
--- a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/memento/presentation/CxGridMementoModelWizard.java
+++ b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/memento/presentation/CxGridMementoModelWizard.java
@@ -108,13 +108,6 @@
*/
public class CxGridMementoModelWizard extends Wizard implements INewWizard {
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "All rights reserved by Loetz GmbH&Co.KG Heidelberg 2015.\n\nContributors:\n Florian Pirchner - initial API and implementation";
-
- /**
* The supported extensions for created files.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -417,8 +410,7 @@
* @generated
*/
public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- {
+ Composite composite = new Composite(parent, SWT.NONE); {
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.verticalSpacing = 12;
diff --git a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/CxGridActionBarContributor.java b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/CxGridActionBarContributor.java
index f5e18ce..bac51ae 100644
--- a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/CxGridActionBarContributor.java
+++ b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/CxGridActionBarContributor.java
@@ -62,13 +62,6 @@
extends EditingDomainActionBarContributor
implements ISelectionChangedListener {
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "All rights reserved by Loetz GmbH&Co.KG Heidelberg 2015.\n\nContributors:\n Florian Pirchner - initial API and implementation";
-
- /**
* This keeps track of the active editor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/CxGridEditor.java b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/CxGridEditor.java
index d4a615b..57bfc35 100644
--- a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/CxGridEditor.java
+++ b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/CxGridEditor.java
@@ -202,13 +202,6 @@
extends MultiPageEditorPart
implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker {
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "All rights reserved by Loetz GmbH&Co.KG Heidelberg 2015.\n\nContributors:\n Florian Pirchner - initial API and implementation";
-
- /**
* This keeps track of the editing domain that is used to track all changes to the model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -999,7 +992,7 @@
* @generated
*/
public void createModel() {
- URI resourceURI = EditUIUtil.getURI(getEditorInput());
+ URI resourceURI = EditUIUtil.getURI(getEditorInput(), editingDomain.getResourceSet().getURIConverter());
Exception exception = null;
Resource resource = null;
try {
@@ -1027,10 +1020,11 @@
* @generated
*/
public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
- if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
+ boolean hasErrors = !resource.getErrors().isEmpty();
+ if (hasErrors || !resource.getWarnings().isEmpty()) {
BasicDiagnostic basicDiagnostic =
new BasicDiagnostic
- (Diagnostic.ERROR,
+ (hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING,
"org.eclipse.osbp.ecview.extension.grid.model.editor",
0,
getString("_UI_CreateModelError_message", resource.getURI()),
diff --git a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/CxGridModelWizard.java b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/CxGridModelWizard.java
index edf64e9..ee318e7 100644
--- a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/CxGridModelWizard.java
+++ b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/CxGridModelWizard.java
@@ -106,13 +106,6 @@
*/
public class CxGridModelWizard extends Wizard implements INewWizard {
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "All rights reserved by Loetz GmbH&Co.KG Heidelberg 2015.\n\nContributors:\n Florian Pirchner - initial API and implementation";
-
- /**
* The supported extensions for created files.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -415,8 +408,7 @@
* @generated
*/
public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- {
+ Composite composite = new Composite(parent, SWT.NONE); {
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.verticalSpacing = 12;
diff --git a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/cxecviewEditorPlugin.java b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/cxecviewEditorPlugin.java
index 96a7667..bfe1b5a 100644
--- a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/cxecviewEditorPlugin.java
+++ b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/presentation/cxecviewEditorPlugin.java
@@ -33,13 +33,6 @@
*/
public final class cxecviewEditorPlugin extends EMFPlugin {
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "All rights reserved by Loetz GmbH&Co.KG Heidelberg 2015.\n\nContributors:\n Florian Pirchner - initial API and implementation";
-
- /**
* Keep track of the singleton.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/renderer/presentation/CxGridRendererActionBarContributor.java b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/renderer/presentation/CxGridRendererActionBarContributor.java
index b53109b..59f30ef 100644
--- a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/renderer/presentation/CxGridRendererActionBarContributor.java
+++ b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/renderer/presentation/CxGridRendererActionBarContributor.java
@@ -64,13 +64,6 @@
extends EditingDomainActionBarContributor
implements ISelectionChangedListener {
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "All rights reserved by Loetz GmbH&Co.KG Heidelberg 2015.\n\nContributors:\n Florian Pirchner - initial API and implementation";
-
- /**
* This keeps track of the active editor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/renderer/presentation/CxGridRendererEditor.java b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/renderer/presentation/CxGridRendererEditor.java
index d88e2a6..4071cb0 100644
--- a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/renderer/presentation/CxGridRendererEditor.java
+++ b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/renderer/presentation/CxGridRendererEditor.java
@@ -204,13 +204,6 @@
extends MultiPageEditorPart
implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker {
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "All rights reserved by Loetz GmbH&Co.KG Heidelberg 2015.\n\nContributors:\n Florian Pirchner - initial API and implementation";
-
- /**
* This keeps track of the editing domain that is used to track all changes to the model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -1001,7 +994,7 @@
* @generated
*/
public void createModel() {
- URI resourceURI = EditUIUtil.getURI(getEditorInput());
+ URI resourceURI = EditUIUtil.getURI(getEditorInput(), editingDomain.getResourceSet().getURIConverter());
Exception exception = null;
Resource resource = null;
try {
@@ -1029,10 +1022,11 @@
* @generated
*/
public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
- if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
+ boolean hasErrors = !resource.getErrors().isEmpty();
+ if (hasErrors || !resource.getWarnings().isEmpty()) {
BasicDiagnostic basicDiagnostic =
new BasicDiagnostic
- (Diagnostic.ERROR,
+ (hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING,
"org.eclipse.osbp.ecview.extension.grid.model.editor",
0,
getString("_UI_CreateModelError_message", resource.getURI()),
diff --git a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/renderer/presentation/CxGridRendererModelWizard.java b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/renderer/presentation/CxGridRendererModelWizard.java
index 6105797..a792ab9 100644
--- a/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/renderer/presentation/CxGridRendererModelWizard.java
+++ b/org.eclipse.osbp.ecview.extension.grid.model.editor/src/org/eclipse/osbp/ecview/extension/grid/renderer/presentation/CxGridRendererModelWizard.java
@@ -108,13 +108,6 @@
*/
public class CxGridRendererModelWizard extends Wizard implements INewWizard {
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String copyright = "All rights reserved by Loetz GmbH&Co.KG Heidelberg 2015.\n\nContributors:\n Florian Pirchner - initial API and implementation";
-
- /**
* The supported extensions for created files.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -417,8 +410,7 @@
* @generated
*/
public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- {
+ Composite composite = new Composite(parent, SWT.NONE); {
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.verticalSpacing = 12;
diff --git a/org.eclipse.osbp.ecview.extension.grid.presentation/META-INF/MANIFEST.MF b/org.eclipse.osbp.ecview.extension.grid.presentation/META-INF/MANIFEST.MF
index 7ac42ec..91f08be 100644
--- a/org.eclipse.osbp.ecview.extension.grid.presentation/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.ecview.extension.grid.presentation/META-INF/MANIFEST.MF
@@ -36,6 +36,10 @@
org.eclipse.osbp.ui.api,
grid-renderers-collection.osgi;bundle-version="1.2.4"
Import-Package: org.apache.commons.lang,
+ org.eclipse.e4.core.contexts,
+ org.eclipse.e4.ui.model.application.ui.advanced,
+ org.eclipse.e4.ui.model.application.ui.advanced.impl,
+ org.eclipse.e4.ui.model.application.ui.basic,
org.eclipse.osbp.ui.api.user;version="0.9.0",
org.eclipse.osbp.vaaclipse.publicapi.authentication;version="0.9.0",
org.osgi.framework;version="1.7.0",
diff --git a/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/GridPresentation.java b/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/GridPresentation.java
index 3ecdf08..d275533 100644
--- a/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/GridPresentation.java
+++ b/org.eclipse.osbp.ecview.extension.grid.presentation/src/org/eclipse/osbp/ecview/extension/grid/presentation/GridPresentation.java
@@ -33,15 +33,17 @@
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
+import org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveImpl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.databinding.EMFObservables;
import org.eclipse.emf.databinding.EMFProperties;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.osbp.dsl.semantic.dto.util.NamingConventionsUtil;
import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
import org.eclipse.osbp.ecview.core.common.editpart.IFieldEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingEndpoint;
import org.eclipse.osbp.ecview.core.common.model.core.YConverter;
import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
@@ -96,6 +98,9 @@
import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableValue;
import org.eclipse.osbp.runtime.web.vaadin.databinding.values.SetToListAdapter;
import org.eclipse.osbp.ui.api.user.IUser;
+import org.eclipse.osbp.ui.api.useraccess.IUserAccessService;
+import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Action;
+import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Group;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -115,8 +120,7 @@
import com.vaadin.ui.Field;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.Column;
-import com.vaadin.ui.Grid.ColumnResizeEvent;
-import com.vaadin.ui.Grid.ColumnResizeListener;
+import com.vaadin.ui.Grid.ColumnReorderEvent;
import com.vaadin.ui.Grid.ColumnVisibilityChangeEvent;
import com.vaadin.ui.Grid.FooterRow;
import com.vaadin.ui.Grid.HeaderRow;
@@ -147,16 +151,16 @@
private Set<ColumnWrapper> columns = new HashSet<>();
/** The grouping headers. */
- private Map<CxGridHeaderRow, HeaderRow> groupingHeaders = new HashMap<CxGridHeaderRow, HeaderRow>();
+ private Map<CxGridHeaderRow, HeaderRow> groupingHeaders = new HashMap<>();
/** The grouping footers. */
- private Map<CxGridFooterRow, FooterRow> groupingFooters = new HashMap<CxGridFooterRow, FooterRow>();
+ private Map<CxGridFooterRow, FooterRow> groupingFooters = new HashMap<>();
/** The filtering header. */
private HeaderRow filteringHeader;
/** The filtering header fields. */
- private Map<CxGridColumn, ISearchFieldEditpart> filteringHeaderFields = new HashMap<CxGridColumn, ISearchFieldEditpart>();
+ private Map<CxGridColumn, ISearchFieldEditpart> filteringHeaderFields = new HashMap<>();
/** The selection binding. */
private Binding selectionBinding;
@@ -241,7 +245,7 @@
resetHeader();
resetFooter();
-
+
// reset the column reference in the editparts
for (CxGridColumn cxColumn : modelAccess.yField.getColumns()) {
IGridColumnEditpart editpart = ModelUtil.getEditpart(getViewContext(), cxColumn);
@@ -283,8 +287,9 @@
}
if (visibleColumns.size() > 0) {
- // create the columns based on the model
+ // create the columns based on the model or the persist at user
//
+ visibleColumns = getColumnOrder(visibleColumns);
grid.setColumns(visibleColumns.toArray(new Object[visibleColumns.size()]));
grid.setColumnOrder(visibleColumns.toArray(new Object[visibleColumns.size()]));
@@ -301,30 +306,38 @@
editpart.initializeColumn();
}
}
- } else {
- Class<?> rootType = modelAccess.yField.getType();
- // order columns by field order in rootType
- List<String> fieldNames = DtoUtils.getFieldNames(rootType);
- for (Iterator<String> iterator = fieldNames.iterator(); iterator.hasNext();) {
- String name = iterator.next();
- if (grid.getColumn(name) == null) {
- iterator.remove();
- }
- }
- grid.setColumnOrder(fieldNames.toArray(new Object[fieldNames.size()]));
- // remove not used fields
- for (Grid.Column col : new ArrayList<>(grid.getColumns())) {
- String propId = (String) col.getPropertyId();
- if (!propId.contains(".")) {
- // only check not nested fields
- if (DtoUtils.isIdField(rootType, propId) || DtoUtils.isVersionField(rootType, propId)
- || DtoUtils.isDisposeField(rootType, propId) || DtoUtils.isDirtyField(rootType, propId)) {
- grid.removeColumn(propId);
- }
- }
- }
+// #479 TODO (JCD): Not needed anymore. Gridxmi provides now all the columns even when no attribute is defined in the grammar
+// } else {
+// // Previous saved column order
+// List<String> columnOrderUser = getColumnOrderUser();
+// // Column order exists at user properties
+// if ((columnOrderUser != null) && !(columnOrderUser.isEmpty())){
+// try {
+// /* required before the setColumnOrder to equalize this column order with the state column order.
+// * Otherwise the column order list will be increased by the state column order list
+// * which produce a IllegalArgumentException and therefore a initial column order. */
+// removeNotUsedColumns();
+// grid.setColumnOrder(columnOrderUser.toArray());
+// } catch (IllegalArgumentException e) {
+// // In case of an incomplete setting of the column order by the user properties
+// createInitialColumnOrder();
+// /* required after the creation of a initial column order that creates the columns
+// * based on all existing field names. */
+// removeNotUsedColumns();
+// }
+// } else {
+// // Otherwise new column order is created based on the filed names
+// createInitialColumnOrder();
+// /* required after the creation of a initial column order that creates the columns
+// * based on all existing field names. */
+// removeNotUsedColumns();
+// }
+//
}
+ // #479 TODO (JCD): Not needed anymore. Unauthorized columns were managed at the creation of the grid.
+// hideUnauthorizedColumns();
+
updateCellStyleGenerator();
createHeaderMetaCells();
createFilteringHeader();
@@ -332,6 +345,115 @@
createSortOrder();
}
+ private List<String> getColumnOrder(List<String> visibleColumns) {
+ List<String> columnOrderUser = getColumnOrderUser();
+ if ( null == columnOrderUser || visibleColumns.size() != columnOrderUser.size()) {
+ return visibleColumns;
+ }
+ boolean unchangedColumns = true;
+ for (String columnOrderUserItem : columnOrderUser){
+ boolean containsFlag = visibleColumns.contains(columnOrderUserItem);
+ unchangedColumns = unchangedColumns && containsFlag;
+ }
+ if (unchangedColumns) {
+ return columnOrderUser;
+ }
+ return visibleColumns;
+ }
+
+ @SuppressWarnings("unchecked")
+ private List<String> getColumnOrderUser() {
+ IUser user = getViewContext().getService(IUser.class.getName());
+ String gridName = modelAccess.yField.getProperties().get("GRIDSOURCE_ID");
+ return (List<String>) user.getProperty(gridName);
+ }
+
+ private void removeNotUsedColumns() {
+ // remove not used fields
+ for (Grid.Column col : new ArrayList<>(grid.getColumns())) {
+ String propId = (String) col.getPropertyId();
+ if (!propId.contains(".")) {
+ // only check not nested fields
+ Class<?> rootType = modelAccess.yField.getType();
+ if (DtoUtils.isIdField(rootType, propId) || DtoUtils.isVersionField(rootType, propId)
+ || DtoUtils.isDisposeField(rootType, propId) || DtoUtils.isDirtyField(rootType, propId)) {
+ grid.removeColumn(propId);
+ }
+ }
+ }
+ }
+
+ // TODO (JCD) delete if it is clear that the gridsource_xmi solution works.
+// private void hideUnauthorizedColumns() {
+// IUserAccessService userAccessService = getViewContext().getService(IUserAccessService.class.getName());
+// Class<?> dtoObjectClass = modelAccess.yField.getType();
+// for (Grid.Column column : new ArrayList<>(grid.getColumns())) {
+// String dtoProperty = (String) column.getPropertyId();
+// columnPermission(userAccessService, dtoObjectClass, column, dtoProperty);
+// }
+// }
+//
+// private void columnPermission(IUserAccessService userAccessService, Class<?> dtoObjectClass, Column column, String dtoProperty) {
+// if (dtoProperty.split("\\.").length > 1) {
+// String refName = dtoProperty.split("\\.")[0];
+// String newDtoProperty = dtoProperty.substring(dtoProperty.indexOf(".") + 1);
+// for (java.lang.reflect.Field ref : DtoUtils.getOwnerDomainReferences(dtoObjectClass)){
+// if (refName.equals(ref.getName())){
+// Class<?> newDtoObjectClass = ref.getType();
+// columnPermission(userAccessService, newDtoObjectClass, column, newDtoProperty);
+// break;
+// }
+// }
+// } else {
+// column.setHidden(false);
+// column.setEditable(false);
+// if (userAccessService == null) {
+// column.setHidden(true);
+// } else {
+// String dtoName = dtoObjectClass.getCanonicalName();
+// boolean dtoGrant = userAccessService.isGranted(Group.DTO, Action.READABLE, dtoName);
+// boolean beanGrant = userAccessService.isGranted(Group.BEAN, Action.READABLE, dtoName);
+// boolean columnHidden = true;
+// boolean columnEditable = false;
+// boolean columnEnabled = false;
+// if (dtoGrant) {
+// columnHidden = userAccessService.isVetoed(Group.DTO, Action.INVISIBLE ,dtoName, dtoProperty);
+// columnEditable = !userAccessService.isVetoed(Group.DTO, Action.NONEDITABLE ,dtoName, dtoProperty);
+// columnEnabled = !userAccessService.isVetoed(Group.DTO, Action.DISABLED ,dtoName, dtoProperty);
+// } else if (beanGrant) {
+// columnHidden = userAccessService.isVetoed(Group.BEAN, Action.INVISIBLE, dtoName, dtoProperty);
+// columnEditable = !userAccessService.isVetoed(Group.BEAN, Action.NONEDITABLE ,dtoName, dtoProperty);
+// columnEnabled = !userAccessService.isVetoed(Group.BEAN, Action.DISABLED ,dtoName, dtoProperty);
+// }
+// if (!columnHidden) {
+// if(column.isEditable()) {
+// // do not set editable true, if editable false
+// column.setEditable(columnEditable && columnEnabled);
+// }
+// } else {
+// if(!column.isHidden()){
+// // do not unhide hidden columns
+// column.setHidden(columnHidden);
+// }
+// }
+//
+// }
+// }
+// }
+//
+ private void createInitialColumnOrder() {
+ Class<?> rootType = modelAccess.yField.getType();
+ // order columns by field order in rootType
+ List<String> fieldNames = DtoUtils.getFieldNames(rootType);
+ for (Iterator<String> iterator = fieldNames.iterator(); iterator.hasNext();) {
+ String name = iterator.next();
+ if (grid.getColumn(name) == null) {
+ iterator.remove();
+ }
+ }
+ grid.setColumnOrder(fieldNames.toArray(new Object[fieldNames.size()]));
+ }
+
/**
* Creates the sort order.
*/
@@ -370,6 +492,14 @@
// create the grouping headers
//
for (CxGridGroupedCell groupingColumn : cxHeader.getGroupings()) {
+ Collection<CxGridGroupable> hiddenColumns = new ArrayList<>();
+ for (CxGridGroupable groupable : groupingColumn.getGroupables()){
+ if ((groupable instanceof CxGridColumn) && (((CxGridColumn)groupable).isHidden())){
+ hiddenColumns.add(groupable);
+ }
+ }
+// groupingColumn.getGroupables().clear();
+ groupingColumn.getGroupables().removeAll(hiddenColumns);
if (groupingColumn.getGroupables().size() <= 1) {
continue;
}
@@ -425,8 +555,8 @@
*/
protected void resetHeader() {
// reset the old header
- for (HeaderRow header : groupingHeaders.values()) {
- grid.removeHeaderRow(header);
+ for (int i = 0; i < groupingHeaders.size(); i++) {
+ grid.removeHeaderRow(i);
}
groupingHeaders.clear();
@@ -492,33 +622,37 @@
protected void createAutoFilters() {
cellFilters = new GridCellFilter(grid);
for (CxGridColumn cxColumn : modelAccess.yField.getColumns()) {
- Class<?> propertyType = cxColumn.getType();
-
- String propertyPath = cxColumn.getPropertyPath();
- String filterPropertyPath = cxColumn.getPropertyPath();
- if (cxColumn.isEditsDto()) {
- // if the column edits a dto, its property path points to
- // the dto. Eg. person.country.
- // So we need to use a special path for filtering which
- // points
- // to the domainkey. person.country.isoCode
- filterPropertyPath = cxColumn.getFilterPropertyPathForEditsDto();
- }
- if (Number.class.isAssignableFrom(propertyType) || isPrimitiveNumber(propertyType)) {
- cellFilters.setNumberFilter(propertyPath, filterPropertyPath);
- } else if (propertyType == String.class) {
- cellFilters.setTextFilter(propertyPath, filterPropertyPath, true, false, null);
- } else if (propertyType == Date.class) {
- cellFilters.setDateFilter(propertyPath, filterPropertyPath);
- // otherwise the column is to wide
- grid.getColumn(propertyPath).setMaximumWidth(175);
- } else if (propertyType == Boolean.class || propertyType == Boolean.TYPE) {
- cellFilters.setBooleanFilter(propertyPath, filterPropertyPath);
- } else if (propertyType.isEnum()) {
- cellFilters.setComboBoxFilter(propertyPath, filterPropertyPath,
- Arrays.asList(propertyType.getEnumConstants()));
- } else if (DtoUtils.getDomainKeyField(propertyType) != null) {
- cellFilters.setDtoFilter(propertyPath, propertyType, "");
+ if (!cxColumn.isHidden()){
+ Class<?> propertyType = cxColumn.getType();
+
+ String propertyPath = cxColumn.getPropertyPath();
+ String filterPropertyPath = cxColumn.getPropertyPath();
+ if (cxColumn.isEditsDto()) {
+ // if the column edits a dto, its property path points to
+ // the dto. Eg. person.country.
+ // So we need to use a special path for filtering which
+ // points
+ // to the domainkey. person.country.isoCode
+ filterPropertyPath = cxColumn.getFilterPropertyPathForEditsDto();
+ }
+ if (Number.class.isAssignableFrom(propertyType) || isPrimitiveNumber(propertyType)) {
+ cellFilters.setNumberFilter(propertyPath, filterPropertyPath);
+ } else if (propertyType == String.class) {
+ cellFilters.setTextFilter(propertyPath, filterPropertyPath, true, false, null);
+ } else if (propertyType == Date.class) {
+ cellFilters.setDateFilter(propertyPath, filterPropertyPath);
+ // otherwise the column is to wide
+ if (grid.getColumn(propertyPath)!=null){
+ grid.getColumn(propertyPath).setMaximumWidth(175);
+ }
+ } else if (propertyType == Boolean.class || propertyType == Boolean.TYPE) {
+ cellFilters.setBooleanFilter(propertyPath, filterPropertyPath);
+ } else if (propertyType.isEnum()) {
+ cellFilters.setComboBoxFilter(propertyPath, filterPropertyPath,
+ Arrays.asList(propertyType.getEnumConstants()));
+ } else if (DtoUtils.getDomainKeyField(propertyType) != null) {
+ cellFilters.setDtoFilter(propertyPath, propertyType, "");
+ }
}
}
}
@@ -568,7 +702,7 @@
* @return the object
*/
private Object refreshFilter() {
- Set<Container.Filter> filters = new HashSet<Container.Filter>();
+ Set<Container.Filter> filters = new HashSet<>();
for (ISearchFieldEditpart ep : filteringHeaderFields.values()) {
Container.Filter f = (Container.Filter) ep.getFilter();
if (f != null) {
@@ -676,7 +810,7 @@
* @return the cells
*/
private List<Grid.HeaderCell> getCells(HeaderRow row, CxGridGroupedCell groupingColumn) {
- List<Grid.HeaderCell> cells = new ArrayList<Grid.HeaderCell>();
+ List<Grid.HeaderCell> cells = new ArrayList<>();
for (CxGridGroupable column : groupingColumn.getGroupables()) {
if (column instanceof CxGridColumn) {
// if it is a column, then use the property id to get the cell
@@ -705,7 +839,7 @@
* @return the cells
*/
private List<Grid.FooterCell> getCells(FooterRow row, CxGridGroupedCell groupingColumn) {
- List<Grid.FooterCell> cells = new ArrayList<Grid.FooterCell>();
+ List<Grid.FooterCell> cells = new ArrayList<>();
for (CxGridGroupable column : groupingColumn.getGroupables()) {
if (column instanceof CxGridColumn) {
// if it is a column, then use the property id to get the cell
@@ -805,16 +939,17 @@
if (eventDispatcher == null) {
return;
}
- String topic = NamingConventionsUtil.toEntityName(bean.getSimpleName()) + "."
- + DtoUtils.getIdField(bean).getName();
- EventDispatcherEvent evnt = new EventDispatcherEvent(EventDispatcherCommand.SELECT, topic,
- toString());
+ MPerspective perspective = getViewContext().getService(MPerspective.class.getName());
+ EventDispatcherEvent evnt = new EventDispatcherEvent(perspective,EventDispatcherCommand.SELECT, bean.getName(), toString());
if (msg.getNewValue() != null) {
evnt.addItem(EventDispatcherDataTag.ID, DtoUtils.getIdValue(msg.getNewValue()));
- } else {
- evnt.addItem(EventDispatcherDataTag.ID, null);
+ eventDispatcher.sendEvent(evnt);
+ /**
+ * this doesn't work for updates on the dto as grid completely removes content and sends this event with null dto
+ */
+// } else {
+// evnt.addItem(EventDispatcherDataTag.ID, null);
}
- eventDispatcher.sendEvent(evnt);
}
}
}
@@ -898,27 +1033,54 @@
user.addToProperties(gridName + "." + columnId.toString(), String.valueOf(width));
}
});
+
+ // persists the changed column width into the user properties map
+ grid.addColumnReorderListener(new Grid.ColumnReorderListener() {
+
+ @Override
+ public void columnReorder(ColumnReorderEvent event) {
+ CxGrid cxGrid = modelAccess.yField;
+ String gridName = cxGrid.getProperties().get("GRIDSOURCE_ID");
+ IUser user = getViewContext().getService(IUser.class.getName());
+ List<Column> gridColumns = grid.getColumns();
+ List<Object> columnPropertyIds = new ArrayList<>();
+ for(Column column : gridColumns){
+ Object propertyId = column.getPropertyId();
+ columnPropertyIds.add(propertyId);
+ }
+ user.addToProperties(gridName, columnPropertyIds);
+ }
+ });
// Must be immediate to send the resize events immediately
grid.setImmediate(true);
applyCaptions();
// DO NOT MOVE THE FOLLOWING CODE LINES!
- // The setting of the column widths from the persisted user properties only works after the call of "applyCaptions()"
+ // The setting of the COLUMN WIDTHS and the COLUMN ORDER from the persisted user properties only works after the call of "applyCaptions()"
// due to the possible new creation of the columns in it.
- for (Column column : grid.getColumns()) {
- IUser user = getViewContext().getService(IUser.class.getName());
- String gridName = cxGrid.getProperties().get("GRIDSOURCE_ID");
+ IUser user = getViewContext().getService(IUser.class.getName());
+ String gridName = cxGrid.getProperties().get("GRIDSOURCE_ID");
+ // Temporarily deactivate to test memento ########### TODO #############
+ // COLUMN WIDTH
+ List<Column> gridColumns = grid.getColumns();
+ for (Column column : gridColumns) {
String columnWidthStr = user.getColumnUtil().getColumnWidth(gridName + "." + column.getPropertyId());
if (columnWidthStr != null){
column.setWidth(Double.parseDouble(columnWidthStr));
}
}
-
+ // COLUMN ORDER
+ Object[] columnOrder = ((List<String>) user.getProperty(gridName)).toArray();
+ try {
+ grid.setColumnOrder(columnOrder);
+ } catch (IllegalArgumentException e) {
+ // In case of an incomplete setting of the column order by the user properties
+ createInitialColumnOrder();
+ }
+ removeNotUsedColumns();
setupUserCallbacks(cxGrid);
-
}
-
return grid;
}
@@ -959,6 +1121,7 @@
* @param widget
* the widget
*/
+ @SuppressWarnings("rawtypes")
protected void createBindings(CxGrid yGrid, Grid widget) {
super.createBindings(yGrid, widget, null);
@@ -1187,6 +1350,7 @@
/**
* Is used by the editpart to update the header.
*/
+ @Override
public void updateHeader() {
createHeaderMetaCells();
updateMemento();
@@ -1195,6 +1359,7 @@
/**
* Is used by the editpart to update the footer.
*/
+ @Override
public void updateFooter() {
createFooterMetaCells();
updateMemento();
@@ -1203,6 +1368,7 @@
/**
* Is used by the editpart to update the columns.
*/
+ @Override
public void updateColumns() {
createColumns();
updateMemento();
@@ -1491,6 +1657,7 @@
}
if (bindableValue instanceof YEmbeddableCollectionEndpoint) {
+ addAutoBindingEndpoint((YBindingEndpoint) bindableValue);
return internalGetCollectionEndpoint();
} else if (bindableValue instanceof YEmbeddableSelectionEndpoint) {
return internalGetSelectionEndpoint((YEmbeddableSelectionEndpoint) bindableValue);
diff --git a/org.eclipse.osbp.ecview.extension.grid.sample/.classpath b/org.eclipse.osbp.ecview.extension.grid.sample/.classpath
index 337730e..502f456 100644
--- a/org.eclipse.osbp.ecview.extension.grid.sample/.classpath
+++ b/org.eclipse.osbp.ecview.extension.grid.sample/.classpath
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry excluding="/" kind="src" path="src-gen"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="src" path="src-gen/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/org.eclipse.osbp.ecview.extension.presentation.vaadin.tests/i18n/I18N_de_AT.properties b/org.eclipse.osbp.ecview.extension.presentation.vaadin.tests/i18n/I18N_de_AT.properties
deleted file mode 100644
index 6c73e1d..0000000
--- a/org.eclipse.osbp.ecview.extension.presentation.vaadin.tests/i18n/I18N_de_AT.properties
+++ /dev/null
@@ -1 +0,0 @@
-#de_AT
diff --git a/org.eclipse.osbp.ecview.extension.presentation.vaadin.tests/i18n/I18N_en_US.properties b/org.eclipse.osbp.ecview.extension.presentation.vaadin.tests/i18n/I18N_en_US.properties
deleted file mode 100644
index d89e21c..0000000
--- a/org.eclipse.osbp.ecview.extension.presentation.vaadin.tests/i18n/I18N_en_US.properties
+++ /dev/null
@@ -1 +0,0 @@
-#en_US
diff --git a/org.eclipse.osbp.ecview.extension.presentation.vaadin/META-INF/MANIFEST.MF b/org.eclipse.osbp.ecview.extension.presentation.vaadin/META-INF/MANIFEST.MF
index e27de06..e73adae 100644
--- a/org.eclipse.osbp.ecview.extension.presentation.vaadin/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.ecview.extension.presentation.vaadin/META-INF/MANIFEST.MF
@@ -41,13 +41,12 @@
org.eclipse.xtext.util;bundle-version="[2.11.0,2.12.0)",
org.eclipse.core.databinding.property;bundle-version="[1.6.0,1.7.0)",
org.eclipse.osbp.blob;bundle-version="0.9.0",
- org.eclipse.osbp.preferences;bundle-version="0.9.0"
+ org.eclipse.osbp.preferences;bundle-version="0.9.0",
+ org.eclipse.e4.core.contexts,
+ org.eclipse.osbp.ui.api;bundle-version="0.9.0"
Import-Package: org.apache.commons.lang,
org.eclipse.core.databinding.property.value,
org.eclipse.e4.core.services.events,
- org.eclipse.osbp.ui.api.customfields;version="0.9.0",
- org.eclipse.osbp.ui.api.functionlibrary;version="0.9.0",
- org.eclipse.osbp.ui.api.themes;version="0.9.0",
org.eclipse.osbp.utils.functionnormalizer.api;version="0.9.0",
org.eclipse.osbp.utils.themes.ui;version="0.9.0",
org.eclipse.osbp.utils.vaadin;version="0.9.0",
diff --git a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/components/BlobUploadComponentPresentation.java b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/components/BlobUploadComponentPresentation.java
index 25f8245..e4cb140 100644
--- a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/components/BlobUploadComponentPresentation.java
+++ b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/components/BlobUploadComponentPresentation.java
@@ -20,8 +20,10 @@
import org.eclipse.core.databinding.Binding;
import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.emf.databinding.EMFObservables;
import org.eclipse.osbp.blob.component.BlobUploadComponent;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
@@ -34,8 +36,10 @@
import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinProperties;
import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableValue;
import org.eclipse.osbp.ui.api.customfields.IBlobService;
+import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService;
import org.eclipse.osbp.ui.api.themes.IThemeResourceService;
import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType;
+import org.eclipse.osbp.ui.api.user.IUser;
import com.vaadin.data.util.ObjectProperty;
import com.vaadin.ui.Component;
@@ -71,14 +75,11 @@
@Override
public Component doCreateWidget(Object parent) {
if (blobUploadComp == null) {
-
- IThemeResourceService themeResourceService = getViewContext().getService(IThemeResourceService.class.getName());
+ IDSLMetadataService dslMetadataService = getViewContext().getService(IDSLMetadataService.class.getName());
IBlobService blobService = getViewContext().getService(IBlobService.class.getName());
- blobUploadComp = new BlobUploadComponent(blobService);
+ IUser user = getViewContext().getService(IUser.class.getName());
+ blobUploadComp = new BlobUploadComponent(blobService, dslMetadataService, user);
blobUploadComp.setDisplayResolutionId(modelAccess.yblobUploadComp.getDisplayResolutionId());
- blobUploadComp.setBlobUploadCompLabel(new Label(modelAccess.yblobUploadComp.getLabel()));
- blobUploadComp.setUploadIcon(themeResourceService.getThemeResource("upload", ThemeResourceType.ICON));
- blobUploadComp.setDownloadIcon(themeResourceService.getThemeResource("download", ThemeResourceType.ICON));
blobUploadComp.addStyleName(CSS_CLASS_CONTROL);
blobUploadComp.setImmediate(true);
setupComponent(blobUploadComp, getCastedModel());
diff --git a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/components/common/ECViewComponent.java b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/components/common/ECViewComponent.java
index c89d61c..7428a80 100644
--- a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/components/common/ECViewComponent.java
+++ b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/components/common/ECViewComponent.java
@@ -47,12 +47,6 @@
private static final Logger LOGGER = LoggerFactory
.getLogger(ECViewComponent.class);
- /**
- * Use this property to pass the beanSlot that should be used for the dto.
- * See properties map in {@link #render(Object, Map)}
- */
- public static final String PROP_SLOT = "beanSlot";
-
/** The cache. */
private Map<String, IViewContext> cache = new HashMap<>();
@@ -152,7 +146,7 @@
* @return the bean slot name
*/
protected String getBeanSlotName(Map<String, Object> properties) {
- return (String) properties.get(PROP_SLOT);
+ return (String) properties.get(IViewContext.PROP_SLOT);
}
/**
diff --git a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/vaadin/components/CustomDecimalField.java b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/vaadin/components/CustomDecimalField.java
index f5e1686..12ac9e8 100644
--- a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/vaadin/components/CustomDecimalField.java
+++ b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/vaadin/components/CustomDecimalField.java
@@ -116,6 +116,7 @@
*
* @see com.vaadin.ui.AbstractField#setConvertedValue(java.lang.Object)
*/
+ @Override
public void setConvertedValue(Object value) {
if (converter != null) {
converter.setConvertedDecimalFormat(null);
diff --git a/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_de_AT.properties b/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_de_AT.properties
deleted file mode 100644
index 6c73e1d..0000000
--- a/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_de_AT.properties
+++ /dev/null
@@ -1 +0,0 @@
-#de_AT
diff --git a/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_en_US.properties b/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_en_US.properties
deleted file mode 100644
index d89e21c..0000000
--- a/org.eclipse.osbp.ecview.extension.samples/i18n/I18N_en_US.properties
+++ /dev/null
@@ -1 +0,0 @@
-#en_US
diff --git a/org.eclipse.osbp.ecview.extension.strategy/META-INF/MANIFEST.MF b/org.eclipse.osbp.ecview.extension.strategy/META-INF/MANIFEST.MF
index a6f467f..a8f407f 100644
--- a/org.eclipse.osbp.ecview.extension.strategy/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.ecview.extension.strategy/META-INF/MANIFEST.MF
@@ -33,5 +33,8 @@
org.junit;bundle-version="4.11.0",
org.eclipse.osbp.ui.api;bundle-version="[0.9.0,0.10.0)",
org.eclipse.osbp.preferences;bundle-version="[0.9.0,0.10.0)",
- org.apache.pdfbox;bundle-version="2.0.6"
+ org.apache.pdfbox;bundle-version="2.0.6",
+ org.eclipse.e4.core.contexts,
+ org.eclipse.osbp.dsl.dto.lib;bundle-version="[0.9.0,0.10.0)",
+ javax.persistence;bundle-version="2.1.0"
Service-Component: OSGI-INF/*.xml
diff --git a/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/AbstractLayoutingStrategy.java b/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/AbstractLayoutingStrategy.java
index 2230f3c..438b814 100644
--- a/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/AbstractLayoutingStrategy.java
+++ b/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/AbstractLayoutingStrategy.java
@@ -19,7 +19,9 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeSet;
@@ -32,7 +34,11 @@
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.osbp.dsl.dto.lib.impl.DtoServiceAccess;
+import org.eclipse.osbp.ecview.core.common.context.IDialogViewContextCallback;
+import org.eclipse.osbp.ecview.core.common.context.IDtoServiceCallback;
import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.extender.IECViewProviderService;
import org.eclipse.osbp.ecview.core.common.model.binding.BindingFactory;
import org.eclipse.osbp.ecview.core.common.model.binding.YBindingEndpoint;
import org.eclipse.osbp.ecview.core.common.model.binding.YBindingUpdateStrategy;
@@ -74,6 +80,7 @@
import org.eclipse.osbp.ecview.core.extension.model.extension.YComboBox;
import org.eclipse.osbp.ecview.core.extension.model.extension.YDateTime;
import org.eclipse.osbp.ecview.core.extension.model.extension.YDecimalField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDialogComponent;
import org.eclipse.osbp.ecview.core.extension.model.extension.YEnumComboBox;
import org.eclipse.osbp.ecview.core.extension.model.extension.YEnumOptionsGroup;
import org.eclipse.osbp.ecview.core.extension.model.extension.YFilteringComponent;
@@ -119,12 +126,13 @@
import org.eclipse.osbp.ecview.extension.model.converter.YSimpleDecimalConverter;
import org.eclipse.osbp.ecview.extension.model.visibility.YSubTypeVisibilityProcessor;
import org.eclipse.osbp.ecview.extension.model.visibility.YVisibilityFactory;
-import org.eclipse.osbp.ecview.extension.strategy.util.NamingConventionsUtil;
import org.eclipse.osbp.ecview.extension.strategy.util.PdfPrintService;
import org.eclipse.osbp.preferences.ProductConfiguration;
+import org.eclipse.osbp.runtime.common.filter.IDTOService;
import org.eclipse.osbp.runtime.common.layouting.IPropertyConstants;
import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService;
import org.eclipse.osbp.ui.api.themes.EnumCssClass;
+import org.eclipse.osbp.ui.api.user.IUser;
import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Action;
import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Group;
import org.eclipse.osbp.ui.api.useraccess.AbstractSubOrganization;
@@ -136,14 +144,21 @@
import org.eclipse.osbp.utils.themes.ui.VaaclipseUiTheme;
import org.eclipse.osbp.utils.themes.ui.VaaclipseUiTheme.ThemeList;
import org.eclipse.xtext.util.Pair;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class AbstractLayoutingStrategy.
*/
+@SuppressWarnings("restriction")
public abstract class AbstractLayoutingStrategy implements ILayoutingStrategy {
+ /** The Constant UNGROUPED for attributes not grouped under a groupName. */
+ private static final String UNGROUPED = "<ungrouped>";
+
/** The filtered category. */
private final String filteredCategory;
@@ -168,6 +183,13 @@
private int currentIndex = 0;
+ private YFormLayout beanLayout;
+
+ private String beanTabName = null;
+
+ private IUser user;
+
+ private static Map<String, Boolean> isEditable = new HashMap<>();
/** The Constant LOGGER. */
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractLayoutingStrategy.class);
@@ -215,12 +237,15 @@
viewContext = ModelUtil.getViewContext(yLayout);
userAccessService = viewContext.getService(IUserAccessService.class.getName());
dslMetadataService = viewContext.getService(IDSLMetadataService.class.getName());
+ user = viewContext.getService(IUser.class.getName());
+
// Identify if a TabSheet is necessary due to existing table or grid
if (isTabSheetNeeded(yLayout.getSuspects())) {
YTabSheet tabSheet;
tabSheet = ExtensionModelFactory.eINSTANCE.createYTabSheet();
YTab tab = ExtensionModelFactory.eINSTANCE.createYTab();
- tab.setLabelI18nKey(getEntityI18nKey(yLayout.getSuspects()));
+ String[] tokens = yLayout.getView().getViewName().split("\\.");
+ tab.setLabelI18nKey(tokens[tokens.length-1]);
tab.setEmbeddable(layout);
tabSheet.getTabs().add(tab);
content = tabSheet;
@@ -318,22 +343,53 @@
for (YSuspect ySuspect : yLayout.getSuspects()) {
if (ySuspect.getTags().contains(TAG__TABLE) || ySuspect.getTags().contains(TAG__GRID)) {
suspectCollectionList.add(ySuspect);
+ } else if (ySuspect instanceof YTypedCompoundSuspect && ySuspect.getTags().contains(TAG__BEANONTAB)) {
+ for (YSuspect childSuspect : ((YTypedCompoundSuspect)ySuspect).getChildren()) {
+ childSuspect.getTags().add(TAG__BEAN);
+ childSuspect.setGroupName(ySuspect.getLabelI18nKey());
+ suspectCollectionList.add(childSuspect);
+ }
} else {
suspectList.add(ySuspect);
}
}
Collections.sort(suspectCollectionList, new SuspectComparator());
- suspectList.sort(new Comparator<YSuspect>() {
- @Override
- public int compare(YSuspect o1, YSuspect o2) {
- if(o1.getGroupName() != null && o2.getGroupName() != null ) {
- return o1.getGroupName().compareTo(o2.getGroupName());
- } else {
- return 0;
+ // sort by first appearance in entity
+ HashMap<String, List<YSuspect>> suspectMap = new HashMap<>();
+ List<String> suspectGroupList = new ArrayList<>();
+ for(YSuspect suspect:suspectList) {
+ if(suspect.getGroupName() == null) {
+ String groupName = UNGROUPED;
+ if(suspect instanceof YTypedCompoundSuspect && !suspect.getTags().contains(TAG__BEANONTAB)) {
+ groupName = suspect.getLabelI18nKey();
+ }
+ suspectMap.put(groupName, new ArrayList<YSuspect>());
+ if(!suspectGroupList.contains(groupName)) {
+ suspectGroupList.add(groupName);
+ }
+ } else {
+ suspectMap.put(suspect.getGroupName(), new ArrayList<YSuspect>());
+ if(!suspectGroupList.contains(suspect.getGroupName())) {
+ suspectGroupList.add(suspect.getGroupName());
}
}
- });
-
+ }
+ for(YSuspect suspect:suspectList) {
+ if(suspect.getGroupName() == null) {
+ String groupName = UNGROUPED;
+ if(suspect instanceof YTypedCompoundSuspect && !suspect.getTags().contains(TAG__BEANONTAB)) {
+ groupName = suspect.getLabelI18nKey();
+ }
+ suspectMap.get(groupName).add(suspect);
+ } else {
+ suspectMap.get(suspect.getGroupName()).add(suspect);
+ }
+ }
+ suspectList.clear();
+ for(String suspectGroup:suspectGroupList) {
+ suspectList.addAll(suspectMap.get(suspectGroup));
+ }
+ // add the collections for the following tabs
suspectList.addAll(suspectCollectionList);
return suspectList;
}
@@ -349,6 +405,7 @@
* the suspect info
*/
private void addElement(YEmbeddable content, YEmbeddable element, YSuspectInfo suspectInfo, int numberColumns) {
+
if (content instanceof YTabSheet) {
EList<YTab> tabs = ((YTabSheet) content).getTabs();
if (suspectInfo.getSuspect().getTags().contains(TAG__TABLE)
@@ -361,9 +418,19 @@
cellStyle.setAlignment(YAlignment.FILL_FILL);
tab.setEmbeddable(layout);
tabs.add(tab);
+ } else if (suspectInfo.getSuspect().getTags().contains(TAG__BEAN)) {
+ if(beanTabName == null || !suspectInfo.getSuspect().getGroupName().equals(beanTabName)) {
+ YTab tab = ExtensionModelFactory.eINSTANCE.createYTab();
+ tab.setLabelI18nKey(suspectInfo.getSuspect().getGroupName());
+ beanLayout = ExtensionModelFactory.eINSTANCE.createYFormLayout();
+ tab.setEmbeddable(beanLayout);
+ tabs.add(tab);
+ beanTabName = suspectInfo.getSuspect().getGroupName();
+ }
+ beanLayout.addElement(element);
} else {
if (suspectInfo.getSuspect().getTags().contains(TAG__GROUP)) {
- createGrouping((YLayout) tabs.get(0).getEmbeddable(), element, suspectInfo, numberColumns);
+ createGrouping(tabs.get(0).getEmbeddable(), element, suspectInfo, numberColumns);
} else {
// Gets the YLayout of the first tab to add the element
if(numberColumns > 0) {
@@ -635,7 +702,7 @@
yEmbeddable = createIconComboBox(ySuspect);
} else if (ySuspect.getTags().contains(TAG__SUBTYPES_ROOT)) {
createSubTypeElements((YSubTypeBaseSuspect) ySuspect);
- } else if (ySuspect.getTags().contains(TAG__DTO)) {
+ } else if (ySuspect.getTags().contains(TAG__DTO) && !ySuspect.getTags().contains(TAG__BEANONTAB)) {
createNestedBeanElements((YTypedCompoundSuspect) ySuspect);
} else {
yEmbeddable = ExtensionModelFactory.eINSTANCE.createYTextField();
@@ -645,6 +712,9 @@
yEmbeddable.setLabel(ySuspect.getLabel());
yEmbeddable.setId(ySuspect.getId());
yEmbeddable.setCssClass(EnumCssClass.BOX.styleName());
+ if (ySuspect.getTags().contains(TAG__READONLY)) {
+ yEmbeddable.setReadonly(true);
+ }
suspectInfo.setTarget(yEmbeddable);
@@ -676,11 +746,7 @@
}
}
- // ------------------------------
-
- // Only for Test purposes
- // Test Converter
- if (ySuspect.getTags().contains("FloatToUomo")) {
+ if (ySuspect.getTags().contains(TAG__NUMBER_TO_UOMO)) {
((YNumericField) yEmbeddable).setConverter(YConverterFactory.eINSTANCE.createYNumericToUomoConverter());
}
@@ -780,6 +846,8 @@
private YEmbeddable createNestedBeanElements(YTypedCompoundSuspect ySuspect) {
for (YSuspect childSuspect : ySuspect.getChildren()) {
+ childSuspect.setGroupName(ySuspect.getLabelI18nKey());
+ childSuspect.getTags().add(TAG__GROUP);
// Create a new suspect info.
YSuspectInfo suspectInfo = layoutingInfo.createSuspectInfo(childSuspect);
// add the suspectInfo as active suspect
@@ -943,7 +1011,6 @@
// create search dialog
Class<?> type = yTypedSuspect.getType();
YFilteringComponent yFilterComponent = ExtensionModelFactory.eINSTANCE.createYFilteringComponent();
-
String filterDepthString = suspectProperties.get(IPropertyConstants.PROPERTY__FILTER_DEPTH);
int depth = 0;
if (filterDepthString != null) {
@@ -955,6 +1022,14 @@
if (!yFilterComponent.getFilterDescriptors().isEmpty()) {
beanReferenceField.setFilteringComponent(yFilterComponent);
}
+
+ if(ySuspect.getTags().contains(TAG__SIDEKICK)) {
+ YDialogComponent yDialogComponent = ExtensionModelFactory.eINSTANCE.createYDialogComponent();
+ yDialogComponent.setType(type);
+ yDialogComponent.setViewContextCallback(new DialogViewContextCallback());
+ yDialogComponent.setUpdateCallback(new DtoServiceCallback());
+ beanReferenceField.setDialogComponent(yDialogComponent);
+ }
}
// Alternative for non editable bean references is a non editable
@@ -978,6 +1053,65 @@
return yEmbeddable;
}
+ /**
+ * Gets the bean slot name.
+ *
+ * @param properties
+ * the properties
+ * @return the bean slot name
+ */
+ protected String getBeanSlotName(Map<String, Object> properties) {
+ return (String) properties.get(IViewContext.PROP_SLOT);
+ }
+
+ public IViewContext getAutobindedDialogModel(Class<?> dtoType) {
+ IViewContext viewContext = null;
+ BundleContext bc = FrameworkUtil.getBundle(getClass()).getBundleContext();
+ ServiceReference<IECViewProviderService> ref = bc.getServiceReference(IECViewProviderService.class);
+ if (ref != null) {
+ IECViewProviderService service = bc.getService(ref);
+ viewContext = service.getViewContext(dtoType, IViewContext.MAIN_BEAN_SLOT);
+ bc.ungetService(ref);
+ } else {
+ LOGGER.error("{}", "IECViewProviderService not found");
+ }
+ if(viewContext != null) {
+ return viewContext;
+ } else {
+ LOGGER.error("No view found for dto {}", dtoType.getCanonicalName());
+ }
+ return null;
+ }
+
+ class DialogViewContextCallback implements IDialogViewContextCallback {
+ @Override
+ public IViewContext getDialogViewContext(Class<?> type) {
+ IViewContext dialogViewContext = getAutobindedDialogModel(type);
+ if(dialogViewContext != null) {
+ dialogViewContext.setLocale(user.getLocale());
+ dialogViewContext.setRenderingParams(viewContext.getRenderingParams());
+ try {
+ Object newDto = type.newInstance();
+ dialogViewContext.setBean(getBeanSlotName(dialogViewContext.getRenderingParams()), newDto);
+ } catch (InstantiationException | IllegalAccessException e) {
+ LOGGER.error("{}", e);
+ }
+ }
+ return dialogViewContext;
+ }
+ }
+
+ class DtoServiceCallback implements IDtoServiceCallback {
+ @Override
+ public void persist(IViewContext dialogViewContext) {
+ Object dto = dialogViewContext.getBean(getBeanSlotName(dialogViewContext.getRenderingParams()));
+ IDTOService<?> dtoService = DtoServiceAccess.getService(dto.getClass());
+ if(dtoService != null) {
+ dtoService.persist(dto);
+ }
+ }
+ }
+
private String getCaptionPropertyPath(EMap<String, String> suspectProperties) {
String captionPropertyPath = suspectProperties.get(IPropertyConstants.PROPERTY__ITEM_CAPTION);
if (captionPropertyPath == null || captionPropertyPath.isEmpty()) {
@@ -1206,12 +1340,8 @@
YEmbeddable yEmbeddable;
yEmbeddable = YECviewFactory.eINSTANCE.createYI18nComboBox();
YI18nComboBox yCombo = (YI18nComboBox) yEmbeddable;
- // yCombo.setUseBeanService(false);
yCombo.setType(String.class);
yCombo.setTypeQualifiedName(String.class.getCanonicalName());
- // yCombo.setModelSelectionType(String.class);
- // yCombo.setModelSelectionTypeQualifiedName(String.class.getCanonicalName());
-
return yEmbeddable;
}
@@ -1269,12 +1399,15 @@
if (suspect.getTags().contains(TAG__TABLE) || suspect.getTags().contains(TAG__GRID)) {
return true;
}
+ if(suspect instanceof YTypedCompoundSuspect && suspect.getTags().contains(TAG__BEANONTAB)) {
+ return true;
+ }
}
return false;
}
/**
- * Checks for existing supect property
+ * Checks for existing suspect property
*/
private boolean existInProperties(YElement ySuspect, String propConstant) {
if (!ySuspect.getProperties().isEmpty()) {
@@ -1313,32 +1446,26 @@
String dtoName = ySuspect.getAuthorizationGroup();
String dtoProperty = ySuspect.getAuthorizationId();
- if (userAccessService.isGranted(Group.DTO, Action.READABLE, dtoName)) {
- boolean invisible = userAccessService.isVetoed(Group.DTO, Action.INVISIBLE, dtoName, dtoProperty);
- if (!invisible) {
- boolean enabled = !userAccessService.isVetoed(Group.DTO, Action.DISABLED, dtoName, dtoProperty);
- boolean editable = !userAccessService.isVetoed(Group.DTO, Action.NONEDITABLE, dtoName, dtoProperty);
- if (enabled && editable) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Gets the entity i18n key.
- *
- * @param suspects
- * the suspects
- * @return the entity i18n key
- */
- private String getEntityI18nKey(EList<YSuspect> suspects) {
- for (YSuspect suspect : suspects) {
- String dto = suspect.getAuthorizationGroup();
- return NamingConventionsUtil.toSimpleEntityName(dto);
- }
- return "";
+ Boolean result=false;
+ String grantKey = dtoName + "." + dtoProperty + "###EDITABLE";
+ if( isEditable.containsKey(grantKey)) {
+ result=isEditable.get(grantKey);
+ } else {
+ if (userAccessService.isGranted(Group.DTO, Action.READABLE, dtoName)) {
+ boolean invisible = userAccessService.isVetoed(Group.DTO, Action.INVISIBLE, dtoName, dtoProperty);
+ boolean enabled = false;
+ boolean editable = false;
+ if (!invisible) {
+ enabled = !userAccessService.isVetoed(Group.DTO, Action.DISABLED, dtoName, dtoProperty);
+ if (enabled) {
+ editable = !userAccessService.isVetoed(Group.DTO, Action.NONEDITABLE, dtoName, dtoProperty);
+ }
+ }
+ result = !invisible && enabled && editable;
+ }
+ isEditable.put(grantKey,result);
+ }
+ return result;
}
/**
diff --git a/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/GridFactory.java b/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/GridFactory.java
index ed85fa0..4333433 100644
--- a/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/GridFactory.java
+++ b/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/GridFactory.java
@@ -101,6 +101,7 @@
col.setTypeQualifiedName(info.getTypeQualifiedName());
}
+ col.setSourceType(info.getSourceType());
col.setHideable(true);
Pair pair = createRendererPair(info);