protected List resolveList(Object value) { if (value instanceof List) { return (List) value; } else if (value instanceof ListDataModel) { return (List) ((ListDataModel) value).getWrappedData(); } else { throw new FacesException("Data type should be java.util.List or javax.faces.model.ListDataModel instance to be sortable."); } } }
@SuppressWarnings("unchecked") public List<T> getWrappedData() { return (List<T>) super.getWrappedData(); }
@SuppressWarnings("unchecked") public List<T> getWrappedData() { return (List<T>) super.getWrappedData(); }
/** * Tries to get result list from table. Generated query table model is not supported by this method. * * @return If table model is not supported by this method null will be returned */ private List<?> getListModel(final HtmlTable table) { final Object tableValue = table.getValue(); if (tableValue instanceof ListDataModel) { return (List<?>) ((ListDataModel) tableValue).getWrappedData(); } else if (tableValue instanceof List) { return (List<?>) tableValue; } return null; }
public UIData getUIData() { List ajaxSliderList = (ArrayList) getSession().get("UISliderList"); _UIData = getDataTable(); if (ajaxSliderList == null) { ListDataModel ajaxSliderLDM = new ListDataModel(); ajaxSliderLDM.setWrappedData(_UIData.getValue()); getSession().put("UISliderList", ajaxSliderLDM.getWrappedData()); } else { _UIData.setValue(ajaxSliderList); } return _UIData; }
public void singleSort(FacesContext context, DataTable table) { Object value = table.getValue(); if (value == null) { return; } ValueExpression sortVE = table.getValueExpression(DataTable.PropertyKeys.sortBy.toString()); SortOrder sortOrder = SortOrder.valueOf(table.getSortOrder().toUpperCase(Locale.ENGLISH)); MethodExpression sortFunction = table.getSortFunction(); List list = null; UIColumn sortColumn = table.getSortColumn(); if (sortColumn != null && sortColumn.isDynamic()) { ((DynamicColumn) sortColumn).applyStatelessModel(); } if (value instanceof List) { list = (List) value; } else if (value instanceof ListDataModel) { list = (List) ((ListDataModel) value).getWrappedData(); } else { throw new FacesException("Data type should be java.util.List or javax.faces.model.ListDataModel instance to be sortable."); } Collections.sort(list, new BeanPropertyComparator( sortVE, table.getVar(), sortOrder, sortFunction, table.isCaseSensitiveSort(), table.resolveDataLocale(), table.getNullSortOrder())); context.getApplication().publishEvent(context, PostSortEvent.class, table); }
list = (List) ((ListDataModel) value).getWrappedData();