mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-09 13:50:57 +00:00
Moved ignoreLocalSettings flag to a separate GenericSerializableSettings
class
This commit is contained in:
1 parent
0a7b43f8b3
commit
b720da2021
2 files changed
+26
-3
No files matched your search
+6
-3
@@ -13,6 +13,7 @@ import com.sap.sse.common.settings.generic.GenericSerializableSettings;
|
||||
import com.sap.sse.common.settings.generic.SettingsMap;
|
||||
import com.sap.sse.gwt.client.shared.components.Component;
|
||||
import com.sap.sse.gwt.client.shared.components.ComponentLifecycle;
|
||||
import com.sap.sse.gwt.settings.SettingsToUrlSerializer;
|
||||
|
||||
/**
|
||||
* Manages all default settings of a component/perspective and its subcomponents if there are any. It supplies
|
||||
@@ -188,11 +189,13 @@ public class ComponentContextWithSettingsStorage<L extends ComponentLifecycle<S,
|
||||
|
||||
public static <L extends ComponentLifecycle<S, ?>, S extends Settings> ComponentContext<L, S> createComponentContext(L rootLifecycle,
|
||||
SettingsStorageManager<S> settingsStorageManager) {
|
||||
final String ignoreLocalSettingsString = Window.Location.getParameter("ignoreLocalSettings");
|
||||
final boolean ignoreLocalSettings = Boolean.TRUE.toString().equals(ignoreLocalSettingsString);
|
||||
if (ignoreLocalSettings) {
|
||||
if (getIgnoreLocalSettings().isIgnoreLocalSettings()) {
|
||||
return new SimpleComponentContext<>(rootLifecycle);
|
||||
}
|
||||
return new ComponentContextWithSettingsStorage<>(rootLifecycle, settingsStorageManager);
|
||||
}
|
||||
|
||||
public static IgnoreLocalSettings getIgnoreLocalSettings() {
|
||||
return new SettingsToUrlSerializer().deserializeFromCurrentLocation(new IgnoreLocalSettings());
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.sap.sse.gwt.client.shared.perspective;
|
||||
|
||||
import com.sap.sse.common.settings.generic.AbstractGenericSerializableSettings;
|
||||
import com.sap.sse.common.settings.generic.BooleanSetting;
|
||||
|
||||
public class IgnoreLocalSettings extends AbstractGenericSerializableSettings {
|
||||
private static final long serialVersionUID = -282780795782313106L;
|
||||
|
||||
private transient BooleanSetting ignoreLocalSettings;
|
||||
|
||||
@Override
|
||||
protected void addChildSettings() {
|
||||
ignoreLocalSettings = new BooleanSetting("ignoreLocalSettings", this, false);
|
||||
}
|
||||
|
||||
public boolean isIgnoreLocalSettings() {
|
||||
return Boolean.TRUE.equals(ignoreLocalSettings.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user