@Override public List getElements() { return getChildren(); }
@Override public void encode(FacesContext context, Column column) throws IOException { ResponseWriter writer = context.getResponseWriter(); String style = column.getStyle(); String styleClass = column.getStyleClass(); styleClass = (styleClass == null) ? PanelGrid.CELL_CLASS : PanelGrid.CELL_CLASS + " " + styleClass; writer.startElement("td", null); writer.writeAttribute("role", "gridcell", null); writer.writeAttribute("class", styleClass, null); if (style != null) { writer.writeAttribute("style", style, null); } if (column.getColspan() > 1) { writer.writeAttribute("colspan", column.getColspan(), null); } if (column.getRowspan() > 1) { writer.writeAttribute("rowspan", column.getRowspan(), null); } renderChildren(context, column); writer.endElement("td"); }
@Override public void renderChildren(FacesContext context) throws IOException { int childCount = getChildCount(); if (childCount > 0) { for (int i = 0; i < childCount; i++) { UIComponent child = getChildren().get(i); child.encodeAll(context); } } } }
public boolean hasFooterColumn() { for (UIComponent child : getChildren()) { if (child instanceof Column && child.isRendered()) { Column column = (Column) child; if (column.getFacet("footer") != null || column.getFooterText() != null) { return true; } } } return false; }
if (column.isRendered() && (column.getHeaderText() != null || column.getFacet("header") != null)) { hasHeader = true; break; for (int i = 0; i < columns.size(); i++) { Column column = columns.get(i); if (!column.isRendered()) { continue; String headerText = column.getHeaderText(); UIComponent headerFacet = column.getFacet("header"); String styleClass = column.getStyleClass() == null ? "ui-state-default" : "ui-state-default " + column.getStyleClass(); if (column.getStyle() != null) { writer.writeAttribute("style", column.getStyle(), null);
protected void encodeFacetColumn(FacesContext context, SubTable table, Column column, String facetName, String styleClass, String text) throws IOException { if (!column.isRendered()) { return; } ResponseWriter writer = context.getResponseWriter(); String style = column.getStyle(); String columnClass = column.getStyleClass(); columnClass = (columnClass == null) ? styleClass : styleClass + " " + columnClass; writer.startElement("td", null); writer.writeAttribute("class", columnClass, null); if (column.getRowspan() != 1) { writer.writeAttribute("rowspan", column.getRowspan(), null); } if (column.getColspan() != 1) { writer.writeAttribute("colspan", column.getColspan(), null); } if (style != null) { writer.writeAttribute("style", style, null); } // Footer content UIComponent facet = column.getFacet(facetName); if (facet != null) { facet.encodeAll(context); } else if (text != null) { writer.write(text); } writer.endElement("td"); }
if (column.getStyle() != null) { writer.writeAttribute("style", column.getStyle(), null); if (column.getStyleClass() != null) { writer.writeAttribute("class", column.getStyleClass(), null);
if (headerRowChild instanceof Column) { Column column = (Column) headerRowChild; if (column.isRendered()) { ValueExpression filterVE = column.getValueExpression(Column.PropertyKeys.filterBy.toString()); if (filterVE != null) { UIComponent filterFacet = column.getFacet("filter"); Object filterValue = (filterFacet == null) ? params.get(column.getClientId(context) + separator + "filter") : ((ValueHolder) filterFacet).getLocalValue();
this.column = new Column(); column.setId(id); column.setColspan(context.getColumnSpan()); column.setRowspan(context.getRowSpan()); column.setStyle(style); column.setStyleClass(styleClass);
public void encodeRow(FacesContext context, SubTable table, int rowIndex) throws IOException { table.setRowIndex(rowIndex); if (!table.isRowAvailable()) { return; } ResponseWriter writer = context.getResponseWriter(); String clientId = table.getClientId(context); writer.startElement("tr", null); writer.writeAttribute("id", clientId + "_row_" + rowIndex, null); writer.writeAttribute("class", DataTable.ROW_CLASS, null); for (Column column : table.getColumns()) { String style = column.getStyle(); String styleClass = column.getStyleClass(); writer.startElement("td", null); if (style != null) { writer.writeAttribute("style", style, null); } if (styleClass != null) { writer.writeAttribute("class", styleClass, null); } column.encodeAll(context); writer.endElement("td"); } writer.endElement("tr"); }
column.getValueExpression("filterBy"); if (null != filterExpression) { String filterExpressionString = filterExpression. FilterMatchMode.fromUiParam(column.getFilterMatchMode());
//Instantiating a Workbook object Workbook workbook = new Workbook(); //Accessing the added worksheet in the Excel file int sheetIndex = workbook.getWorksheets().add(); Worksheet worksheet = workbook.getWorksheets().get(sheetIndex); Cells cells = worksheet.getCells(); Column column = cells.getColumns().get(30); Style style1 = column.getStyle(); style1.setHorizontalAlignment(TextAlignmentType.CENTER); style1.setCustom("$#,##0;[Red]$-#,##0"); StyleFlag styleFlag1 = new StyleFlag(); styleFlag1.setNumberFormat(true); styleFlag1.setHorizontalAlignment(true); //Applying the style to the column column.applyStyle(style1, styleFlag1); //Saving the modified Excel file in default format workbook.save("C:\\output.xls");
public int getColumnsCountWithSpan() { if (columnsCountWithSpan == -1) { columnsCountWithSpan = 0; for (UIComponent kid : getChildren()) { if (kid.isRendered()) { if (kid instanceof Columns) { int dynamicColumnsCount = ((Columns) kid).getRowCount(); if (dynamicColumnsCount > 0) { columnsCountWithSpan += dynamicColumnsCount; } } else if (kid instanceof Column) { Column col = (Column) kid; if (col.isVisible()) { columnsCountWithSpan += col.getColspan(); } } else if (kid instanceof SubTable) { SubTable subTable = (SubTable) kid; for (UIComponent subTableKid : subTable.getChildren()) { if (subTableKid.isRendered() && subTableKid instanceof Column) { columnsCountWithSpan += ((Column) subTableKid).getColspan(); } } } } } } return columnsCountWithSpan; }
@Override public int getElementsCount() { return getChildCount(); }
@Override public String getColumnKey() { return getClientId(); }
if (column.isRendered() && (column.getHeaderText() != null || column.getFacet("header") != null)) { hasHeader = true; break; for (int i = 0; i < ac.getColums().size(); i++) { Column column = ac.getColums().get(i); if (!column.isRendered()) { continue; String headerText = column.getHeaderText(); UIComponent headerFacet = column.getFacet("header"); String styleClass = column.getStyleClass() == null ? "ui-state-default" : "ui-state-default " + column.getStyleClass(); if (column.getStyle() != null) { writer.writeAttribute("style", column.getStyle(), null); if (column.isRendered()) { writer.startElement("td", null); if (column.getStyle() != null) { writer.writeAttribute("style", column.getStyle(), null); if (column.getStyleClass() != null) { writer.writeAttribute("class", column.getStyleClass(), null); column.encodeAll(context);
protected void encodeFacetColumn(FacesContext context, SubTable table, Column column, String facetName, String styleClass, String text) throws IOException { if (!column.isRendered()) { return; } ResponseWriter writer = context.getResponseWriter(); String style = column.getStyle(); String columnClass = column.getStyleClass(); columnClass = (columnClass == null) ? styleClass : styleClass + " " + columnClass; writer.startElement("td", null); writer.writeAttribute("class", columnClass, null); if (column.getRowspan() != 1) writer.writeAttribute("rowspan", column.getRowspan(), null); if (column.getColspan() != 1) writer.writeAttribute("colspan", column.getColspan(), null); if (style != null) writer.writeAttribute("style", style, null); // Footer content UIComponent facet = column.getFacet(facetName); if (facet != null) { facet.encodeAll(context); } else if (text != null) { writer.write(text); } writer.endElement("td"); }
for (int j = 0; j < columns.size(); j++) { Column column = columns.get(j); String style = column.getStyle(); String styleClass = column.getStyleClass();
if (headerRowChild instanceof Column) { Column column = (Column) headerRowChild; if (column.isRendered()) { ValueExpression filterVE = column.getValueExpression(Column.PropertyKeys.filterBy.toString()); if (filterVE != null) { UIComponent filterFacet = column.getFacet("filter"); Object filterValue = (filterFacet == null) ? params.get(column.getClientId(context) + separator + "filter") : ((ValueHolder) filterFacet).getLocalValue();