aboutsummaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorDenis Anisimov <denis@vaadin.com>2014-09-21 19:32:13 +0300
committerHenri Sara <hesara@vaadin.com>2014-10-13 12:20:05 +0000
commitdda6e0c4ddf6e4bb4cd777e24ccb22acbb3790a7 (patch)
treecf1867a0180ae8bcd861f0f34e942ab32186021c /server/src
parent442b35ade51bd82c3e345b0833f67e3dbd85885f (diff)
downloadvaadin-framework-dda6e0c4ddf6e4bb4cd777e24ccb22acbb3790a7.tar.gz
vaadin-framework-dda6e0c4ddf6e4bb4cd777e24ccb22acbb3790a7.zip
Make DefaultFieldGroupFieldFactory singleton (#11038).
Change-Id: I40250fadfe78d663d1cb7614f4f8818216e773a4
Diffstat (limited to 'server/src')
-rw-r--r--server/src/com/vaadin/data/fieldgroup/DefaultFieldGroupFieldFactory.java16
-rw-r--r--server/src/com/vaadin/data/fieldgroup/FieldGroup.java3
2 files changed, 18 insertions, 1 deletions
diff --git a/server/src/com/vaadin/data/fieldgroup/DefaultFieldGroupFieldFactory.java b/server/src/com/vaadin/data/fieldgroup/DefaultFieldGroupFieldFactory.java
index b1bf58199a..9c2e4b2f83 100644
--- a/server/src/com/vaadin/data/fieldgroup/DefaultFieldGroupFieldFactory.java
+++ b/server/src/com/vaadin/data/fieldgroup/DefaultFieldGroupFieldFactory.java
@@ -36,10 +36,26 @@ import com.vaadin.ui.RichTextArea;
import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
+/**
+ * This class contains a basic implementation for {@link FieldGroupFieldFactory}
+ * .The class is singleton, use {@link #get()} method to get reference to the
+ * instance.
+ *
+ * @author Vaadin Ltd
+ */
public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory {
+ private static final DefaultFieldGroupFieldFactory INSTANCE = new DefaultFieldGroupFieldFactory();
+
public static final Object CAPTION_PROPERTY_ID = "Caption";
+ protected DefaultFieldGroupFieldFactory() {
+ }
+
+ public static DefaultFieldGroupFieldFactory get() {
+ return INSTANCE;
+ }
+
@Override
public <T extends Field> T createField(Class<?> type, Class<T> fieldType) {
if (Enum.class.isAssignableFrom(type)) {
diff --git a/server/src/com/vaadin/data/fieldgroup/FieldGroup.java b/server/src/com/vaadin/data/fieldgroup/FieldGroup.java
index 27515d15af..c5aab5a053 100644
--- a/server/src/com/vaadin/data/fieldgroup/FieldGroup.java
+++ b/server/src/com/vaadin/data/fieldgroup/FieldGroup.java
@@ -68,7 +68,8 @@ public class FieldGroup implements Serializable {
/**
* The field factory used by builder methods.
*/
- private FieldGroupFieldFactory fieldFactory = new DefaultFieldGroupFieldFactory();
+ private FieldGroupFieldFactory fieldFactory = DefaultFieldGroupFieldFactory
+ .get();
/**
* Constructs a field binder. Use {@link #setItemDataSource(Item)} to set a