[richfaces-svn-commits] JBoss Rich Faces SVN: r5695 - in trunk/sandbox/ui/pickList/src/main: java/org/richfaces/component and 3 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Tue Jan 29 08:11:32 EST 2008


Author: vmolotkov
Date: 2008-01-29 08:11:32 -0500 (Tue, 29 Jan 2008)
New Revision: 5695

Added:
   trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java
   trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickList.js
   trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickListSI.js
   trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/picklist_.js
Modified:
   trunk/sandbox/ui/pickList/src/main/config/component/picklist.xml
   trunk/sandbox/ui/pickList/src/main/java/org/richfaces/component/UIPickList.java
   trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
   trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/css/picklist.xcss
Log:
pickList component

Modified: trunk/sandbox/ui/pickList/src/main/config/component/picklist.xml
===================================================================
--- trunk/sandbox/ui/pickList/src/main/config/component/picklist.xml	2008-01-29 12:11:07 UTC (rev 5694)
+++ trunk/sandbox/ui/pickList/src/main/config/component/picklist.xml	2008-01-29 13:11:32 UTC (rev 5695)
@@ -15,9 +15,9 @@
         <description>
             <![CDATA[  ]]>
         </description>
-		<renderer  generate="false" override="false">
-			<name>org.richfaces.PickList</name>
-			<classname>org.richfaces.renderkit.PickListRenderer</classname>
+        <renderer generate="true" override="true">
+			<name>org.richfaces.PickListRenderer</name>
+			<template>htmlPickList.jspx</template>
 		</renderer>
        	
        	<tag>
@@ -69,6 +69,42 @@
        			<classname>java.lang.String</classname>
        		</property>
        		       		
+       	<property>
+	    	<name>listClass</name>
+	    	<classname>java.lang.String</classname>
+	        <description>CSS class for a list</description>
+	    	<defaultvalue><![CDATA[""]]></defaultvalue>
+	    </property>
+       	<property>
+            <name>switchByClick</name>
+            <classname>boolean</classname>
+            <description>If &quot;true&quot;, dragging between lists realized by click </description>
+            <defaultvalue>false</defaultvalue>
+        </property>
+        <property>
+            <name>sourceListWidth</name>
+            <classname>java.lang.String</classname>
+            <description>
+                Defines width of a source list
+            </description>
+            <defaultvalue>"140"</defaultvalue>
+        </property>
+        <property>
+            <name>targetListWidth</name>
+            <classname>java.lang.String</classname>
+            <description>
+                Defines width of a target list
+            </description>
+            <defaultvalue>"140"</defaultvalue>
+        </property>
+        <property>
+            <name>listsHeight</name>
+            <classname>java.lang.String</classname>
+            <description>
+                Defines height of the list
+            </description>
+            <defaultvalue>"140"</defaultvalue>
+        </property>     		
        		&ui_component_attributes;
        		&html_universal_attributes;
        		&html_events;

Modified: trunk/sandbox/ui/pickList/src/main/java/org/richfaces/component/UIPickList.java
===================================================================
--- trunk/sandbox/ui/pickList/src/main/java/org/richfaces/component/UIPickList.java	2008-01-29 12:11:07 UTC (rev 5694)
+++ trunk/sandbox/ui/pickList/src/main/java/org/richfaces/component/UIPickList.java	2008-01-29 13:11:32 UTC (rev 5695)
@@ -1,9 +1,17 @@
 package org.richfaces.component;
 
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
 import javax.faces.component.UISelectMany;
+import javax.faces.context.FacesContext;
 
 public abstract class UIPickList extends UISelectMany{
+	private String listClass;
+	private String moveControlsVerticalAlign;
 	
+	public abstract String getMoveControlsVerticalAlign();
+	public abstract void setMoveControlsVerticalAlign(String moveControlsVerticalAlign);
+	
 	public abstract boolean isDisplayValueOnly();
 	public abstract void setDisplayValueOnly(boolean displayValueOnly);
 	 
@@ -19,4 +27,43 @@
 	public abstract boolean isDisabled();
 	public abstract void setDisabled(boolean disabled);
 	
+	public abstract boolean isFastOrderControlsVisible();
+	public abstract void setFastOrderControlsVisible(boolean visible);
+	
+	/**
+	 * Get base clietntId of this component ( withowt iteration part )
+	 * 
+	 * @param faces
+	 * @return
+	 */
+	public String getBaseClientId(FacesContext faces) {
+		// Return any previously cached client identifier
+		if (_baseClientId == null) {
+
+			// Search for an ancestor that is a naming container
+			UIComponent ancestorContainer = this;
+			StringBuffer parentIds = new StringBuffer();
+			while (null != (ancestorContainer = ancestorContainer.getParent())) {
+				if (ancestorContainer instanceof NamingContainer) {
+					parentIds.append(ancestorContainer.getClientId(faces))
+							.append(NamingContainer.SEPARATOR_CHAR);
+					break;
+				}
+			}
+			String id = getId();
+			if (null != id) {
+				_baseClientId = parentIds.append(id).toString();
+			} else {
+				_baseClientId = parentIds.append(
+						faces.getViewRoot().createUniqueId()).toString();
+			}
+		}
+		return (_baseClientId);
+
+	}
+	private String _baseClientId = null;
+	public abstract String getListClass();
+	
+	public abstract void setListClass(String listClass);
+		
 }

