Refine search
protected void processColumnFacets(FacesContext context, PhaseId phaseId) { setRowKey(null); for (UIComponent child : getChildren()) { if (child instanceof UIColumn && child.isRendered()) { UIColumn column = (UIColumn) child; if (column.getFacetCount() > 0) { for (UIComponent columnFacet : column.getFacets().values()) { if (phaseId == PhaseId.APPLY_REQUEST_VALUES) { columnFacet.processDecodes(context); } else if (phaseId == PhaseId.PROCESS_VALIDATIONS) { columnFacet.processValidators(context); } else if (phaseId == PhaseId.UPDATE_MODEL_VALUES) { columnFacet.processUpdates(context); } else { throw new IllegalArgumentException(); } } } } } }
protected boolean hasColumnFooter(List<UIColumn> columns) { for (UIColumn column : columns) { if (column.getFooter() != null) { return true; } } return false; }
public static void encodeHeader(FacesContext facesContext, UIComponent component, SelectManyRendererBase renderer, String rowClass, String cellClass) throws IOException { ResponseWriter writer = facesContext.getResponseWriter(); AbstractSelectManyComponent select = (AbstractSelectManyComponent) component; Iterator<UIColumn> headers = select.columns(); writer.startElement("tr", component); StringBuilder headerClass = new StringBuilder(rowClass); if (select.getHeaderClass() != null && !select.getHeaderClass().isEmpty()) { writer.writeAttribute("class", headerClass, null); while (headers.hasNext()) { UIColumn header = headers.next(); writer.startElement("th", component); writer.writeAttribute("class", cellClass, null); UIComponent facet = header.getFacet("header"); if (facet != null && facet.isRendered()) { facet.encodeBegin(facesContext); if (facet.getRendersChildren()) { facet.encodeChildren(facesContext); } else {
private static void updateColumnCells(UIData table, int index, int rowCount) { FacesContext context = FacesContext.getCurrentInstance(); String tableId = table.getClientId(context); char separator = UINamingContainer.getSeparatorChar(context); Collection<String> renderIds = getContext().getRenderIds(); UIColumn column = findColumn(table, index); if (column != null) { for (UIComponent cell : column.getChildren()) { String cellId = cell.getId(); for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) { renderIds.add(format("%s%c%d%c%s", tableId, separator, rowIndex, separator, cellId)); } } } }
private void renderEmptyTableRow(final ResponseWriter writer, final UIComponent component) throws IOException { writer.startElement("tr", component); List<UIColumn> columns = getColumns(component); for (UIColumn column : columns) { if (column.isRendered()) { writer.startElement("td", component); writer.endElement("td"); } } writer.endElement("tr"); }
Object rowHeaderValue = column.getAttributes().get("rowHeader"); if (null != rowHeaderValue ) { isRowHeader = Boolean.valueOf(rowHeaderValue.toString()); writer.startElement("th", column); writer.writeAttribute("scope", "row", null); } else { writer.startElement("td", column);
protected String extractValueToDisplay(UIColumn column, ColumnType columnType) { UIComponent facet = column.getFacet(columnType.facet()); if (facet != null && facet.isRendered()) { String value = exportValue(FacesContext.getCurrentInstance(), facet); return value; } else { String value = ""; if (column instanceof Column) { Column _column = (Column) column; if (columnType == ColumnType.HEADER) { String headerText = _column.getHeaderText(); value = headerText != null ? headerText : ""; } else if (columnType == ColumnType.FOOTER) { String footerText = _column.getFooterText(); value = footerText != null ? footerText : ""; } } return value; } }
private static void generateTableHeader(PdfPTable pdfTable, List columns) { for (int i = 0; i < columns.size(); i++) { UIColumn column = (UIColumn) columns.get(i); UIComponent columnHeaderCell = column.getHeader(); if (columnHeaderCell instanceof ValueHolder) { String cellValue = ComponentUtils.getStringValue(FacesContext .getCurrentInstance(), columnHeaderCell); pdfTable.addCell(cellValue); } } }
for (UIComponent facet : getFacets().values()) { if (phaseId == PhaseId.APPLY_REQUEST_VALUES) { facet.processDecodes(context); } else if (phaseId == PhaseId.PROCESS_VALIDATIONS) { facet.processValidators(context); } else if (phaseId == PhaseId.UPDATE_MODEL_VALUES) { facet.processUpdates(context); } else { throw new IllegalArgumentException(); if (column.getFacetCount() > 0) { for (UIComponent columnFacet : column.getFacets().values()) { if (phaseId == PhaseId.APPLY_REQUEST_VALUES) { columnFacet.processDecodes(context); if (kid.getChildCount() > 0) { for (UIComponent grandkid : kid.getChildren()) { if (!grandkid.isRendered()) { continue;
public static String findInputLabel(FacesContext facesContext, String inputClientId) { Map outputLabelMap = getOutputLabelMap(facesContext); MessageLabelInfo info = ((MessageLabelInfo)outputLabelMap.get(inputClientId)); if(info == null) { UIComponent comp = facesContext.getViewRoot().findComponent(inputClientId); UIComponent parent=comp; while(parent != null && !((parent=parent.getParent())instanceof UIColumn)); if(parent != null) { UIColumn column = (UIColumn) parent; if(column.getHeader()!=null) { UIComponent header = column.getHeader(); return getComponentText(facesContext, header); } } } return info==null?null:info.getText(facesContext); }
@Override protected void encodeColumn(FacesContext facesContext, UIData uiData, UIColumn currentUIColumn, int currentIndex) throws IOException { if ((currentUIColumn instanceof Tab) && currentUIColumn.isRendered()) { Tab childTab = (Tab) currentUIColumn; if (!childTab.isDisabled() && (currentIndex == selectedIndex)) { // accordionClientVarName.items[clientSideTabIndexString].expand(); ResponseWriter responseWriter = facesContext.getResponseWriter(); responseWriter.write(clientVarName); responseWriter.write(".items["); responseWriter.write(Integer.toString(clientSideTabIndex)); responseWriter.write("].expand();"); } clientSideTabIndex++; } } }
protected List<String> getFacetTexts(List<UIColumn> columns, ColumnType columnType) { List<String> facets = new ArrayList<String>(); for (Iterator<UIColumn> iterator = columns.iterator(); iterator.hasNext();) { UIColumn uiColumn = iterator.next(); UIComponent facet = uiColumn.getFacet(columnType.facet()); if (facet != null) { String value = exportValue(FacesContext.getCurrentInstance(), facet); facets.add(sanitizeXMLTagName(value)); } else { String value = ""; if (uiColumn instanceof Column) { Column column = (Column) uiColumn; if (columnType == ColumnType.HEADER) { String headerText = column.getHeaderText(); value = headerText != null ? headerText : ""; } else if (columnType == ColumnType.FOOTER) { String footerText = column.getFooterText(); value = footerText != null ? footerText : ""; } } facets.add(sanitizeXMLTagName(value)); } } return facets; }
/** * Renders the column header or footer row. */ private void renderColumnHeaderOrFooterRow(FacesContext facesContext, ResponseWriter writer, HtmlNewspaperTable newspaperTable, String styleClass, boolean header) throws IOException { HtmlRendererUtils.writePrettyLineSeparator(facesContext); writer.startElement(HTML.TR_ELEM, newspaperTable); int newspaperColumns = newspaperTable.getNewspaperColumns(); for(int nc = 0; nc < newspaperColumns; nc++) { for(Iterator it = newspaperTable.getChildren().iterator(); it.hasNext(); ) { UIComponent uiComponent = (UIComponent)it.next(); if(!(uiComponent instanceof UIColumn)) continue; UIColumn column = (UIColumn)uiComponent; if(!column.isRendered()) continue; // get the component to render UIComponent facet = null; if(header) facet = column.getHeader(); else facet = column.getFooter(); // do the rendering of the cells renderColumnHeaderOrFooterCell(facesContext, writer, column, styleClass, facet); } // draw the spacer facet if(nc < newspaperColumns - 1) renderSpacerCell(facesContext, writer, newspaperTable); } writer.endElement(HTML.TR_ELEM); }
public List<UIComponent> getRenderedChildrenOf(final UIColumn column) { final List<UIComponent> children = new ArrayList<>(); for (final UIComponent kid : column.getChildren()) { if (kid.isRendered()) { children.add(kid); } } return children; }
public DataTableInfo(DataTable dataTable) { List<UIComponent> children = dataTable.getChildren(); for (UIComponent child : children) { if (child instanceof UIColumn) { if (!headerFacetOrTextPresentInColumn) { headerFacetOrTextPresentInColumn = (child.getFacet("header") != null); if (!headerFacetOrTextPresentInColumn) { if (child instanceof Column) { Column column = (Column) child; headerFacetOrTextPresentInColumn = (column.getHeaderText() != null); } } } if (!footerFacetPresentInColumn) { footerFacetPresentInColumn = (child.getFacet("footer") != null); } UIColumn uiColumn = (UIColumn) child; if (uiColumn.isRendered()) { totalRenderedColumns++; } } } }
/** * @param header * @param uiComponent * @return boolean */ protected boolean hasFacet(boolean header, UIComponent uiComponent) { if (uiComponent instanceof UIColumn) { UIColumn uiColumn = (UIColumn) uiComponent; return header ? uiColumn.getHeader() != null : uiColumn.getFooter() != null; } return false; }
/** * <p>Return the header facet of the column (if any). A convenience * method for <code>getFacet("header")</code>.</p> * * @return the header component. */ public UIComponent getHeader() { return getFacet("header"); }
/** * <p>Return the number of child <code>UIColumn</code> components nested in * the specified <code>UIData</code> that have a facet with the specified * name.</p> * * @param name Name of the facet being analyzed * @param columns the columns to search * * @return the number of columns associated with the specified Facet name */ private static boolean hasFacet(String name, List<UIColumn> columns) { if (!columns.isEmpty()) { for (UIColumn column : columns) { if (column.getFacetCount() > 0) { if (column.getFacets().containsKey(name)) { return true; } } } } return false; }
String headerClass = (String) column.getAttributes().get("headerClass"); if (headerClass != null){ styleClass = (String) headerClass; String footerClass = (String) column.getAttributes().get("footerClass"); if (footerClass != null){ styleClass = (String) footerClass; ((UIColumn) uiComponent).getHeader(), styleClass, 0); ((UIColumn) uiComponent).getFooter(), styleClass, 0);
public void encodeRow(ResponseWriter writer, FacesContext facesContext, RowHolderBase holder) throws IOException { RowHolder rowHolder = (RowHolder) holder; AbstractColumnGroup row = (AbstractColumnGroup) rowHolder.getRow(); rowHolder.setRowStart(true); Iterator<UIComponent> components = row.columns(); int columnNumber = 0; while (components.hasNext()) { UIColumn column = (UIColumn) components.next(); if (column.isRendered()) { column.getAttributes().put(COLUMN_CLASS, getColumnClass(rowHolder, columnNumber)); encodeColumn(facesContext, writer, column, rowHolder); columnNumber++; } } }