From 5844dcccc46d1375f4a9be42a06d9f653510de0d Mon Sep 17 00:00:00 2001 From: Matthew Gerring Date: Mon, 12 Jun 2017 14:53:56 +0100 Subject: [PATCH 1/2] Added generics on IBeanController --- org.eclipse.richbeans.api/.classpath | 14 ++++++------- .../.settings/org.eclipse.jdt.core.prefs | 11 +++++++--- .../META-INF/MANIFEST.MF | 2 +- .../api/binding/IBeanController.java | 4 ++-- .../richbeans/api/binding/IBeanService.java | 2 +- .../richbeans/api/event/ValueListener.java | 5 ++++- .../richbeans/binding/BeanController.java | 8 +++---- .../richbeans/binding/BeanService.java | 4 ++-- .../ExamplePrintBeanValueListener.java | 4 ++-- .../examples/example1/ExampleRunner.java | 2 +- .../examples/example2/ExampleRunner.java | 2 +- .../examples/example3/ExampleRunner.java | 2 +- .../examples/example4/ExampleRunner.java | 2 +- .../examples/example5/ExampleRunner.java | 2 +- .../examples/example6/ExampleRunner.java | 2 +- .../examples/example7/ExampleRunner.java | 2 +- .../widgets/file/FileSelectionDialog.java | 14 +++++++++++-- .../richbeans/widgets/table/SeriesTable.java | 1 + .../richbeans/widgets/dialog/BeanDialog.java | 8 +++---- .../richbeans/widgets/scalebox/NumberBox.java | 3 +++ .../widgets/selector/BeanConfigurator.java | 21 +++++++++++++++++-- .../selector/HorizontalListEditor.java | 3 ++- .../widgets/selector/VerticalListEditor.java | 3 ++- 23 files changed, 81 insertions(+), 40 deletions(-) diff --git a/org.eclipse.richbeans.api/.classpath b/org.eclipse.richbeans.api/.classpath index 098194c..6e16b23 100644 --- a/org.eclipse.richbeans.api/.classpath +++ b/org.eclipse.richbeans.api/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/org.eclipse.richbeans.api/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.richbeans.api/.settings/org.eclipse.jdt.core.prefs index f42de36..a698e59 100644 --- a/org.eclipse.richbeans.api/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.richbeans.api/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,12 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/org.eclipse.richbeans.api/META-INF/MANIFEST.MF b/org.eclipse.richbeans.api/META-INF/MANIFEST.MF index 2b21aec..60db777 100644 --- a/org.eclipse.richbeans.api/META-INF/MANIFEST.MF +++ b/org.eclipse.richbeans.api/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Api Bundle-SymbolicName: org.eclipse.richbeans.api Bundle-Version: 1.0.0.qualifier Bundle-Vendor: Diamond Light Source -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Export-Package: org.eclipse.richbeans.api, org.eclipse.richbeans.api.beans, org.eclipse.richbeans.api.binding, diff --git a/org.eclipse.richbeans.api/src/org/eclipse/richbeans/api/binding/IBeanController.java b/org.eclipse.richbeans.api/src/org/eclipse/richbeans/api/binding/IBeanController.java index 7a0dca0..29aadb3 100644 --- a/org.eclipse.richbeans.api/src/org/eclipse/richbeans/api/binding/IBeanController.java +++ b/org.eclipse.richbeans.api/src/org/eclipse/richbeans/api/binding/IBeanController.java @@ -24,7 +24,7 @@ * @author Matthew Gerring * */ -public interface IBeanController { +public interface IBeanController { /** * Add a value listener to any UI objects which change in the UIObject. @@ -59,7 +59,7 @@ public interface IBeanController { * Get the current bean directly (no copy is made, use with caution) * @return */ - Object getBean(); + T getBean(); /** * Returns the original UI object to which we are linking with reflection. diff --git a/org.eclipse.richbeans.api/src/org/eclipse/richbeans/api/binding/IBeanService.java b/org.eclipse.richbeans.api/src/org/eclipse/richbeans/api/binding/IBeanService.java index afb84f7..6fa769e 100644 --- a/org.eclipse.richbeans.api/src/org/eclipse/richbeans/api/binding/IBeanService.java +++ b/org.eclipse.richbeans.api/src/org/eclipse/richbeans/api/binding/IBeanService.java @@ -21,7 +21,7 @@ public interface IBeanService { * @param bean * @return */ - public IBeanController createController(Object ui, Object bean); + public IBeanController createController(Object ui, T bean); } diff --git a/org.eclipse.richbeans.api/src/org/eclipse/richbeans/api/event/ValueListener.java b/org.eclipse.richbeans.api/src/org/eclipse/richbeans/api/event/ValueListener.java index 5ed2dc2..57bdbca 100644 --- a/org.eclipse.richbeans.api/src/org/eclipse/richbeans/api/event/ValueListener.java +++ b/org.eclipse.richbeans.api/src/org/eclipse/richbeans/api/event/ValueListener.java @@ -19,6 +19,7 @@ * @author Matthew Gerring * */ +@FunctionalInterface public interface ValueListener extends EventListener { /** @@ -41,7 +42,9 @@ public interface ValueListener extends EventListener { * * @return name */ - public String getValueListenerName(); + default String getValueListenerName() { + return null; + } } diff --git a/org.eclipse.richbeans.binding/src/org/eclipse/richbeans/binding/BeanController.java b/org.eclipse.richbeans.binding/src/org/eclipse/richbeans/binding/BeanController.java index 34a6f26..f75f3e4 100644 --- a/org.eclipse.richbeans.binding/src/org/eclipse/richbeans/binding/BeanController.java +++ b/org.eclipse.richbeans.binding/src/org/eclipse/richbeans/binding/BeanController.java @@ -33,16 +33,16 @@ * * @author Colin Palmer */ -class BeanController implements IBeanController { +class BeanController implements IBeanController { private final Object ui; - private final Object bean; + private final T bean; /** * Create a new BeanController with the given UI and bean objects. Note the * correct order of the arguments! */ - public BeanController(Object ui, Object bean) { + public BeanController(Object ui, T bean) { if (ui == null) { throw new NullPointerException("UI object must not be null"); } @@ -57,7 +57,7 @@ public Object getUI() { return ui; } - public Object getBean() { + public T getBean() { return bean; } diff --git a/org.eclipse.richbeans.binding/src/org/eclipse/richbeans/binding/BeanService.java b/org.eclipse.richbeans.binding/src/org/eclipse/richbeans/binding/BeanService.java index 8ed0e64..96590c3 100644 --- a/org.eclipse.richbeans.binding/src/org/eclipse/richbeans/binding/BeanService.java +++ b/org.eclipse.richbeans.binding/src/org/eclipse/richbeans/binding/BeanService.java @@ -43,8 +43,8 @@ public static BeanService getInstance() { } @Override - public IBeanController createController(Object ui, Object bean) { - return new BeanController(ui, bean); + public IBeanController createController(Object ui, T bean) { + return new BeanController<>(ui, bean); } } diff --git a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/ExamplePrintBeanValueListener.java b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/ExamplePrintBeanValueListener.java index c3f7b8a..2975e43 100644 --- a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/ExamplePrintBeanValueListener.java +++ b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/ExamplePrintBeanValueListener.java @@ -20,7 +20,7 @@ public class ExamplePrintBeanValueListener extends ValueAdapter { - private IBeanController controller; + private IBeanController controller; private Control value; private int textLimit = -1; @@ -28,7 +28,7 @@ public class ExamplePrintBeanValueListener extends ValueAdapter { * @param controller * @param value A control with a setText(...) method. */ - public ExamplePrintBeanValueListener(IBeanController controller, Control value) { + public ExamplePrintBeanValueListener(IBeanController controller, Control value) { // The name should be unique and is only hard-coded here for simplicity - see the javadoc for ValueAdapter. this.name = "Example listener"; diff --git a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example1/ExampleRunner.java b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example1/ExampleRunner.java index 030b99e..9b428ec 100644 --- a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example1/ExampleRunner.java +++ b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example1/ExampleRunner.java @@ -58,7 +58,7 @@ public Shell createShell(Display display) throws Exception { bean.setY(5); // Connect the UI and bean - final IBeanController controller = BeanService.getInstance().createController(ui, bean); + final IBeanController controller = BeanService.getInstance().createController(ui, bean); controller.addValueListener(new ExamplePrintBeanValueListener(controller, value)); controller.beanToUI(); controller.switchState(true); diff --git a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example2/ExampleRunner.java b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example2/ExampleRunner.java index b9c1049..3895773 100644 --- a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example2/ExampleRunner.java +++ b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example2/ExampleRunner.java @@ -62,7 +62,7 @@ public Shell createShell(Display display) throws Exception { bean.addItem(new ExampleItem("Fred 1", 1, 2)); // Connect the UI and bean - final IBeanController controller = BeanService.getInstance().createController(ui, bean); + final IBeanController controller = BeanService.getInstance().createController(ui, bean); controller.addValueListener(new ExamplePrintBeanValueListener(controller, value)); controller.beanToUI(); controller.switchState(true); diff --git a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example3/ExampleRunner.java b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example3/ExampleRunner.java index 3b04df2..517ea8a 100644 --- a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example3/ExampleRunner.java +++ b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example3/ExampleRunner.java @@ -60,7 +60,7 @@ public Shell createShell(Display display) throws Exception { bean.addItem(new ExampleItem("Item 2", 2, 3, ItemChoice.POLAR)); // Connect the UI and bean - final IBeanController controller = BeanService.getInstance().createController(ui, bean); + final IBeanController controller = BeanService.getInstance().createController(ui, bean); controller.addValueListener(new ExamplePrintBeanValueListener(controller, value)); controller.beanToUI(); controller.switchState(true); diff --git a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example4/ExampleRunner.java b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example4/ExampleRunner.java index f3de3e0..e276c86 100644 --- a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example4/ExampleRunner.java +++ b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example4/ExampleRunner.java @@ -69,7 +69,7 @@ public Shell createShell(Display display) throws Exception { bean.addItem(new ExampleItem("Item 3", 3, 4, ItemChoice.XY)); // Connect the UI and bean - final IBeanController controller = BeanService.getInstance().createController(ui, bean); + final IBeanController controller = BeanService.getInstance().createController(ui, bean); controller.addValueListener(new ExamplePrintBeanValueListener(controller, value)); controller.beanToUI(); controller.switchState(true); diff --git a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example5/ExampleRunner.java b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example5/ExampleRunner.java index 374c176..34c74f7 100644 --- a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example5/ExampleRunner.java +++ b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example5/ExampleRunner.java @@ -61,7 +61,7 @@ public Shell createShell(Display display) throws Exception { bean.setY("5"); // Connect the UI and bean - final IBeanController controller = BeanService.getInstance().createController(ui, bean); + final IBeanController controller = BeanService.getInstance().createController(ui, bean); controller.beanToUI(); controller.switchState(true); controller.addValueListener(new ValueAdapter("Example listener") { diff --git a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example6/ExampleRunner.java b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example6/ExampleRunner.java index 4d9e0b5..d463c80 100644 --- a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example6/ExampleRunner.java +++ b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example6/ExampleRunner.java @@ -61,7 +61,7 @@ public static void main(String[] args) throws Exception { bean.setY(5); // Connect the UI and bean - final IBeanController controller = BeanService.getInstance().createController(ui, bean); + final IBeanController controller = BeanService.getInstance().createController(ui, bean); controller.addValueListener(new ExamplePrintBeanValueListener(controller, value)); controller.beanToUI(); controller.switchState(true); diff --git a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example7/ExampleRunner.java b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example7/ExampleRunner.java index e4ffaba..e8a8983 100644 --- a/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example7/ExampleRunner.java +++ b/org.eclipse.richbeans.examples/src/org/eclipse/richbeans/examples/example7/ExampleRunner.java @@ -63,7 +63,7 @@ public static void main(String[] args) throws Exception { final ExampleBean bean = createSimpleBean(); // Connect the UI and bean - final IBeanController controller = BeanService.getInstance().createController(ui, bean); + final IBeanController controller = BeanService.getInstance().createController(ui, bean); ExamplePrintBeanValueListener listener = new ExamplePrintBeanValueListener(controller, value); listener.setTextLimit(300); controller.addValueListener(listener); diff --git a/org.eclipse.richbeans.widgets.file/src/org/eclipse/richbeans/widgets/file/FileSelectionDialog.java b/org.eclipse.richbeans.widgets.file/src/org/eclipse/richbeans/widgets/file/FileSelectionDialog.java index b87ce15..d186b0a 100644 --- a/org.eclipse.richbeans.widgets.file/src/org/eclipse/richbeans/widgets/file/FileSelectionDialog.java +++ b/org.eclipse.richbeans.widgets.file/src/org/eclipse/richbeans/widgets/file/FileSelectionDialog.java @@ -142,15 +142,25 @@ public String[] getExtensions() { return extensions; } + /** + * This method would be more accurately called getLabels() + * It is the labels for the file dialog + * @return + */ public String[] getFiles() { return files; } - public void setFiles(String[] files) { + /** + * This method would be more accurately called setLabels(...) + * It is the labels for the file dialog + * @return + */ + public void setFiles(String... files) { this.files = files; } - public void setExtensions(String[] extensions) { + public void setExtensions(String... extensions) { this.extensions = extensions; } diff --git a/org.eclipse.richbeans.widgets.file/src/org/eclipse/richbeans/widgets/table/SeriesTable.java b/org.eclipse.richbeans.widgets.file/src/org/eclipse/richbeans/widgets/table/SeriesTable.java index 6d44225..7a624bf 100644 --- a/org.eclipse.richbeans.widgets.file/src/org/eclipse/richbeans/widgets/table/SeriesTable.java +++ b/org.eclipse.richbeans.widgets.file/src/org/eclipse/richbeans/widgets/table/SeriesTable.java @@ -260,6 +260,7 @@ public void setLockEditing(boolean checked) { } public List getSeriesItems() { + if (tableViewer==null) return null; SeriesContentProvider prov = (SeriesContentProvider)tableViewer.getContentProvider(); return prov.getSeriesItems(); } diff --git a/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/dialog/BeanDialog.java b/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/dialog/BeanDialog.java index f15210d..8368b00 100644 --- a/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/dialog/BeanDialog.java +++ b/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/dialog/BeanDialog.java @@ -51,11 +51,11 @@ * * */ -public abstract class BeanDialog extends Dialog { +public abstract class BeanDialog extends Dialog { private static final Logger logger = LoggerFactory.getLogger(BeanDialog.class); - protected IBeanController controller; + protected IBeanController controller; protected BeanDialog(Shell parentShell) { @@ -82,11 +82,11 @@ public boolean close() { return super.close(); } - public Object getBean() { + public T getBean() { return controller.getBean(); } - public void setBean(Object bean) { + public void setBean(T bean) { try { IBeanService service = (IBeanService)Activator.getService(IBeanService.class); this.controller = service.createController(this, bean); diff --git a/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/scalebox/NumberBox.java b/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/scalebox/NumberBox.java index b832b4f..f011a52 100644 --- a/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/scalebox/NumberBox.java +++ b/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/scalebox/NumberBox.java @@ -95,6 +95,9 @@ public abstract class NumberBox extends ButtonComposite implements BoundsProvide private ActiveMode activeMode = ActiveMode.SET_VISIBLE_AND_ACTIVE; private String boundsKey; + // FIXME Widgets should not have a reference to the controller. + // This breaks the model/view/controller design because the controller + // is referenced by the view to look up field values. private IBeanController beanService; diff --git a/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/BeanConfigurator.java b/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/BeanConfigurator.java index b669f4c..0dc1c37 100644 --- a/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/BeanConfigurator.java +++ b/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/BeanConfigurator.java @@ -1,10 +1,27 @@ package org.eclipse.richbeans.widgets.selector; +import java.util.List; + /** * A configurator may be set on a list editor to - * provide configuration of a bean when it is added. + * provide configuration of a bean when it is added.

* + * The configurator is a functional interface allowing beans when created and added to be + * compared with existing values and changed. This allows checks to be done of the current + * state of added items and the new item to be added with sensible defaults.

* + * For instance:

+ * + ListEditor myListEditor = new VerticalListEditor<>(); + // myListEditor... + // MyBean bean, MyBean previous, List context + myListEditor.setBeanConfigurator((bean, previous, context)->contiguous(bean, previous)); + +

+ + Here the contiguous(...) method checks that the values of bean are contiguous with previous + and sets those values as the new bean is added. + * * @author Matthew Gerring * @@ -18,5 +35,5 @@ public interface BeanConfigurator { * @param previous - the previous bean in the list of beans or null * @param context - the parent bean which contains the list of bean which we are editing */ - void configure(T bean, T previous, Object context); + void configure(T bean, T previous, List context); } diff --git a/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/HorizontalListEditor.java b/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/HorizontalListEditor.java index fbeb1c9..2086010 100644 --- a/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/HorizontalListEditor.java +++ b/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/HorizontalListEditor.java @@ -282,6 +282,7 @@ public void addBean(final T bean) throws ClassCastException { * @throws ClassCastException * is bean is not an instance of beanTemplate */ + @SuppressWarnings("unchecked") public void addBean(final T bean, int index) throws ClassCastException { if (!beanTemplate.getClass().isInstance(bean)) { throw new ClassCastException("Bean passed to addBean is not an instance of beanTemplate.getClass()"); @@ -289,7 +290,7 @@ public void addBean(final T bean, int index) throws ClassCastException { if (!getListEditorUI().isAddAllowed(this)) return; try { - if (getBeanConfigurator()!=null) getBeanConfigurator().configure(bean, getBean(), getValue()); + if (getBeanConfigurator()!=null) getBeanConfigurator().configure(bean, getBean(), (List)getValue()); final BeanWrapper wrapper = new BeanWrapper<>(bean); wrapper.setName(getFreeName(wrapper, getTemplateName(), index)); if (index < 0) diff --git a/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/VerticalListEditor.java b/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/VerticalListEditor.java index 7e33b3e..2091bd2 100644 --- a/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/VerticalListEditor.java +++ b/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/VerticalListEditor.java @@ -277,11 +277,12 @@ public void addBean(final T bean) throws ClassCastException { * @throws ClassCastException * is bean is not an instance of beanTemplate */ + @SuppressWarnings("unchecked") public void addBean(final T bean, int index) throws ClassCastException { if (!beanTemplate.getClass().isInstance(bean)) { throw new ClassCastException("Bean passed to addBean is not an instance of beanTemplate.getClass()"); } - if (getBeanConfigurator()!=null) getBeanConfigurator().configure(bean, getBean(), getValue()); + if (getBeanConfigurator()!=null) getBeanConfigurator().configure(bean, getBean(), (List)getValue()); final BeanWrapper wrapper = new BeanWrapper<>(bean); String wrapperName = getFreeName(wrapper, getTemplateName(), index); wrapper.setName(wrapperName); From f242b6bbfe0f1616d98cc11c91d88c89289c3a43 Mon Sep 17 00:00:00 2001 From: Matthew Gerring Date: Mon, 12 Jun 2017 14:54:10 +0100 Subject: [PATCH 2/2] Improved comment after feedback from Matt Webber --- .../widgets/selector/ListEditor.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/ListEditor.java b/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/ListEditor.java index 57a8d61..4784c27 100644 --- a/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/ListEditor.java +++ b/org.eclipse.richbeans.widgets/src/org/eclipse/richbeans/widgets/selector/ListEditor.java @@ -453,13 +453,28 @@ public String toString() { return super.toString(); } - + /** + * The configurator is a functional interface allowing beans when created and added to be + * compared with existing values and changed. This allows checks to be done of the current + * state of added items and the new item to be added with sensible defaults. + * + * @return the current configurator + */ public BeanConfigurator getBeanConfigurator() { return beanConfigurator; } - public void setBeanConfigurator(BeanConfigurator beanConfigurator) { + /** + * The configurator is a functional interface allowing beans when created and added to be + * compared with existing values and changed. This allows checks to be done of the current + * state of added items and the new item to be added with sensible defaults. + * + * @return the current configurator + */ + public BeanConfigurator setBeanConfigurator(BeanConfigurator beanConfigurator) { + BeanConfigurator old = this.beanConfigurator; this.beanConfigurator = beanConfigurator; + return old; } }