bug3529 Added skeleton for storage pipeline

This commit is contained in:
Vladislav Chumak committed 2016-10-17 15:42:04 +02:00
1 parent 23fb9fb8f2
commit 594db4ea8c
3 files changed
+60 -2

No files matched your search

@@ -7,12 +7,20 @@ import java.util.Map.Entry;
import com.google.gwt.user.client.Window;
import com.sap.sse.common.settings.Settings;
import com.sap.sse.gwt.client.shared.defaultsettings.DefaultSettingsStorage;
import com.sap.sse.gwt.client.shared.perspective.Perspective;
import com.sap.sse.gwt.client.shared.perspective.PerspectiveCompositeSettings;
import com.sap.sse.gwt.client.shared.perspective.PerspectiveLifecycleWithAllSettings;
public class ComponentContext {
private final Perspective<? extends Settings> rootPerspective;
private final DefaultSettingsStorage defaultSettingsStorage = new DefaultSettingsStorage(this);
public ComponentContext(Perspective<? extends Settings> rootPerspective) {
this.rootPerspective = rootPerspective;
}
public void makeSettingsDefault(Component<? extends Settings> component, Settings newDefaultSettings) {
Perspective<? extends Settings> parentPerspective = component.getComponentTreeNodeInfo().getParentPerspective();
if(parentPerspective == null) {
@@ -25,6 +33,7 @@ public class ComponentContext {
private void storeNewDefaultSettings(PerspectiveCompositeSettings<?> newRootPerspectiveSettings) {
// TODO implement storage pipeline
Window.alert("default settings are ready to enter the storage pipeline");
defaultSettingsStorage.storeDefaultSettings();
}
private<S extends Settings> PerspectiveCompositeSettings<?> updatePerspectiveLifecycleWithAllSettings(Perspective<S> perspective, Component<? extends Settings> replaceComponent, Settings replaceComponentNewDefaultSettings) {
@@ -51,6 +60,8 @@ public class ComponentContext {
}
}
public Perspective<? extends Settings> getRootPerspective() {
return rootPerspective;
}
}
@@ -0,0 +1,46 @@
package com.sap.sse.gwt.client.shared.defaultsettings;
import java.io.Serializable;
import com.sap.sse.gwt.client.shared.components.ComponentContext;
public class DefaultSettingsStorage {
private final ComponentContext componentContext;
private final Serializable rootPerspectiveId;
// private final SettingsToJsonSerializer serializer = new SettingsToJsonSerializer();
public DefaultSettingsStorage(ComponentContext componentContext) {
this.componentContext = componentContext;
this.rootPerspectiveId = componentContext.getRootPerspective().getId();
}
public void storeDefaultSettings() {
//TODO how to use serializer with PerspectiveCompositeSettings?
//iterate over components and call their getSettings() method.
//components should get also a method getGuiState()
// componentContext.getRootPerspective()
}
public void getDefaultSettings() {
//TODO where to retrieve settings from?
//create system default
//obtain my default from localStorage
//obtain my default from server
//rules
//context specific
//obtain from url
}
public void generateShareSettingsLink() {
//TODO how to use serializer with PerspectiveCompositeSettings?
// componentContext.getRootPerspective().getPerspectiveLifecycleWithAllSettings();
//use settings from root perspective?
}
}
@@ -7,7 +7,8 @@ public abstract class AbstractRootPerspectiveComposite<PL extends PerspectiveLif
public AbstractRootPerspectiveComposite(
PerspectiveLifecycleWithAllSettings<PL, PS> perspectiveLifecycleWithAllSettings) {
super(new ComponentContext(), perspectiveLifecycleWithAllSettings);
super(null, perspectiveLifecycleWithAllSettings);
getComponentTreeNodeInfo().setComponentContext(new ComponentContext(this));
}
}