Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2013-04-26 04:42:54 -0400
committervlorenzo2013-04-26 04:42:54 -0400
commite4d5d44e15fba5e3552ea7a7bde50fca5ab794a0 (patch)
tree60b717e1050c87e8ddee463382eb6a0a7ea46c0f /sandbox
parent0f7cd07be6821245c97f9874a11c9fa9ff26a0fd (diff)
downloadorg.eclipse.papyrus-e4d5d44e15fba5e3552ea7a7bde50fca5ab794a0.tar.gz
org.eclipse.papyrus-e4d5d44e15fba5e3552ea7a7bde50fca5ab794a0.tar.xz
org.eclipse.papyrus-e4d5d44e15fba5e3552ea7a7bde50fca5ab794a0.zip
401764: [Table 2] The classes managing the table model and Nattable must be refactored
https://bugs.eclipse.org/bugs/show_bug.cgi?id=401764 The Nattable API has changes -> this commit update the Papyrus code.
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/ComboBoxWithButtonCellEditor.java16
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/CustomizedCellPainter.java6
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java2
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/widget/NatComboButton.java51
4 files changed, 60 insertions, 15 deletions
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/ComboBoxWithButtonCellEditor.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/ComboBoxWithButtonCellEditor.java
index 72bf8cbc308..616d5e8aec2 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/ComboBoxWithButtonCellEditor.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/ComboBoxWithButtonCellEditor.java
@@ -49,8 +49,8 @@ public class ComboBoxWithButtonCellEditor extends ComboBoxCellEditor {
* the action done by the button
*/
public ComboBoxWithButtonCellEditor(IComboBoxDataProvider dataProvider, int maxVisibleItems, boolean freeEdit, boolean multiselect, ButtonConfiguration buttonConfig) {
- super(dataProvider, maxVisibleItems, freeEdit, multiselect);
- this.buttonConfiguration = buttonConfig;
+ this(dataProvider, maxVisibleItems, freeEdit, buttonConfig);
+ setMultiselect(multiselect);
}
/**
@@ -63,8 +63,8 @@ public class ComboBoxWithButtonCellEditor extends ComboBoxCellEditor {
* @param action
*/
public ComboBoxWithButtonCellEditor(IComboBoxDataProvider dataProvider, int maxVisibleItems, boolean freeEdit, ButtonConfiguration action) {
- super(dataProvider, maxVisibleItems, freeEdit);
- this.buttonConfiguration = action;
+ this(dataProvider, maxVisibleItems, action);
+ setFreeEdit(freeEdit);
}
/**
@@ -103,8 +103,8 @@ public class ComboBoxWithButtonCellEditor extends ComboBoxCellEditor {
* @param action
*/
public ComboBoxWithButtonCellEditor(List<?> canonicalValues, int maxVisibleItems, boolean freeEdit, boolean multiselect, ButtonConfiguration action) {
- super(canonicalValues, maxVisibleItems, freeEdit, multiselect);
- this.buttonConfiguration = action;
+ this(canonicalValues, maxVisibleItems, freeEdit, action);
+ setMultiselect(multiselect);
}
/**
@@ -117,8 +117,8 @@ public class ComboBoxWithButtonCellEditor extends ComboBoxCellEditor {
* @param action
*/
public ComboBoxWithButtonCellEditor(List<?> canonicalValues, int maxVisibleItems, boolean freeEdit, ButtonConfiguration action) {
- super(canonicalValues, maxVisibleItems, freeEdit);
- this.buttonConfiguration = action;
+ this(canonicalValues, maxVisibleItems, action);
+ setFreeEdit(freeEdit);
}
/**
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/CustomizedCellPainter.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/CustomizedCellPainter.java
index a3abbf2f936..53b09552b9f 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/CustomizedCellPainter.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/CustomizedCellPainter.java
@@ -47,7 +47,11 @@ public class CustomizedCellPainter extends TextPainter {
final LabelProviderService serv = configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
final ILabelProviderContextElement contextElement = new LabelProviderCellContextElement(cell, configRegistry);
final ILabelProvider provider = serv.getLabelProvider(Constants.TABLE_LABEL_PROVIDER_CONTEXT, contextElement);
- return provider.getText(contextElement);
+ String str = provider.getText(contextElement);
+ if(str == null) {
+ str = ""; //$NON-NLS-1$
+ }
+ return str;
}
}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java
index abcadad383b..834e15a429c 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java
@@ -33,7 +33,7 @@ import org.eclipse.swt.SWT;
public class RowHeaderLayerStack extends AbstractLayerTransform {
- private static final int DEFAULT_COLUMN_WIDTH = 50;
+ private static final int DEFAULT_COLUMN_WIDTH = 150;
private static final int DEFAULT_ROW_HEIGHT = 20;
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/widget/NatComboButton.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/widget/NatComboButton.java
index 995a2f69198..f4c7cbd554e 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/widget/NatComboButton.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/widget/NatComboButton.java
@@ -89,13 +89,35 @@ public class NatComboButton extends NatCombo {
* @param style
* @param buttonConfiguration
* the configuration of the button
+ * @deprecated freeEdit parameter is deprecated. Use the SWT.READ_ONLY flag to specify freeEdit = false
*/
+ @Deprecated
public NatComboButton(Composite parent, IStyle cellStyle, int maxVisibleItems, boolean freeEdit, int style, ButtonConfiguration buttonConfiguration) {
- super(parent, cellStyle, maxVisibleItems, freeEdit, style);
+ super(parent, cellStyle, maxVisibleItems, computeFreeEditStyle(freeEdit, style));
this.buttonConfiguration = buttonConfiguration;
configureButton();
}
+ //NatCombo computes freeEdit from the style
+ //freeEdit == true <=> style | SWT.READ_ONLY = false
+ @Deprecated
+ private static int computeFreeEditStyle(boolean freeEdit, int style) {
+ if(freeEdit) {
+ return style & ~SWT.READ_ONLY;
+ } else {
+ return style | SWT.READ_ONLY;
+ }
+ }
+
+ @Deprecated
+ private static int computeMultiSelectStyle(boolean multiselect, int style) {
+ if(multiselect) {
+ return style | SWT.MULTI; //Add the SWT.MULTI style
+ } else {
+ return style & ~SWT.MULTI; //Remove the SWT.MULTI style
+ }
+ }
+
/**
*
* Constructor.
@@ -109,11 +131,12 @@ public class NatComboButton extends NatCombo {
* @param style
* @param buttonConfiguration
* the configuration of the button
+ *
+ * @deprecated multiselect parameter is deprecated. Use the SWT.MULTI flag instead
*/
+ @Deprecated
public NatComboButton(Composite parent, IStyle cellStyle, int maxVisibleItems, boolean freeEdit, boolean multiselect, int style, ButtonConfiguration buttonConfiguration) {
- super(parent, cellStyle, maxVisibleItems, freeEdit, multiselect, style);
- this.buttonConfiguration = buttonConfiguration;
- configureButton();
+ this(parent, cellStyle, maxVisibleItems, multiselect, computeMultiSelectStyle(multiselect, style), buttonConfiguration);
}
/**
@@ -130,9 +153,27 @@ public class NatComboButton extends NatCombo {
* @param iconImage
* @param buttonConfiguration
* the configuration of the button
+ *
+ * @deprecated The freeEdit and multiselect parameter. Use the SWT.READ_ONLY flag to specify freeEdit = False. Use SWT.MULTI flag to specify
+ * multiselect = True
*/
+ @Deprecated
public NatComboButton(Composite parent, IStyle cellStyle, int maxVisibleItems, boolean freeEdit, boolean multiselect, int style, Image iconImage, ButtonConfiguration buttonConfiguration) {
- super(parent, cellStyle, maxVisibleItems, freeEdit, multiselect, style, iconImage);
+ this(parent, cellStyle, maxVisibleItems, computeMultiSelectStyle(multiselect, computeFreeEditStyle(freeEdit, style)), buttonConfiguration);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param parent
+ * @param cellStyle
+ * @param maxVisibleItems
+ * @param style
+ * @param iconImage
+ * @param buttonConfiguration
+ */
+ public NatComboButton(Composite parent, IStyle cellStyle, int maxVisibleItems, int style, Image iconImage, ButtonConfiguration buttonConfiguration) {
+ super(parent, cellStyle, maxVisibleItems, style, iconImage);
this.buttonConfiguration = buttonConfiguration;
configureButton();
}

Back to the top