Added: trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java
===================================================================
--- trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java	                        (rev 0)
+++ trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java	2008-01-29 13:11:32 UTC (rev 5695)
@@ -0,0 +1,147 @@
+package org.richfaces.renderkit;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.UIListShuttle;
+import org.richfaces.component.UIOrderingBaseComponent;
+import org.richfaces.renderkit.html.images.ListShuttleIconCopy;
+import org.richfaces.renderkit.html.images.ListShuttleIconCopyAll;
+import org.richfaces.renderkit.html.images.ListShuttleIconCopyAllDisabled;
+import org.richfaces.renderkit.html.images.ListShuttleIconCopyDisabled;
+import org.richfaces.renderkit.html.images.ListShuttleIconRemove;
+import org.richfaces.renderkit.html.images.ListShuttleIconRemoveAll;
+import org.richfaces.renderkit.html.images.ListShuttleIconRemoveAllDisabled;
+import org.richfaces.renderkit.html.images.ListShuttleIconRemoveDisabled;
+
+public class PickListControlsHelper {
+	
+	private final static String FACET_COPY_ALL = "copyAllControl";
+	
+	private final static String FACET_REMOVE_ALL = "removeAllControl";
+	
+	private final static String FACET_COPY = "copyControl";
+	
+	private final static String FACET_REMOVE = "removeControl";
+	
+	private final static String FACET_DIS_COPY_ALL = FACET_COPY_ALL + "Disabled";
+	
+	private final static String FACET_DIS_REMOVE_ALL = FACET_REMOVE_ALL + "Disabled";
+	
+	private final static String FACET_DIS_COPY = FACET_COPY + "Disabled";
+	
+	private final static String FACET_DIS_REMOVE = FACET_REMOVE + "Disabled";
+	
+	public final static String FACET_CAPTION = "caption";
+	
+	private final static String ATTRIBUTE_CE_ONCOPYALLCLICK = "oncopyallclick";
+	
+	private final static String ATTRIBUTE_CE_ONREMOVECLICK = "onremoveclick";
+	
+	private final static String ATTRIBUTE_CE_ONCOPYCLICK = "oncopyclick";
+	
+	private final static String ATTRIBUTE_CE_ONREMOVEALLCLICK = "onremoveallclick";
+	
+	public final static String ATTRIBUTE_SOURCE_CAPTION_LABEL = "sourceCaptionLabel";
+	
+	public final static String ATTRIBUTE_TARGET_CAPTION_LABEL = "targetCaptionLabel";
+	
+	private final static String ATTRIBUTE_CLASS_COPY_ALL_CONTROL = FACET_COPY_ALL + "Class";
+	
+	private final static String ATTRIBUTE_CLASS_REMOVE_ALL_CONTROL = FACET_REMOVE_ALL + "Class";
+	
+	private final static String ATTRIBUTE_CLASS_REMOVE_CONTROL = FACET_REMOVE + "Class";
+	
+	private final static String ATTRIBUTE_CLASS_COPY_CONTROL = FACET_COPY + "Class";
+	
+	private final static String ATTRIBUTE_CLASS_DISABLED_CONTROL = "disabledControlClass";
+	
+	private final static String DIS_CONTROL_ID_PREFIX = "dis";
+	
+	private final static String CONTROL_ID_COPY_ALL = "copyAll";
+
+	private final static String CONTROL_ID_COPY = "copy";
+	
+	private final static String CONTROL_ID_REMOVE = "remove";
+	
+	private final static String CONTROL_ID_REMOVE_ALL = "removeAll";
+	
+	private final static String DEFAULT_LABEL_COPY_ALL = "Copy all";
+	private final static String DEFAULT_LABEL_COPY = "Copy";
+	private final static String DEFAULT_LABEL_REMOVE = "Remove";
+	private final static String DEFAULT_LABEL_REMOVE_ALL = "Remove All";
+	
+	protected static final OrderingComponentRendererBase.ControlsHelper[] HELPERS = new OrderingComponentRendererBase.ControlsHelper[] {
+		new OrderingComponentRendererBase.ControlsHelper("copyAll", "COPY_ALL_LABEL", DEFAULT_LABEL_COPY_ALL, ListShuttleIconCopyAll.class.getName(), FACET_COPY_ALL,
+						   "-copyall", ATTRIBUTE_CLASS_COPY_ALL_CONTROL, "", 
+						   CONTROL_ID_COPY_ALL, ATTRIBUTE_CE_ONCOPYALLCLICK, true, "copyAll".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
+
+			public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+				return true;
+			}
+			
+		},
+		new OrderingComponentRendererBase.ControlsHelper("disabledCopyAll", "COPY_ALL_LABEL", DEFAULT_LABEL_COPY_ALL, ListShuttleIconCopyAllDisabled.class.getName(), FACET_DIS_COPY_ALL,
+						   "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled", 
+						   DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY_ALL), null, false, "copyAll".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
+
+			public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+				return true;
+			}
+			
+		},
+		new OrderingComponentRendererBase.ControlsHelper("copy", "COPY_LABEL", DEFAULT_LABEL_COPY, ListShuttleIconCopy.class.getName(), FACET_COPY,
+						   "-copy", ATTRIBUTE_CLASS_COPY_CONTROL, "", 
+						   CONTROL_ID_COPY, ATTRIBUTE_CE_ONCOPYCLICK ,true, "copy".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
+
+			public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+				return true;
+			}
+			
+		},
+		new OrderingComponentRendererBase.ControlsHelper("disabledCopy", "COPY_LABEL", DEFAULT_LABEL_COPY, ListShuttleIconCopyDisabled.class.getName(), FACET_DIS_COPY,
+						   "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
+						   DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY), null, false, "copy".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
+
+			public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+				return true;
+			}
+			
+		},
+		new OrderingComponentRendererBase.ControlsHelper("remove", "REMOVE_LABEL", DEFAULT_LABEL_REMOVE, ListShuttleIconRemove.class.getName(), FACET_REMOVE,
+						   "-remove", ATTRIBUTE_CLASS_REMOVE_CONTROL, "",
+						   CONTROL_ID_REMOVE, ATTRIBUTE_CE_ONREMOVECLICK, true, "remove".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
+
+			public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+				return true;
+			}
+			
+		},
+		new OrderingComponentRendererBase.ControlsHelper("disabledRemove", "REMOVE_LABEL", DEFAULT_LABEL_REMOVE, ListShuttleIconRemoveDisabled.class.getName(), FACET_DIS_REMOVE,
+						   "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled", 
+						   DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE), null, false, "remove".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
+
+			public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+				return true;
+			}
+			
+		},
+		new OrderingComponentRendererBase.ControlsHelper("removeAll", "REMOVE_ALL_LABEL", DEFAULT_LABEL_REMOVE_ALL, ListShuttleIconRemoveAll.class.getName(), FACET_REMOVE_ALL,
+						   "-removeall", ATTRIBUTE_CLASS_REMOVE_ALL_CONTROL, "",
+						   CONTROL_ID_REMOVE_ALL, ATTRIBUTE_CE_ONREMOVEALLCLICK, true, "removeAll".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
+
+			public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+				return true;
+			}
+			
+		},
+		new OrderingComponentRendererBase.ControlsHelper("disabledRemoveAll", "REMOVE_ALL_LABEL", DEFAULT_LABEL_REMOVE_ALL, ListShuttleIconRemoveAllDisabled.class.getName(), FACET_DIS_REMOVE_ALL,
+						   "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
+						   DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE_ALL), null, false, "removeAll".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
+
+			public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+				return true;
+			}
+			
+		}
+	};
+}

Modified: trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
===================================================================
--- trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java	2008-01-29 12:11:07 UTC (rev 5694)
+++ trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java	2008-01-29 13:11:32 UTC (rev 5695)
@@ -3,16 +3,22 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
+import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
 import java.util.Set;
 
 import javax.faces.component.EditableValueHolder;
 import javax.faces.component.UIComponent;
 import javax.faces.component.UISelectMany;
 import javax.faces.component.UISelectOne;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 import javax.faces.convert.Converter;
