ExternalContext exCtx = context.getExternalContext();
Map rqMap = exCtx.getRequestParameterMap();
Object clnId = rqMap.get(component.getClientId(context));
UISimpleTogglePanel2 panel = (UISimpleTogglePanel2) component;
if (clnId != null) {
// enqueue event here for this component or for component with Id
// taken fro forId attribute
String switchType = panel.getSwitchType();
if (!(UISimpleTogglePanel2.CLIENT_SWITCH_TYPE.equals(switchType))) {
//xxxx by nick - denis - use constants, please!
if ((panel.isOpened() == UISimpleTogglePanel2.EXPANDED)) {
panel.setOpened(UISimpleTogglePanel2.COLLAPSED);
} else {
//xxxx by nick - denis - use constants, please!
panel.setOpened(UISimpleTogglePanel2.EXPANDED);
}
SimpleToggle2Event event = new SimpleToggle2Event(panel, (panel.isOpened()));
if (panel.isImmediate()) {
event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
} else {
event.setPhaseId(PhaseId.INVOKE_APPLICATION);
}
event.queue();
} else {
if (panel.isOpened()!= new Boolean((String) clnId).booleanValue()){
SimpleToggle2Event event = new SimpleToggle2Event(panel, (panel.isOpened()));
if (panel.isImmediate()) {
event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
} else {
event.setPhaseId(PhaseId.INVOKE_APPLICATION);
}
event.queue();
}
panel.setOpened(new Boolean((String) clnId).booleanValue());
}
}
if (AjaxRendererUtils.isAjaxRequest(context) && panel.getSwitchType().equals(UISimpleTogglePanel2.AJAX_SWITCH_TYPE)) {
AjaxRendererUtils.addRegionByName(context,
panel,
panel.getId());
}
}