From 776b908cb9ab8ee18060ef0eb2c62d5a202e23ab Mon Sep 17 00:00:00 2001 From: brinn <brinn> Date: Mon, 13 Aug 2012 07:32:18 +0000 Subject: [PATCH] [BIS-149/SP-237] Display settings for custom web UIs. Replace DisplaySettings.clone() by a copy constructor as GWT cannot cope with clone(). SVN: 26346 --- .../server/DisplaySettingsProvider.java | 2 +- .../shared/basic/dto/DisplaySettings.java | 42 +++++++++++++------ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/DisplaySettingsProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/DisplaySettingsProvider.java index e93b628e167..e7cd55ec780 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/DisplaySettingsProvider.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/DisplaySettingsProvider.java @@ -53,7 +53,7 @@ public class DisplaySettingsProvider settings = person.getDisplaySettings(); displaySettingsMap.put(person.getUserId(), settings); } - settings = settings.clone(); + settings = new DisplaySettings(settings); settings.clearCustomWebAppSettings(); return settings; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DisplaySettings.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DisplaySettings.java index 1224b4e6558..b8dd1a569f7 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DisplaySettings.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DisplaySettings.java @@ -34,10 +34,14 @@ import java.util.Map; * * @author Franz-Josef Elmer */ -public class DisplaySettings implements Serializable, Cloneable +public class DisplaySettings implements Serializable { private static final long serialVersionUID = 1L; + // + // NOTE: if you add new fields to this class, you also need to add it to the copy constructor! + // + private Map<String, List<ColumnSetting>> columnSettings = new HashMap<String, List<ColumnSetting>>(); @@ -74,6 +78,31 @@ public class DisplaySettings implements Serializable, Cloneable private Map<String, Map<String, String>> customWebAppDisplaySettings; + public DisplaySettings() + { + } + + /** + * Copy constructor (shallow copy). + */ + public DisplaySettings(DisplaySettings other) + { + this.columnSettings = other.columnSettings; + this.technologySpecificSettings = other.technologySpecificSettings; + this.tabSettings = other.tabSettings; + this.dropDownSettings = other.dropDownSettings; + this.useWildcardSearchMode = other.useWildcardSearchMode; + this.debugging = other.debugging; + this.lastHistoryTokenOrNull = other.lastHistoryTokenOrNull; + this.ignoreLastHistoryToken = other.ignoreLastHistoryToken; + this.realNumberFormatingParameters = other.realNumberFormatingParameters; + this.panelCollapsedSettings = other.panelCollapsedSettings; + this.panelSizeSettings = other.panelSizeSettings; + this.visits = other.visits; + this.portletConfigurations = other.portletConfigurations; + this.customWebAppDisplaySettings = other.customWebAppDisplaySettings; + } + /** @deprecated Should be used only by DisplaySettingsManager. */ @Deprecated public Map<String, Serializable> getTechnologySpecificSettings() @@ -357,15 +386,4 @@ public class DisplaySettings implements Serializable, Cloneable customWebAppDisplaySettings = null; } - @Override - public DisplaySettings clone() - { - try - { - return (DisplaySettings) super.clone(); - } catch (CloneNotSupportedException ex) - { - throw new Error(ex); - } - } } -- GitLab