protected boolean isDetailStampAfterRow(UIComponent uiComponent) { if (uiComponent instanceof HtmlDataTable) { return "after".equals(((HtmlDataTable) uiComponent).getDetailStampLocation()); } return true; }
public boolean isEmbedded() { if (_embeddedSet) { return _embedded; } ValueBinding vb = getValueBinding("embedded"); if (vb != null) { return ((Boolean) vb.getValue(getFacesContext())).booleanValue(); } return false; }
private void createColumnInfos(HtmlDataTable htmlDataTable, FacesContext facesContext) throws IOException { int first = htmlDataTable.getFirst(); int rows = htmlDataTable.getRows(); int last; int currentRowSpan = -1; int currentRowInfoIndex = -1; TableContext tableContext = htmlDataTable.getTableContext(); RowInfo rowInfo = null; ColumnInfo columnInfo = null; last = htmlDataTable.getRowCount(); htmlDataTable.setRowIndex(rowIndex); rowInfo = new RowInfo(); if (!htmlDataTable.isRowAvailable()) { break; getColumnInfos().get(j)). setRowSpan(currentRowSpan); columnInfo.setStyle(htmlDataTable.getRowGroupStyle()); columnInfo.setStyleClass(htmlDataTable.getRowGroupStyleClass()); columnInfo.setStyle(htmlDataTable.getRowGroupStyle()); columnInfo.setStyleClass(htmlDataTable.getRowGroupStyleClass()); tableContext.getRowInfos().get(currentRowInfoIndex)). getColumnInfos().get(j)).
List tableChildren = htmlDataTable.getChildren(); int first = htmlDataTable.getFirst(); int rowInfoIndex = htmlDataTable.getRowIndex() - first; int columnInfoIndex = tableChildren.indexOf(component); RowInfo rowInfo = (RowInfo) htmlDataTable.getTableContext().getRowInfos().get(rowInfoIndex); ColumnInfo columnInfo = (ColumnInfo) rowInfo.getColumnInfos().get(columnInfoIndex);
public void editBook(ActionEvent evt) { // We get the table object HtmlDataTable table = getParentDatatable((UIComponent) evt.getSource()); // We get the object on the selected line. Object o = table.getRowData(); // Eventually, if you need the index of the line, simply do: int index = table.getRowIndex(); // ... } // Method to get the HtmlDataTable. private HtmlDataTable getParentDatatable(UIComponent compo) { if (compo == null) { return null; } if (compo instanceof HtmlDataTable) { return (HtmlDataTable) compo; } return getParentDataTable(compo.getParent()); }
/** * @see org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase#encodeBegin(javax.faces.context.FacesContext, javax.faces.component.UIComponent) */ public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException { if (uiComponent instanceof HtmlDataTable) { HtmlDataTable htmlDataTable = (HtmlDataTable) uiComponent; if (htmlDataTable.isRenderedIfEmpty() || htmlDataTable.getRowCount() > 0) { super.encodeBegin(facesContext, uiComponent); } } else { super.encodeBegin(facesContext, uiComponent); } }
public class Person implements Serializable { private List<String> guys = new ArrayList<String>(); private HtmlDataTable dtGuys; public void addNewItem() { guys.add(""); } public void addToList(ValueChangeEvent e) { guys.set(dtGuys.getRowIndex(), e.getNewValue().toString()); } public String save() { System.out.println("saving..."); for (String item : guys) { System.out.println("item= " + item); } return null; } //gettes and setters }
/** * Perform any operations necessary in the TBODY start tag. * * @param facesContext the <code>FacesContext</code>. * @param uiData the <code>UIData</code> being rendered. */ protected void inBodyStart(FacesContext facesContext, UIData uiData) throws IOException { String bodyStyleClass; String bodyStyle; if (uiData instanceof HtmlDataTable) { bodyStyleClass = ((HtmlDataTable) uiData).getBodyStyleClass(); bodyStyle = ((HtmlDataTable) uiData).getBodyStyle(); } else { bodyStyleClass = (String) uiData.getAttributes().get(BODY_STYLE_CLASS); bodyStyle = (String) uiData.getAttributes().get(BODY_STYLE); } ResponseWriter writer = facesContext.getResponseWriter(); if (bodyStyleClass != null) { writer.writeAttribute(HTML.CLASS_ATTR, bodyStyleClass, BODY_STYLE_CLASS); } if (bodyStyle != null) { writer.writeAttribute(HTML.STYLE_ATTR, bodyStyle, BODY_STYLE); } }
comp.setValueBinding("first", vb); comp.getAttributes().put("first", Integer.valueOf(_first)); comp.setValueBinding("rows", vb); comp.getAttributes().put("rows", Integer.valueOf(_rows)); comp.setValueBinding("forceIdIndexFormula", vb); comp.getAttributes().put("forceIdIndexFormula", _forceIdIndexFormula); comp.setValueBinding("sortColumn", vb); comp.getAttributes().put("sortColumn", _sortColumn); comp.setValueBinding("sortAscending", vb); comp.getAttributes().put("sortAscending", Boolean.valueOf(_sortAscending)); comp.setValueBinding("sortable", vb); comp.getAttributes().put("sortable", Boolean.valueOf(_sortable)); comp.setValueBinding("embedded", vb); comp.getAttributes().put("embedded", Boolean.valueOf(_embedded)); comp.setValueBinding("detailStampExpandedDefault", vb);
/** * @see org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase#encodeEnd(javax.faces.context.FacesContext, javax.faces.component.UIComponent) */ public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException { if (uiComponent instanceof HtmlDataTable) { HtmlDataTable htmlDataTable = (HtmlDataTable) uiComponent; if (htmlDataTable.isRenderedIfEmpty() || htmlDataTable.getRowCount() > 0) { super.encodeEnd(facesContext, uiComponent); } } else { super.encodeEnd(facesContext, uiComponent); } }
public int getNewspaperColumns() { if (_newspaperColumnsSet) { return _newspaperColumns; } ValueBinding vb = getValueBinding("newspaperColumns"); if (vb != null) { return ((Integer) vb.getValue(getFacesContext())).intValue(); } return 1; }
/** * @see org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase#encodeChildren(javax.faces.context.FacesContext, javax.faces.component.UIComponent) */ public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException { if (component instanceof HtmlDataTable) { HtmlDataTable htmlDataTable = (HtmlDataTable) component; if (htmlDataTable.isRenderedIfEmpty() || htmlDataTable.getRowCount() > 0) { super.encodeChildren(facesContext, component); } } else { super.encodeChildren(facesContext, component); } }
public boolean isSortable() { if (_sortableSet) { return _sortable; } ValueBinding vb = getValueBinding("sortable"); if (vb != null) { return ((Boolean) vb.getValue(getFacesContext())).booleanValue(); } return false; }
public boolean isDetailStampExpandedDefault() { if (_detailStampExpandedDefaultSet) { return _detailStampExpandedDefault; } ValueBinding vb = getValueBinding("detailStampExpandedDefault"); if (vb != null) { return ((Boolean) vb.getValue(getFacesContext())).booleanValue(); } return false; }
public boolean isRenderedIfEmpty() { if (_renderedIfEmptySet) { return _renderedIfEmpty; } ValueBinding vb = getValueBinding("renderedIfEmpty"); if (vb != null) { return ((Boolean) vb.getValue(getFacesContext())).booleanValue(); } return true; }
public String getRowOnKeyPress() { if (_rowOnKeyPress != null) { return _rowOnKeyPress; } ValueBinding vb = getValueBinding("rowOnKeyPress"); if (vb != null) { Object value = vb.getValue(getFacesContext()); if (value == null) { return null; } else { return (String) value.toString(); } } return null; }
public String getValueType() { if (_valueType != null) { return _valueType; } ValueBinding vb = getValueBinding("valueType"); if (vb != null) { Object value = vb.getValue(getFacesContext()); if (value == null) { return null; } else { return (String) value.toString(); } } return null; }
public String getRowOnMouseOut() { if (_rowOnMouseOut != null) { return _rowOnMouseOut; } ValueBinding vb = getValueBinding("rowOnMouseOut"); if (vb != null) { Object value = vb.getValue(getFacesContext()); if (value == null) { return null; } else { return (String) value.toString(); } } return null; }
public String getRowOnKeyUp() { if (_rowOnKeyUp != null) { return _rowOnKeyUp; } ValueBinding vb = getValueBinding("rowOnKeyUp"); if (vb != null) { Object value = vb.getValue(getFacesContext()); if (value == null) { return null; } else { return (String) value.toString(); } } return null; }
public String getRowOnMouseDown() { if (_rowOnMouseDown != null) { return _rowOnMouseDown; } ValueBinding vb = getValueBinding("rowOnMouseDown"); if (vb != null) { Object value = vb.getValue(getFacesContext()); if (value == null) { return null; } else { return (String) value.toString(); } } return null; }