/** * Specify what column the data should be sorted on. * <p/> * Note that calling this method <i>immediately</i> stores the value * via any value-binding with name "sortColumn". This is done because * this method is called by the HtmlCommandSortHeader component when * the user has clicked on a column's sort header. In this case, the * the model getter method mapped for name "value" needs to read this * value in able to return the data in the desired order - but the * HtmlCommandSortHeader component is usually "immediate" in order to * avoid validating the enclosing form. Yes, this is rather hacky - * but it works. */ public void setSortColumn(String sortColumn) { _sortColumn = sortColumn; // update model is necessary here, because processUpdates is never called // reason: HtmlCommandSortHeader.isImmediate() == true ValueBinding vb = getValueBinding("sortColumn"); if (vb != null) { vb.setValue(getFacesContext(), _sortColumn); _sortColumn = null; } setSortColumnIndex(columnNameToIndex(sortColumn)); }
public _SerializableDataModel getSerializableDataModel() { DataModel dm = getDataModel(); if (dm instanceof _SerializableDataModel) { return (_SerializableDataModel) dm; } return createSerializableDataModel(); }
public void processDecodes(FacesContext context) if (!isRendered()) setRowIndex(-1); processFacets(context, PROCESS_DECODES); processColumnFacets(context, PROCESS_DECODES); processColumnChildren(context, PROCESS_DECODES); setRowIndex(-1); try decode(context); setRowIndex(-1); processColumns(context, PROCESS_DECODES); setRowIndex(-1); processDetails(context, PROCESS_DECODES); setRowIndex(-1);
public int getSortColumnIndex() { if (_sortColumnIndex == -1) _sortColumnIndex = columnNameToIndex(getSortColumn()); return _sortColumnIndex; }
public boolean isCurrentDetailExpanded() { Boolean expanded = (Boolean) _expandedNodes.get(getClientId(getFacesContext())); if (expanded != null) { return expanded.booleanValue(); } return isDetailStampExpandedDefault(); }
public void encodeBegin(FacesContext context) throws IOException if (!isRendered()) return; if (_isValidChildren && !hasErrorMessages(context)) for (Iterator iter = getChildren().iterator(); iter.hasNext();) for (Iterator iter = getChildren().iterator(); iter.hasNext();) boolean replaceHeaderFacets = isSortable(); //if the table is sortable, all if (replaceHeaderFacets && isSortHeaderNeeded(aColumn, headerFacet)) propertyName = propertyName != null ? propertyName : getSortPropertyFromEL(aColumn); if (propertyName == null) log.warn("Couldn't determine sort property for column [" + aColumn.getId() + "]."); HtmlCommandSortHeader sortHeader = createSortHeaderComponent(context, aColumn, headerFacet, propertyName); columnName = sortHeader.getColumnName(); propertyName = getSortPropertyFromEL(aColumn); sortHeader.setPropertyName(propertyName); if (defaultSorted && getSortColumn() == null) setSortColumn(columnName); setSortProperty(propertyName);
UIComponent facet = getFacet(HtmlTableRenderer.DETAIL_STAMP_FACET_NAME); int first = getFirst(); int rows = getRows(); int last; if (rows == 0) last = getRowCount(); setRowIndex(rowIndex); if (!isRowAvailable()) if (!isCurrentDetailExpanded()) resetAllSubmittedValues(facet); process(context, facet, processAction);
int first = getFirst(); int rows = getRows(); int last; if (rows == 0) last = getRowCount(); setRowIndex(rowIndex); if (!isRowAvailable()) break; for (Iterator it = getChildren().iterator(); it.hasNext();) process(context, columnChild, processAction);
String rowIndexVar = getRowIndexVar(); String rowCountVar = getRowCountVar(); String previousRowDataVar = getPreviousRowDataVar(); if (rowIndexVar != null || rowCountVar != null || previousRowDataVar != null) if (isRowAvailable()) requestMap.put(previousRowDataVar, getRowData()); requestMap.put(rowCountVar, new Integer(getRowCount())); Map requestMap = getFacesContext().getExternalContext().getRequestMap(); requestMap.put(_varDetailToggler, this);
int rowCount = getRowCount(); if (getRowKey() != null) int oldRow = getRowIndex(); try setRowIndex(row); _expandedNodes.put(getClientId(getFacesContext()), Boolean.TRUE); setRowIndex(oldRow);
boolean isSortable = isSortable(); for (Iterator iter = getChildren().iterator(); iter.hasNext();) if (isSortable()) aColumn.setSortable(true); isSortable = true; if (aColumn.isDefaultSorted() && getSortColumn() == null) setSortProperty(aColumn.getSortPropertyName()); if (isSortable && getSortProperty() != null) SortCriterion criterion = new SortCriterion(getSortProperty(), isSortAscending()); List criteria = new ArrayList(); criteria.add(criterion);
public void setForceIdIndexFormula(String forceIdIndexFormula) { _forceIdIndexFormula = forceIdIndexFormula; ValueBinding vb = getValueBinding("forceIdIndexFormula"); if (vb != null) { vb.setValue(getFacesContext(), _forceIdIndexFormula); _forceIdIndexFormula = null; } }
protected Object saveDescendantComponentStates() { if (!getFacets().isEmpty()) { UIComponent detailStampFacet = getFacet(DETAIL_STAMP_FACET_NAME); if (detailStampFacet != null) { return saveDescendantComponentStates(new _DetailStampFacetAndChildrenIterator(detailStampFacet, getChildren()), false); } } return super.saveDescendantComponentStates(); }
protected void restoreDescendantComponentStates(Object state) { if (!getFacets().isEmpty()) { UIComponent detailStampFacet = getFacet(DETAIL_STAMP_FACET_NAME); if (detailStampFacet != null) { restoreDescendantComponentStates(new _DetailStampFacetAndChildrenIterator(detailStampFacet, getChildren()), state, false); return; } } super.restoreDescendantComponentStates(state); }
String derivedRowKey = getClientId(getFacesContext()); boolean expanded = isDetailExpanded(); if (expanded) if (isDetailStampExpandedDefault()) if (isDetailStampExpandedDefault())
private void updateModelFromPreservedDataModel(FacesContext context) ValueBinding vb = getValueBinding("value"); if (vb != null && !vb.isReadOnly(context)) _SerializableDataModel dm = (_SerializableDataModel) getDataModel(); Class type = (getValueType() == null) ? vb.getType(context) : ClassUtils.simpleClassForName(getValueType()); Class dmType = dm.getClass(); if (DataModel.class.isAssignableFrom(type))
/** * @param context * @param processAction */ private void processColumns(FacesContext context, int processAction) { for (Iterator it = getChildren().iterator(); it.hasNext();) { UIComponent child = (UIComponent) it.next(); if (child instanceof UIColumns) { process(context, child, processAction); } } }
private void processFacets(FacesContext context, int processAction) { for (Iterator it = getFacets().entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Map.Entry) it.next(); if (!DETAIL_STAMP_FACET_NAME.equals((String)entry.getKey())) { process(context, (UIComponent) entry.getValue(), processAction); } } }
/** * This facet renders an additional row after or before (according * to detailStampLocation value) the current row, usually containing * additional information of the related row. It is toggled usually * using varDetailToggle variable and the method toggleDetail(). * * @JSFFacet name="detailStamp" */ public UIComponent getDetailStamp() { return (UIComponent) getFacets().get(DETAIL_STAMP_FACET_NAME); }
/** * @see javax.faces.component.UIData#encodeEnd(javax.faces.context.FacesContext) */ public void encodeEnd(FacesContext context) throws IOException { super.encodeEnd(context); for (Iterator iter = getChildren().iterator(); iter.hasNext();) { UIComponent component = (UIComponent) iter.next(); if (component instanceof UIColumns) { ((UIColumns) component).encodeTableEnd(context); } } }