if (i == first) { buf.append(" ").append(savedArticleItemStyleClass).append("_first"); } if (i == last - 1) { buf.append(" ").append(savedArticleItemStyleClass).append("_last"); }
	public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {				RendererUtils.checkParamValidity(facesContext, component, UIData.class);		UIData uiData = (UIData) component;		ResponseWriter writer = facesContext.getResponseWriter();				String savedArticleItemStyleClass = null;		String firstArticleItemStyleClass = null;				String rowClasses;		String columnClasses;		if (component instanceof ContentItemListViewer) {			rowClasses = ((ContentItemListViewer) component).getRowClasses();			columnClasses = ((ContentItemListViewer) component).getColumnClasses();			firstArticleItemStyleClass = ((ContentItemListViewer) component).getFirstArticleItemStyleClass();		}		else {			rowClasses = (String) component.getAttributes().get(JSFAttr.ROW_CLASSES_ATTR);			columnClasses = (String) component.getAttributes().get(JSFAttr.COLUMN_CLASSES_ATTR);		}				Styles styles = new Styles(rowClasses, columnClasses);		int first = uiData.getFirst();		int rows = uiData.getRows();		int rowCount = uiData.getRowCount();		if (rows <= 0) {			rows = rowCount - first;		}		int last = first + rows;		if (last > rowCount)			last = rowCount;		for (int i = first; i < last; i++) {			uiData.setRowIndex(i);   						if (!uiData.isRowAvailable()) {				logError("Row is not available. Rowindex = " + i);				return;			}			beforeViewer(facesContext, uiData);						if (styles.hasRowStyle()) {				HtmlRendererUtils.writePrettyLineSeparator(facesContext);				writer.startElement(DIV_ELEM, component);				String rowStyle = styles.getRowStyle(i);				writer.writeAttribute(HTML.CLASS_ATTR, rowStyle, null);			}			List children = component.getChildren();			for (int j = 0, size = component.getChildCount(); j < size; j++) {				UIComponent child = (UIComponent) children.get(j);												if (child instanceof UIColumn && ((UIColumn) child).isRendered()) {					if (styles.hasColumnStyle()) {						HtmlRendererUtils.writePrettyLineSeparator(facesContext);						writer.startElement(DIV_ELEM, component);						String columnStyle = styles.getColumnStyle(j);						writer.writeAttribute(HTML.CLASS_ATTR, columnStyle, null);					}					HtmlRendererUtils.writePrettyLineSeparator(facesContext);										                    /*                    if (!(firstArticleItemStyleClass == null)) {                        						List childrenOfAChild = child.getChildren(); // the same as getting first child...											for (int k = 0; k < child.getChildCount(); k++) { 							WFContainer article = (WFContainer) childrenOfAChild.get(k);							if (i == first) { // this is first atricle item								savedArticleItemStyleClass = article.getStyleClass();								article.setStyleClass(firstArticleItemStyleClass);  							} else {								article.setStyleClass(savedArticleItemStyleClass);							}						}					}                    */					//different style classes to article items are assigned;                    //that will help to style articles                     List childrenOfAChild = child.getChildren(); // the same as getting first child...                    for (int k = 0; k < child.getChildCount(); k++) { // because there is only one child allways                         WFContainer article = (WFContainer) childrenOfAChild.get(k);                        if (i == first) {                            savedArticleItemStyleClass = article.getStyleClass();                        }                                                if (!(firstArticleItemStyleClass == null)) {                            if (i == first) { // this is first atricle item                                                                article.setStyleClass(firstArticleItemStyleClass);                              } else {                                article.setStyleClass(savedArticleItemStyleClass);                            }                        }                                                // this will break previous first article thingie... hmm... its not used anyway...:)                        if ((i % 2) == 0) {                            article.setStyleClass(savedArticleItemStyleClass + " " + "odd");                        } else {                            article.setStyleClass(savedArticleItemStyleClass + " " + "even");                        }                    }										RendererUtils.renderChild(facesContext, child);					if (styles.hasColumnStyle()) {						writer.endElement(DIV_ELEM);					}				}			}			if (styles.hasRowStyle()) {				writer.endElement(DIV_ELEM);			}			afterViewer(facesContext, uiData);		}	}