aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2013-02-22 05:11:20 (EST)
committerDirk Fauth2013-02-22 05:11:20 (EST)
commita3f85a650103ea87e0740d45d729fdd1b11613e5 (patch)
tree7bd41bc541e3b4193097fe07fdb8dcf7e96a4083
parent39cf0e91b5820a51b5cb977283079198b832423b (diff)
downloadorg.eclipse.nebula.widgets.nattable-a3f85a650103ea87e0740d45d729fdd1b11613e5.zip
org.eclipse.nebula.widgets.nattable-a3f85a650103ea87e0740d45d729fdd1b11613e5.tar.gz
org.eclipse.nebula.widgets.nattable-a3f85a650103ea87e0740d45d729fdd1b11613e5.tar.bz2
Bug 401431 - modified API to make ComboBoxCellEditor and NatCombo extensible
-rw-r--r--org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/edit/editor/ComboBoxCellEditor.java29
-rw-r--r--org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/widget/NatCombo.java4
2 files changed, 22 insertions, 11 deletions
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/edit/editor/ComboBoxCellEditor.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/edit/editor/ComboBoxCellEditor.java
index d5cdb7b..88784ae 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/edit/editor/ComboBoxCellEditor.java
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/edit/editor/ComboBoxCellEditor.java
@@ -55,7 +55,7 @@ public class ComboBoxCellEditor extends AbstractCellEditor {
/**
* The maximum number of items the drop down will show before introducing a scroll bar.
*/
- private int maxVisibleItems;
+ protected int maxVisibleItems;
/**
* The list of canonical values that will be set as selectable items to the combo.
@@ -85,20 +85,20 @@ public class ComboBoxCellEditor extends AbstractCellEditor {
* Flag that indicates whether this ComboBoxCellEditor supports free editing in the
* text control of the NatCombo or not. By default free editing is disabled.
*/
- private boolean freeEdit;
+ protected boolean freeEdit;
/**
* Flag that indicates whether this ComboBoxCellEditor supports multiple selection or not.
* By default multiple selection is disabled.
*/
- private boolean multiselect;
+ protected boolean multiselect;
/**
* String that is used to separate values in the String representation showed
* in the text control if multiselect is supported. <code>null</code> to use the
* default String ", ".
*/
- private String multiselectValueSeparator = null;
+ protected String multiselectValueSeparator = null;
/**
* String that is used to prefix the generated String representation showed
@@ -106,7 +106,7 @@ public class ComboBoxCellEditor extends AbstractCellEditor {
* multiselection to the user. If this value is <code>null</code> the default
* String "[" is used.
*/
- private String multiselectTextPrefix = null;
+ protected String multiselectTextPrefix = null;
/**
* String that is used to suffix the generated String representation showed
@@ -114,7 +114,7 @@ public class ComboBoxCellEditor extends AbstractCellEditor {
* multiselection to the user. If this value is <code>null</code> the default
* String "]" is used.
*/
- private String multiselectTextSuffix = null;
+ protected String multiselectTextSuffix = null;
/**
* The image to use as overlay to the {@link Text} Control if the dropdown
@@ -122,7 +122,7 @@ public class ComboBoxCellEditor extends AbstractCellEditor {
* If this value is <code>null</code> the default image specified in NatCombo
* will be used.
*/
- private Image iconImage;
+ protected Image iconImage;
/**
* Create a new single selection {@link ComboBoxCellEditor} based on the given list of items,
@@ -382,6 +382,19 @@ public class ComboBoxCellEditor extends AbstractCellEditor {
combo.setMultiselectTextBracket(this.multiselectTextPrefix, this.multiselectTextSuffix);
}
+ addNatComboListener(combo);
+ return combo;
+ }
+
+ /**
+ * Registers listeners on the combo
+ * to do some actions : commit, close and hide dropdown list.
+ *
+ *
+ * @param combo
+ * the combo on which we add the listeners
+ */
+ protected void addNatComboListener(final NatCombo combo){
combo.addKeyListener(new KeyAdapter() {
@Override
@@ -420,8 +433,6 @@ public class ComboBoxCellEditor extends AbstractCellEditor {
}
});
}
-
- return combo;
}
/**
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/widget/NatCombo.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/widget/NatCombo.java
index 0a451c1..07961d9 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/widget/NatCombo.java
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/widget/NatCombo.java
@@ -285,7 +285,7 @@ public class NatCombo extends Composite {
* @param style The style for the Text Control to construct. Uses this style
* adding internal styles via ConfigRegistry.
*/
- private void createTextControl(int style) {
+ protected void createTextControl(int style) {
int widgetStyle = style | (freeEdit ?
HorizontalAlignmentEnum.getSWTStyle(cellStyle) :
HorizontalAlignmentEnum.getSWTStyle(cellStyle) | SWT.READ_ONLY);
@@ -401,7 +401,7 @@ public class NatCombo extends Composite {
* Create the dropdown control of this NatCombo, adding styles, look&feel and
* needed listeners for the control only.
*/
- private void createDropdownControl() {
+ protected void createDropdownControl() {
dropdownShell = new Shell(getShell(), SWT.MODELESS);
dropdownShell.setLayout(new FillLayout());