Author: pgolawski
Date: 2008-07-28 03:22:39 -0400 (Mon, 28 Jul 2008)
New Revision: 9795
Modified:
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/component/UIExtendedDataTable.java
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/ExtendedTableHolder.java
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/RichTableMenuRenderer.java
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/SimpleTableMenuRenderer.java
Log:
do NOT reset data model before RENDER_RESPONSE phase
removed call column getColumnLabel method
Modified:
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/component/UIExtendedDataTable.java
===================================================================
---
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/component/UIExtendedDataTable.java 2008-07-28
07:16:15 UTC (rev 9794)
+++
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/component/UIExtendedDataTable.java 2008-07-28
07:22:39 UTC (rev 9795)
@@ -17,11 +17,14 @@
import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
+import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.event.AjaxEvent;
import org.ajax4jsf.model.ExtendedDataModel;
-import org.richfaces.event.ChangeColumnVisibilityEvent;
-import org.richfaces.event.ColumnResizeEvent;
-import org.richfaces.event.DragDropEvent;
+import org.richfaces.event.extdt.ChangeColumnVisibilityEvent;
+import org.richfaces.event.extdt.ColumnResizeEvent;
+import org.richfaces.event.extdt.DragDropEvent;
+import org.richfaces.event.extdt.ExtTableFilterEvent;
+import org.richfaces.event.extdt.ExtTableSortEvent;
import org.richfaces.model.ExtendedDataTableModifiableModel;
import org.richfaces.model.ExtendedTableDataModel;
import org.richfaces.model.FilterField;
@@ -33,251 +36,299 @@
*
*/
public abstract class UIExtendedDataTable extends UIDataTable implements
- Selectable {
-
- /**
- * COMPONENT_TYPE
- */
- public static final String COMPONENT_TYPE =
"org.richfaces.ExtendedDataTable";
-
- /**
- * COMPONENT_FAMILY
- */
- public static final String COMPONENT_FAMILY =
"org.richfaces.ExtendedDataTable";
+ Selectable {
- protected UIExtendedDataTableState state;
+ /**
+ * COMPONENT_TYPE
+ */
+ public static final String COMPONENT_TYPE =
"org.richfaces.ExtendedDataTable";
- public abstract Object getActiveRowKey();
+ /**
+ * COMPONENT_FAMILY
+ */
+ public static final String COMPONENT_FAMILY =
"org.richfaces.ExtendedDataTable";
- public abstract void setActiveRowKey(Object activeRowKey);
+ protected UIExtendedDataTableState state;
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- super.broadcast(event);
- if (event instanceof DragDropEvent) {
- processDradDrop((DragDropEvent) event);
- } else if (event instanceof ChangeColumnVisibilityEvent) {
- processChangeColumnVisibility((ChangeColumnVisibilityEvent) event);
- } else if (event instanceof ColumnResizeEvent) {
- processColumnResize((ColumnResizeEvent) event);
- }
+ public abstract Object getActiveRowKey();
- }
+ public abstract void setActiveRowKey(Object activeRowKey);
- public void queueEvent(FacesEvent event) {
- if (event instanceof DragDropEvent) {
- new AjaxEvent(this).queue();
- event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- // event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- // new AjaxEvent(this).queue();
- } else if (event instanceof ChangeColumnVisibilityEvent) {
- new AjaxEvent(this).queue();
- event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- } else if (event instanceof ColumnResizeEvent) {
- new AjaxEvent(this).queue();
- event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- }
- super.queueEvent(event);
- }
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ super.broadcast(event);
+ if (event instanceof AjaxEvent) {
+ AjaxContext.getCurrentInstance().addComponentToAjaxRender(this);
+ } else if (event instanceof DragDropEvent) {
+ processDradDrop((DragDropEvent) event);
+ } else if (event instanceof ChangeColumnVisibilityEvent) {
+ processChangeColumnVisibility((ChangeColumnVisibilityEvent) event);
+ } else if (event instanceof ColumnResizeEvent) {
+ processColumnResize((ColumnResizeEvent) event);
+ } else if (event instanceof ExtTableSortEvent) {
+ processSortingChange((ExtTableSortEvent) event);
+ } else if (event instanceof ExtTableFilterEvent) {
+ processFilteringChange((ExtTableFilterEvent) event);
+ }
- public Iterator<UIColumn> getSortedColumns() {
- return new SortedColumnsIterator(this);
- }
+ }
- public Iterator<UIColumn> getChildColumns() {
- return new ExtendedTableColumnsIterator(this);
- }
+ public void queueEvent(FacesEvent event) {
+ if (event instanceof AjaxEvent) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else if (event instanceof DragDropEvent) {
+ new AjaxEvent(this).queue();
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ // event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ // new AjaxEvent(this).queue();
+ } else if (event instanceof ChangeColumnVisibilityEvent) {
+ new AjaxEvent(this).queue();
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else if (event instanceof ColumnResizeEvent) {
+ // new AjaxEvent(this).queue();
+ event.setPhaseId(PhaseId.RENDER_RESPONSE);
+ } else if (event instanceof ExtTableSortEvent) {
+ new AjaxEvent(this).queue();
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else if (event instanceof ExtTableFilterEvent) {
+ new AjaxEvent(this).queue();
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ }
+ super.queueEvent(event);
+ }
- public void processDradDrop(DragDropEvent event) {
- String dragValue = event.getDragValue().toString();// dnd_drag_script
- String dropValue = event.getDropValue().toString();// dnd_drop_script
+ public Iterator<UIColumn> getSortedColumns() {
+ return new SortedColumnsIterator(this);
+ }
- ensureTableStateInitialized();
- state.changeColumnsOrder(dragValue, dropValue, event.isDropBefore());
- state.publishChanges(getFacesContext(), this);
+ public Iterator<UIColumn> getChildColumns() {
+ return new ExtendedTableColumnsIterator(this);
+ }
- getFacesContext().renderResponse();
- }
+ public void processDradDrop(DragDropEvent event) {
+ String dragValue = event.getDragValue().toString();// dnd_drag_script
+ String dropValue = event.getDropValue().toString();// dnd_drop_script
- public List<UIComponent> getSortedChildren() {
- ensureTableStateInitialized();
- return state.sortColumns(getFacesContext(), super.getChildren());
- }
+ ensureTableStateInitialized();
+ state.changeColumnsOrder(dragValue, dropValue, event.isDropBefore());
+ state.publishChanges(getFacesContext(), this);
- public void ensureTableStateInitialized() {
- if (state == null) {
- state = UIExtendedDataTableState.getUIExtendedDataTableState(this);
- }
- }
+ getFacesContext().renderResponse();
+ }
- public void processChangeColumnVisibility(ChangeColumnVisibilityEvent event) {
- ensureTableStateInitialized();
- state.toggleColumnVisibility(this, event.getColumnId());
- state.publishChanges(getFacesContext(), this);
+ public List<UIComponent> getSortedChildren() {
+ ensureTableStateInitialized();
+ return state.sortColumns(getFacesContext(), super.getChildren());
+ }
- getFacesContext().renderResponse();
- }// processChangeColumnVisibility
+ public void ensureTableStateInitialized() {
+ if (state == null) {
+ state = UIExtendedDataTableState.getUIExtendedDataTableState(this);
+ }
+ }
- public boolean isColumnVisible(UIComponent column) {
- ensureTableStateInitialized();
- return state.isColumnVisible(column.getId());
- }// isColumnVisible
+ public void processChangeColumnVisibility(ChangeColumnVisibilityEvent event) {
+ ensureTableStateInitialized();
+ state.toggleColumnVisibility(this, event.getColumnId());
+ state.publishChanges(getFacesContext(), this);
- public void processColumnResize(ColumnResizeEvent event) {
- ensureTableStateInitialized();
- state.changeColumnSize(this, event.getColumnWidths());
- state.publishChanges(getFacesContext(), this);
+ getFacesContext().renderResponse();
+ }// processChangeColumnVisibility
- getFacesContext().renderResponse();
- }// processChangeColumnVisibility
+ public void processSortingChange(ExtTableSortEvent event) {
+ resetModel();
+ getFacesContext().renderResponse();
+ }
- public String getColumnSize(UIComponent column) {
- ensureTableStateInitialized();
- return state.getColumnSize(column);
- }
+ public void processFilteringChange(ExtTableFilterEvent event) {
+ resetModel();
+ resetGroupVisibilityState();
+ getFacesContext().renderResponse();
+ }
- public boolean isGroupingOn() {
- ensureTableStateInitialized();
- return state.isGroupingOn();
- }
+ public boolean isColumnVisible(UIComponent column) {
+ ensureTableStateInitialized();
+ return state.isColumnVisible(column.getId());
+ }// isColumnVisible
- public String getGroupingColumnId() {
- ensureTableStateInitialized();
- return state.getGroupingColumnId();
- }
+ public void processColumnResize(ColumnResizeEvent event) {
+ ensureTableStateInitialized();
+ state.changeColumnSize(this, event.getColumnWidths());
+ state.publishChanges(getFacesContext(), this);
- public UIColumn getGroupingColumn() {
- String groupingColumnId = getGroupingColumnId();
- if (groupingColumnId == null)
- return null;
- for (Iterator<UIColumn> columns = getChildColumns(); columns.hasNext();) {
- UIColumn child = columns.next();
- if (groupingColumnId.equalsIgnoreCase(child.getId())) {
- return child;
- }
- }
- return null;
- }// getGroupingColumn
+ getFacesContext().renderResponse();
+ }// processChangeColumnVisibility
- public void setGroupingColumn(org.richfaces.component.UIColumn column) {
- ensureTableStateInitialized();
- if (column == null) {
- state.disableGrouping();
- } else {
- state.groupBy(column.getId(), column.getSortOrder());
- }
- state.publishChanges(getFacesContext(), this);
- }
+ public String getColumnSize(UIComponent column) {
+ ensureTableStateInitialized();
+ return state.getColumnSize(column);
+ }
- public void resetGroupVisibilityState() {
- ensureTableStateInitialized();
- state.resetGroupVisibilityState();
- }
+ public boolean isGroupingOn() {
+ ensureTableStateInitialized();
+ return state.isGroupingOn();
+ }
- public void disableGrouping() {
- ensureTableStateInitialized();
- state.disableGrouping();
- state.publishChanges(getFacesContext(), this);
- }
+ public String getGroupingColumnId() {
+ ensureTableStateInitialized();
+ return state.getGroupingColumnId();
+ }
- public boolean groupIsExpanded(int index) {
- ensureTableStateInitialized();
- return state.groupIsExpanded(index);
- }
+ public UIColumn getGroupingColumn() {
+ String groupingColumnId = getGroupingColumnId();
+ if (groupingColumnId == null)
+ return null;
+ for (Iterator<UIColumn> columns = getChildColumns(); columns.hasNext();) {
+ UIColumn child = columns.next();
+ if (groupingColumnId.equalsIgnoreCase(child.getId())) {
+ return child;
+ }
+ }
+ return null;
+ }// getGroupingColumn
- public void toggleGroup(int index) {
- ensureTableStateInitialized();
- state.toggleGroup(index);
- state.publishChanges(getFacesContext(), this);
- }
+ public void setGroupingColumn(org.richfaces.component.UIColumn column) {
+ ensureTableStateInitialized();
+ if (column == null) {
+ state.disableGrouping();
+ } else {
+ state.groupBy(column.getId(), column.getSortOrder());
+ }
+ state.publishChanges(getFacesContext(), this);
+ }
- public Collection<Object> getSortPriority() {
- Collection<Object> priority = super.getSortPriority();
- if (isGroupingOn()) {// grouping is on
- String groupColId = getGroupingColumnId();
- // try to add group column id as first
- if (priority.contains(groupColId)) {
- priority.remove(groupColId);
- }
- if (priority instanceof List) {
- ((List<Object>) priority).add(0, groupColId);
- } else {
- priority.add(groupColId);
- }
- }
- return priority;
- }
+ protected void resetGroupVisibilityState() {
+ ensureTableStateInitialized();
+ state.resetGroupVisibilityState();
+ }
- public Object saveState(FacesContext context) {
- Object values[] = new Object[2];
- values[0] = super.saveState(context);
- values[1] = state;
- return values;
- }
+ public void disableGrouping() {
+ ensureTableStateInitialized();
+ state.disableGrouping();
+ state.publishChanges(getFacesContext(), this);
+ }
- public void restoreState(FacesContext context, Object state) {
- Object values[] = (Object[]) state;
- super.restoreState(context, values[0]);
- this.state = (UIExtendedDataTableState) values[1];
- }
+ public boolean groupIsExpanded(int index) {
+ ensureTableStateInitialized();
+ return state.groupIsExpanded(index);
+ }
- public int getVisibleColumnsCount() {
- int count = 0;
- for (Iterator<UIColumn> iter = getChildColumns(); iter.hasNext();) {
- UIColumn column = iter.next();
- if (column.isRendered())
- count++;
- }// for
- return count;
- }// getVisibleColumnnCount
+ public void toggleGroup(int index) {
+ ensureTableStateInitialized();
+ state.toggleGroup(index);
+ state.publishChanges(getFacesContext(), this);
+ }
- @SuppressWarnings("unchecked")
- protected ExtendedDataModel createDataModel() {
- List<FilterField> filterFields = new LinkedList<FilterField>();
- Map<String, SortField2> sortFieldsMap = new LinkedHashMap<String,
SortField2>();
- List<UIComponent> list = getChildren();
- for (Iterator<UIComponent> iterator = list.iterator(); iterator
- .hasNext();) {
- UIComponent component = iterator.next();
- if (component instanceof org.richfaces.component.UIColumn) {
- org.richfaces.component.UIColumn column =
(org.richfaces.component.UIColumn) component;
- FilterField filterField = column.getFilterField();
- if (filterField != null) {
- filterFields.add(filterField);
- }
- SortField2 sortField = column.getSortField();
- if (sortField != null) {
- sortFieldsMap.put(component.getId(), sortField);
- }
- }
+ public Collection<Object> getSortPriority() {
+ Collection<Object> priority = super.getSortPriority();
+ if (isGroupingOn()) {// grouping is on
+ String groupColId = getGroupingColumnId();
+ // try to add group column id as first
+ if (priority.contains(groupColId)) {
+ priority.remove(groupColId);
+ }
+ if (priority instanceof List) {
+ ((List<Object>) priority).add(0, groupColId);
+ } else {
+ priority.add(groupColId);
+ }
+ }
+ return priority;
+ }
- }
- List<SortField2> sortFields = new LinkedList<SortField2>();
- Collection<Object> sortPriority = getSortPriority();
- if (sortPriority != null) {
- for (Object object : sortPriority) {
- if (object instanceof String) {
- String id = (String) object;
- SortField2 sortField = sortFieldsMap.get(id);
- if (sortField != null) {
- sortFields.add(sortField);
- sortFieldsMap.remove(id);
- }
- }
- }
- }
- sortFields.addAll(sortFieldsMap.values());
- setFilterFields(filterFields);
- setSortFields(sortFields);
- ExtendedDataModel dataModel = (ExtendedDataModel) super.getDataModel();
- if (dataModel instanceof ExtendedTableDataModel<?>) {
- ExtendedTableDataModel<?> tableDataModel =
(ExtendedTableDataModel<?>) dataModel;
- return new ExtendedDataTableModifiableModel(tableDataModel, getVar(),
- getFilterFields(), getSortFields());
- } else {
- ModifiableModel modifiableModel = new ModifiableModel(dataModel, getVar());
- modifiableModel.modify(getFilterFields(), getSortFields());
-
- return modifiableModel;
- }
- }
+ public Object saveState(FacesContext context) {
+ Object values[] = new Object[2];
+ values[0] = super.saveState(context);
+ values[1] = state;
+ return values;
+ }
+
+ public void restoreState(FacesContext context, Object state) {
+ Object values[] = (Object[]) state;
+ super.restoreState(context, values[0]);
+ this.state = (UIExtendedDataTableState) values[1];
+ }
+
+ public int getVisibleColumnsCount() {
+ int count = 0;
+ for (Iterator<UIColumn> iter = getChildColumns(); iter.hasNext();) {
+ UIColumn column = iter.next();
+ if (column.isRendered())
+ count++;
+ }// for
+ return count;
+ }// getVisibleColumnnCount
+
+ // @Override
+ @SuppressWarnings("unchecked")
+ protected ExtendedDataModel createDataModel() {
+ List<FilterField> filterFields = new LinkedList<FilterField>();
+ Map<String, SortField2> sortFieldsMap = new LinkedHashMap<String,
SortField2>();
+ List<UIComponent> list = getChildren();
+ for (Iterator<UIComponent> iterator = list.iterator(); iterator
+ .hasNext();) {
+ UIComponent component = iterator.next();
+ if (component instanceof org.richfaces.component.UIColumn) {
+ org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn)
component;
+ FilterField filterField = column.getFilterField();
+ if (filterField != null) {
+ filterFields.add(filterField);
+ }
+ SortField2 sortField = column.getSortField();
+ if (sortField != null) {
+ sortFieldsMap.put(component.getId(), sortField);
+ }
+ }
+
+ }
+ List<SortField2> sortFields = new LinkedList<SortField2>();
+ Collection<Object> sortPriority = getSortPriority();
+ if (sortPriority != null) {
+ for (Object object : sortPriority) {
+ if (object instanceof String) {
+ String id = (String) object;
+ SortField2 sortField = sortFieldsMap.get(id);
+ if (sortField != null) {
+ sortFields.add(sortField);
+ sortFieldsMap.remove(id);
+ }
+ }
+ }
+ }
+ sortFields.addAll(sortFieldsMap.values());
+ setFilterFields(filterFields);
+ setSortFields(sortFields);
+ ExtendedDataModel dataModel = (ExtendedDataModel) super.getDataModel();
+ if (dataModel instanceof ExtendedTableDataModel<?>) {
+ ExtendedTableDataModel<?> tableDataModel = (ExtendedTableDataModel<?>)
dataModel;
+ return new ExtendedDataTableModifiableModel(tableDataModel,
+ getVar(), getFilterFields(), getSortFields());
+ } else {
+ ModifiableModel modifiableModel = new ModifiableModel(dataModel,
+ getVar());
+ modifiableModel.modify(getFilterFields(), getSortFields());
+
+ return modifiableModel;
+ }
+ }
+
+ /**
+ * Original version of this method is defined in
+ * {@link org.ajax4jsf.component.UIDataAdaptor} and is called before
+ * RENDER_RESPONSE phase. In that version data model is reseted which causes
+ * need to sort and filter every time component is rendered. In this
+ */
+ // @Override
+ protected void resetDataModel() {
+ // Do nothing!
+ }
+
+ /**
+ * Method resets data model by calling
+ * {@link org.ajax4jsf.component.UIDataAdaptor#resetDataModel()}. This
+ * method is called on sort and filter action.
+ */
+ protected void resetModel() {
+ super.resetDataModel();
+ }
+
}
Modified:
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java
===================================================================
---
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java 2008-07-28
07:16:15 UTC (rev 9794)
+++
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java 2008-07-28
07:22:39 UTC (rev 9795)
@@ -50,9 +50,11 @@
import org.richfaces.component.UIDataTable;
import org.richfaces.component.UIExtendedDataTable;
import org.richfaces.component.nsutils.NSUtils;
-import org.richfaces.event.ChangeColumnVisibilityEvent;
-import org.richfaces.event.ColumnResizeEvent;
-import org.richfaces.event.DragDropEvent;
+import org.richfaces.event.extdt.ChangeColumnVisibilityEvent;
+import org.richfaces.event.extdt.ColumnResizeEvent;
+import org.richfaces.event.extdt.DragDropEvent;
+import org.richfaces.event.extdt.ExtTableFilterEvent;
+import org.richfaces.event.extdt.ExtTableSortEvent;
import org.richfaces.model.Ordering;
import org.richfaces.model.SortField2;
import org.richfaces.model.impl.expressive.JavaBeanWrapper;
@@ -1056,6 +1058,9 @@
if (SORT_FILTER_PARAMETER.equals(map.get(clientId))) {
String sortColumnId = map.get(SORT_FILTER_PARAMETER);
boolean isSingleSortMode =
!"multi".equals(table.getSortMode());
+
+ boolean sorting = false;
+ boolean filtering = false;
boolean isGroupingOn = table.isGroupingOn();
boolean sortByGroupingColumn = false;
@@ -1075,6 +1080,7 @@
column.setId(id);
if (sortColumnId != null) {
+ sorting = true;
boolean isGroupingColumn = (isGroupingOn && column
.equals(groupingColumn));
if (sortColumnId.equals(column.getClientId(context))) {
@@ -1139,16 +1145,21 @@
}
boolean filterChanged = (newFilterValue == null ? (oldFilterValue
!= null)
: !newFilterValue.equals(oldFilterValue));
- if (filterChanged) {
- table.resetGroupVisibilityState();
- }
+ //if (filterChanged) {
+ // table.resetGroupVisibilityState();
+ //}
+ filtering = (filtering || filterChanged);
}
}
- AjaxContext.getCurrentInstance().addComponentToAjaxRender(
- component);
- // AjaxContext.getCurrentInstance().addRenderedArea(clientId +
- // ":tu");
+ // AjaxContext.getCurrentInstance().addComponentToAjaxRender(component);
+ if (sorting){
+ new ExtTableSortEvent(component).queue();
+ }
+ if (filtering){
+ new ExtTableFilterEvent(component).queue();
+ }
+
}
// GROUP COLUMNS
@@ -1180,10 +1191,10 @@
}// for columns
}// if
- AjaxContext.getCurrentInstance().addComponentToAjaxRender(
- component);
+ // AjaxContext.getCurrentInstance().addComponentToAjaxRender(component);
// AjaxContext.getCurrentInstance().addRenderedArea(clientId +
// ":tu");
+ new ExtTableSortEvent(component).queue();
}// group columns
// CHANGE COLUMN ORDER - DRAG AND DROP
@@ -1213,8 +1224,7 @@
dragDropEvent.queue();
- AjaxContext.getCurrentInstance().addComponentToAjaxRender(
- component);
+ //
AjaxContext.getCurrentInstance().addComponentToAjaxRender(component);
// AjaxContext ajaxContext =
// AjaxContext.getCurrentInstance();
// ajaxContext.addComponentToAjaxRender(component);
@@ -1234,8 +1244,7 @@
event.queue();
- AjaxContext.getCurrentInstance().addComponentToAjaxRender(
- component);
+ // AjaxContext.getCurrentInstance().addComponentToAjaxRender(component);
// AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
// ajaxContext.addComponentToAjaxRender(component);
// ajaxContext.addRenderedArea(clientId + ":tb");// body
@@ -1266,6 +1275,11 @@
}
}
+ public void encodeBegin(FacesContext context, UIComponent component)throws
IOException {
+ super.encodeBegin(context, component);
+ //component.getAttributes().put(AjaxRendererUtils.AJAX_SINGLE_ATTR, Boolean.TRUE);
+ }
+
public void encodeEnd(FacesContext context, UIComponent component)
throws IOException {
super.encodeEnd(context, component);
@@ -1546,7 +1560,7 @@
String dragSourceId = tableId + "_hdrag_" +
dataColumn.getId();
String indicatorId = tableId + ":dataTable_indicator";
renderDragSupport(context, dataColumn, dragSourceId,
- indicatorId, dataColumn.getColumnLabel());
+ indicatorId,
(String)dataColumn.getAttributes().get("label"));
// separator area
writer.startElement(HTML.SPAN_ELEM, column);
@@ -1686,6 +1700,8 @@
public void encodeTableMenu(FacesContext context, UIExtendedDataTable table)
throws IOException {
AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
+ Object key = table.getRowKey();
+ table.setRowKey(null);
TableMenuRenderer menuRenderer = new RichTableMenuRenderer();
menuRenderer.setSortFunction(getSortFunction(context, table));
menuRenderer.setGroupFunction(getGroupFunction(context, table));
@@ -1705,6 +1721,7 @@
// }
}
}// for
+ table.setRowKey(key);
}
public void contributorsEncodeHere(FacesContext context, UIDataTable table)
Modified:
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/ExtendedTableHolder.java
===================================================================
---
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/ExtendedTableHolder.java 2008-07-28
07:16:15 UTC (rev 9794)
+++
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/ExtendedTableHolder.java 2008-07-28
07:22:39 UTC (rev 9795)
@@ -37,7 +37,7 @@
if (groupingOn){
groupingColumn = table.getGroupingColumn();
if ((groupingColumn != null) && (groupingColumn instanceof UIColumn)){
- groupingColumnLabel = ((UIColumn)groupingColumn).getColumnLabel();
+ groupingColumnLabel =
(String)groupingColumn.getAttributes().get("label");;
}
}
}
Modified:
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/RichTableMenuRenderer.java
===================================================================
---
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/RichTableMenuRenderer.java 2008-07-28
07:16:15 UTC (rev 9794)
+++
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/RichTableMenuRenderer.java 2008-07-28
07:22:39 UTC (rev 9795)
@@ -352,7 +352,8 @@
dataColumn.getId());
}
}// if
- menuItem.setValue(dataColumn.getColumnLabel());
+ String label = (String)dataColumn.getAttributes().get("label");
+ menuItem.setValue(label == null ? "" : label);
menuItem.setIcon(columnVisible ? iconCheckedURI : iconUncheckedURI);
if (menuItem instanceof HtmlMenuItem) {
((HtmlMenuItem) menuItem)
Modified:
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/SimpleTableMenuRenderer.java
===================================================================
---
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/SimpleTableMenuRenderer.java 2008-07-28
07:16:15 UTC (rev 9794)
+++
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/SimpleTableMenuRenderer.java 2008-07-28
07:22:39 UTC (rev 9795)
@@ -119,7 +119,8 @@
"/org/richfaces/renderkit/html/images/s.gif").getUri(
context, null), null);
writer.endElement(HTML.IMG_ELEMENT);
- writer.writeText(dataColumn.getColumnLabel(), null);
+ String label = (String)dataColumn.getAttributes().get("label");
+ writer.writeText(label == null ? "" : label, null);
writer.endElement(HTML.a_ELEMENT);
writer.endElement("li");
}