Adjusted RegattaOverview to use Lifecycle/ComponentContext for handling

of settings
This commit is contained in:
Steffen Schaefer committed 2017-02-20 08:28:44 +01:00
1 parent e39fc2cee8
commit 29fa3bc38f
12 files changed
+130 -108

No files matched your search

@@ -13,6 +13,10 @@ public class LinkWithSettingsGenerator<S extends Settings> {
private final String path;
private final GenericSerializableSettings contextDefinition;
public LinkWithSettingsGenerator(GenericSerializableSettings contextDefinition) {
this(null, contextDefinition);
}
public LinkWithSettingsGenerator(String path, GenericSerializableSettings contextDefinition) {
this.path = path;
@@ -185,4 +185,14 @@ public class ComponentContextWithSettingsStorage<L extends ComponentLifecycle<S,
}
return current;
}
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) {
return new SimpleComponentContext<>(rootLifecycle);
}
return new ComponentContextWithSettingsStorage<>(rootLifecycle, settingsStorageManager);
}
}