@@ -20,31 +26,32 @@
 import javax.faces.model.SelectItem;
 import javax.faces.model.SelectItemGroup;
 
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.javascript.JSReference;
+import org.ajax4jsf.javascript.ScriptString;
+import org.ajax4jsf.javascript.ScriptUtils;
 import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
 import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.resource.InternetResource;
 import org.ajax4jsf.util.SelectUtils;
 import org.apache.commons.collections.CollectionUtils;
+import org.richfaces.component.UIListShuttle;
+import org.richfaces.component.UIOrderingBaseComponent;
 import org.richfaces.component.UIPickList;
+import org.richfaces.component.util.HtmlUtil;
 import org.richfaces.picklist.util.PickListUtils;
+import org.richfaces.renderkit.OrderingComponentRendererBase.SelectionState;
 
 public class PickListRenderer extends HeaderResourcesRendererBase {
 	
 	private static final String AVAILABLE_SUFFIX = "_AVAILABLE";
 	private static final String SELECTED_SUFFIX = "_SELECTED";
-	private static final String HIDDEN_SUFFIX = "_HIDDEN";
+	private static final String HIDDEN_SUFFIX = "valueKeeper";
 	private static final String FUNCTION_ADD_TO_SELECTED = "myfaces_picklist_addToSelected";
     private static final String FUNCTION_REMOVE_FROM_SELECTED = "myfaces_picklist_removeFromSelected";
-    private final InternetResource[] scripts = {getResource("/org/richfaces/renderkit/html/scripts/picklist.js")};
-    private final InternetResource[] styles = {getResource("/org/richfaces/renderkit/html/css/picklist.xcss")};
-
-    protected InternetResource[] getScripts() {
-    	return scripts;
-    }
+    protected static final OrderingComponentRendererBase.ControlsHelper[] SHUTTLE_HELPERS = PickListControlsHelper.HELPERS;
+    protected final static String SHOW_LABELS_ATTRIBUTE_NAME = "showButtonLabels";
+    private static final String MESSAGE_BUNDLE_NAME = OrderingListRendererBase.class.getPackage().getName() + "ListShuttle";
     
-    protected InternetResource[] getStyles() {
-       	return styles;
-    }
     protected List selectItemsForSelectedList(FacesContext facesContext,UIComponent uiComponent, List selectItemList, Converter converter, Set lookupSet) {
 		List selectItemForSelectedValues = new ArrayList(lookupSet.size());
 		for (Iterator i = selectItemList.iterator(); i.hasNext();) {
@@ -68,6 +75,14 @@
 		return SelectUtils.getSelectItems(context, component);
 	}
 	
+	private final String bundleName;
+	
+	public PickListRenderer() {
+		super();
+		
+		this.bundleName = MESSAGE_BUNDLE_NAME;
+	}
+	
 	public void decode(FacesContext context, UIComponent component) {
 		
 		UIPickList picklist = (UIPickList)component; 
@@ -83,6 +98,13 @@
 	    	return;
 	    }
 
+	    /*String[] valuesInline = getSubmittedValues(context, component);
+	    if (valuesInline == null || (valuesInline[0] == null) || "".equals(valuesInline[0].trim())) {
+		((EditableValueHolder) picklist).setSubmittedValue(new String[] {});
+	    } else {
+		String[] reqValues = valuesInline[0].split(",");
+                ((EditableValueHolder) picklist).setSubmittedValue(reqValues);
+	    }*/
 	    if (paramValuesMap.containsKey(hiddenClientId)) {
 	    	String[] valuesInline = (String[]) paramValuesMap.get(hiddenClientId);
 
@@ -97,6 +119,21 @@
 	    }
 	}
 	
+	private String[] getSubmittedValues(FacesContext context, UIComponent component) {
+	    UIListShuttle listShuttle = (UIListShuttle) component;
+		
+		String clientId = listShuttle.getBaseClientId(context);
+		ExternalContext externalContext = context.getExternalContext();
+		Map requestParameterMap = externalContext.getRequestParameterMap();
+    
+		String[] strings = null;
+		
+		if (requestParameterMap.containsKey(clientId)) {
+		    strings = (String[]) externalContext.getRequestParameterValuesMap().get(clientId);
+		} 
+		return strings;
+	}
+	
 	private boolean isDisabledOrReadOnly(UIPickList picklist) {		
 		return picklist.isDisplayValueOnly() || isTrue(picklist.getAttributes().get("disabled"));
 	}
@@ -121,8 +158,7 @@
 	    }
 	
 	}
-	 @Override
-	protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+	/*protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
 
 		 UIPickList picklist = (UIPickList) component;
 
@@ -175,9 +211,9 @@
 		 writer.endElement(HTML.td_ELEM);
 		 writer.endElement(HTML.TR_ELEMENT);
 		 writer.endElement("table");
-	 }
+	 }*/
 	 
