public class ClientConfigManager extends ConfigManager implements WidgetStateListener
ConfigManager.WorkArea
Modifier and Type | Field and Description |
---|---|
private boolean |
canPushUpdates
Flag indicating when the client-side can start pushing updates.
|
private static java.util.List<java.lang.Class<? extends WidgetConfig>> |
CONFIG_CLASSES
This list contains all config classes which implement
WidgetConfig . |
private ThinClient |
tc
Cache of the
ThinClient instance. |
activeConfigs, backupConfigs, dirtyConfigs, survivals, widgetCfg
Constructor and Description |
---|
ClientConfigManager()
Initialize the client-side by collecting all widget configuration classes (registered in
the
CONFIG_CLASSES ) and store them in
the ConfigManager.WorkArea.cfgDefs map. |
Modifier and Type | Method and Description |
---|---|
void |
activateConfigUpdates()
Inform the client-side that it can start sending the config updates.
|
void |
deactivateConfigUpdates()
Inform the client-side that it can no longer send config updates.
|
WidgetConfigUpdates[] |
getConfigUpdates()
Get the widget configuration updates, by comparing the active with the backup configuration.
|
protected boolean |
isRegisteredWidget(WidgetId id)
Check if the given ID is associated with a registered widget.
|
void |
notifyWidgetDestroyed(Widget<? extends OutputManager<?>> w)
Notify the given widget has been destroyed.
|
void |
pushConfigDefs(ServerExports server)
On client-side, send the widget configurations to the specified server.
|
(package private) ConfigOwner<?> |
resolveConfigOwner(WidgetId widgetId)
The method attempts to resolve a
ConfigOwner reference from
the widget widgetId . |
void |
switchId(WidgetId oldId,
WidgetId newId)
Switch the widget's ID from the old one to the new one.
|
private void |
switchId(WidgetId oldId,
WidgetId newId,
java.util.Map map)
Helper method to replace the entry in the given map, to use the new key.
|
void |
trackAllChanges(WidgetConfig cfg)
Mark all differences between the backup config and the given widget configuration as being
"dirty".
|
addDirtyConfig, addWidgetConfig, addWidgetConfig, applyConfigUpdates, duplicate, getActiveConfig, getConfigDef, getConfigDef, getDynamicConfig, getInstance, notifyWidgetDestroyed, removeWidgetConfig, replaceConfig, resolveWidgetConfig, resolveWidgetConfig, setDynamicConfig, setWidgetConfig, syncConfigChanges, trackConfig
private static final java.util.List<java.lang.Class<? extends WidgetConfig>> CONFIG_CLASSES
WidgetConfig
.private boolean canPushUpdates
ClientExports.activateConfigUpdates()
.private final ThinClient tc
ThinClient
instance.public ClientConfigManager()
CONFIG_CLASSES
) and store them in
the ConfigManager.WorkArea.cfgDefs
map.public void pushConfigDefs(ServerExports server)
server
- The server where to send the configs.ServerExports.initWidgetConfigurations(Map)
public void deactivateConfigUpdates()
public void activateConfigUpdates()
public WidgetConfigUpdates[] getConfigUpdates()
getConfigUpdates
in class ConfigManager
public void notifyWidgetDestroyed(Widget<? extends OutputManager<?>> w)
notifyWidgetDestroyed
in interface WidgetStateListener
w
- The deleted widget.protected boolean isRegisteredWidget(WidgetId id)
isRegisteredWidget
in class ConfigManager
id
- The widget ID.true
if a widget exists in the registry, with the given ID.ConfigOwner<?> resolveConfigOwner(WidgetId widgetId)
ConfigOwner
reference from
the widget widgetId
.resolveConfigOwner
in class ConfigManager
widgetId
- Widget Id.ConfigOwner
reference or null
if
such cannot be find.public void switchId(WidgetId oldId, WidgetId newId)
oldId
- The old widget ID, currently in use by the manager.newId
- The new widget ID.public void trackAllChanges(WidgetConfig cfg)
cfg
- The configuration from which the changes are extracted.private void switchId(WidgetId oldId, WidgetId newId, java.util.Map map)
oldId
- The old widget ID, which has some state registered in the given map.newId
- The new widget ID, to which the state needs to be re-put.map
- The map which needs to be updated.