AjaxBehaviorEvent behaviorEvent = (AjaxBehaviorEvent) event;
FacesEvent wrapperEvent = null;
if(eventName.equals("toggle")) {
boolean collapsed = Boolean.valueOf(params.get(clientId + "_collapsed"));
LayoutUnit unit = getLayoutUnitByPosition(params.get(clientId + "_unit"));
Visibility visibility = collapsed ? Visibility.HIDDEN : Visibility.VISIBLE;
unit.setCollapsed(collapsed);
wrapperEvent = new ToggleEvent(unit, behaviorEvent.getBehavior(), visibility);
}
else if(eventName.equals("close")) {
LayoutUnit unit = getLayoutUnitByPosition(params.get(clientId + "_unit"));
unit.setVisible(false);
wrapperEvent = new CloseEvent(unit, behaviorEvent.getBehavior());
}
else if(eventName.equals("resize")) {
LayoutUnit unit = getLayoutUnitByPosition(params.get(clientId + "_unit"));
String position = unit.getPosition();
int width = Integer.valueOf(params.get(clientId + "_width"));
int height = Integer.valueOf(params.get(clientId + "_height"));
if(position.equals("west") || position.equals("east")) {
unit.setSize(String.valueOf(width));
} else if(position.equals("north") || position.equals("south")) {
unit.setSize(String.valueOf(height));
}
wrapperEvent = new ResizeEvent(unit, behaviorEvent.getBehavior(), width, height);
}