-	 private void encodeSelect(FacesContext context, UIPickList picklist, String clientId, boolean disabled,
+	 /*private void encodeSelect(FacesContext context, UIPickList picklist, String clientId, boolean disabled,
       		int size, List selectItemsToDisplay, Converter converter, ResponseWriter writer) throws IOException {
 
 		writer.startElement("select", picklist);
@@ -260,9 +296,9 @@
 		renderSelectOptions(context, picklist, converter, Collections.EMPTY_SET, selectItemsToDisplay);
 		writer.writeText("", null);
 		writer.endElement("select");
-	 }
+	 }*/
 	 
-	public void renderSelectOptions(FacesContext context, UIComponent component, Converter converter, Set lookupSet,
+	/*public void renderSelectOptions(FacesContext context, UIComponent component, Converter converter, Set lookupSet,
 					List selectItemList) throws IOException {
 		ResponseWriter writer = context.getResponseWriter();
 		
@@ -316,8 +352,145 @@
 				writer.endElement("option");
 			}
 		}
+	}*/
+	
+	private void encodeRows(FacesContext context, UIComponent component, boolean source) throws IOException {
+	    List <SelectItem> selectItemsList = SelectUtils.getSelectItems(context,component);
+	    Converter converter = PickListUtils.findUISelectManyConverterFailsafe(context, component);
+	    Set lookupSet = PickListUtils.getSubmittedOrSelectedValuesAsSet(true, component, context, converter);
+	    List selectItemsForSelectedValues = selectItemsForSelectedList(context, component, selectItemsList, converter, lookupSet); //TODO: optimaze
+	    List selectItemsForAvailableList = selectItemsForAvailableList(context, component, selectItemsList, selectItemsForSelectedValues, converter);
+	    
+	    List selectItemList = null;
+	    if (source) {
+		selectItemList = selectItemsForAvailableList;
+	    } else {
+		selectItemList = selectItemsForSelectedValues;
+	    }
+	    
+	    int i = 0;
+	    for (Iterator it = selectItemList.iterator(); it.hasNext();) {
+		i++;
+		SelectItem selectItem = (SelectItem) it.next();
+		if (selectItem instanceof SelectItemGroup) {
+		    //TODO
+		} else {
+		    String itemStrValue = PickListUtils.getConvertedStringValue(context, component, converter, selectItem.getValue());
+		    
+		    ResponseWriter writer = context.getResponseWriter();
+		    writer.startElement(HTML.TR_ELEMENT, component);
+		    String clientId = component.getClientId(context);
+		    String id = clientId + ":" + i;
+		    writer.writeAttribute("id", id, null);
+		    
+		    StringBuffer rowClassName = new StringBuffer();
+		    StringBuffer cellClassName = new StringBuffer();
+		    if (source) {
+			rowClassName.append("rich-shuttle-source-row");
+			cellClassName.append("rich-shuttle-source-cell");
+		    } else {
+			rowClassName.append("rich-shuttle-target-row");
+			cellClassName.append("rich-shuttle-target-cell");
+		    }
+		    
+		    /*
+		     * String rowClass = holder.getRowClass();
+				if (rowClass != null) {
+					rowClassName.append(' ');
+					rowClassName.append(rowClass);
+				}
+		     */
+		    
+		    /*
+		     * boolean active = itemState.isActive();
+				boolean selected = itemState.isSelected();
+				selectionState.addState(selected);
+				if (selected) {
+					if (source) {
+						rowClassName.append(" rich-shuttle-source-row-selected");
+						cellClassName.append(" rich-shuttle-source-cell-selected");
+					} else {
+						rowClassName.append(" rich-shuttle-target-row-selected");
+						cellClassName.append(" rich-shuttle-target-cell-selected");
+					}
+				}
+		     */
+		    writer.writeAttribute("class", rowClassName.toString(), null);
+		    
+		    writer.startElement(HTML.td_ELEM, component);
+		    Object width = component.getAttributes().get("width");
+		    if (width != null) {
+			writer.writeAttribute("style", "width: " + HtmlUtil.qualifySize(width.toString()), null);
+		    }
+		    /*
+		     * String columnClass = holder.getColumnClass(colCounter);
+						if (columnClass != null) {
+							writer.writeAttribute("class", cellClassName.toString().concat(" " + columnClass), null);
+						} else {
+							writer.writeAttribute("class", cellClassName.toString(), null);
+						}
+		     */
+		    encodeSpacer(context, component, writer);
+		    
+		    boolean escape = isTrue(component.getAttributes().get("escape"));
+		    if (escape) {
+			writer.writeText(selectItem.getLabel(), null);
+		    } else {
+			writer.write(selectItem.getLabel());
+		    }
+		    
+		    encodeItemValue(context, component, writer, id, itemStrValue, lookupSet, i);
+		    
+		    writer.endElement(HTML.td_ELEM);
+		    writer.endElement(HTML.TR_ELEMENT);
+		}
+	    }
 	}
 	
+	public void encodeTargetRows(FacesContext context, UIComponent component) throws IOException {
+	    encodeRows(context, component, false);
+	}
+	
+	public void encodeSourceRows(FacesContext context, UIComponent component) throws IOException {
+	    encodeRows(context, component, true);
+	}
+	
+	private void encodeItemValue(FacesContext context, UIComponent component, 
+				     ResponseWriter writer, String id, 
+				     String itemStrValue, Set lookupSet, int rowKey) throws IOException { //rowKey = i
+	    writer.startElement(HTML.INPUT_ELEM, component);
+	    writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
+	    writer.writeAttribute(HTML.NAME_ATTRIBUTE, id, null);
+
+	    StringBuffer value = new StringBuffer();
+	    //if (lookupSet.contains(itemStrValue)) {
+		//value.append('s');
+	    //}
+		
+	    /*if (active) {
+		value.append('a');
+	    }*/
+
+	    //value.append(rowKey);
+	    //value.append(':');
+	    //value.append(shuttleRendererTableHolder.getConverter().getAsString(context, table, table.getRowData()));
+	    value.append(itemStrValue); //??
+		
+	    writer.writeAttribute(HTML.value_ATTRIBUTE, value.toString(), null);
+		
+	    writer.writeAttribute(HTML.id_ATTRIBUTE, id + "StateInput", null);
+		
+	    writer.endElement(HTML.INPUT_ELEM);
+	}
+	
+	protected void encodeSpacer(FacesContext context, UIComponent component, 
+				    ResponseWriter writer) throws IOException {
+	    writer.startElement(HTML.IMG_ELEMENT, component);
+	    writer.writeAttribute(HTML.src_ATTRIBUTE, getResource("/org/richfaces/renderkit/html/images/spacer.gif").getUri(context, null), null);
+	    writer.writeAttribute(HTML.style_ATTRIBUTE, "width:1px;height:1px;", null);
+	    writer.endElement(HTML.IMG_ELEMENT);
+	}
+	
 	 private void encodeSwapButton(FacesContext context, UIComponent component, String javaScriptFunction, 
 			 	  boolean isRight,ResponseWriter writer) throws IOException {
 
@@ -353,6 +526,14 @@
 		writer.endElement(HTML.BUTTON);
 	 }
 	 
+	 public void encodeHiddenField(FacesContext context, UIComponent component) throws IOException {
+	     UIPickList pl = (UIPickList) component;
+	     ResponseWriter writer = context.getResponseWriter();
+	     Converter converter = PickListUtils.findUISelectManyConverterFailsafe(context, pl);
+	     Set lookupSet = PickListUtils.getSubmittedOrSelectedValuesAsSet(true, (UIPickList) pl, context, converter);
+	     encodeHiddenField(context, pl, pl.getClientId(context) + HIDDEN_SUFFIX, lookupSet, writer);
+	 }
+	 
 	 private void encodeHiddenField(FacesContext context, UIComponent component, 
 			 String hiddenFieldCliendId, Set lookupSet, ResponseWriter writer) throws IOException {
 		 
@@ -380,4 +561,215 @@
 	protected Class<? extends UIComponent> getComponentClass() {
 		return UIPickList.class;
 	}	
+	
+	public String getAsEventHandler(FacesContext context, UIComponent component, String attributeName) {
+		String event = (String) component.getAttributes().get(attributeName);
+		ScriptString result = JSReference.NULL;
+		
+		if (event != null) {
+			event = event.trim();
+		
+			if (event.length() != 0) {
+				JSFunctionDefinition function = new JSFunctionDefinition();
+				function.addParameter("event");
+				function.addToBody(event);
+
+				result = function;
+			}
+		}
+
+		return ScriptUtils.toScript(result);
+	}
+	
+	public String getColumnClassesAsJSArray(FacesContext context, UIComponent component) {
+		return ScriptUtils.toScript(getClassesAsList(context, component, "columnClasses"));
+	}
+	
+	public String getRowClassesAsJSArray(FacesContext context, UIComponent component) {
+		return ScriptUtils.toScript(getClassesAsList(context, component, "rowClasses"));
+	}
+	
+	protected List getClassesAsList(FacesContext context, UIComponent component, String attr) {
+		
+		String value = (String) ((UIComponent) component).getAttributes().get(attr);
+		if (value != null && (value.length() != 0)) {
+			return Arrays.asList(value.split(","));
+		}
+		return null;
+	}
+	
+	public void encodePickListControlsFacets(FacesContext context, UIComponent component)
+		throws IOException {
+	String clientId = component.getClientId(context);
+
+	ResponseWriter writer = context.getResponseWriter();
+	
+	int divider = SHUTTLE_HELPERS.length / 2;
+	
+	for (int i = 0; i < SHUTTLE_HELPERS.length; i++) {
+	    	/*SelectionState state = (i < divider ? sourceSelectionState : targetSelectionState);
+		boolean enabled;
+		if (i <= 1 || i >= SHUTTLE_HELPERS.length - 2) {
+			enabled = state.isItemExist();
+		} else {
+			enabled = state.isSelected();
+		}
+		
+		if (i % 2 == 1) {
+			enabled = !enabled;
+		}*/
+		
+		if (SHUTTLE_HELPERS[i].isRendered(context, null)) {
+			//proper assumption about helpers ordering
+			encodeControlFacet(context, component, SHUTTLE_HELPERS[i], clientId, writer, true, 
+					"rich-list-shuttle-button", " rich-shuttle-control");
+		}
+	}
+	}
+	
+	protected void encodeControlFacet(FacesContext context,
+		UIComponent component, OrderingComponentRendererBase.ControlsHelper helper,
+		String clientId, ResponseWriter writer, boolean enabled, String baseStyle, 
+		String baseControlStyle) throws IOException {
+	Locale locale = null;
+	
+	UIViewRoot viewRoot = context.getViewRoot();
+	if (viewRoot != null) {
+		locale = viewRoot.getLocale();
+	}
+	
+	ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+	ResourceBundle bundle = null;
+	
+	if (locale != null) {
+		try {
+			bundle = ResourceBundle.getBundle(bundleName, locale, contextClassLoader);
+		} catch (MissingResourceException e) {
+
+		}
+	}
+	
+	Map attributes = component.getAttributes();
+	UIComponent facet = component.getFacet(helper.getFacetName());
+	boolean useFacet = (facet != null && facet.isRendered());
+
+		renderDefaultControl(context, component, writer, useFacet,
+							 helper, clientId, bundle ,enabled, baseStyle, baseControlStyle);
+	}
+	
+	protected void renderDefaultControl(FacesContext context,
+		UIComponent orderingList, ResponseWriter writer,
+		boolean useFacet, OrderingComponentRendererBase.ControlsHelper helper, String clientId, ResourceBundle bundle, 
+		boolean enabled, String baseStyle, String baseControlStyle)
+		throws IOException {
+	UIComponent facet = orderingList.getFacet(helper.getFacetName());
+	String customEvent = null;
+	Map attributes = orderingList.getAttributes();
+	if (helper.customEvent != null) {
+		customEvent = (String) attributes.get(helper.customEvent);
+	}
+
+	String styleFromAttribute = (String) attributes
+			.get(helper.styleFromAttribute);
+
+	String baseStyleLight = baseStyle.concat("-light");
+	String baseStylePress = baseStyle.concat("-press");
+
+	String currentStyle = baseControlStyle + helper.getStyleClassName();
+	if (styleFromAttribute != null) {
+		currentStyle = styleFromAttribute.concat(currentStyle);
+	}
+
+	writer.startElement(HTML.DIV_ELEM, orderingList);
+	String controlId = clientId + helper.getIdSuffix();
+	writer.writeAttribute(HTML.id_ATTRIBUTE, controlId, null); //FIXME:
+	writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
+	String style = null;
+	if (enabled) {
+		style = "display:block;";
+	} else {
+		style = "display:none;";
+	}
+	writer.writeAttribute(HTML.style_ATTRIBUTE, style, null);
+	if (!useFacet) {
+		
+		writer.startElement(HTML.DIV_ELEM, orderingList);
+		writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + helper.getButtonStyleClass(), null);
+		if (helper.enable) {
+			writer.writeAttribute(HTML.onmouseover_ATTRIBUTE, "this.className='" + baseStyleLight + "'", null);
+			writer.writeAttribute(HTML.onmousedown_ATTRIBUTE, "this.className='" + baseStylePress + "'", null);
+			writer.writeAttribute(HTML.onmouseup_ATTRIBUTE, "this.className='" + baseStyle + "'", null);
+			writer.writeAttribute(HTML.onmouseout_ATTRIBUTE, "this.className='" + baseStyle + "'", null);
+		}
+		
+		writer.startElement(HTML.a_ELEMENT, orderingList);
+		writer.writeAttribute(HTML.id_ATTRIBUTE, controlId + "link", null); //FIXME:
+		writer.writeAttribute(HTML.HREF_ATTR, "#", null);
+		writer.writeAttribute(HTML.onclick_ATTRIBUTE, "return false;", null);
+		if (!helper.enable) {
+			writer.writeAttribute(HTML.DISABLED_ATTR, "disabled", null);
+			writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-a-disabled", null);
+			writer.startElement(HTML.a_ELEMENT, orderingList);
+		} else {
+			writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-selection", null);
+			writer.writeAttribute(HTML.onblur_ATTRIBUTE, "Control.onblur(this);", null);
+			writer.writeAttribute(HTML.onfocus_ATTRIBUTE, "Control.onfocus(this);", null);
+		}
+		
+		writer.startElement(HTML.DIV_ELEM, orderingList);
+		writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-content", null);
+
+	}
+
+	if (customEvent != null) {
+		writer.writeAttribute(HTML.onclick_ATTRIBUTE, customEvent,null);
+	}
+	
+	if (useFacet) {
+		renderChild(context, facet);
+	} else {
+		writer.startElement(HTML.IMG_ELEMENT, orderingList);
+		writer.writeAttribute(HTML.width_ATTRIBUTE, "15", null);
+		writer.writeAttribute(HTML.height_ATTRIBUTE, "15", null);
+		writer.writeAttribute(HTML.border_ATTRIBUTE, "0", null);
+		writer.writeAttribute(HTML.alt_ATTRIBUTE, helper.getFacetName(),
+				null);
+		writer.writeAttribute(HTML.src_ATTRIBUTE, getResource(
+				helper.getImageURI()).getUri(context, null), null);
+
+		writer.endElement(HTML.IMG_ELEMENT);
+
+		if (getUtils().isBooleanAttribute(orderingList, SHOW_LABELS_ATTRIBUTE_NAME)) {
+			String label = (String) attributes.get(helper.getLabelAttributeName());
+			
+			if (label == null && bundle != null) {
+				try {
+					label = bundle.getString(helper.getBundlePropertyName());
+				} catch (MissingResourceException e) {
+				
+				}
+			}
+
+			if (label == null) {
+				label = helper.getDefaultText();
+			}
+			
+			writer.writeText(label, null);
+		}
+	}
+	// writer.writeAttribute(HTML.id_ATTRIBUTE, clientId +
+	// helper.getIdSuffix(), null);
+
+	// writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
+	
+	if (!useFacet) {
+		writer.endElement(HTML.DIV_ELEM);
+		if (!helper.enable) {
+			writer.endElement(HTML.a_ELEMENT);
+		}
+		writer.endElement(HTML.a_ELEMENT);
+		writer.endElement(HTML.DIV_ELEM);
+	}
+	writer.endElement(HTML.DIV_ELEM);
+}
  }

Modified: trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/css/picklist.xcss
===================================================================
--- trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/css/picklist.xcss	2008-01-29 12:11:07 UTC (rev 5694)
+++ trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/css/picklist.xcss	2008-01-29 13:11:32 UTC (rev 5695)
@@ -2,99 +2,290 @@
 <f:template xmlns:f='http:/jsf.exadel.com/template'
    xmlns:u='http:/jsf.exadel.com/template/util'
    xmlns="http://www.w3.org/1999/xhtml" >
-	<f:verbatim>
-		<![CDATA[
-		
-			.rich-pick-list{
-				font-family : Arial; 
-				font-size :11px;
-				width : 200px; 
-				height : 150px; 
-				border : 1px solid;
-			}
-			
-			.rich-pick-button{
-				background : top left repeat-x; 
-				cursor : pointer;  
-				font-family : Arial; 
-				font-size :11px;
-				border : 1px solid;
-				padding : 0px 0px 0px 0px;
-				margin : 3px;
-			}
-			
-			.rich-pick-button-light{
-				background : top left repeat-x; 
-				cursor : pointer;  
-				font-family : Arial; 
-				font-size :11px;
-				border : 1px solid;
-				padding : 0px 0px 0px 0px;
-				margin : 3px;
-			}
-			
-			.rich-pick-button-press{
-				background : top left repeat-x;
-				cursor : pointer;  
-				font-family : Arial; 
-				font-size :11px;
-				border : 1px solid;
-				padding : 0px 0px 0px 0px;
-				margin : 3px;
-			}
-		]]>
-	</f:verbatim>	
+
+<f:verbatim><![CDATA[
+
+.rich-shuttle-controls {
+	padding : 0px 8px 5px 8px;
+}
+
+.rich-shuttle-list-content {
+	overflow: auto;
+}
+
+.rich-shuttle-list-header {
+	overflow: hidden;
+}
+
+.rich-shuttle-header-tab-cell, .rich-shuttle-header-tab-cell-last {
+	padding : 2px;
+	border-style: solid;
+	font-weight: normal;
+	white-space: nowrap;
+	background-repeat: repeat-x;
+	border-top: 0px;
+	border-left: 0px;
+}
+
+.rich-shuttle-internal-tab {
+	width:100%;
+}
+
+.body {
+	-moz-user-select: none;
+}
+]]>
+</f:verbatim>
+
+<u:selector name=".rich-shuttle-list">
+	<u:style name="background-color" skin="tableBackgroundColor"/>
+	<u:style name="border-width" value="0px" />
+	<u:style name="border-style" value="none" />
+</u:selector>
+
+<u:selector name=".rich-shuttle-source-cell, .rich-shuttle-target-cell, .rich-shuttle-source-cell *, .rich-shuttle-target-cell *">
+	<u:style name="color" skin="generalTextColor"/>
+	<u:style name="font-size" skin="generalSizeFont"/>
+	<u:style name="font-family" skin="generalFamilyFont"/>
+	<u:style name="white-space" value="nowrap"/>
+</u:selector>
+
+<f:verbatim><![CDATA[
+
+.rich-shuttle-control-disabled, .rich-shuttle-control-top, .rich-shuttle-control-bottom, 
+.rich-shuttle-control-up, .rich-shuttle-control-down, .rich-shuttle-control-copyall,
+.rich-shuttle-control-copy, .rich-shuttle-control-remove, .rich-shuttle-control-removeall {
+	border : 1px solid;
+	margin-bottom : 3px;
+}
+
+.rich-list-shuttle-button, .rich-list-shuttle-button-disabled {
+	background : top left repeat-x;
+	padding : 2px;
+}
+
+.rich-list-shuttle-button {
+	cursor : pointer;
+}
+
+.rich-list-shuttle-button-light {
+	background : top left repeat-x;
+	border-style: solid;
+	cursor : pointer;
+	padding: 1px;
+}
+
+.rich-list-shuttle-button-press {
+	background : top left repeat-x;
+	border-style: solid;
+	padding : 2px 0px 0px 2px;
+}
+
+.rich-list-shuttle-button-valign {
+	vertical-align : middle;
+}
+
+.rich-list-shuttle-button-layout {
+	padding : 15px 8px 15px 0px;
+}
+
+.rich-list-shuttle-button-content {
+	padding : 0px 4px 0px 1px;
+	text-align : left;
+	white-space: nowrap;
+}
+
+.rich-list-shuttle-button-content img {
+	margin-right: 2px;
+	vertical-align: middle;
+}
+
+a.rich-list-shuttle-button-selection:visited,
+a.rich-list-shuttle-button-selection:link {
+	color: inherit;
+}
+
+.rich-list-shuttle-button-a-disabled {
+	cursor: default;
+	text-decoration: none;
+}
+
+.rich-list-shuttle-caption {
+	text-align: left;
+	padding : 1px;
+}
+
+.rich-shuttle-source-caption {
+	padding: 3px 3px 3px 8px;
+}
+
+.rich-shuttle-target-caption {
+	padding: 3px 3px 3px 0px;
+}
+
+.rich-shuttle-source-items {
+	margin: 0px 0px 8px 8px;
+}
+
+.rich-shuttle-target-items {
+	margin: 0px 0px 8px 0px;
+}
+
+.rich-shuttle-source-row-active, .rich-shuttle-target-row-active {
+	background : transparent none repeat-x scroll left top;
+}
+
+.rich-shuttle-source-row-selected, .rich-shuttle-target-row-selected {
+	background : transparent none repeat-x scroll left top;
+}
+
+.rich-shuttle-source-cell, .rich-shuttle-target-cell {
+	padding : 2px;
+	white-space: nowrap;
+	border: 0px;
+}
+
+.rich-shuttle-source-cell-selected, .rich-shuttle-target-cell-selected {
+	padding : 2px;
+	white-space: nowrap;
+}
+
+.rich-shuttle-source-cell-active, .rich-shuttle-target-cell-active {
+	padding: 1px 2px;
+	white-space: nowrap;
+	border-top: 1px dotted;
+	border-bottom: 1px dotted;
+} 
+
+]]>
+</f:verbatim>
+
+	<u:selector name=".rich-list-shuttle">
+		<!--u:style name="background-color" skin="additionalBackgroundColor" />
+		<u:style name="border-color" skin="tableBorderColor" />
+		<u:style name="border-width" skin="tableBorderWidth" />
+		<u:style name="border-style" value="solid" /-->
+		<u:style name="-moz-user-select" value="-moz-none" />
+	</u:selector>
+
+	<u:selector name=".rich-shuttle-header-tab-cell, .rich-shuttle-header-tab-cell-last">
+		<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:style name="border-right-width" skin="tableBorderWidth" />
+		<u:style name="border-bottom-width" skin="tableBorderWidth" />
+
+		<u:style name="border-right-color" skin="tableBorderColor" />
+		<u:style name="border-bottom-color" skin="tableBorderColor" />
+	</u:selector>
 	
-	<u:selector name=".rich-pick-list">
-		<u:style name="background" skin="tableBackgroundColor" />
+	<u:selector name=".rich-shuttle-header-tab-cell-last">
+		<u:style name="border-right-width" value="0px" />
+	</u:selector>
+
+<u:selector name=".rich-list-shuttle-button">
+	<u:style name="background-image">
+		<f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListButtonGradient" />
+	</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-list-shuttle-button-disabled">
+	<u:style name="background-image">
+		<f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListButtonGradient" />
+	</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-list-shuttle-button-light">
+		<u:style name="background-image">
+			<f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListButtonGradient" />
+		</u:style>
+		<u:style name="background-color" skin="tabBackgroundColor" />
+		<u:style name="border-color" skin="selectControlColor" />
+		<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-list-shuttle-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="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-shuttle-source-cell-last, .rich-shuttle-target-cell-last">
+		<u:style name="border-right-color" skin="selectControlColor" />
+	</u:selector>
 	
-	<u:selector name=".rich-pick-button">
-		<u:style name="background-color" skin="trimColor" />
+	<u:selector name=".rich-shuttle-source-items, .rich-shuttle-target-items">
+		<u:style name="background-color" skin="generalBackgroundColor" />
 		<u:style name="border-color" skin="tableBorderColor" />
+		<u:style name="border-width" skin="tableBorderWidth" />
+		<u:style name="border-style" value="solid" />
 	</u:selector>
 	
-	<u:selector name=".rich-pick-button-light">
-		<u:style name="background-color" skin="trimColor" />
-		<u:style name="border-color" skin="selectControlColor" />
+	<u:selector name=".rich-shuttle-source-cell-selected, .rich-shuttle-target-cell-selected, .rich-shuttle-source-cell-selected *, .rich-shuttle-target-cell-selected *">
+		<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-pick-button-press">
-		<u:style name="background-color" skin="additionalBackgroundColor" />
-		<u:style name="border-color" skin="selectControlColor" />
+	<u:selector name=".rich-shuttle-source-cell-active, .rich-shuttle-target-cell-active, .rich-shuttle-source-cell-active *, .rich-shuttle-target-cell-active *">
+		<u:style name="font-size" skin="generalSizeFont" />
+		<u:style name="font-family" skin="generalFamilyFont" />
 	</u:selector>
+	<u:selector name=".rich-shuttle-source-cell-active, .rich-shuttle-target-cell-active" >
+		<u:style name="border-top-color" skin="generalTextColor" />
+		<u:style name="border-bottom-color" skin="generalTextColor" />
+	</u:selector>
 	
+	<u:selector name=".rich-shuttle-control-disabled, .rich-shuttle-control-top, .rich-shuttle-control-bottom, .rich-shuttle-control-up, .rich-shuttle-control-down, .rich-shuttle-control-copyall, .rich-shuttle-control-copy, .rich-shuttle-control-remove, .rich-shuttle-control-removeall">
+		<u:style name="border-color" skin="tableBorderColor" />
+	</u:selector>
 	
-	<u:selector name=".rich-pick-right-arrow">
-		<u:style name="background-image">
-			<f:resource f:key="org.richfaces.renderkit.images.PickListRightArrowImage" />
-		</u:style>
+	<u:selector name=".rich-list-shuttle-button-content">
+		<u:style name="font-family" skin="headerFamilyFont" />
+		<u:style name="font-size" skin="headerSizeFont" />
 	</u:selector>
 	
-	<u:selector name=".rich-pick-left-arrow">
-		<u:style name="background-image">
-			<f:resource f:key="org.richfaces.renderkit.images.PickListLeftArrowImage" />
-		</u:style>
+	<u:selector name=".rich-list-shuttle-button-selection">
+		<u:style name="color" skin="generalTextColor" />
+		<u:style name="text-decoration" value="none" />
+		<u:style name="display" value="block" />
 	</u:selector>
 	
-	<u:selector name=".rich-pick-button-light">
-		<u:style name="background-image">
-			<f:resource f:key="org.richfaces.renderkit.images.PickListButtonLightGradient" />
-		</u:style>
+	<u:selector name="a.rich-list-shuttle-button-a-disabled a">
+		<u:style name="color" skin="tabDisabledTextColor"/>
 	</u:selector>
 	
-	<u:selector name=".rich-pick-button">
-		<u:style name="background-image">
-			<f:resource f:key="org.richfaces.renderkit.images.PickListButtonGradient" />
-		</u:style>
+	<u:selector name=".rich-shuttle-source-caption, .rich-shuttle-target-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-pick-button-press">
-		<u:style name="background-image">
-			<f:resource f:key="org.richfaces.renderkit.images.PickListButtonPressGradient" />
-		</u:style>
+	<u:selector name=".rich-shuttle-source-row-selected, .rich-shuttle-target-row-selected">
+		<u:style name="background-color" skin="additionalBackgroundColor" />
 	</u:selector>
-	
-	
-</f:template>	
\ No newline at end of file
+}
+
+</f:template>
\ No newline at end of file

