use of org.primefaces.component.api.UITree in project primefaces by primefaces.
the class UIDataContextCallback method invokeContextCallback.
@Override
public void invokeContextCallback(FacesContext fc, UIComponent component) {
String[] idTokens = dragId.split(String.valueOf(UINamingContainer.getSeparatorChar(fc)));
String dataId = idTokens[idTokens.length - 2];
if (component instanceof UITree) {
UITree uiTree = (UITree) component;
uiTree.setRowKey(dataId);
data = uiTree.getRowNode();
uiTree.setRowKey(null);
} else {
UIData uiData = (UIData) component;
uiData.setRowIndex(Integer.parseInt(dataId));
data = uiData.getRowData();
uiData.setRowIndex(-1);
}
}
use of org.primefaces.component.api.UITree in project primefaces by primefaces.
the class CellEditEvent method resolveValue.
private T resolveValue() {
if (source instanceof UIData) {
DataTable data = (DataTable) source;
data.setRowModel(rowIndex);
} else if (source instanceof UITree) {
TreeTable data = (TreeTable) source;
data.setRowKey(data.getValue(), rowKey);
}
if (column.isDynamic()) {
DynamicColumn dynamicColumn = (DynamicColumn) column;
dynamicColumn.applyStatelessModel();
}
T value = null;
for (UIComponent child : column.getChildren()) {
if (child instanceof CellEditor) {
UIComponent inputFacet = child.getFacet("input");
// multiple
if (inputFacet instanceof UIPanel) {
List<Object> values = new ArrayList<>();
for (UIComponent kid : inputFacet.getChildren()) {
if (kid instanceof ValueHolder) {
values.add(((ValueHolder) kid).getValue());
}
}
value = (T) values;
} else // single
{
value = (T) ((ValueHolder) inputFacet).getValue();
}
}
}
return value;
}
Aggregations