Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2020-02-19 14:20:29 +0000
committerVincent Lorenzo2020-02-19 15:09:14 +0000
commit4f1bd2898064a6384b491469b033f51f71d52f05 (patch)
tree3cf6c72167cbad66ef67de322718daacf5369ced /plugins/infra
parent652770afc708e7707473f510f468e15858ee8c18 (diff)
downloadorg.eclipse.papyrus-master.tar.gz
org.eclipse.papyrus-master.tar.xz
org.eclipse.papyrus-master.zip
Bug 560318: [Table] The hide of the column of row header doesn't work on TreeTableHEADmaster
Change-Id: Id9dee8c6e3820a563e7b3ada4c2b612d4ae26127 Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java25
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java100
2 files changed, 75 insertions, 50 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
index 176e1d1a29a..0bd3d55b1b6 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
@@ -14,7 +14,7 @@
* Nicolas Boulay (Esterel Technologies SAS) - Bug 497467
* Sebastien Bordes (Esterel Technologies SAS) - Bug 497738
* Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 459220, 526146, 515737, 516314
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Bug 559973
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Bug 559973, 560318
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.manager.table;
@@ -461,7 +461,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
/**
*
* @return
- * the new list to use for vertical element
+ * the new list to use for vertical element
*/
protected List<Object> createVerticalElementList() {
// return Collections.synchronizedList(new ArrayList<Object>());
@@ -475,7 +475,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
/**
*
* @return
- * the new list to use for horizontal element
+ * the new list to use for horizontal element
*/
protected List<Object> createHorizontalElementList() {
// return Collections.synchronizedList(new ArrayList<Object>());
@@ -1129,7 +1129,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
/**
*
* @return
- * a new runnable for the refreash action
+ * a new runnable for the refreash action
*/
private Runnable createRefreshRunnable() {
return new Runnable() {
@@ -1178,6 +1178,8 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
if (isRefreshing.compareAndSet(false, true)) {
final SelectionLayer selectionLayer = getBodyLayerStack().getSelectionLayer();
selectionLayer.doCommand(new ClearAllSelectionsCommand());
+
+
this.natTable.refresh();
// Refresh the nattable columns size in the case of named style
@@ -1303,7 +1305,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
* @param table
* the table
* @return
- * the celleditor declaration to use according to the table configuration and {@link Table#isInvertAxis()}
+ * the celleditor declaration to use according to the table configuration and {@link Table#isInvertAxis()}
*/
private CellEditorDeclaration getCellEditorDeclarationToUse(final Table table) {
CellEditorDeclaration declaration = table.getTableConfiguration().getCellEditorDeclaration();
@@ -2000,6 +2002,13 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
resizeAxis();
resizeHeader();
}
+
+ /*
+ * refresh when with show/hide the column for row header label (for example)
+ */
+ if (notification.getNewValue() instanceof Boolean && notification.getNotifier() instanceof AbstractHeaderAxisConfiguration) {
+ resizeHeader();
+ }
}
}
});
@@ -2059,7 +2068,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
*/
@Override
public Cell getCell(final Object columnElement, final Object rowElement) {
- //required to support axis with no associated element
+ // required to support axis with no associated element
if (AxisUtils.getRepresentedElement(columnElement) != null && AxisUtils.getRepresentedElement(rowElement) != null) {
final CellMapKey key = new CellMapKey(columnElement, rowElement);
return this.cellsMap.get(key);
@@ -2155,7 +2164,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
/**
* @return
- * the filter strategy to use
+ * the filter strategy to use
*
*/
@Override
@@ -2169,7 +2178,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
/**
*
* @return
- * a new decoration service listener
+ * a new decoration service listener
*/
private Observer getOrCreateDecorationServiceObserver() {
if (this.decoractionServiceObserver == null) {
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java
index 1b8f9629640..9b943577f23 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2015, 2016 CEA LIST and others.
+ * Copyright (c) 2015, 2016, 2020 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -12,6 +12,7 @@
* CEA LIST - Initial API and implementation
* Dirk Fauth <dirk.fauth@googlemail.com> - Bug 488234
* Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 508175
+ * Vincent LORENZO (CEA LIST) vincent.lorenzo@cea.fr - Bug 560318
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.manager.table;
@@ -362,18 +363,32 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
*/
public int getWidthOfSliderComposite() {
int result = 0;
-
- final IntValueStyle valueRowHeader = (IntValueStyle) getTable().getNamedStyle(NattablestylePackage.eINSTANCE.getIntValueStyle(), NamedStyleConstants.ROW_HEADER_WIDTH);
- if (null != valueRowHeader) {
- result = valueRowHeader.getIntValue();
- } else {
- result = calculateBestWidthSliderComposite();
+ AbstractHeaderAxisConfiguration configuration = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisConfigurationUsedInTable(getTable());
+ if (configuration.isDisplayLabel()) {
+ final IntValueStyle valueRowHeader = (IntValueStyle) getTable().getNamedStyle(NattablestylePackage.eINSTANCE.getIntValueStyle(), NamedStyleConstants.ROW_HEADER_WIDTH);
+ if (null != valueRowHeader && valueRowHeader.getIntValue() != 0) {
+ result = valueRowHeader.getIntValue();
+ } else {
+ result = calculateBestWidthSliderComposite();
+ }
}
-
return result;
}
/**
+ * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#resizeHeader()
+ *
+ */
+ @Override
+ public void resizeHeader() {
+ ClientAreaAdapter clientAreaAdapter = new ClientAreaAdapter(getRowHeaderLayerStack().getViewportLayer().getClientAreaProvider());
+ clientAreaAdapter.setWidth(getWidthOfSliderComposite());
+ getRowHeaderLayerStack().getViewportLayer().setClientAreaProvider(clientAreaAdapter);
+ super.resizeHeader();
+ refreshNatTable();
+ }
+
+ /**
* This allows to calculate the initial width of the row header.
*
* @return The int value corresponding to the needed row header width.
@@ -383,42 +398,43 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
// If non namedStyle exists for the slider composite, the initial width of the table must be an addition of:
// - The size of the two first columns
- // - The alf size of the 3rd column
+ // - The half size of the 3rd column
int result = 0;
-
- final AbstractHeaderAxisConfiguration rowHeader = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisConfigurationUsedInTable(getTable());
-
- // Get the size of the two first columns
- final IntValueStyle valueFirstRow = (IntValueStyle) rowHeader.getNamedStyle(NattablestylePackage.eINSTANCE.getIntValueStyle(), NamedStyleConstants.ROW_LABEL_WIDTH);
- if (null != valueFirstRow) {
- result += valueFirstRow.getIntValue();
- } else {
- result += DefaultSizeUtils.getDefaultRowHeaderWidth();
- }
- final IntValueStyle valueSecondRow = (IntValueStyle) rowHeader.getNamedStyle(NattablestylePackage.eINSTANCE.getIntValueStyle(), NamedStyleConstants.ROW_LABEL_POSITION_PREFIX_WIDTH + "2" + NamedStyleConstants.ROW_LABEL_POSITION_SUFFIX_WIDTH); //$NON-NLS-1$
- if (null != valueSecondRow) {
- result += valueSecondRow.getIntValue();
- } else {
- result += DefaultSizeUtils.getDefaultRowHeaderWidth();
- }
-
- // Get the alf size of the 3rd column
- final IntValueStyle valueThirdRow = (IntValueStyle) rowHeader.getNamedStyle(NattablestylePackage.eINSTANCE.getIntValueStyle(), NamedStyleConstants.ROW_LABEL_POSITION_PREFIX_WIDTH + "3" + NamedStyleConstants.ROW_LABEL_POSITION_SUFFIX_WIDTH); //$NON-NLS-1$
- if (null != valueThirdRow) {
- if (1 == valueThirdRow.getIntValue() % 2) {
- result += (valueThirdRow.getIntValue() / 2) + 1;
+ AbstractHeaderAxisConfiguration configuration = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisConfigurationUsedInTable(getTable());
+ if (configuration.isDisplayLabel()) {
+ final AbstractHeaderAxisConfiguration rowHeader = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisConfigurationUsedInTable(getTable());
+
+ // Get the size of the two first columns
+ final IntValueStyle valueFirstRow = (IntValueStyle) rowHeader.getNamedStyle(NattablestylePackage.eINSTANCE.getIntValueStyle(), NamedStyleConstants.ROW_LABEL_WIDTH);
+ if (null != valueFirstRow) {
+ result += valueFirstRow.getIntValue();
} else {
- result += valueThirdRow.getIntValue() / 2;
+ result += DefaultSizeUtils.getDefaultRowHeaderWidth();
}
- } else {
- if (1 == DefaultSizeUtils.getDefaultRowHeaderWidth() % 2) {
- result += (DefaultSizeUtils.getDefaultRowHeaderWidth() / 2) + 1;
+ final IntValueStyle valueSecondRow = (IntValueStyle) rowHeader.getNamedStyle(NattablestylePackage.eINSTANCE.getIntValueStyle(), NamedStyleConstants.ROW_LABEL_POSITION_PREFIX_WIDTH + "2" + NamedStyleConstants.ROW_LABEL_POSITION_SUFFIX_WIDTH); //$NON-NLS-1$
+ if (null != valueSecondRow) {
+ result += valueSecondRow.getIntValue();
} else {
- result += DefaultSizeUtils.getDefaultRowHeaderWidth() / 2;
+ result += DefaultSizeUtils.getDefaultRowHeaderWidth();
}
- }
+ // Get the half size of the 3rd column
+ final IntValueStyle valueThirdRow = (IntValueStyle) rowHeader.getNamedStyle(NattablestylePackage.eINSTANCE.getIntValueStyle(), NamedStyleConstants.ROW_LABEL_POSITION_PREFIX_WIDTH + "3" + NamedStyleConstants.ROW_LABEL_POSITION_SUFFIX_WIDTH); //$NON-NLS-1$
+ if (null != valueThirdRow) {
+ if (1 == valueThirdRow.getIntValue() % 2) {
+ result += (valueThirdRow.getIntValue() / 2) + 1;
+ } else {
+ result += valueThirdRow.getIntValue() / 2;
+ }
+ } else {
+ if (1 == DefaultSizeUtils.getDefaultRowHeaderWidth() % 2) {
+ result += (DefaultSizeUtils.getDefaultRowHeaderWidth() / 2) + 1;
+ } else {
+ result += DefaultSizeUtils.getDefaultRowHeaderWidth() / 2;
+ }
+ }
+ }
return result;
}
@@ -589,7 +605,7 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
* @param contentProvider
* @param columnAxisManager
* @return
- * the Composite axis manager used to manage Tree
+ * the Composite axis manager used to manage Tree
* @since 3.0
*/
protected ICompositeAxisManager createTreeAxisManager(List<AxisManagerRepresentation> representations, AbstractAxisProvider contentProvider, boolean columnAxisManager) {
@@ -746,7 +762,7 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
* the body layer stack to use
*
* @return
- * the row header layer stack to use
+ * the row header layer stack to use
*/
@Override
protected RowHeaderLayerStack createRowHeaderLayerStack(BodyLayerStack bodyLayerStack) {
@@ -789,7 +805,7 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
* @param iAxis
* The list of axis.
*/
- private void modifyAcisDeliver(final List<IAxis> iAxis) {
+ private void modifyAxisDeliver(final List<IAxis> iAxis) {
for (IAxis axis : iAxis) {
if (axis instanceof ITreeItemAxis) {
boolean isDelivering = axis.eDeliver();
@@ -829,14 +845,14 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
@Override
public void run() {
- modifyAcisDeliver(iAxis);
+ modifyAxisDeliver(iAxis);
}
};
try {
if (null != getTableEditingDomain()) {
GMFUnsafe.write(getTableEditingDomain(), runnable);
} else {
- modifyAcisDeliver(iAxis);
+ modifyAxisDeliver(iAxis);
}
} catch (InterruptedException e) {
Activator.log.error(e);

Back to the top