Added supportsStore method to decide if a SettingsStorageManager can

handle save
This commit is contained in:
Steffen Schaefer committed 2017-02-21 09:34:51 +01:00
1 parent f54ba0803e
commit e7e09a0895
3 files changed
+12

No files matched your search

@@ -18,6 +18,8 @@ import com.sap.sse.common.settings.generic.GenericSerializableSettings;
* @see ComponentContextWithSettingsStorage
*/
public interface SettingsStorageManager<S extends Settings> {
boolean supportsStore();
/**
* Retrieves the {@link Settings} of the root component using the provided callback.
@@ -20,6 +20,11 @@ import com.sap.sse.gwt.settings.SettingsToUrlSerializer;
*/
public class SimpleSettingsStorageManager<S extends Settings> implements SettingsStorageManager<S> {
private final SettingsToUrlSerializer urlSerializer = new SettingsToUrlSerializer();
@Override
public boolean supportsStore() {
return false;
}
/**
* {@inheritDoc}
@@ -72,6 +72,11 @@ public class UserSettingsStorageManager<S extends Settings> implements SettingsS
this.storageGlobalKey = globalDefinitionId;
this.storageContextSpecificKey = this.storageGlobalKey + "#" + contextDefinitionId;
}
@Override
public boolean supportsStore() {
return true;
}
private void storeContextSpecificSettingsJsonOnLocalStorage(String serializedContextSpecificSettings) {
Storage localStorage = Storage.getLocalStorageIfSupported();