super.doDecode(context, component);
ExternalContext exCtx = context.getExternalContext();
Map <String, String> rqMap = exCtx.getRequestParameterMap();
Object clnId = rqMap.get(component.getClientId(context));
UISimpleTogglePanel panel = (UISimpleTogglePanel) component;
if (clnId != null) {
// enqueue event here for this component or for component with Id
// taken fro forId attribute
String switchType = panel.getSwitchType();
if (!(UISimpleTogglePanel.CLIENT_SWITCH_TYPE.equals(switchType))) {
// xxxx by nick - denis - use constants, please!
SimpleToggleEvent event;
if (panel.isOpened()) {
event = new SimpleToggleEvent(panel, UISimpleTogglePanel.COLLAPSED);
// panel.setOpened(UISimpleTogglePanel.COLLAPSED);
// panel.setOpenedSet(UISimpleTogglePanel.COLLAPSED);
} else {
event = new SimpleToggleEvent(panel, UISimpleTogglePanel.EXPANDED);
// xxxx by nick - denis - use constants, please!
// panel.setOpened(UISimpleTogglePanel.EXPANDED);
// panel.setOpenedSet(UISimpleTogglePanel.EXPANDED);
}
// if (panel.isImmediate()) {
// event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
// } else {
// event.setPhaseId(PhaseId.INVOKE_APPLICATION);
// }
event.queue();
} else {
boolean submittedState = Boolean.parseBoolean((String) clnId);
if (panel.isOpened() != submittedState) {
// panel.setAjaxSingle(false);
SimpleToggleEvent event = new SimpleToggleEvent(panel, submittedState);
// if (panel.isImmediate()) {
// event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
// } else {
// event.setPhaseId(PhaseId.INVOKE_APPLICATION);
// }
event.queue();
}
// TODO: should we remove it ??
if (null == panel.getValueBinding("value"))
panel.setOpened(submittedState);
// panel.setOpenedSet(submittedState);
}
// in case of "ajax" request and "ajax" switch mode of toggle panel
// set the regions to be rendered (reRendered) after operating this
// "ajax" request
if (AjaxRendererUtils.isAjaxRequest(context) && panel.getSwitchType().equals(UISimpleTogglePanel.AJAX_SWITCH_TYPE)) {
// add toggle panel itself to rendered list of components
AjaxRendererUtils.addRegionByName(context, panel, panel.getId());
// add regions specified in the "reRender" attribute of toggle
// panel
// to rendered list of components
AjaxRendererUtils.addRegionsFromComponent(panel, context);
}