public UISelection getSelection() { UIData parentUIData = getParentUIData(); if (parentUIData != null) { if (parentUIData.getValue() instanceof DataModel) { String dataModelExpression = parentUIData.getValueExpression("value") .getExpressionString(); String dataModelName = dataModelExpression.substring(2, dataModelExpression.length() - 1).replace('$', '.'); UISelection uiSelection = UISelection.newInstance(); uiSelection.setDataModel(dataModelName); uiSelection.setVar(parentUIData.getVar()); return uiSelection; } else { return null; } } else { return null; } }
protected DataModel getDataModel() { if (model != null) { return model; } model = UIDataUtil.getSuitableDataModel(getValue()); return model; }
public static boolean isIterateOverDataModel(UIData uiData) { Object value = uiData.getValue(); String var = uiData.getVar(); return ((value != null) && (var != null)); }
protected void saveChild(FacesContext facesContext, UIComponent uiComponent) { super.saveChild(facesContext, uiComponent); if (uiComponent instanceof UIData) { String clientId = uiComponent.getClientId(facesContext); savedChildren.put(clientId, ((UIData) uiComponent).getValue()); } }
protected void saveChild(FacesContext facesContext, UIComponent uiComponent) { super.saveChild(facesContext, uiComponent); if (uiComponent instanceof UIData) { String clientId = uiComponent.getClientId(facesContext); savedChildren.put(clientId, ((UIData) uiComponent).getValue()); } }
protected void saveChild(FacesContext facesContext, UIComponent uiComponent) { super.saveChild(facesContext, uiComponent); if (uiComponent instanceof UIData) { String clientId = uiComponent.getClientId(facesContext); savedChildren.put(clientId, ((UIData) uiComponent).getValue()); } }
public boolean isModelResultSet() { if (modelResultSet == null) { if (getUIData().getValue() instanceof ResultSet) { modelResultSet = Boolean.TRUE; } else { if (getUIData() .getValue() instanceof javax.faces.model.DataModel) { javax.faces.model.DataModel dataModel = (javax.faces.model.DataModel) getUIData() .getValue(); if (dataModel.getRowCount() == -1) { modelResultSet = Boolean.TRUE; return modelResultSet.booleanValue(); } } modelResultSet = Boolean.FALSE; } } return modelResultSet.booleanValue(); }
private PageControl getPageControl(UIComponent component) { UIData enclosingTable = getEnclosingData(component); PagedListDataModel pagedListDataModel = (PagedListDataModel)enclosingTable.getValue(); return pagedListDataModel.getPageControl(); }
public void filterDataTable(int sliderVal) { UIData dataTable = getUIData(); List filteredDataTable = new ArrayList(); List dataTableList = (ArrayList) dataTable.getValue(); String filterByString; int objectVal; for (int i = 0; i < dataTableList.size(); i++) { Object o = dataTableList.get(i); try { filterByString = o.getClass().getMethod(getFilterBy(), null).invoke(o, null).toString(); if (filterByString.indexOf(".") > 0) { filterByString = filterByString.substring(0, filterByString.indexOf(".")); } objectVal = Integer.parseInt(filterByString); if (objectVal < sliderVal) { filteredDataTable.add(o); } } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } getDataTable().setValue(filteredDataTable); }
public UIData getUIData() { String forStr = getFor(); UIData forComp = (UIData) CoreComponentUtils.findComponent(forStr, this); if (forComp == null) { throw new IllegalArgumentException( "could not find UIData referenced by attribute @for = '" + forStr + "'"); } else if (!(forComp instanceof UIData)) { throw new IllegalArgumentException( "uiComponent referenced by attribute @for = '" + forStr + "' must be of type " + UIData.class.getName() + ", not type " + forComp.getClass().getName()); } //compare with cached DataModel to check for updates if( _origDataModelHash != 0 && _origDataModelHash != forComp.getValue().hashCode()){ reset(); } if (!isIgnorePagination() && ((first != Integer.MIN_VALUE && first != forComp.getFirst()) || (rows != Integer.MIN_VALUE && rows != forComp.getRows())) ) { reset(); } Object value = forComp.getValue(); if (null != value) { _origDataModelHash = forComp.getValue().hashCode(); } return forComp; }
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; }
private void sort(SortableColumnHeaderComponent sortableColumnHeader) { String sortBy = sortableColumnHeader.getSortBy(); UIData data = FacesComponentUtility.getAncestorOfType(sortableColumnHeader, UIData.class); PagedListDataModel<?> model = (PagedListDataModel<?>) data.getValue(); PageControl pageControl = model.getPageControl(); pageControl.sortBy(sortBy); // Even though its the same PageControl instance, call setPageControl() so the updated version gets // persisted. model.setPageControl(pageControl); } }
Object value = getValue();
Object current = getValue(); if (current == null) { setDataModel(new ListDataModel(Collections.EMPTY_LIST));
Object current = getValue(); if (current == null) { setDataModel(new ListDataModel(Collections.EMPTY_LIST));
Object current = getValue(); if (current == null) { setDataModel(new ListDataModel(Collections.EMPTY_LIST));
Object current = getValue(); if (current == null) { setDataModel(new ListDataModel(Collections.EMPTY_LIST));
Object current = getValue(); if (current == null) { setDataModel(new ListDataModel(Collections.EMPTY_LIST));
Object current = getValue(); if (current == null) { setDataModel(new ListDataModel(Collections.EMPTY_LIST));