Author: nbelaevski
Date: 2009-04-07 11:59:12 -0400 (Tue, 07 Apr 2009)
New Revision: 13409
Modified:
trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
trunk/ui/pickList/src/main/config/component/picklist.xml
trunk/ui/pickList/src/main/java/org/richfaces/component/UIPickList.java
trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java
trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
trunk/ui/pickList/src/main/templates/htmlPickList.jspx
Log:
https://jira.jboss.org/jira/browse/RF-6701
https://jira.jboss.org/jira/browse/RF-2357
https://jira.jboss.org/jira/browse/RF-6622
https://jira.jboss.org/jira/browse/RF-3755
Modified:
trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java
===================================================================
---
trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java 2009-04-07
15:51:37 UTC (rev 13408)
+++
trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java 2009-04-07
15:59:12 UTC (rev 13409)
@@ -20,6 +20,9 @@
*/
package org.richfaces.renderkit;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIData;
import javax.faces.context.FacesContext;
import org.richfaces.component.UIListShuttle;
@@ -119,8 +122,8 @@
"-copyall", ATTRIBUTE_CLASS_COPY_ALL_CONTROL, "",
CONTROL_ID_COPY_ALL, ATTRIBUTE_CE_ONCOPYALLCLICK, true,
"copyAll".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX),
COPY_ALL_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isFastMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIListShuttle) listComponent).isFastMoveControlsVisible();
}
},
@@ -128,8 +131,8 @@
"-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY_ALL), null, false,
"copyAll".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX),
COPY_ALL_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isFastMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIListShuttle) listComponent).isFastMoveControlsVisible();
}
},
@@ -137,8 +140,8 @@
"-copy", ATTRIBUTE_CLASS_COPY_CONTROL, "",
CONTROL_ID_COPY, ATTRIBUTE_CE_ONCOPYCLICK ,true,
"copy".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX),
COPY_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIListShuttle) listComponent).isMoveControlsVisible();
}
},
@@ -146,8 +149,8 @@
"-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY), null, false,
"copy".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX),
COPY_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIListShuttle) listComponent).isMoveControlsVisible();
}
},
@@ -155,8 +158,8 @@
"-remove", ATTRIBUTE_CLASS_REMOVE_CONTROL, "",
CONTROL_ID_REMOVE, ATTRIBUTE_CE_ONREMOVECLICK, true,
"remove".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX),
REMOVE_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIListShuttle) listComponent).isMoveControlsVisible();
}
},
@@ -164,8 +167,8 @@
"-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE), null, false,
"remove".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX),
REMOVE_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIListShuttle) listComponent).isMoveControlsVisible();
}
},
@@ -173,8 +176,8 @@
"-removeall", ATTRIBUTE_CLASS_REMOVE_ALL_CONTROL, "",
CONTROL_ID_REMOVE_ALL, ATTRIBUTE_CE_ONREMOVEALLCLICK, true,
"removeAll".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX),
REMOVE_ALL_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isFastMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIListShuttle) listComponent).isFastMoveControlsVisible();
}
},
@@ -182,8 +185,8 @@
"-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE_ALL), null, false,
"removeAll".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX),
REMOVE_ALL_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isFastMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIListShuttle) listComponent).isFastMoveControlsVisible();
}
}
Modified:
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java
===================================================================
---
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java 2009-04-07
15:51:37 UTC (rev 13408)
+++
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java 2009-04-07
15:59:12 UTC (rev 13409)
@@ -20,6 +20,7 @@
*/
package org.richfaces.renderkit;
+import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import org.richfaces.component.UIOrderingBaseComponent;
@@ -99,8 +100,8 @@
"-top", ATTRIBUTE_CLASS_TOP_CONTROL, "",
CONTROL_ID_TOP, ATTRIBUTE_CE_ONTOPCLICK, true,
"top".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX), getTitle("top")) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return list.isFastOrderControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIOrderingBaseComponent) listComponent).isFastOrderControlsVisible();
}
},
@@ -108,8 +109,8 @@
"-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_TOP), null, false,
"top".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX), getTitle("top")) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return list.isFastOrderControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIOrderingBaseComponent) listComponent).isFastOrderControlsVisible();
}
},
@@ -117,8 +118,8 @@
"-up", ATTRIBUTE_CLASS_UP_CONTROL, "",
CONTROL_ID_UP, ATTRIBUTE_CE_ONUPCLICK ,true,
"up".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX), getTitle("up")) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return list.isOrderControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIOrderingBaseComponent) listComponent).isOrderControlsVisible();
}
},
@@ -126,8 +127,8 @@
"-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_UP), null, false,
"up".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX), getTitle("up")) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return list.isOrderControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIOrderingBaseComponent) listComponent).isOrderControlsVisible();
}
},
@@ -135,8 +136,8 @@
"-down", ATTRIBUTE_CLASS_DOWN_CONTROL, "",
CONTROL_ID_DOWN, ATTRIBUTE_CE_ONDOWNCLICK, true,
"down".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX), getTitle("down")) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return list.isOrderControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIOrderingBaseComponent) listComponent).isOrderControlsVisible();
}
},
@@ -144,8 +145,8 @@
"-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_DOWN), null, false,
"down".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX), getTitle("down")) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return list.isOrderControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIOrderingBaseComponent) listComponent).isOrderControlsVisible();
}
},
@@ -153,8 +154,8 @@
"-bottom", ATTRIBUTE_CLASS_BOTTOM_CONTROL, "",
CONTROL_ID_BOTTOM, ATTRIBUTE_CE_ONBOTTOMCLICK, true,
"bottom".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX), getTitle("bottom"))
{
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return list.isFastOrderControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIOrderingBaseComponent) listComponent).isFastOrderControlsVisible();
}
},
@@ -162,8 +163,8 @@
"-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_BOTTOM), null, false,
"bottom".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX), getTitle("bottom"))
{
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return list.isFastOrderControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIOrderingBaseComponent) listComponent).isFastOrderControlsVisible();
}
}
Modified:
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
===================================================================
---
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2009-04-07
15:51:37 UTC (rev 13408)
+++
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2009-04-07
15:59:12 UTC (rev 13409)
@@ -119,7 +119,7 @@
private String title;
public abstract boolean isRendered(FacesContext context,
- UIOrderingBaseComponent list);
+ UIComponent component);
public ControlsHelper(String name, String bundlePropertyName,
String defaultText, String imageURI, String facetName,
Modified: trunk/ui/pickList/src/main/config/component/picklist.xml
===================================================================
--- trunk/ui/pickList/src/main/config/component/picklist.xml 2009-04-07 15:51:37 UTC (rev
13408)
+++ trunk/ui/pickList/src/main/config/component/picklist.xml 2009-04-07 15:59:12 UTC (rev
13409)
@@ -165,7 +165,22 @@
</description>
<defaultvalue>"140px"</defaultvalue>
</property>
-
+ <property>
+ <name>moveControlsVisible</name>
+ <classname>boolean</classname>
+ <description>
+ If "false", 'Copy' and
'Remove' controls aren't displayed. Default value is
"true".
+ </description>
+ <defaultvalue>true</defaultvalue>
+ </property>
+ <property>
+ <name>fastMoveControlsVisible</name>
+ <classname>boolean</classname>
+ <description>
+ If "false", 'Copy All' and
'Remove All' controls aren't displayed. Default value is
"true".
+ </description>
+ <defaultvalue>true</defaultvalue>
+ </property>
<property>
<name>disabledStyle</name>
<classname>java.lang.String</classname>
Modified: trunk/ui/pickList/src/main/java/org/richfaces/component/UIPickList.java
===================================================================
--- trunk/ui/pickList/src/main/java/org/richfaces/component/UIPickList.java 2009-04-07
15:51:37 UTC (rev 13408)
+++ trunk/ui/pickList/src/main/java/org/richfaces/component/UIPickList.java 2009-04-07
15:59:12 UTC (rev 13409)
@@ -33,7 +33,7 @@
public abstract class UIPickList extends UISelectMany {
/**
- * Get base clietntId of this component ( withowt iteration part )
+ * Get base clientId of this component ( without iteration part )
*
* @param faces
* @return
@@ -133,4 +133,10 @@
public abstract boolean isDisabled();
public abstract void setDisabled(boolean disabled);
+ public abstract boolean isMoveControlsVisible();
+ public abstract void setMoveControlsVisible(boolean visible);
+
+ public abstract boolean isFastMoveControlsVisible();
+ public abstract void setFastMoveControlsVisible(boolean visible);
+
}
Modified:
trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java
===================================================================
---
trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java 2009-04-07
15:51:37 UTC (rev 13408)
+++
trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java 2009-04-07
15:59:12 UTC (rev 13409)
@@ -20,10 +20,10 @@
*/
package org.richfaces.renderkit;
+import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import org.richfaces.component.UIListShuttle;
-import org.richfaces.component.UIOrderingBaseComponent;
+import org.richfaces.component.UIPickList;
import org.richfaces.renderkit.html.images.ListShuttleIconCopy;
import org.richfaces.renderkit.html.images.ListShuttleIconCopyAll;
import org.richfaces.renderkit.html.images.ListShuttleIconCopyAllDisabled;
@@ -126,8 +126,8 @@
.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),
COPY_ALL_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isFastMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIPickList) listComponent).isFastMoveControlsVisible() &&
!((UIPickList) listComponent).isDisabled();
}
},
@@ -136,8 +136,8 @@
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY_ALL), null, false,
"copyAll"
.concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX),
COPY_ALL_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isFastMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIPickList) listComponent).isFastMoveControlsVisible();
}
},
@@ -145,8 +145,8 @@
"-copy", ATTRIBUTE_CLASS_COPY_CONTROL, "", CONTROL_ID_COPY,
ATTRIBUTE_CE_ONCOPYCLICK, true, "copy"
.concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX),
COPY_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIPickList) listComponent).isMoveControlsVisible() &&
!((UIPickList) listComponent).isDisabled();
}
},
@@ -154,8 +154,8 @@
FACET_DIS_COPY, "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL,
DISABLED_STYLE_PREF, DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY), null,
false,
"copy".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX),
COPY_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIPickList) listComponent).isMoveControlsVisible();
}
},
@@ -163,8 +163,8 @@
FACET_REMOVE, "-remove", ATTRIBUTE_CLASS_REMOVE_CONTROL, "",
CONTROL_ID_REMOVE, ATTRIBUTE_CE_ONREMOVECLICK, true, "remove"
.concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX),
REMOVE_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIPickList) listComponent).isMoveControlsVisible() &&
!((UIPickList) listComponent).isDisabled();
}
},
@@ -172,8 +172,8 @@
.getName(), FACET_DIS_REMOVE, "-disabled",
ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF, DIS_CONTROL_ID_PREFIX
.concat(CONTROL_ID_REMOVE), null, false,
"remove".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX),
REMOVE_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIPickList) listComponent).isMoveControlsVisible();
}
},
@@ -181,8 +181,8 @@
.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),
REMOVE_ALL_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isFastMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIPickList) listComponent).isFastMoveControlsVisible() &&
!((UIPickList) listComponent).isDisabled();
}
},
@@ -191,8 +191,8 @@
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE_ALL), null, false,
"removeAll"
.concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX),
REMOVE_ALL_TITLE) {
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return ((UIListShuttle) list).isFastMoveControlsVisible();
+ public boolean isRendered(FacesContext context, UIComponent listComponent) {
+ return ((UIPickList) listComponent).isFastMoveControlsVisible();
}
} };
Modified: trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
===================================================================
---
trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2009-04-07
15:51:37 UTC (rev 13408)
+++
trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2009-04-07
15:59:12 UTC (rev 13409)
@@ -67,11 +67,17 @@
private static final OrderingComponentRendererBase.ControlsHelper[] SHUTTLE_HELPERS =
PickListControlsHelper.HELPERS;
- private boolean isSelectedList;
+ protected static final class ListStateFlags {
+
+ public ListStateFlags() {
+ super();
+ }
+
+ protected boolean isSelectedList;
+
+ protected boolean isAvailableList;
+ }
- private boolean isAvailableList;
-
-
protected List<SelectItem> selectItemsForSelectedList(FacesContext
facesContext, UIComponent uiComponent, List<SelectItem> selectItemList,
List<Object> lookupList) {
List<SelectItem> selectItemForSelectedValues = new
ArrayList<SelectItem>();
@@ -234,7 +240,7 @@
return convertedValue;
}
- private void encodeRows(FacesContext context, UIPickList pickList, boolean source)
throws IOException {
+ private void encodeRows(FacesContext context, UIPickList pickList, boolean source,
ListStateFlags flags) throws IOException {
List <SelectItem> selectItemsList = SelectUtils.getSelectItems(context,
pickList);
@@ -245,8 +251,8 @@
List <SelectItem> selectItemsForSelectedValues =
selectItemsForSelectedList(context, pickList, selectItemsList, values);
List <SelectItem> selectItemsForAvailableList =
selectItemsForAvailableList(context, pickList, selectItemsList,
selectItemsForSelectedValues);
- isSelectedList = !selectItemsForSelectedValues.isEmpty();
- isAvailableList = !selectItemsForAvailableList.isEmpty();
+ flags.isSelectedList = !selectItemsForSelectedValues.isEmpty();
+ flags.isAvailableList = !selectItemsForAvailableList.isEmpty();
List <SelectItem> selectItemList = null;
@@ -341,12 +347,12 @@
}
- public void encodeTargetRows(FacesContext context, UIPickList pickList) throws
IOException {
- encodeRows(context, pickList, false);
+ public void encodeTargetRows(FacesContext context, UIPickList pickList,
ListStateFlags flags) throws IOException {
+ encodeRows(context, pickList, false, flags);
}
- public void encodeSourceRows(FacesContext context, UIPickList pickList) throws
IOException {
- encodeRows(context, pickList, true);
+ public void encodeSourceRows(FacesContext context, UIPickList pickList,
ListStateFlags flags) throws IOException {
+ encodeRows(context, pickList, true, flags);
}
private void encodeItemValue(FacesContext context, UIComponent component,
ResponseWriter writer, String id, String itemValue) throws IOException { //rowKey = i
@@ -469,40 +475,42 @@
return null;
}
- public void encodePickListControlsFacets(FacesContext context, UIComponent component)
throws IOException {
+ public void encodePickListControlsFacets(FacesContext context, UIComponent component,
ListStateFlags listStateFlags) throws IOException {
String clientId = component.getClientId(context);
boolean enable = false;
ResponseWriter writer = context.getResponseWriter();
-
+ boolean componentDisabled = ((UIPickList) component).isDisabled();
for (int i = 0; i < SHUTTLE_HELPERS.length; i++) {
+ //Conditionally render the control based on the return value of the control's
corresponding helper.isRendered method
+ if (SHUTTLE_HELPERS[i].isRendered(context, component)){
+ OrderingComponentRendererBase.ControlsHelper helper = SHUTTLE_HELPERS[i];
+
+ boolean isDisabled =
helper.getButtonStyleClass().equals(PickListControlsHelper.DISABLED_STYLE_PREF);
+
+ if
(helper.getBundlePropertyName().equals(PickListControlsHelper.BUNDLE_REMOVE_ALL_LABEL)) {
+
+ enable = listStateFlags.isSelectedList;
+ enable = (enable != isDisabled) || (isDisabled && componentDisabled) ?
true : false;
+
+ } else if
(helper.getBundlePropertyName().equals(PickListControlsHelper.BUNDLE_COPY_ALL_LABEL)) {
+
+ enable = listStateFlags.isAvailableList;
+ enable = (enable != isDisabled) || (isDisabled && componentDisabled) ?
true : false;
+
+ } else {
+
+ if
(helper.getButtonStyleClass().equals(PickListControlsHelper.DISABLED_STYLE_PREF)) {
+ enable = true;
+ } else {
+ enable = false;
+ }
+
+ }
- OrderingComponentRendererBase.ControlsHelper helper = SHUTTLE_HELPERS[i];
-
- boolean isDisabled =
helper.getButtonStyleClass().equals(PickListControlsHelper.DISABLED_STYLE_PREF);
-
- if
(helper.getBundlePropertyName().equals(PickListControlsHelper.BUNDLE_REMOVE_ALL_LABEL)) {
-
- enable = isSelectedList;
- enable = enable != isDisabled ? true : false;
-
- } else if
(helper.getBundlePropertyName().equals(PickListControlsHelper.BUNDLE_COPY_ALL_LABEL)) {
-
- enable = isAvailableList;
- enable = enable != isDisabled ? true : false;
-
- } else {
-
- if
(helper.getButtonStyleClass().equals(PickListControlsHelper.DISABLED_STYLE_PREF)) {
- enable = true;
- } else {
- enable = false;
- }
-
+ encodeControlFacet(context, component, SHUTTLE_HELPERS[i], clientId, writer,
enable, "rich-list-picklist-button", " rich-picklist-control");
}
-
- encodeControlFacet(context, component, SHUTTLE_HELPERS[i], clientId, writer,
enable, "rich-list-picklist-button", " rich-picklist-control");
}
}
@@ -612,7 +620,7 @@
writer.writeAttribute(HTML.id_ATTRIBUTE, controlId, null); // FIXME:
writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
- String style = enabled ? "display:block;" : "display:none;";
+ String style = enabled ? "display:block;" : "display:none;";
writer.writeAttribute(HTML.style_ATTRIBUTE, style, null);
Modified: trunk/ui/pickList/src/main/templates/htmlPickList.jspx
===================================================================
--- trunk/ui/pickList/src/main/templates/htmlPickList.jspx 2009-04-07 15:51:37 UTC (rev
13408)
+++ trunk/ui/pickList/src/main/templates/htmlPickList.jspx 2009-04-07 15:59:12 UTC (rev
13409)
@@ -30,9 +30,31 @@
<f:clientId var="clientId"/>
- <table id="#{clientId}" class="rich-list-picklist
#{component.attributes['styleClass']}"
+ <c:object var="componentEnabled" value="#{!component.disabled}"
type="boolean" />
+
+ <c:object var="componentStyle" type="java.lang.String" />
+ <c:object var="componentStyleClass" type="java.lang.String"
/>
+
+ <jsp:scriptlet><![CDATA[
+ if (componentEnabled) {
+ componentStyle = HtmlUtil.concatStyles((String)
component.getAttributes().get("style"),
+ (String) component.getAttributes().get("enabledStyle"));
+
+ componentStyleClass = HtmlUtil.concatClasses((String)
component.getAttributes().get("styleClass"),
+ (String) component.getAttributes().get("enabledStyleClass"));
+ } else {
+ componentStyle = HtmlUtil.concatStyles((String)
component.getAttributes().get("style"),
+ (String) component.getAttributes().get("disabledStyle"));
+
+ componentStyleClass = HtmlUtil.concatClasses((String)
component.getAttributes().get("styleClass"),
+ "rich-list-picklist-disabled",
+ (String) component.getAttributes().get("disabledStyleClass"));
+ }
+ ]]></jsp:scriptlet>
+
+ <table id="#{clientId}" class="rich-list-picklist
#{componentStyleClass}" style="#{componentStyle}"
cellspacing="0" cellpadding="0"
- x:passThruWithExclusions="id, class, styleClass">
+ x:passThruWithExclusions="id,style,class,styleClass">
<tbody>
<vcp:body>
<f:clientId var="clientId"/>
@@ -46,6 +68,7 @@
//SelectionState targetSelectionState = new SelectionState();
//variables.setVariable("selectionState", targetSelectionState);
//String encodedTargetRows = encodeRows(context, component, false);
+ ListStateFlags listStateFlags = new ListStateFlags();
Boolean switchByClick = (Boolean)
component.getAttributes().get("switchByClick");
variables.setVariable("switchByClick", switchByClick);
@@ -86,7 +109,11 @@
<div id="#{clientId}contentBox"
class="rich-picklist-list-content"
style="#{contentContainerStyle}">
<table id="#{clientId}internal_tab"
class="rich-picklist-internal-tab" cellpadding="0"
cellspacing="0">
<tbody id="#{clientId}tbody">
- <f:call name="encodeSourceRows" />
+ <jsp:scriptlet>
+ <![CDATA[
+ encodeSourceRows(context, component, listStateFlags);
+ ]]>
+ </jsp:scriptlet>
</tbody>
</table>
</div>
@@ -100,7 +127,7 @@
<td style="vertical-align: #{component.moveControlsVerticalAlign};"
>
<div class="rich-picklist-controls #{component.controlClass}" >
<jsp:scriptlet><![CDATA[
- encodePickListControlsFacets(context, component);
+ encodePickListControlsFacets(context, component, listStateFlags);
]]></jsp:scriptlet>
</div>
@@ -137,7 +164,11 @@
<div id="#{clientId}tlContentBox"
class="rich-picklist-list-content"
style="#{trContentContainerStyle}">
<table id="#{clientId}tlInternal_tab"
class="rich-picklist-internal-tab" cellpadding="0"
cellspacing="0">
<tbody id="#{clientId}tlTbody">
- <f:call name="encodeTargetRows" />
+ <jsp:scriptlet>
+ <![CDATA[
+ encodeTargetRows(context, component, listStateFlags);
+ ]]>
+ </jsp:scriptlet>
</tbody>
</table>
</div>
@@ -157,8 +188,9 @@
<span id="#{clientId}script">
<f:call name="reRenderScript" />
-
- <script type="text/javascript">
+
+ <c:if test="#{!component.disabled}">
+ <script type="text/javascript">
var clientId = '#{clientId}';
new Richfaces.PickList(
@@ -170,6 +202,7 @@
onfocus:#{this:getAsEventHandler(context, component, "onfocus")},
onblur:#{this:getAsEventHandler(context, component, "onblur")}},
"#{clientId}valueKeeper");
- </script>
+ </script>
+ </c:if>
</span>
</f:root>