// // Decode // @SuppressWarnings("unchecked") @Override protected void decode( FacesContext facesContext, UIComponent component, @SuppressWarnings("unused") FacesBean facesBean, @SuppressWarnings("unused") String clientId) { UIXCollection table = (UIXCollection) component; Object oldKey = table.getRowKey(); try { // Set the row key to null to force the clientId to be correct table.setRowKey(null); String selectionParam = __getSelectionParameterName(facesContext, table); Map<String, String> parameters = facesContext.getExternalContext().getRequestParameterMap(); _LOG.finest("Params:{0}", parameters); String selection = parameters.get(selectionParam); if (selection != null) { final RowKeySet state; if (table instanceof UIXTable) state = ((UIXTable) table).getSelectedRowKeys(); else state = ((UIXTree) table).getSelectedRowKeys(); table.setClientRowKey(selection); // If the key is not already selected, or the state is more than one // (someone changed the table selection from multiple to single), // update the keys if (!state.isContained() || state.size() > 1) { RowKeySet unselected = state.clone(); // TODO : do not mutate the selectedRowKeys here. // instead, mutate when event is broadcast: state.clear(); state.add(); // clone, so that subsequent mutations of "state" will // not affect the parameters of this event: bug 4733858: RowKeySet selected = state.clone(); FacesEvent event = new SelectionEvent(table, unselected, selected); event.queue(); } } } finally { table.setRowKey(oldKey); } }
public void queue() { originalEvent.queue(); }