Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2013-04-16 10:21:16 -0400
committercletavernie2013-04-16 10:21:16 -0400
commit477cb0c4b53b595f8edb2cfd1b40994bd41b4373 (patch)
treeed9f9fbc381547ea5be7eac75bf613caa414a270 /sandbox
parent761dc35af2c8a8a673091710cd07eb97bcfb0ab8 (diff)
downloadorg.eclipse.papyrus-477cb0c4b53b595f8edb2cfd1b40994bd41b4373.tar.gz
org.eclipse.papyrus-477cb0c4b53b595f8edb2cfd1b40994bd41b4373.tar.xz
org.eclipse.papyrus-477cb0c4b53b595f8edb2cfd1b40994bd41b4373.zip
[Sandbox] Update the sample properties view/table integration
404531: [Table 2] Metamodel must be refactored https://bugs.eclipse.org/bugs/show_bug.cgi?id=404531
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration52
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/SynchronizedFeatureValueAxisManager.java22
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/widgets/NattablePropertyEditor.java38
3 files changed, 63 insertions, 49 deletions
diff --git a/sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration b/sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration
index 4566daabc62..1b32af8a56b 100644
--- a/sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration
@@ -1,32 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
-<nattableconfiguration:TableConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:nattable="http://www.eclipse.org/papyrus/nattable/model" xmlns:nattableaxisconfiguration="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisconfiguration" xmlns:nattableaxisprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider" xmlns:nattableconfiguration="http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration" xmlns:nattablelabelprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattablecontentprovider" type="PapyruGenericNattable">
- <rowAxisProvider xsi:type="nattableaxisprovider:EMFFeatureValueAxisProvider">
- <javaAxisManagerIds>org.eclipse.papyrus.emf.nattable.synchronized.featurevalue.axis.manager</javaAxisManagerIds>
- <axisConfiguration xsi:type="nattableaxisconfiguration:DefaultAxisConfiguration" displayIndex="false">
- <labelConfiguration xsi:type="nattablelabelprovider:ObjectLabelProviderConfiguration" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.labelprovider"/>
- </axisConfiguration>
- <listenFeature xsi:type="ecore:EReference" href="http://www.eclipse.org/uml2/4.0.0/UML#//StructuredClassifier/ownedAttribute"/>
- </rowAxisProvider>
- <columnAxisProvider xsi:type="nattableaxisprovider:DefaultAxisProvider">
- <javaAxisManagerIds>org.eclipse.papyrus.uml.nattable.feature.axis.manager</javaAxisManagerIds>
- <javaAxisManagerIds>org.eclipse.papyrus.uml.nattable.stereotype.property.axis.manager</javaAxisManagerIds>
- <axisConfiguration xsi:type="nattableaxisconfiguration:DefaultAxisConfiguration" indexStyle="ALPHABETIC" displayIndex="false">
- <labelConfiguration xsi:type="nattablelabelprovider:FeatureLabelProviderConfiguration" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.feature.labelprovider" displayType="false"/>
- </axisConfiguration>
- <axis xsi:type="nattable:EObjectAxis" xmi:id="_wNegDJYhEeKsVckQ7wUDqg">
- <element href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name"/>
+<nattableconfiguration:TableConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:nattableaxis="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis" xmlns:nattableaxisconfiguration="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisconfiguration" xmlns:nattableaxisprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider" xmlns:nattableconfiguration="http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration" xmlns:nattablelabelprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattablecontentprovider" xmlns:nattabletester="http://www.eclipse.org/papyrus/nattable/model/table/nattabletester" description="This table references all the owned attributes of the context element" name="OwnedAttributeTable" type="PapyrusOwnedAttributeTable" iconPath="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/icons/uml_generic_table.gif" defaultRowAxisProvider="//@rowAxisProviders.0" defaultColumnAxisProvider="//@columnAxisProviders.0">
+ <creationTester xsi:type="nattabletester:JavaTableTester" tester="org.eclipse.papyrus.uml.nattable.tester.isumlelement"/>
+ <rowHeaderAxisConfiguration xsi:type="nattableaxisconfiguration:TableHeaderAxisConfiguration" indexStyle="NUMERIC" displayIndex="false">
+ <ownedLabelConfiguration xsi:type="nattablelabelprovider:ObjectLabelProviderConfiguration"/>
+ <ownedAxisConfiguration xsi:type="nattableaxisconfiguration:EStructuralFeatureValueFillingConfiguration">
+ <listenFeature xsi:type="ecore:EReference" href="http://www.eclipse.org/uml2/4.0.0/UML#//StructuredClassifier/ownedAttribute"/>
+ </ownedAxisConfiguration>
+ <axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.emf.nattable.synchronized.featurevalue.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.labelprovider" headerLabelConfiguration="//@rowHeaderAxisConfiguration/@ownedLabelConfiguration.0" specificAxisConfiguration="//@rowHeaderAxisConfiguration/@ownedAxisConfiguration.0"/>
+ </rowHeaderAxisConfiguration>
+ <columnHeaderAxisConfiguration xsi:type="nattableaxisconfiguration:TableHeaderAxisConfiguration" displayIndex="false">
+ <ownedLabelConfiguration xsi:type="nattablelabelprovider:FeatureLabelProviderConfiguration"/>
+ <axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.uml.nattable.feature.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.feature.labelprovider" headerLabelConfiguration="//@columnHeaderAxisConfiguration/@ownedLabelConfiguration.0"/>
+ <axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.uml.nattable.stereotype.property.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.feature.labelprovider" headerLabelConfiguration="//@columnHeaderAxisConfiguration/@ownedLabelConfiguration.0"/>
+ </columnHeaderAxisConfiguration>
+ <columnAxisProviders xsi:type="nattableaxisprovider:SlaveObjectAxisProvider" description="This axis provider provides available columns according to the rows of the table (features of the object displayed on the other axis)" name="UML Feature axis provider">
+ <axis xsi:type="nattableaxis:EStructuralFeatureAxis" manager="//@rowHeaderAxisConfiguration/@axisManagers.0">
+ <element xsi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name"/>
</axis>
- <axis xsi:type="nattable:EObjectAxis" xmi:id="_wNef_ZYhEeKsVckQ7wUDqg">
- <element href="http://www.eclipse.org/uml2/4.0.0/UML#//TypedElement/type"/>
+ <axis xsi:type="nattableaxis:EStructuralFeatureAxis" manager="//@rowHeaderAxisConfiguration/@axisManagers.0">
+ <element xsi:type="ecore:EReference" href="http://www.eclipse.org/uml2/4.0.0/UML#//TypedElement/type"/>
</axis>
- <axis xsi:type="nattable:EObjectAxis" xmi:id="_wNef-JYhEeKsVckQ7wUDqg">
- <element href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/visibility"/>
+ <axis xsi:type="nattableaxis:EStructuralFeatureAxis" manager="//@rowHeaderAxisConfiguration/@axisManagers.0">
+ <element xsi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/visibility"/>
</axis>
- <axis xsi:type="nattable:EObjectAxis" xmi:id="_wNef7ZYhEeKsVckQ7wUDqg">
- <element href="http://www.eclipse.org/uml2/4.0.0/UML#//Property/defaultValue"/>
+ <axis xsi:type="nattableaxis:EStructuralFeatureAxis" manager="//@rowHeaderAxisConfiguration/@axisManagers.0">
+ <element xsi:type="ecore:EReference" href="http://www.eclipse.org/uml2/4.0.0/UML#//Property/defaultValue"/>
</axis>
- <axis xsi:type="nattable:EObjectAxis" xmi:id="_wNef8pYhEeKsVckQ7wUDqg">
- <element href="http://www.eclipse.org/uml2/4.0.0/UML#//Property/isDerived"/>
+ <axis xsi:type="nattableaxis:EStructuralFeatureAxis" manager="//@rowHeaderAxisConfiguration/@axisManagers.0">
+ <element xsi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/4.0.0/UML#//Property/isDerived"/>
</axis>
- </columnAxisProvider>
+ </columnAxisProviders>
+ <rowAxisProviders xsi:type="nattableaxisprovider:MasterObjectAxisProvider" description="This axis provider contains the object dropped by the user into the table" name="DroppedElementAxisProvider"/>
</nattableconfiguration:TableConfiguration>
diff --git a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/SynchronizedFeatureValueAxisManager.java b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/SynchronizedFeatureValueAxisManager.java
index 7c4101e7ace..b934f486b45 100644
--- a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/SynchronizedFeatureValueAxisManager.java
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/SynchronizedFeatureValueAxisManager.java
@@ -17,10 +17,8 @@ import java.util.List;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.papyrus.infra.nattable.manager.axis.AbstractSynchronizedOnFeatureAxisManager;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.EMFFeatureValueAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.EStructuralFeatureValueFillingConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration;
/**
*
@@ -29,14 +27,20 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.EM
*/
public class SynchronizedFeatureValueAxisManager extends AbstractSynchronizedOnFeatureAxisManager {
- @Override
- public void init(INattableModelManager manager, String managerId, Table table, AbstractAxisProvider provider, boolean mustRefreshOnAxisChanges) {
- super.init(manager, managerId, table, provider, mustRefreshOnAxisChanges);
- }
+ public static final String AXIS_MANAGER_ID = "org.eclipse.papyrus.emf.nattable.synchronized.featurevalue.axis.manager"; //$NON-NLS-1$
@Override
public synchronized void updateAxisContents() {
- EStructuralFeature synchronizedFeature = ((EMFFeatureValueAxisProvider)getRepresentedContentProvider()).getListenFeature();
+
+ EStructuralFeatureValueFillingConfiguration config = null;
+ for(final IAxisConfiguration current : this.rep.getSpecificAxisConfiguration()) {
+ if(current instanceof EStructuralFeatureValueFillingConfiguration) {
+ config = (EStructuralFeatureValueFillingConfiguration)current;
+ break;
+ }
+ }
+
+ EStructuralFeature synchronizedFeature = config.getListenFeature();
List<Object> theList = getTableManager().getElementsList(getRepresentedContentProvider());
theList.clear();
diff --git a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/widgets/NattablePropertyEditor.java b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/widgets/NattablePropertyEditor.java
index 62d2db91d08..353ac387570 100644
--- a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/widgets/NattablePropertyEditor.java
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/widgets/NattablePropertyEditor.java
@@ -24,8 +24,10 @@ import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.NattableFactory;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.EStructuralFeatureValueFillingConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.EMFFeatureValueAxisProvider;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderFactory;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
import org.eclipse.papyrus.views.properties.contexts.Property;
@@ -33,11 +35,11 @@ import org.eclipse.papyrus.views.properties.modelelement.EMFModelElement;
import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
import org.eclipse.papyrus.views.properties.table.Activator;
import org.eclipse.papyrus.views.properties.widgets.AbstractPropertyEditor;
-import org.eclipse.papyrus.views.properties.widgets.layout.GridData;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
@@ -61,7 +63,7 @@ public class NattablePropertyEditor extends AbstractPropertyEditor {
fillLayout.marginWidth = 10;
self.setLayout(fillLayout);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- data.heightHint = 300;
+ data.minimumHeight = 300;
self.setLayoutData(data);
}
@@ -142,7 +144,7 @@ public class NattablePropertyEditor extends AbstractPropertyEditor {
final Table table = NattableFactory.eINSTANCE.createTable();
- table.setEditorConfiguration(tableConfiguration);
+ table.setTableConfiguration(tableConfiguration);
Property property = getModelProperty();
if(property != null) {
String description = property.getDescription();
@@ -154,29 +156,35 @@ public class NattablePropertyEditor extends AbstractPropertyEditor {
table.setName(getLabel());
table.setContext(sourceElement);
- AbstractAxisProvider rowProvider = tableConfiguration.getRowAxisProvider();
+ AbstractAxisProvider rowProvider = tableConfiguration.getDefaultRowAxisProvider();
if(rowProvider == null) {
- rowProvider = NattableaxisproviderFactory.eINSTANCE.createDefaultAxisProvider();
+ rowProvider = NattableaxisproviderFactory.eINSTANCE.createMasterObjectAxisProvider();
} else {
rowProvider = EcoreUtil.copy(rowProvider);
}
- AbstractAxisProvider columnProvider = tableConfiguration.getColumnAxisProvider();
+ AbstractAxisProvider columnProvider = tableConfiguration.getDefaultColumnAxisProvider();
if(columnProvider == null) {
- columnProvider = NattableaxisproviderFactory.eINSTANCE.createDefaultAxisProvider();
+ columnProvider = NattableaxisproviderFactory.eINSTANCE.createSlaveObjectAxisProvider();
} else {
columnProvider = EcoreUtil.copy(columnProvider);
}
- if(rowProvider instanceof EMFFeatureValueAxisProvider) {
- EMFFeatureValueAxisProvider emfAxisProvider = (EMFFeatureValueAxisProvider)rowProvider;
-
- emfAxisProvider.setListenFeature(synchronizedFeature);
+ TableHeaderAxisConfiguration rowHeaderAxisconfig = tableConfiguration.getRowHeaderAxisConfiguration();
+ for(IAxisConfiguration axisConfig : rowHeaderAxisconfig.getOwnedAxisConfiguration()) {
+ if(axisConfig instanceof EStructuralFeatureValueFillingConfiguration) {
+ ((EStructuralFeatureValueFillingConfiguration)axisConfig).setListenFeature(synchronizedFeature);
+ }
}
-
- table.setColumnAxisProvider(columnProvider);
- table.setRowAxisProvider(rowProvider);
+ // if(rowProvider instanceof EMFFeatureValueAxisProvider) {
+ // EMFFeatureValueAxisProvider emfAxisProvider = (EMFFeatureValueAxisProvider)rowProvider;
+ //
+ // emfAxisProvider.setListenFeature(synchronizedFeature);
+ // }
+
+ table.setCurrentColumnAxisProvider(columnProvider);
+ table.setCurrentRowAxisProvider(rowProvider);
return table;
}

Back to the top