Author: nbelaevski
Date: 2007-11-28 12:59:50 -0500 (Wed, 28 Nov 2007)
New Revision: 4322
Added:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/model/OrderingListDataModel.java
Removed:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/model/TranslatedSequenceDataModel.java
Modified:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
Log:
latest changes for listShuttle & orderingList
Modified:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
===================================================================
---
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2007-11-28
17:59:37 UTC (rev 4321)
+++
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2007-11-28
17:59:50 UTC (rev 4322)
@@ -5,6 +5,7 @@
import java.io.IOException;
import java.io.Serializable;
+import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -13,11 +14,11 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.faces.FacesException;
import javax.faces.application.FacesMessage;
import javax.faces.component.EditableValueHolder;
-import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.component.UIInput;
@@ -61,7 +62,7 @@
public static final Predicate isColumn = new Predicate() {
public boolean evaluate(Object input) {
- return (input instanceof UIColumn || input instanceof Column) &&
+ return (input instanceof javax.faces.component.UIColumn || input instanceof Column)
&&
((UIComponent) input).isRendered();
}
};
@@ -488,6 +489,11 @@
public void execute(FacesContext context);
}
+ protected interface DataAdder {
+ Object getContainer();
+ void add(Object object);
+ }
+
protected final UpdateModelCommand updateValueCommand = new UpdateModelCommand() {
public void execute(FacesContext context) {
@@ -698,4 +704,89 @@
setRowKey(rowKey);
}
+ protected Set[] convertKeySets(FacesContext context, Set[] sets) {
+ Set[] result = new Set[sets.length];
+
+ for (int i = 0; i < sets.length; i++) {
+ Set set = result[i] = new HashSet();
+
+ Iterator iterator = sets[i].iterator();
+ while (iterator.hasNext()) {
+ setRowKey(context, iterator.next());
+ set.add(getRowData());
+ }
+ }
+
+ return result;
+ }
+
+ protected DataAdder createDataAdder(Object object, int size) {
+ if (object instanceof List) {
+ return new ListDataAdder(size);
+ } else {
+ return new ArrayDataAdder(object.getClass(), size);
+ }
+ }
+
+ private class ListDataAdder implements DataAdder {
+ private ArrayList container;
+
+ public ListDataAdder(int size) {
+ container = new ArrayList(size);
+ }
+
+ public Object getContainer() {
+ container.trimToSize();
+ return container;
+ }
+
+ public void add(Object object) {
+ container.add(object);
+ }
+ }
+
+ private class ArrayDataAdder implements DataAdder {
+ private int idx = 0;
+ private Object[] objects;
+
+ public ArrayDataAdder(Class objectClass, int size) {
+ this.objects = (Object[]) Array.newInstance(objectClass.getComponentType(),
+ size);
+ }
+
+ public void add(Object object) {
+ this.objects[idx++] = object;
+ }
+
+ public Object getContainer() {
+ return objects;
+ }
+ }
+
+ public abstract ItemState getItemState();
+
+ public interface ItemState {
+ public boolean isSelected();
+ public boolean isActive();
+ }
+
+ protected final class SubmittedItemState implements ItemState {
+
+ private Set activeItemKeys;
+ private Set selectionKeys;
+
+ public boolean isActive() {
+ return activeItemKeys != null &&
activeItemKeys.contains(getTranslatedRowKey());
+ }
+
+ public boolean isSelected() {
+ return selectionKeys != null &&
selectionKeys.contains(getTranslatedRowKey());
+ }
+
+ public SubmittedItemState(Set selectionKeys, Set activeItemKeys) {
+ super();
+ this.selectionKeys = selectionKeys;
+ this.activeItemKeys = activeItemKeys;
+ }
+ }
}
Modified:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
===================================================================
---
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-28
17:59:37 UTC (rev 4321)
+++
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-28
17:59:50 UTC (rev 4322)
@@ -1,13 +1,8 @@
package org.richfaces.component;
import java.io.IOException;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
@@ -33,7 +28,7 @@
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.ExtendedDataModel;
-import org.richfaces.model.TranslatedSequenceDataModel;
+import org.richfaces.model.OrderingListDataModel;
public abstract class UIOrderingList extends UIOrderingBaseComponent {
@@ -80,24 +75,6 @@
}
- public interface ItemState {
- public boolean isSelected();
- public boolean isActive();
- }
-
- private final class SubmittedItemState implements ItemState {
-
- public boolean isActive() {
- Set activeItems = submittedValueHolder.getActiveItems();
- return activeItems != null && activeItems.contains(getTranslatedRowKey());
- }
-
- public boolean isSelected() {
- Set selection = submittedValueHolder.getSelection();
- return selection != null && selection.contains(getTranslatedRowKey());
- }
- }
-
private final class ModelItemState implements ItemState {
private Collection selectedItems;
private Object activeItem;
@@ -121,9 +98,9 @@
DataModel dataModel = createDataModel(getValue());
if (isTranslatedRenderingState() || isTranslatedState()) {
- return new TranslatedSequenceDataModel(dataModel, isTranslatedState(),
submittedValueHolder != null ? submittedValueHolder.permutationOrder :
this.permutationOrder);
+ return new OrderingListDataModel(dataModel, isTranslatedState(), submittedValueHolder
!= null ? submittedValueHolder.permutationOrder : this.permutationOrder);
} else {
- return new TranslatedSequenceDataModel(dataModel, false, null);
+ return new OrderingListDataModel(dataModel, false, null);
}
}
@@ -393,10 +370,34 @@
return;
}
+ Object previousValue = getValue();
Object newValue = null;
try {
- newValue = getConvertedValue(context);
+ if (previousValue == null) {
+ previousValue = Collections.EMPTY_LIST;
+ }
+
+ OrderingListDataModel dataModel = (OrderingListDataModel) getExtendedDataModel();
+ dataModel.setTranslationTable(submittedValueHolder.permutationOrder);
+
+ try {
+ final DataAdder dataAdder = createDataAdder(previousValue, dataModel.getRowCount());
+
+ walk(context, new DataVisitor() {
+ public void process(FacesContext context, Object rowKey,
+ Object argument) throws IOException {
+
+ setRowKey(rowKey);
+ dataAdder.add(getRowData());
+ }
+
+ }, null);
+
+ newValue = dataAdder.getContainer();
+ } catch (IOException e) {
+ throw new ConverterException(e.getLocalizedMessage(), e);
+ }
}
catch (ConverterException ce) {
Object submittedValue = submittedValueHolder;
@@ -409,34 +410,25 @@
// If our value is valid, store the new value, erase the
// "submitted" value, and emit a ValueChangeEvent if appropriate
if (isValid()) {
- Set selectionSet = new HashSet();
- Set selectedItems = submittedValueHolder.getSelection();
- for (Iterator iterator = selectedItems.iterator(); iterator
- .hasNext();) {
- setRowKey(context, iterator.next());
- Object selectionItem = getRowData();
+ Set[] sets = convertKeySets(context,
+ new Set[] {
+ submittedValueHolder.getSelection(),
+ submittedValueHolder.getActiveItems() });
- selectionSet.add(selectionItem);
- }
+ setSelection(sets[0]);
- setSelection(selectionSet);
-
- Set activeItems = submittedValueHolder.getActiveItems();
- if (!activeItems.isEmpty()) {
- setRowKey(context, activeItems.iterator().next());
- Object activeItem = getRowData();
-
- setActiveItem(activeItem);
- } else {
+ Set activeItems = sets[1];
+ if (activeItems.isEmpty()) {
setActiveItem(null);
+ } else {
+ setActiveItem(activeItems.iterator().next());
}
-
- Object previous = getValue();
+
setValue(newValue);
setTranslatedState();
- //setSubmittedValue(null);
- if (compareValues(previous, newValue)) {
- queueEvent(new ValueChangeEvent(this, previous, newValue));
+
+ if (compareValues(previousValue, newValue)) {
+ queueEvent(new ValueChangeEvent(this, previousValue, newValue));
}
this.permutationOrder = this.submittedValueHolder.permutationOrder;
@@ -444,64 +436,6 @@
}
}
- protected Object getConvertedValue(FacesContext context) throws ConverterException {
- Object convertedValue = getValue();
- if (convertedValue == null) {
- convertedValue = Collections.EMPTY_LIST;
- }
-
- if (submittedValueHolder != null) {
- Object savedValue = convertedValue;
-
- //int[] indexes = submittedValueHolder.permutationOrder;
-
- TranslatedSequenceDataModel dataModel = (TranslatedSequenceDataModel)
getExtendedDataModel();
- dataModel.setTranslationTable(submittedValueHolder.permutationOrder);
-
- try {
- if (savedValue instanceof List) {
- List list = (List) savedValue;
- final ArrayList arrayList = new ArrayList(list.size());
-
- walk(context, new DataVisitor() {
-
- public void process(FacesContext context, Object rowKey,
- Object argument) throws IOException {
-
- setRowKey(rowKey);
- arrayList.add(getRowData());
- }
-
- }, null);
-
- convertedValue = arrayList;
- } else {
- final Object[] convertedValueArray = (Object[])
Array.newInstance(savedValue.getClass().getComponentType(),
- Array.getLength(savedValue));
-
- walk(context, new DataVisitor() {
- private int counter = 0;
-
- public void process(FacesContext context, Object rowKey,
- Object argument) throws IOException {
-
- setRowKey(rowKey);
- convertedValueArray[counter++] = getRowData();
- }
-
- }, null);
-
- convertedValue = convertedValueArray;
- }
-
- } catch (IOException e) {
- throw new ConverterException(e.getLocalizedMessage(), e);
- }
- }
-
- return convertedValue;
- }
-
protected void resetDataModel() {
super.resetDataModel();
@@ -603,12 +537,13 @@
}
public Object getTranslatedRowKey() {
- return ((TranslatedSequenceDataModel) getExtendedDataModel()).getTranslatedRowKey();
+ return ((OrderingListDataModel) getExtendedDataModel()).getTranslatedRowKey();
}
public ItemState getItemState() {
if (submittedValueHolder != null) {
- return new SubmittedItemState();
+ return new SubmittedItemState(submittedValueHolder.getSelection(),
+ submittedValueHolder.getActiveItems());
} else {
return new ModelItemState(getSelection(), getActiveItem());
}
Copied:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/model/OrderingListDataModel.java
(from rev 4315,
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/model/TranslatedSequenceDataModel.java)
===================================================================
---
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/model/OrderingListDataModel.java
(rev 0)
+++
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/model/OrderingListDataModel.java 2007-11-28
17:59:50 UTC (rev 4322)
@@ -0,0 +1,135 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.faces.context.FacesContext;
+import javax.faces.model.DataModel;
+
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.Range;
+import org.ajax4jsf.model.SequenceDataModel;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 07.11.2007
+ *
+ */
+public class OrderingListDataModel extends SequenceDataModel {
+
+ protected static final class TranslatedRowKey implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2035943770925539333L;
+ private Object key;
+ private String asString;
+
+ public TranslatedRowKey(Object key, String asString) {
+ super();
+ this.key = key;
+ this.asString = asString;
+ }
+
+ public Object getKey() {
+ return key;
+ }
+
+ public String getAsString() {
+ return asString;
+ }
+
+ public String toString() {
+ return getAsString();
+ }
+ };
+
+ private Map translationTable;
+ private boolean translatedModel;
+
+ private Object rowKey;
+
+ public OrderingListDataModel(DataModel wrapped,
+ boolean translatedModel, Map translationTable) {
+ super(wrapped);
+ this.translatedModel = translatedModel;
+ this.translationTable = translationTable;
+ }
+
+ public OrderingListDataModel(DataModel wrapped) {
+ super(wrapped);
+ }
+
+ private Object translate(Object key) {
+ if (translationTable != null) {
+ return translationTable.get(key);
+ } else {
+ return key;
+ }
+ }
+
+ public Object getTranslatedRowKey() {
+ return super.getRowKey();
+ }
+
+ public Object getRowKey() {
+ return rowKey;
+ }
+
+ public void setRowKey(Object key) {
+ this.rowKey = key;
+
+ if (key instanceof TranslatedRowKey) {
+ super.setRowKey(((TranslatedRowKey) key).getKey());
+ } else {
+ if (this.translatedModel) {
+ if (rowKey != null) {
+ super.setRowKey(translate(key));
+ } else {
+ super.setRowKey(null);
+ }
+ } else {
+ super.setRowKey(key);
+ }
+ }
+ }
+
+ public void walk(FacesContext context, DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+
+ if (this.translationTable != null) {
+ Iterator iterator = this.translationTable.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Entry entry = (Entry) iterator.next();
+
+ if (this.translatedModel) {
+ visitor.process(context, new TranslatedRowKey(
+ entry.getValue(), String.valueOf(entry.getKey())), argument);
+ } else {
+ visitor.process(context, entry.getKey(), argument);
+ }
+ }
+ } else {
+ for (int i = 0; i < getRowCount(); i++) {
+ if (this.translatedModel) {
+ Integer key = new Integer(i);
+ visitor.process(context, new TranslatedRowKey(
+ translate(key), String.valueOf(key)), argument);
+ } else {
+ visitor.process(context, new Integer(i), argument);
+ }
+ }
+ }
+ }
+
+ public void setTranslationTable(Map translationTable) {
+ this.translationTable = translationTable;
+ }
+}
Deleted:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/model/TranslatedSequenceDataModel.java
===================================================================
---
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/model/TranslatedSequenceDataModel.java 2007-11-28
17:59:37 UTC (rev 4321)
+++
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/model/TranslatedSequenceDataModel.java 2007-11-28
17:59:50 UTC (rev 4322)
@@ -1,130 +0,0 @@
-/**
- *
- */
-package org.richfaces.model;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.faces.context.FacesContext;
-import javax.faces.model.DataModel;
-
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.Range;
-import org.ajax4jsf.model.SequenceDataModel;
-
-/**
- * @author Nick Belaevski
- * mailto:nbelaevski@exadel.com
- * created 07.11.2007
- *
- */
-public class TranslatedSequenceDataModel extends SequenceDataModel {
-
- protected static final class TranslatedRowKey {
- private Object key;
- private String asString;
-
- public TranslatedRowKey(Object key, String asString) {
- super();
- this.key = key;
- this.asString = asString;
- }
-
- public Object getKey() {
- return key;
- }
-
- public String getAsString() {
- return asString;
- }
-
- public String toString() {
- return getAsString();
- }
- };
-
- private Map translationTable;
- private boolean translatedModel;
-
- private Object rowKey;
-
- public TranslatedSequenceDataModel(DataModel wrapped,
- boolean translatedModel, Map translationTable) {
- super(wrapped);
- this.translatedModel = translatedModel;
- this.translationTable = translationTable;
- }
-
- public TranslatedSequenceDataModel(DataModel wrapped) {
- super(wrapped);
- }
-
- private Object translate(Object key) {
- if (translationTable != null) {
- return translationTable.get(key);
- } else {
- return key;
- }
- }
-
- public Object getTranslatedRowKey() {
- return super.getRowKey();
- }
-
- public Object getRowKey() {
- return rowKey;
- }
-
- public void setRowKey(Object key) {
- this.rowKey = key;
-
- if (key instanceof TranslatedRowKey) {
- super.setRowKey(((TranslatedRowKey) key).getKey());
- } else {
- if (this.translatedModel) {
- if (rowKey != null) {
- super.setRowKey(translate(key));
- } else {
- super.setRowKey(null);
- }
- } else {
- super.setRowKey(key);
- }
- }
- }
-
- public void walk(FacesContext context, DataVisitor visitor, Range range,
- Object argument) throws IOException {
-
- if (this.translationTable != null) {
- Iterator iterator = this.translationTable.entrySet().iterator();
- while (iterator.hasNext()) {
- Entry entry = (Entry) iterator.next();
-
- if (this.translatedModel) {
- visitor.process(context, new TranslatedRowKey(
- entry.getValue(), String.valueOf(entry.getKey())), argument);
- } else {
- visitor.process(context, entry.getKey(), argument);
- }
- }
- } else {
- for (int i = 0; i < getRowCount(); i++) {
- if (this.translatedModel) {
- Integer key = new Integer(i);
- visitor.process(context, new TranslatedRowKey(
- translate(key), String.valueOf(key)), argument);
- } else {
- visitor.process(context, new Integer(i), argument);
- }
- }
- }
- }
-
- public void setTranslationTable(Map translationTable) {
- this.translationTable = translationTable;
- }
-}
Modified:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
===================================================================
---
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2007-11-28
17:59:37 UTC (rev 4321)
+++
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2007-11-28
17:59:50 UTC (rev 4322)
@@ -15,8 +15,11 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import org.ajax4jsf.renderkit.ComponentVariables;
+import org.ajax4jsf.renderkit.ComponentsVariableResolver;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.UIOrderingBaseComponent;
+import org.richfaces.component.UIOrderingBaseComponent.ItemState;
/**
* @author Nick Belaevski
@@ -24,6 +27,8 @@
*/
public abstract class OrderingComponentRendererBase extends AbstractRowsRenderer {
+ private static final String ITEM_STATE_VAR_NAME = "itemState";
+
protected final static String SHOW_LABELS_ATTRIBUTE_NAME =
"showButtonLabels";
protected final static String ATTRIBUTE_CE_ONHEADERCLICK = "onheaderclick";
@@ -351,4 +356,18 @@
helper, clientId, bundle ,enabled);
}
}
+
+ public void encodeBegin(FacesContext context, UIComponent component)
+ throws IOException {
+ UIOrderingBaseComponent orderingComponent = (UIOrderingBaseComponent) component;
+ ComponentVariables variables = ComponentsVariableResolver.getVariables(this,
component);
+ variables.setVariable(ITEM_STATE_VAR_NAME, orderingComponent.getItemState());
+
+ super.encodeBegin(context, component);
+ }
+
+ protected ItemState getItemState(FacesContext context, UIComponent component,
ComponentVariables variables)
+ throws IOException {
+ return (ItemState) variables.getVariable(ITEM_STATE_VAR_NAME);
+ }
}
Modified:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
===================================================================
---
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-28
17:59:37 UTC (rev 4321)
+++
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-28
17:59:50 UTC (rev 4322)
@@ -10,27 +10,16 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.component.UIDataAdaptor;
import org.ajax4jsf.renderkit.ComponentVariables;
import org.ajax4jsf.renderkit.ComponentsVariableResolver;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.UIOrderingList;
-import org.richfaces.component.UIOrderingList.ItemState;
-import org.richfaces.renderkit.html.images.OrderingListIconBottom;
-import org.richfaces.renderkit.html.images.OrderingListIconBottomDisabled;
-import org.richfaces.renderkit.html.images.OrderingListIconDown;
-import org.richfaces.renderkit.html.images.OrderingListIconDownDisabled;
-import org.richfaces.renderkit.html.images.OrderingListIconTop;
-import org.richfaces.renderkit.html.images.OrderingListIconTopDisabled;
-import org.richfaces.renderkit.html.images.OrderingListIconUp;
-import org.richfaces.renderkit.html.images.OrderingListIconUpDisabled;
+import org.richfaces.component.UIOrderingBaseComponent.ItemState;
public abstract class OrderingListRendererBase extends OrderingComponentRendererBase {
private static final String SELECTION_STATE_VAR_NAME = "selectionState";
- private static final String ITEM_STATE_VAR_NAME = "itemState";
-
public OrderingListRendererBase() {
super(MESSAGE_BUNDLE_NAME);
}
@@ -56,7 +45,6 @@
public void encodeBegin(FacesContext context, UIComponent component)
throws IOException {
ComponentVariables variables = ComponentsVariableResolver.getVariables(this,
component);
- variables.setVariable(ITEM_STATE_VAR_NAME, ((UIOrderingList)
component).getItemState());
variables.setVariable(SELECTION_STATE_VAR_NAME, new OrderingListSelectionState());
super.encodeBegin(context, component);
@@ -135,10 +123,10 @@
StringBuffer cellClassName = new StringBuffer("rich-ordering-list-cell");
ComponentVariables variables = ComponentsVariableResolver.getVariables(this, table);
+ ItemState state = getItemState(context, table, variables);
- ItemState state = (ItemState) variables.getVariable(ITEM_STATE_VAR_NAME);
-
- if (state.isActive()) {
+ boolean active = state.isActive();
+ if (active) {
rowClassName.append(" rich-ordering-list-row-active");
cellClassName.append(" rich-ordering-list-cell-active");
}
Modified:
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
===================================================================
---
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2007-11-28
17:59:37 UTC (rev 4321)
+++
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2007-11-28
17:59:50 UTC (rev 4322)
@@ -49,14 +49,14 @@
this.shuttleTbody = this.shuttleTable.tBodies[0];
+ this.activeItem = null;
this.items = null;
+
this.retrieveShuttleItems(containerId);
this.shuttle = null;
this.sortOrder = Richfaces.ListBase.ASC;
- this.activeItem = null;
-
$(contentTableId).observe("click", function(e)
{this.onclickHandler(window.event || e)}.bindAsEventListener(this));
},
@@ -143,6 +143,8 @@
Richfaces.SelectItems.doActive(this.activeItem);
this.setFocus();
+
+ this.saveState();
//this.layoutManager.widthSynchronization();
}
},
@@ -166,6 +168,7 @@
Event.stop(event);
}
Richfaces.SelectItems.doActive(this.activeItem);
+ this.saveSate();
break;
case 32 : this.invertSelection(event); break; //blank
}
@@ -193,6 +196,8 @@
}
this.autoScrolling(action, event);
+
+ this.saveState();
//this.layoutManager.widthSynchronization();
},
@@ -252,6 +257,8 @@
if (this.activeItem && !this.getSelectItemByNode(this.activeItem)._selected) {
Richfaces.SelectItems.doNormal(this.activeItem);
}
+
+ this.saveState();
},
/**
@@ -283,6 +290,8 @@
this.selectedItems.push(rows[i]);
this.getSelectItemByNode(rows[i])._selected = true;
}
+
+ this.saveState();
},
resetMarked : function() {