Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2013-06-03 13:11:42 +0000
committervlorenzo2013-06-03 13:11:42 +0000
commita8894fe0702e7311d6047f4b2d64cdcdd08b9603 (patch)
tree59230ff7e4e9b957afa4d94c4c373ea7a2b21531 /extraplugins
parent9004fb232a92713e57b77fcc232f32d5c2065b1b (diff)
downloadorg.eclipse.papyrus-a8894fe0702e7311d6047f4b2d64cdcdd08b9603.tar.gz
org.eclipse.papyrus-a8894fe0702e7311d6047f4b2d64cdcdd08b9603.tar.xz
org.eclipse.papyrus-a8894fe0702e7311d6047f4b2d64cdcdd08b9603.zip
409724: [Table 2] Resize Row/Column actions doesn't work for the first row/column and in the body
https://bugs.eclipse.org/bugs/show_bug.cgi?id=409724
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusColumnResizeBindingsConfiguration.java54
-rw-r--r--extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusRowResizeBindingsConfiguration.java56
-rw-r--r--extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java6
-rw-r--r--extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java5
4 files changed, 116 insertions, 5 deletions
diff --git a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusColumnResizeBindingsConfiguration.java b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusColumnResizeBindingsConfiguration.java
new file mode 100644
index 00000000000..69369c3a28c
--- /dev/null
+++ b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusColumnResizeBindingsConfiguration.java
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.configuration;
+
+import org.eclipse.nebula.widgets.nattable.config.AbstractUiBindingConfiguration;
+import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
+import org.eclipse.nebula.widgets.nattable.resize.action.ColumnResizeCursorAction;
+import org.eclipse.nebula.widgets.nattable.resize.event.ColumnResizeEventMatcher;
+import org.eclipse.nebula.widgets.nattable.resize.mode.ColumnResizeDragMode;
+import org.eclipse.nebula.widgets.nattable.ui.action.ClearCursorAction;
+import org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction;
+import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
+import org.eclipse.swt.SWT;
+
+/**
+ * Adapted code from DefaultRowResizeBindings. Allow to resize the columns on all regions of the table (corner, body, row header, column header)
+ *
+ * @author vl222926
+ *
+ */
+public class PapyrusColumnResizeBindingsConfiguration extends AbstractUiBindingConfiguration {
+
+ @Override
+ public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
+ // Mouse move - Show resize cursor
+ uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 0), new ColumnResizeCursorAction());
+ uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 0), new ColumnResizeCursorAction());
+ uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.CORNER, 0), new ColumnResizeCursorAction());
+ uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.BODY, 0), new ColumnResizeCursorAction());
+
+ uiBindingRegistry.registerMouseMoveBinding(new MouseEventMatcher(), new ClearCursorAction());
+
+ // Column resize
+ uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new ColumnResizeDragMode());
+ uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 1), new ColumnResizeDragMode());
+ uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.CORNER, 1), new ColumnResizeDragMode());
+ uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.BODY, 1), new ColumnResizeDragMode());
+
+ // uiBindingRegistry.registerDoubleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new AutoResizeColumnAction());
+ uiBindingRegistry.registerSingleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new NoOpMouseAction());
+ }
+}
diff --git a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusRowResizeBindingsConfiguration.java b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusRowResizeBindingsConfiguration.java
new file mode 100644
index 00000000000..68fd98da512
--- /dev/null
+++ b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusRowResizeBindingsConfiguration.java
@@ -0,0 +1,56 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.configuration;
+
+import org.eclipse.nebula.widgets.nattable.config.AbstractUiBindingConfiguration;
+import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
+import org.eclipse.nebula.widgets.nattable.resize.action.RowResizeCursorAction;
+import org.eclipse.nebula.widgets.nattable.resize.event.RowResizeEventMatcher;
+import org.eclipse.nebula.widgets.nattable.resize.mode.RowResizeDragMode;
+import org.eclipse.nebula.widgets.nattable.ui.action.ClearCursorAction;
+import org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction;
+import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
+import org.eclipse.swt.SWT;
+
+/**
+ * Adapted code from DefaultRowResizeBindings. Allow to resize the rows on all regions of the table (corner, body, row header, column header)
+ *
+ * @author vl222926
+ *
+ */
+public class PapyrusRowResizeBindingsConfiguration extends AbstractUiBindingConfiguration {
+
+ @Override
+ public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
+ // Mouse move - Show resize cursor
+ uiBindingRegistry.registerFirstMouseMoveBinding(new RowResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 0), new RowResizeCursorAction());
+ uiBindingRegistry.registerFirstMouseMoveBinding(new RowResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 0), new RowResizeCursorAction());
+ uiBindingRegistry.registerFirstMouseMoveBinding(new RowResizeEventMatcher(SWT.NONE, GridRegion.CORNER, 0), new RowResizeCursorAction());
+ uiBindingRegistry.registerFirstMouseMoveBinding(new RowResizeEventMatcher(SWT.NONE, GridRegion.BODY, 0), new RowResizeCursorAction());
+
+ uiBindingRegistry.registerMouseMoveBinding(new MouseEventMatcher(), new ClearCursorAction());
+
+ // Row resize
+ uiBindingRegistry.registerFirstMouseDragMode(new RowResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new RowResizeDragMode());
+ uiBindingRegistry.registerFirstMouseDragMode(new RowResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 1), new RowResizeDragMode());
+ uiBindingRegistry.registerFirstMouseDragMode(new RowResizeEventMatcher(SWT.NONE, GridRegion.CORNER, 1), new RowResizeDragMode());
+ uiBindingRegistry.registerFirstMouseDragMode(new RowResizeEventMatcher(SWT.NONE, GridRegion.BODY, 1), new RowResizeDragMode());
+
+ // uiBindingRegistry.registerDoubleClickBinding(new RowResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 1), new AutoResizeRowAction());
+ uiBindingRegistry.registerSingleClickBinding(new RowResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 1), new NoOpMouseAction());
+
+ }
+
+}
diff --git a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java
index e26a8ff61a5..c5c8af9456e 100644
--- a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java
+++ b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java
@@ -30,6 +30,7 @@ import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer;
import org.eclipse.nebula.widgets.nattable.viewport.action.ViewportSelectColumnAction;
+import org.eclipse.papyrus.infra.nattable.configuration.PapyrusColumnResizeBindingsConfiguration;
import org.eclipse.papyrus.infra.nattable.configuration.PapyrusColumnHeaderStyleConfiguration;
import org.eclipse.papyrus.infra.nattable.dataprovider.BodyDataProvider;
import org.eclipse.swt.SWT;
@@ -56,9 +57,8 @@ public class ColumnHeaderLayerStack extends AbstractLayerTransform {
final SelectionLayer selectionLayer = new SelectionLayer(new DataLayer(bodyDataProvider));
final ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
this.selectionLayer = bodyLayer.getSelectionLayer();
- this.colHeaderLayer = new ColumnHeaderLayer(this.dataLayer, bodyLayer.getViewportLayer(), bodyLayer.getSelectionLayer());
-
-
+ this.colHeaderLayer = new ColumnHeaderLayer(this.dataLayer, bodyLayer.getViewportLayer(), bodyLayer.getSelectionLayer(), false);//FIXME : set default configuration to false?!
+ this.colHeaderLayer.addConfiguration(new PapyrusColumnResizeBindingsConfiguration());
final IConfiguration configuration = new CustomConfig();
// setUnderlyingLayer(sortHeaderLayer);
diff --git a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java
index 834e15a429c..70b262761a9 100644
--- a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java
+++ b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java
@@ -28,6 +28,7 @@ import org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode;
import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
import org.eclipse.papyrus.infra.nattable.configuration.PapyrusRowHeaderStyleConfiguration;
+import org.eclipse.papyrus.infra.nattable.configuration.PapyrusRowResizeBindingsConfiguration;
import org.eclipse.swt.SWT;
@@ -40,8 +41,8 @@ public class RowHeaderLayerStack extends AbstractLayerTransform {
public RowHeaderLayerStack(final IDataProvider dataProvider, final BodyLayerStack bodyLayer) {
final DataLayer dataLayer = new DataLayer(dataProvider, RowHeaderLayerStack.DEFAULT_COLUMN_WIDTH, RowHeaderLayerStack.DEFAULT_ROW_HEIGHT);
//I know that selection layer is probably false
- final RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(dataLayer, bodyLayer, /* bodyLayer.getSelectionLayer() */new SelectionLayer(dataLayer));
-
+ final RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(dataLayer, bodyLayer, /* bodyLayer.getSelectionLayer() */new SelectionLayer(dataLayer), false);
+ rowHeaderLayer.addConfiguration(new PapyrusRowResizeBindingsConfiguration());
//ne marche pas! but : avoir le même type de cellule dans les headers des lignes et des colonnes
rowHeaderLayer.addConfiguration(new PapyrusRowHeaderStyleConfiguration());
// final IConfiguration configuration = new CustomConfig();

Back to the top