public class ClientConfigManager extends ConfigManager implements WidgetStateListener
Modifier and Type | Field and Description |
---|---|
private boolean |
canPushUpdates
Flag indicating when the client-side can start pushing updates.
|
private ThinClient |
tc
Cache of the
ThinClient instance. |
activeConfigs, backupConfigs, cfgDefs, dirtyConfigs, widgetCfg
Constructor and Description |
---|
ClientConfigManager()
Initialize the client-side.
|
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.
|
(package private) ConfigOwner<?> |
resolveConfigOwner(WidgetId widgetId)
The method attempts to resolve a
ConfigOwner reference from
the widget widgetId . |
void |
setConfigField(WidgetId wid,
WidgetConfig wcfg,
int fid,
java.lang.Object value)
Set the widget config field to the specified value.
|
void |
setConfigField(WidgetId wid,
WidgetConfig wcfg,
java.lang.String fname,
java.lang.Object value)
Set the widget config field to the specified value.
|
(package private) <T extends WidgetConfig> |
setWidgetConfig(T cfg,
java.lang.Object value,
WidgetConfigDef wdef,
int fid)
Set a widget configuration field to the specified value.
|
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, addWidgetConfiguration, duplicate, getActiveConfig, getBackupConfig, getConfigDef, getConfigDef, getDynamicConfig, getInstance, notifyWidgetDestroyed, registerExternalWidgetConfigs, removeWidgetConfig, replaceConfig, resolveWidgetConfig, resolveWidgetConfig, setDynamicConfig, setTracking, syncConfigChanges, trackConfig
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
ancestorChanged
private boolean canPushUpdates
ClientExports.activateConfigUpdates()
.private final ThinClient tc
ThinClient
instance.public void setConfigField(WidgetId wid, WidgetConfig wcfg, java.lang.String fname, java.lang.Object value)
wid
- The widget ID.wcfg
- The widget configuration; if this is a down widget, this will be used.fname
- The list of config field names.value
- The list of new config field values.public void setConfigField(WidgetId wid, WidgetConfig wcfg, int fid, java.lang.Object value)
wid
- The widget ID.wcfg
- The widget configuration; if this is a down widget, this will be used.fid
- The config field id.value
- The list of new config field values.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.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.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.<T extends WidgetConfig> void setWidgetConfig(T cfg, java.lang.Object value, WidgetConfigDef wdef, int fid)
setWidgetConfig
in class ConfigManager
T
- Config type.cfg
- The widget configuration to be updated.value
- The new field value.wdef
- The definition of the widget configuration.fid
- The ID of the changed field.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.