Added: trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickList.js
===================================================================
--- trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickList.js	                        (rev 0)
+++ trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickList.js	2008-01-29 13:11:32 UTC (rev 5695)
@@ -0,0 +1,105 @@
+if(!window.Richfaces) window.Richfaces = {};
+
+Richfaces.PickList = Class.create(Richfaces.ListShuttle, {
+		initialize : function($super, targetList, sourceList, clientId, controlIds, switchByClick, sourceLayoutManager, targetLayoutManager, onlistchanged, valueKeeperId) {
+			$super(targetList, sourceList, clientId, controlIds, switchByClick, sourceLayoutManager, targetLayoutManager, onlistchanged);
+			this.valueKeeper = $(valueKeeperId);
+			this.controlListManager();
+		},
+		
+		moveItems : function($super, sourceComponent, targetComponent, items) {
+			this.saveState(items, this.isAdd(sourceComponent));
+			$super(sourceComponent, targetComponent, items);
+		},
+		
+		moveItemByClick : function($super, event, sourceComponent, targetComponent, layoutManager) {
+			$super(event, sourceComponent, targetComponent, layoutManager);
+			this.saveState([this.sourceList.getEventTargetRow(event)], this.isAdd(sourceComponent));
+		},
+		
+		saveState : function(items, isAdd) {
+			var items = this.getSIAsLabels(items);
+			if (isAdd) {
+				var valuesAsString = this.valueKeeper.value;
+				if (valuesAsString.length != 0) {
+					valuesAsString += ",";
+				}
+				this.valueKeeper.value = valuesAsString + items.join(",");
+			} else {
+				var values = this.valueKeeper.value.split(",");
+				for (var i = 0; i < items.length; i++) {
+					values.remove(items[i]);
+				}
+				values.without(items);
+				this.valueKeeper.value = values.join(",");
+			}
+		},
+		
+		isAdd : function(sourceComponent) {
+			if (this.targetList.shuttleTable.id == sourceComponent.shuttleTable.id) {
+					return false;
+			}
+			return true;
+		},
+		
+		getSIAsLabels : function(items) {
+			if ((items == null) || (items.length == 0)) {
+				return;
+			}
+			var result = new Array();
+			for (var i = 0; i < items.length; i++) {
+				var item = items[i];
+				if (!item.input) {
+					item = item.item;
+				}
+				result[i] = item.input.value;
+			}
+			return result;
+		}
+});
+
+Richfaces.PickList.Source = Class.create(Richfaces.ListBase);
+Richfaces.PickList.Target = Class.create(Richfaces.ListBase);
+
+Richfaces.PickList.Source.SelectItem = Class.create(Richfaces.PickListSI);
+Richfaces.PickList.Source.SelectItem.prototype.CLASSES = {
+	ROW : {
+		ACTIVE   : "rich-shuttle-source-row-active",
+		SELECTED : "rich-shuttle-source-row-selected",
+		DISABLED : "rich-shuttle-source-row-disabled",
+		NORMAL   : "rich-shuttle-source-row"
+	},
+	CELL : {
+		ACTIVE   : "rich-shuttle-source-cell-active",
+		SELECTED : "rich-shuttle-source-cell-selected",
+		DISABLED : "rich-shuttle-source-cell-disabled",
+		NORMAL   : "rich-shuttle-source-cell",
+		BEGIN:	" rich-shuttle-source-cell-first",
+		END:	" rich-shuttle-source-cell-last"
+	}
+};
+
+Richfaces.PickList.Target.SelectItem = Class.create(Richfaces.PickListSI);
+Richfaces.PickList.Target.SelectItem.prototype.CLASSES = {
+	ROW : {
+		ACTIVE   : "rich-shuttle-target-row-active",
+		SELECTED : "rich-shuttle-target-row-selected",
+		DISABLED : "rich-shuttle-target-row-disabled",
+		NORMAL   : "rich-shuttle-target-row"
+	},
+	CELL : {
+		ACTIVE   : "rich-shuttle-target-cell-active",
+		SELECTED : "rich-shuttle-target-cell-selected",
+		DISABLED : "rich-shuttle-target-cell-disabled",
+		NORMAL   : "rich-shuttle-target-cell",
+		BEGIN:	" rich-shuttle-target-cell-first",
+		END:	" rich-shuttle-target-cell-last"
+	}
+};
+
+Richfaces.PickList.HANDLERS = {
+	copy:      function (e) { this.moveItems(this.sourceList, this.targetList, this.sourceList.selectedItems); return false; },
+	copyAll:   function (e) { this.moveItems(this.sourceList, this.targetList, this.sourceList.shuttleItems); return false; },
+	remove:    function (e) { this.moveItems(this.targetList, this.sourceList, this.targetList.selectedItems); return false; },
+	removeAll: function (e) { this.moveItems(this.targetList, this.sourceList, this.targetList.shuttleItems); return false; }
+};
\ No newline at end of file

