Context screenContext = rundata.getContext(componentName);
final Context callerContext = rundata.getCurrentContext();
final Set<String> exportVars = params.exportVars == null ? Collections.<String> emptySet() : params.exportVars;
// create control context
MappedContext context = new MappedContext(screenContext) {
@Override
protected void internalPut(String key, Object value) {
if (isExport(key)) {
callerContext.put(key, value);
}
super.internalPut(key, value);
}
@Override
protected void internalRemove(String key) {
if (isExport(key)) {
callerContext.remove(key);
}
super.internalRemove(key);
}
private boolean isExport(String key) {
return callerContext != null && (exportAll || exportVars.contains(key));
}
};
// add all params
context.getMap().putAll(params);
return context;
}