Map<String,String> params = context.getExternalContext().getRequestParameterMap();
String eventName = params.get(Constants.PARTIAL_BEHAVIOR_EVENT_PARAM);
String clientId = this.getClientId(context);
FacesEvent wrapperEvent = null;
AjaxBehaviorEvent behaviorEvent = (AjaxBehaviorEvent) event;
if(eventName.equals("expand")) {
String nodeKey = params.get(clientId + "_expand");
this.setRowKey(nodeKey);
TreeNode node = this.getRowNode();
wrapperEvent = new NodeExpandEvent(this, behaviorEvent.getBehavior(), node);
wrapperEvent.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
}
else if(eventName.equals("collapse")) {
String nodeKey = params.get(clientId + "_collapse");
this.setRowKey(nodeKey);
TreeNode node = this.getRowNode();
wrapperEvent = new NodeCollapseEvent(this, behaviorEvent.getBehavior(), node);
wrapperEvent.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
}
else if(eventName.equals("select")) {
String nodeKey = params.get(clientId + "_instantSelect");
this.setRowKey(nodeKey);
TreeNode node = this.getRowNode();
wrapperEvent = new NodeSelectEvent(this, behaviorEvent.getBehavior(), node);
wrapperEvent.setPhaseId(behaviorEvent.getPhaseId());
}
else if(eventName.equals("unselect")) {
String nodeKey = params.get(clientId + "_instantUnselect");
this.setRowKey(nodeKey);
TreeNode node = this.getRowNode();
wrapperEvent = new NodeUnselectEvent(this, behaviorEvent.getBehavior(), node);
wrapperEvent.setPhaseId(behaviorEvent.getPhaseId());
}
else if(eventName.equals("colResize")) {
String columnId = params.get(clientId + "_columnId");
int width = Integer.parseInt(params.get(clientId + "_width"));
int height = Integer.parseInt(params.get(clientId + "_height"));
wrapperEvent = new ColumnResizeEvent(this, behaviorEvent.getBehavior(), width, height, findColumn(columnId));
wrapperEvent.setPhaseId(behaviorEvent.getPhaseId());
}
super.queueEvent(wrapperEvent);