throws IOException {
if (ComponentUtils.getBooleanAttribute(component, Attributes.READONLY)
|| ComponentUtils.getBooleanAttribute(component, Attributes.DISABLED)) {
return;
}
CommandMap commandMap = null;
final Map<String, UIComponent> facets = component.getFacets();
for (final Map.Entry<String, UIComponent> entry : facets.entrySet()) {
final UIComponent facetComponent = entry.getValue();
if (facetComponent.isRendered()
&& (facetComponent instanceof AbstractUICommand || facetComponent instanceof UIForm)) {
if (commandMap == null) {
commandMap = new CommandMap();
}
final String key = entry.getKey();
commandMap.addCommand(key, new Command(facesContext, entry.getValue(), id));
}
}
if (commandMap != null) {
writer.writeAttribute(DataAttributes.COMMANDS, JsonUtils.encode(commandMap), true);
}