private List<UIComponent> getOrderedColumns(FacesContext context) { Map<String, UIComponent> columnsMap = new LinkedHashMap<String, UIComponent>(); Iterator<UIComponent> iterator = table.columns(); while (iterator.hasNext()) { // initialize a map of all the columns UIComponent component = iterator.next(); if (component.isRendered()) { columnsMap.put(component.getId(), component); } } List<UIComponent> columns = new ArrayList<UIComponent>(); String[] columnsOrder = RenderKitUtils.evaluateAttribute("columnsOrder", table, context); if (columnsOrder != null && columnsOrder.length > 0) { // add columns in the order specified by columnsOrder for (int i = 0; i < columnsOrder.length && !columnsMap.isEmpty(); i++) { columns.add(columnsMap.remove(columnsOrder[i])); } } for (UIComponent column : columnsMap.values()) { // add the remaining columns columns.add(column); } return columns; }
protected List<UIComponent> getOrderedColumns(FacesContext context) { Map<String, UIComponent> columnsMap = new LinkedHashMap<String, UIComponent>(); Iterator<UIComponent> iterator = table.columns(); while (iterator.hasNext()) { // initialize a map of all the columns UIComponent component = iterator.next(); if (component.isRendered()) { columnsMap.put(component.getId(), component); } } List<UIComponent> columns = new ArrayList<UIComponent>(); String[] columnsOrder = RenderKitUtils.evaluateAttribute("columnsOrder", table, context); if (columnsOrder != null && columnsOrder.length > 0) { // add columns in the order specified by columnsOrder for (int i = 0; i < columnsOrder.length && !columnsMap.isEmpty(); i++) { columns.add(columnsMap.remove(columnsOrder[i])); } } for (UIComponent column : columnsMap.values()) { // add the remaining columns columns.add(column); } return columns; }
protected List<UIComponent> getOrderedColumns(FacesContext context) { Map<String, UIComponent> columnsMap = new LinkedHashMap<String, UIComponent>(); Iterator<UIComponent> iterator = table.columns(); while (iterator.hasNext()) { // initialize a map of all the columns UIComponent component = iterator.next(); if (component.isRendered()) { columnsMap.put(component.getId(), component); } } List<UIComponent> columns = new ArrayList<UIComponent>(); String[] columnsOrder = RenderKitUtils.evaluateAttribute("columnsOrder", table, context); if (columnsOrder != null && columnsOrder.length > 0) { // add columns in the order specified by columnsOrder for (int i = 0; i < columnsOrder.length && !columnsMap.isEmpty(); i++) { columns.add(columnsMap.remove(columnsOrder[i])); } } for (UIComponent column : columnsMap.values()) { // add the remaining columns columns.add(column); } return columns; }