Author: nbelaevski
Date: 2007-11-27 21:27:22 -0500 (Tue, 27 Nov 2007)
New Revision: 4304
Modified:
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleDataModel.java
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleRowKey.java
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java
branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss
Log:
latest changes for orderingList & listShuttle
Modified:
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java
===================================================================
---
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java 2007-11-28
02:27:14 UTC (rev 4303)
+++
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java 2007-11-28
02:27:22 UTC (rev 4304)
@@ -4,6 +4,7 @@
package org.richfaces.component;
+import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.ArrayList;
@@ -13,7 +14,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -26,7 +26,7 @@
import javax.faces.event.ValueChangeListener;
import javax.faces.model.DataModel;
-import org.apache.commons.collections.map.CompositeMap;
+import org.ajax4jsf.model.DataVisitor;
import org.richfaces.model.ListShuttleDataModel;
import org.richfaces.model.ListShuttleRowKey;
@@ -47,8 +47,8 @@
*/
private static final long serialVersionUID = 5655312942714191981L;
//ListShuttleRowKey -> ListShuttleRowKey
- private Map sourceTranslationTable = new LinkedHashMap();
- private Map targetTranslationTable = new LinkedHashMap();
+ private Map sourceTranslationTable = null;
+ private Map targetTranslationTable = null;
private Set selectedItems = new HashSet();
private List activeItems = new ArrayList();
@@ -60,59 +60,62 @@
targetListFromString(submittedStrings[1]);
}
- private void convertAndStoreKey(String keyString, int i, boolean keySource) {
- Matcher matcher = ITEM_PATTERN.matcher(keyString);
- matcher.matches();
+ private Map convertAndStoreKey(String string, boolean keySource) {
+ String[] valueOrder = string.split(",");
+ Map map = new LinkedHashMap();
- try {
- char c = matcher.group(1).charAt(0);
- boolean source;
-
- if (c == 's') {
- source = true;
- } else if (c == 't') {
- source = false;
- } else {
- throw new IllegalArgumentException();
- }
-
- Integer key = Integer.valueOf(matcher.group(2));
-
- ListShuttleRowKey orderKey = new ListShuttleRowKey(Integer.valueOf(i),
keySource);
- ListShuttleRowKey result = new ListShuttleRowKey(key, source);
-
- Map translationMap = keySource ? sourceTranslationTable : targetTranslationTable;
-
- translationMap.put(orderKey, result);
-
- String group = matcher.group(3);
- for (int j = 0; j < group.length(); j++) {
- c = group.charAt(j);
- if ('s' == c) {
- selectedItems.add(orderKey);
- } else if ('a' == c) {
- activeItems.add(orderKey);
- } else {
- break ;
+ for (int i = 0; i < valueOrder.length; i++) {
+ Matcher matcher = ITEM_PATTERN.matcher(valueOrder[i]);
+ matcher.matches();
+
+ try {
+ char c = matcher.group(1).charAt(0);
+ boolean source;
+
+ if (c == 's') {
+ source = true;
+ } else if (c == 't') {
+ source = false;
+ } else {
+ throw new IllegalArgumentException();
+ }
+
+ Integer key = Integer.valueOf(matcher.group(2));
+ ListShuttleRowKey oldKey = new ListShuttleRowKey(key, source, keySource);
+
+ ListShuttleRowKey newKey = new ListShuttleRowKey(Integer.valueOf(i), keySource);
+
+ map.put(oldKey, newKey);
+
+ String group = matcher.group(3);
+ for (int j = 0; j < group.length(); j++) {
+ c = group.charAt(j);
+ if ('s' == c) {
+ selectedItems.add(oldKey);
+ } else if ('a' == c) {
+ activeItems.add(newKey);
+ } else {
+ break ;
+ }
+
}
-
+ } catch (NumberFormatException e) {
+ // TODO: handle exception
}
- } catch (NumberFormatException e) {
- // TODO: handle exception
- }
+ }
+
+ return map;
}
private void targetListFromString(String string) {
- String[] valueOrder = string.split(",");
- for (int i = 0; i < valueOrder.length; i++) {
- convertAndStoreKey(valueOrder[i], i, false);
+ if (string != null && string.length() != 0) {
+ targetTranslationTable = convertAndStoreKey(string, false);
}
}
private void sourceListFromString(String string) {
- String[] valueOrder = string.split(",");
- for (int i = 0; i < valueOrder.length; i++) {
- convertAndStoreKey(valueOrder[i], i, true);
+ if (string != null && string.length() != 0) {
+ sourceTranslationTable = convertAndStoreKey(string, true);
}
}
@@ -147,6 +150,9 @@
}
}
+ private transient Map sourceTranslationTable;
+ private transient Map targetTranslationTable;
+
private transient SubmittedValue submittedValueHolder = null;
protected static final class ValueHolder implements Serializable {
@@ -160,6 +166,9 @@
private Object targetValue;
private boolean targetValueSet;
+
+ private Map sourceTranslationTable;
+ private Map targetTranslationTable;
}
private Object sourceValue;
@@ -256,6 +265,9 @@
holder.targetValue = targetValue;
holder.targetValueSet = targetValueSet;
+ holder.sourceTranslationTable = sourceTranslationTable;
+ holder.targetTranslationTable = targetTranslationTable;
+
return holder;
}
@@ -268,6 +280,8 @@
targetValue = holder.targetValue;
targetValueSet = holder.targetValueSet;
+ sourceTranslationTable = holder.sourceTranslationTable;
+ targetTranslationTable = holder.targetTranslationTable;
}
public org.ajax4jsf.model.ExtendedDataModel createDataModel() {
@@ -281,6 +295,9 @@
if (submittedValueHolder != null) {
sourceTranslationTable = submittedValueHolder.sourceTranslationTable;
targetTranslationTable = submittedValueHolder.targetTranslationTable;
+ } else {
+ sourceTranslationTable = this.sourceTranslationTable;
+ targetTranslationTable = this.targetTranslationTable;
}
return new ListShuttleDataModel(sourceDataModel, targetDataModel,
@@ -470,8 +487,6 @@
// If our value is valid, store the new value, erase the
// "submitted" value, and emit a ValueChangeEvent if appropriate
if (isValid()) {
- Object rowKey = getRowKey();
-
Set selectionSet = new HashSet();
Set selectedItems = submittedValueHolder.selectedItems;
for (Iterator iterator = selectedItems.iterator(); iterator
@@ -495,17 +510,21 @@
Object previousSource = getSourceValue();
Object previousTarget = getTargetValue();
+
setSourceValue(newValue[0]);
setTargetValue(newValue[1]);
+
setTranslatedState();
- //setSubmittedValue(null);
+
if (compareValues(previousSource, newValue[0]) || compareValues(previousTarget,
newValue[1])) {
queueEvent(new ValueChangeEvent(this, new Object[]{previousSource,previousTarget},
newValue));
}
+ this.sourceTranslationTable = this.submittedValueHolder.sourceTranslationTable;
+ this.targetTranslationTable = this.submittedValueHolder.targetTranslationTable;
+
this.submittedValueHolder = null;
- setRowKey(rowKey);
}
}
@@ -515,13 +534,14 @@
}
private class ListDataAdder implements DataAdder {
- private List container;
+ private ArrayList container;
public ListDataAdder(int size) {
container = new ArrayList(size);
}
public Object getContainer() {
+ container.trimToSize();
return container;
}
@@ -565,31 +585,56 @@
if (submittedValueHolder != null) {
Object rowKey = getRowKey();
- Map source = submittedValueHolder.sourceTranslationTable;
- Map target = submittedValueHolder.targetTranslationTable;
+ Object oldSourceValue = getSourceValue();
+ Object newSourceValue = oldSourceValue;
+
+ Object oldTargetValue = getTargetValue();
+ Object newTargetValue = oldTargetValue;
- DataAdder sourceValue = createDataAdder(getSourceValue(), source.size());
- DataAdder targetValue = createDataAdder(getTargetValue(), target.size());
+ final ListShuttleDataModel listShuttleDataModel = (ListShuttleDataModel)
getExtendedDataModel();
- Iterator iterator = source.entrySet().iterator();
- while (iterator.hasNext()) {
- Entry entry = (Entry) iterator.next();
+ listShuttleDataModel.setSourceTranslationTable(submittedValueHolder.getSourceTranslationTable());
+ listShuttleDataModel.setTargetTranslationTable(submittedValueHolder.getTargetTranslationTable());
- setRowKey(context, entry.getValue());
- sourceValue.add(getRowData());
- }
+ try {
+ if (listShuttleDataModel.needSourceTranslation()) {
+ final DataAdder sourceValueAdder = createDataAdder(oldSourceValue,
listShuttleDataModel.getSourceRowCount());
+ listShuttleDataModel.walkSource(context, new DataVisitor() {
- iterator = target.entrySet().iterator();
- while (iterator.hasNext()) {
- Entry entry = (Entry) iterator.next();
-
- setRowKey(context, entry.getValue());
- targetValue.add(getRowData());
+ public void process(FacesContext context, Object rowKey,
+ Object argument) throws IOException {
+
+ setRowKey(rowKey);
+ sourceValueAdder.add(getRowData());
+ }
+
+ }, null, null);
+
+ newSourceValue = sourceValueAdder.getContainer();
+ }
+
+ if (listShuttleDataModel.needTargetTranslation()) {
+ final DataAdder targetValueAdder = createDataAdder(oldTargetValue,
listShuttleDataModel.getTargetRowCount());
+ listShuttleDataModel.walkTarget(context, new DataVisitor() {
+
+ public void process(FacesContext context, Object rowKey,
+ Object argument) throws IOException {
+
+ setRowKey(rowKey);
+ targetValueAdder.add(getRowData());
+ }
+
+ }, null, null);
+
+ newTargetValue = targetValueAdder.getContainer();
+ }
+
+ setRowKey(rowKey);
+ } catch (IOException e) {
+ throw new ConverterException(e.getLocalizedMessage(), e);
}
- setRowKey(rowKey);
-
- return new Object[] {sourceValue.getContainer(), targetValue.getContainer()};
+ return new Object[] {newSourceValue, newTargetValue};
}
return null;
@@ -598,6 +643,9 @@
protected void resetDataModel() {
super.resetDataModel();
+ this.sourceTranslationTable = null;
+ this.targetTranslationTable = null;
+
if (this.submittedValueHolder != null) {
setTranslatedRenderingState();
}
Modified:
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleDataModel.java
===================================================================
---
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleDataModel.java 2007-11-28
02:27:14 UTC (rev 4303)
+++
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleDataModel.java 2007-11-28
02:27:22 UTC (rev 4304)
@@ -16,7 +16,6 @@
import org.ajax4jsf.model.Range;
import org.ajax4jsf.model.SequenceDataModel;
import org.ajax4jsf.model.SequenceRange;
-import org.apache.commons.collections.map.CompositeMap;
/**
* @author Nick Belaevski
@@ -26,10 +25,10 @@
private Object rowKey;
- private Boolean useSource = null;
-
+ private Boolean useSourceFacade = null;
+ private Boolean useSourceModel = null;
+
private boolean translatedModel;
- private Map translationTable;
private SequenceDataModel sourceModel;
private SequenceDataModel targetModel;
@@ -61,30 +60,6 @@
}
};
- protected static final class MovedRowKey {
- private Object rowKey;
-
- private boolean sourceKey;
-
- public MovedRowKey(Object key, boolean sourceKey) {
- super();
- this.rowKey = key;
- this.sourceKey = sourceKey;
- }
-
- public Object getRowKey() {
- return rowKey;
- }
-
- public boolean isSourceKey() {
- return sourceKey;
- }
-
- public String toString() {
- return rowKey.toString();
- }
- };
-
/* (non-Javadoc)
* @see org.ajax4jsf.model.ExtendedDataModel#getRowKey()
*/
@@ -93,30 +68,40 @@
}
private Object translate(Object key) {
- if (translationTable != null && key != null) {
- return translationTable.get(key);
+ if (key != null) {
+ if (sourceTranslationTable != null && sourceTranslationTable.containsKey(key))
{
+ return sourceTranslationTable.get(key);
+ } else if (targetTranslationTable != null &&
targetTranslationTable.containsKey(key)) {
+ return targetTranslationTable.get(key);
+ } else {
+ return key;
+ }
} else {
return key;
}
}
-
+
private void setShuttleRowKey(ListShuttleRowKey shuttleRowKey) {
Object sourceKey = null;
Object targetKey = null;
- Boolean useSource = null;
-
+ Boolean useSourceFacade = null;
+ Boolean useSourceModel = null;
+
if (shuttleRowKey != null) {
if (shuttleRowKey.isSource()) {
sourceKey = shuttleRowKey.getRowKey();
- useSource = Boolean.TRUE;
+ useSourceModel = Boolean.TRUE;
} else {
targetKey = shuttleRowKey.getRowKey();
- useSource = Boolean.FALSE;
+ useSourceModel = Boolean.FALSE;
}
+
+ useSourceFacade = (shuttleRowKey.isFacadeSource() ? Boolean.TRUE : Boolean.FALSE);
}
- this.useSource = useSource;
-
+ this.useSourceFacade = useSourceFacade;
+ this.useSourceModel = useSourceModel;
+
this.sourceModel.setRowKey(sourceKey);
this.targetModel.setRowKey(targetKey);
}
@@ -130,12 +115,6 @@
if (key instanceof TranslatedRowKey) {
ListShuttleRowKey shuttleRowKey = (ListShuttleRowKey) ((TranslatedRowKey)
key).getRowKey();
setShuttleRowKey(shuttleRowKey);
- } else if (key instanceof MovedRowKey) {
- MovedRowKey mrk = (MovedRowKey) key;
- setRowKey(mrk.getRowKey());
- if (!this.translatedModel) {
- useSource = Boolean.valueOf(mrk.isSourceKey());
- }
} else {
if (this.translatedModel) {
if (rowKey != null) {
@@ -155,75 +134,85 @@
this.translatedModel = translatedModel;
this.sourceTranslationTable = sourceTranslationTable;
this.targetTranslationTable = targetTranslationTable;
- if (sourceTranslationTable != null && targetTranslationTable != null) {
- this.translationTable = new CompositeMap(sourceTranslationTable,
targetTranslationTable);
- }
this.sourceModel = new org.ajax4jsf.model.SequenceDataModel(source);
this.targetModel = new org.ajax4jsf.model.SequenceDataModel(target);
}
- /* (non-Javadoc)
- * @see org.ajax4jsf.model.ExtendedDataModel#walk(javax.faces.context.FacesContext,
org.ajax4jsf.model.DataVisitor, org.ajax4jsf.model.Range, java.lang.Object)
- */
- public void walk(final FacesContext context, final DataVisitor visitor, Range range,
- Object argument) throws IOException {
+ private void walkModel(final FacesContext context, final DataVisitor visitor, Range
range,
+ Object argument, final boolean source) throws IOException {
- if (translationTable != null) {
- //TODO is it ordered?
- Iterator translations = this.translationTable.entrySet().iterator();
- while (translations.hasNext()) {
- Entry translation = (Entry) translations.next();
- ListShuttleRowKey translatedKey = (ListShuttleRowKey) translation.getKey();
- ListShuttleRowKey sourceKey = (ListShuttleRowKey) translation.getValue();
-
- if (translatedModel) {
- visitor.process(context, new TranslatedRowKey(
- translatedKey, String.valueOf(sourceKey)), argument);
- } else {
- visitor.process(context, new MovedRowKey(sourceKey,
sourceTranslationTable.containsKey(translatedKey)),
- argument);
- }
- }
- } else {
- this.sourceModel.walk(context, new DataVisitor() {
- public void process(FacesContext context, Object rowKey,
- Object argument) throws IOException {
+ ExtendedDataModel dataModel = source ? this.sourceModel : this.targetModel;
- ListShuttleRowKey shuttleRowKey = new ListShuttleRowKey(rowKey, true);
+ dataModel.walk(context, new DataVisitor() {
+ public void process(FacesContext context, Object rowKey,
+ Object argument) throws IOException {
+
+ ListShuttleRowKey shuttleRowKey = new ListShuttleRowKey(rowKey, source);
Object translatedShuttleRowKey = translate(shuttleRowKey);
-
+
if (translatedModel) {
visitor.process(context, new TranslatedRowKey(
shuttleRowKey, String.valueOf(translatedShuttleRowKey)), argument);
} else {
- visitor.process(context, new MovedRowKey(translatedShuttleRowKey, true), argument);
+ visitor.process(context, translatedShuttleRowKey, argument);
}
}
- }, new SequenceRange(0, -1), argument);
+ }, new SequenceRange(0, -1), argument);
+ }
- this.targetModel.walk(context, new DataVisitor(){
- public void process(FacesContext context, Object rowKey,
- Object argument) throws IOException {
+ private void walkMap(final FacesContext context, final DataVisitor visitor, Range
range,
+ Object argument, Map translationMap) throws IOException {
- ListShuttleRowKey shuttleRowKey = new ListShuttleRowKey(rowKey, false);
- Object translatedShuttleRowKey = translate(shuttleRowKey);
+ Iterator translations = translationMap.entrySet().iterator();
+ while (translations.hasNext()) {
+ Entry translation = (Entry) translations.next();
+ ListShuttleRowKey sourceKey = (ListShuttleRowKey) translation.getKey();
+ ListShuttleRowKey translatedKey = (ListShuttleRowKey) translation.getValue();
- if (translatedModel) {
- visitor.process(context, new TranslatedRowKey(
- shuttleRowKey, String.valueOf(translatedShuttleRowKey)), argument);
- } else {
- visitor.process(context, new MovedRowKey(translatedShuttleRowKey, false),
argument);
- }
- }
- }, new SequenceRange(0, -1), argument);
+ if (translatedModel) {
+ visitor.process(context, new TranslatedRowKey(
+ translatedKey, String.valueOf(sourceKey)), argument);
+ } else {
+ visitor.process(context, sourceKey, argument);
+ }
}
}
+ public void walkSource(final FacesContext context, final DataVisitor visitor, Range
range,
+ Object argument) throws IOException {
+
+ if (this.sourceTranslationTable != null) {
+ this.walkMap(context, visitor, range, argument, this.sourceTranslationTable);
+ } else {
+ this.walkModel(context, visitor, range, argument, true);
+ }
+ }
+
+ public void walkTarget(final FacesContext context, final DataVisitor visitor, Range
range,
+ Object argument) throws IOException {
+
+ if (this.targetTranslationTable != null) {
+ this.walkMap(context, visitor, range, argument, this.targetTranslationTable);
+ } else {
+ this.walkModel(context, visitor, range, argument, false);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.model.ExtendedDataModel#walk(javax.faces.context.FacesContext,
org.ajax4jsf.model.DataVisitor, org.ajax4jsf.model.Range, java.lang.Object)
+ */
+ public void walk(final FacesContext context, final DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+
+ walkSource(context, visitor, range, argument);
+ walkTarget(context, visitor, range, argument);
+ }
+
public Object getTranslatedRowKey() {
return this.translate(getRowKey());
}
-
+
/* (non-Javadoc)
* @see javax.faces.model.DataModel#getRowCount()
*/
@@ -235,10 +224,10 @@
* @see javax.faces.model.DataModel#getRowData()
*/
public Object getRowData() {
- if (sourceModel.isRowAvailable()) {
+ if (isSourceModel()) {
return sourceModel.getRowData();
- } else if (targetModel.isRowAvailable()) {
- return targetModel.getRowData();
+ } else if (isTargetModel()) {
+ return targetModel.getRowData();
} else {
return null;
}
@@ -263,7 +252,13 @@
* @see javax.faces.model.DataModel#isRowAvailable()
*/
public boolean isRowAvailable() {
- return sourceModel.isRowAvailable() || targetModel.isRowAvailable();
+ if (isSourceModel()) {
+ return sourceModel.isRowAvailable();
+ } else if (isTargetModel()) {
+ return targetModel.isRowAvailable();
+ } else {
+ return false;
+ }
}
/* (non-Javadoc)
@@ -279,12 +274,52 @@
// TODO Auto-generated method stub
}
+
+ public boolean needSourceTranslation() {
+ return sourceTranslationTable != null;
+ }
+
+ public boolean needTargetTranslation() {
+ return targetTranslationTable != null;
+ }
+ public int getSourceRowCount() {
+ if (sourceTranslationTable != null) {
+ return sourceTranslationTable.size();
+ } else {
+ return sourceModel.getRowCount();
+ }
+ }
+
+ public int getTargetRowCount() {
+ if (targetTranslationTable != null) {
+ return targetTranslationTable.size();
+ } else {
+ return targetModel.getRowCount();
+ }
+ }
+
+ protected boolean isSourceModel() {
+ return Boolean.TRUE.equals(useSourceModel);
+ }
+
+ protected boolean isTargetModel() {
+ return Boolean.FALSE.equals(useSourceModel);
+ }
+
public boolean isSource() {
- return Boolean.TRUE.equals(useSource);
+ return Boolean.TRUE.equals(useSourceFacade);
}
public boolean isTarget() {
- return Boolean.FALSE.equals(useSource);
+ return Boolean.FALSE.equals(useSourceFacade);
}
+
+ public void setSourceTranslationTable(Map sourceTranslationTable) {
+ this.sourceTranslationTable = sourceTranslationTable;
+ }
+
+ public void setTargetTranslationTable(Map targetTranslationTable) {
+ this.targetTranslationTable = targetTranslationTable;
+ }
}
Modified:
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleRowKey.java
===================================================================
---
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleRowKey.java 2007-11-28
02:27:14 UTC (rev 4303)
+++
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleRowKey.java 2007-11-28
02:27:22 UTC (rev 4304)
@@ -18,12 +18,18 @@
private boolean source;
+ private boolean facadeSource;
+
private Object rowKey;
public boolean isSource() {
return source;
}
+ public boolean isFacadeSource() {
+ return facadeSource;
+ }
+
public Object getRowKey() {
return rowKey;
}
@@ -62,5 +68,13 @@
super();
this.rowKey = rowKey;
this.source = source;
+ this.facadeSource = source;
}
+
+ public ListShuttleRowKey(Object rowKey, boolean source, boolean facadeSource) {
+ super();
+ this.rowKey = rowKey;
+ this.source = source;
+ this.facadeSource = facadeSource;
+ }
}
Modified:
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java
===================================================================
---
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java 2007-11-28
02:27:14 UTC (rev 4303)
+++
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java 2007-11-28
02:27:22 UTC (rev 4304)
@@ -245,7 +245,7 @@
Object object =
context.getExternalContext().getRequestParameterValuesMap().get(clientId);
if (object != null) {
String[] submittedValues = (String[]) object;
- if (submittedValues.length == 2 && !isEmpty(submittedValues[0]) &&
!isEmpty(submittedValues[1])) {
+ if (submittedValues.length == 2 && (!isEmpty(submittedValues[0]) ||
!isEmpty(submittedValues[1]))) {
UIListShuttle listShuttle = (UIListShuttle) component;
listShuttle.setSubmittedStrings(submittedValues);
}
Modified:
branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss
===================================================================
---
branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss 2007-11-28
02:27:14 UTC (rev 4303)
+++
branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss 2007-11-28
02:27:22 UTC (rev 4304)
@@ -180,4 +180,311 @@
</u:style>
<u:style name="background-color" skin="additionalBackgroundColor"
/>
</u:selector>
+
+
+
+<!-- Ordering List copied -->
+
+<f:verbatim><![CDATA[
+
+.rich-ordering-control-disabled {
+ border : 1px solid;
+ margin-bottom : 3px;
+}
+
+.rich-ordering-control-top {
+ border : 1px solid;
+ margin-bottom : 3px;
+}
+
+.rich-ordering-control-bottom {
+ border : 1px solid;
+ margin-bottom : 3px;
+}
+
+.rich-ordering-control-up {
+ border : 1px solid;
+ margin-bottom : 3px;
+}
+
+.rich-ordering-control-down {
+ border : 1px solid;
+ margin-bottom : 3px;
+}
+
+.rich-ordering-list-button {
+ background : top left repeat-x;
+ cursor : pointer;
+ padding : 2px;
+}
+
+.rich-ordering-list-button-disabled {
+ background : top left repeat-x;
+ padding : 2px;
+}
+
+.rich-ordering-list-button-light {
+ background : top left repeat-x;
+ border-style: solid;
+ cursor : pointer;
+ padding: 1px;
+}
+
+/*
+.rich-ordering-list-button-dis {
+ border : 1px solid #bfbfc0;
+ margin-bottom : 3px;
+ padding : 1px
+}
+*/
+
+.rich-ordering-list-button-press {
+ background : top left repeat-x;
+ border-style: solid;
+ padding : 2px 0px 0px 2px;
+}
+
+.rich-ordering-list-button-valign {
+ vertical-align : middle;
+}
+
+.rich-ordering-list-button-layout {
+ padding : 15px 8px 15px 0px;
+}
+
+.rich-ordering-list-button-content {
+ padding : 0px 4px 0px 1px;
+ text-align : left;
+ white-space: nowrap;
+}
+
+.rich-ordering-list-button-content img {
+ margin-right: 2px;
+ vertical-align: middle;
+}
+
+.rich-ordering-list-caption {
+ height: 8px;
+ padding : 3px 3px 3px 8px
+}
+
+.rich-ordering-list-body {
+ border : 0px solid;
+}
+
+.rich-ordering-list-output {
+ border : 1px solid;
+ margin : 0px 8px 8px 8px;
+ background: none repeat scroll 0% 50%;
+}
+
+.rich-ordering-list-content {
+ overflow: auto;
+}
+
+.rich-ordering-list-header {
+ overflow: hidden;
+ height: 18px;
+}
+
+.rich-ordering-list-items {
+ background : repeat scroll left top;
+ width: 100%;
+}
+
+.rich-ordering-list-active {
+ background : repeat scroll left top;
+ width: 100%;
+}
+
+.rich-ordering-list-disabled {
+ background : repeat scroll left top;
+ width: 100%;
+}
+
+.rich-ordering-list-row-active {
+ background : transparent none repeat-x scroll left top;
+ width: 100%;
+}
+
+.rich-ordering-list-row-selected {
+ background : transparent none repeat-x scroll left top;
+ width: 100%;
+}
+
+.rich-ordering-list-table-header-cell {
+ background : none top left repeat-x;
+ border-style: solid;
+ padding : 2px;
+}
+
+.rich-ordering-list-table-header-cell-end {
+ border-right : 0px;
+ white-space: nowrap;
+}
+
+.rich-ordering-list-cell-end {
+ border-right : 0px;
+ white-space: nowrap;
+}
+
+.rich-ordering-list-cell {
+ padding : 2px;
+ white-space: nowrap;
+}
+
+.rich-ordering-list-ds {
+ -moz-user-select: -moz-none;
+}
+
+.rich-ordering-list-fk {
+ width: 1px;
+ position: absolute;
+ left: -32767px;
+}
+
+.rich-ordering-list-ds input {
+ -moz-user-select: text;
+}
+]]>
+</f:verbatim>
+
+<u:selector name=".rich-ordering-list-button">
+ <u:style name="background-image">
+ <f:resource
f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient"
/>
+ </u:style>
+ <u:style name="background-color" skin="tabBackgroundColor" />
+ <u:style name="color" skin="generalTextColor"/>
+ <u:style name="font-family" skin="headerFamilyFont"/>
+ <u:style name="font-size" skin="headerSizeFont"/>
+</u:selector>
+
+<u:selector name=".rich-ordering-list-button-disabled">
+ <u:style name="background-image">
+ <f:resource
f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient"
/>
+ </u:style>
+ <u:style name="background-color" skin="tabBackgroundColor" />
+ <u:style name="color" skin="tabDisabledTextColor"/>
+ <u:style name="font-family" skin="headerFamilyFont"/>
+ <u:style name="font-size" skin="headerSizeFont"/>
+</u:selector>
+
+ <u:selector name=".rich-ordering-list-button-light">
+ <u:style name="background-image">
+ <f:resource
f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient"
/>
+ </u:style>
+ <u:style name="background-color" skin="tabBackgroundColor"
/>
+ <u:style name="border-color" skin="tableBorderColor" />
+ <u:style name="border-width" skin="tableBorderWidth" />
+ <u:style name="font-family" skin="headerFamilyFont" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ <u:style name="color" skin="generalTextColor"/>
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-button-press">
+ <u:style name="background-image">
+ <f:resource
f:key="org.richfaces.renderkit.html.gradientimages.OrderingListClickedGradient"
/>
+ </u:style>
+ <u:style name="background-color" skin="generalBackgroundColor"
/>
+ <u:style name="border-color" skin="tableBorderColor" />
+ <u:style name="border-width" skin="tableBorderWidth" />
+ <u:style name="font-family" skin="headerFamilyFont" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ <u:style name="color" skin="generalTextColor"/>
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-table-header-cell">
+ <u:style name="background-image">
+ <f:resource
f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient"
/>
+ </u:style>
+ <u:style name="background-color" skin="headerBackgroundColor"
/>
+ <u:style name="color" skin="headerTextColor" />
+ <u:style name="font-family" skin="headerFamilyFont" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ <u:style name="font-weight" skin="headerWeightFont" />
+ <u:style name="border-width" skin="tableBorderWidth" />
+ <u:style name="border-top-color" skin="subBorderColor" />
+ <u:style name="border-bottom-color" skin="tableBorderColor"
/>
+ <u:style name="border-right-color" skin="tableBorderColor"
/>
+ <u:style name="border-left-color" skin="panelBorderColor" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-table-header-cell-end">
+ <u:style name="background-image">
+ <f:resource
f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient"
/>
+ </u:style>
+ <u:style name="background-color" skin="headerBackgroundColor"
/>
+ <u:style name="color" skin="headerTextColor" />
+ <u:style name="font-family" skin="headerFamilyFont" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ <u:style name="font-weight" skin="headerWeightFont" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-cell-end">
+ <u:style name="font-family" skin="generalFamilyFont" />
+ <u:style name="font-size" skin="generalSizeFont" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-items">
+ <u:style name="background-color" skin="generalBackgroundColor"
/>
+ <u:style name="border-color" skin="panelBorderColor" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-output">
+ <u:style name="background-color" skin="generalBackgroundColor"
/>
+ <u:style name="border-color" skin="panelBorderColor" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-cell, .rich-ordering-list-cell
*">
+ <u:style name="color" skin="generalTextColor"/>
+ <u:style name="font-family" skin="generalFamilyFont" />
+ <u:style name="font-size" skin="generalSizeFont" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-control-disabled">
+ <u:style name="border-color" skin="panelBorderColor" />
+ </u:selector>
+ <u:selector name=".rich-ordering-control-top">
+ <u:style name="border-color" skin="panelBorderColor" />
+ </u:selector>
+ <u:selector name=".rich-ordering-control-bottom">
+ <u:style name="border-color" skin="panelBorderColor" />
+ </u:selector>
+ <u:selector name=".rich-ordering-control-up">
+ <u:style name="border-color" skin="panelBorderColor" />
+ </u:selector>
+ <u:selector name=".rich-ordering-control-down">
+ <u:style name="border-color" skin="panelBorderColor" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-button-content">
+ <u:style name="font-family" skin="headerFamilyFont" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-caption">
+ <u:style name="font-family" skin="headerFamilyFont" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ <u:style name="font-weight" skin="headerWeightFont" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-row-active">
+ <u:style name="font-family" skin="headerFamilyFont" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ <u:style name="font-weight" skin="headerWeightFont" />
+ <u:style name="background-image">
+ <f:resource
f:key="org.richfaces.renderkit.html.gradientimages.OrderingListSelectGradient"
/>
+ </u:style>
+ <u:style name="background-color" skin="headerGradientColor"
/>
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-row-selected">
+ <u:style name="background-image">
+ <f:resource
f:key="org.richfaces.renderkit.html.gradientimages.OrderingListSelectGradient"
/>
+ </u:style>
+ <u:style name="background-color" skin="headerGradientColor"
/>
+ </u:selector>
+}
+
+
</f:template>
\ No newline at end of file