Added: trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickListSI.js
===================================================================
--- trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickListSI.js	                        (rev 0)
+++ trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickListSI.js	2008-01-29 13:11:32 UTC (rev 5695)
@@ -0,0 +1,9 @@
+if (!window.Richfaces) { window.Richfaces = {}; }
+
+Richfaces.PickListSI = Class.create(Richfaces.SelectItem, {
+	initialize : function($super, label, id, node) {
+		$super(label, id, node);
+	},
+	
+	saveState : function() {}	
+});
\ No newline at end of file

Copied: trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/picklist_.js (from rev 5298, trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/picklist.js)
===================================================================
--- trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/picklist_.js	                        (rev 0)
+++ trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/picklist_.js	2008-01-29 13:11:32 UTC (rev 5695)
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ 
+ /**
+ * @author Bruno Aranda (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+ 
+// moves an item to the selected list
+function myfaces_picklist_addToSelected(availableListId, selectedListId, hiddenId)
+{
+	var availableList = document.getElementById(availableListId);
+    var selectedList = document.getElementById(selectedListId);
+
+	myfaces_picklist_move(availableList, selectedList, hiddenId);
+	myfaces_picklist_updateHidden(selectedList, hiddenId);
+}
+
+// removes an item from the selected list
+function myfaces_picklist_removeFromSelected(availableListId, selectedListId, hiddenId)
+{
+    var availableList = document.getElementById(availableListId);
+    var selectedList = document.getElementById(selectedListId);
+
+	myfaces_picklist_move(selectedList, availableList, hiddenId);
+	myfaces_picklist_updateHidden(selectedList, hiddenId);
+}
+
+function myfaces_picklist_move(fromList, toList, hiddenId) {
+	// Return, if no items selected
+	var selectedIndex = fromList.selectedIndex;
+	if(selectedIndex < 0) { return; }
+
+	// Decremental loop, so the index is not affected in the moves
+	for(var i = fromList.length - 1; i >= 0; i--) {
+		if(fromList.options.item(i).selected) {
+			toList.appendChild(fromList.options.item(i));
+		}
+	}
+
+}
+
+// Selection - invoked on submit
+function myfaces_picklist_updateHidden(selectedList, hiddenId) {
+	var hiddenField = document.getElementById(hiddenId);
+	
+	var arrValues = new Array(selectedList.options.length);
+	for (var i = 0; i<selectedList.options.length; i++) {
+	    arrValues[i] = selectedList.options[i].value;
+	}
+	
+	hiddenField.value = arrValues.join();
+}
\ No newline at end of file




More information about the richfaces-svn-commits mailing list