Author: nbelaevski
Date: 2007-11-29 15:58:10 -0500 (Thu, 29 Nov 2007)
New Revision: 4366
Modified:
branches/3.1.x/sandbox/ui/listShuttle/src/main/config/component/listShuttle.xml
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.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
branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
Log:
latest changes for listShuttle & orderingList
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/config/component/listShuttle.xml
===================================================================
---
branches/3.1.x/sandbox/ui/listShuttle/src/main/config/component/listShuttle.xml 2007-11-29
20:58:01 UTC (rev 4365)
+++
branches/3.1.x/sandbox/ui/listShuttle/src/main/config/component/listShuttle.xml 2007-11-29
20:58:10 UTC (rev 4366)
@@ -81,5 +81,47 @@
</description>
<defaultvalue>true</defaultvalue>
</property>
+
+ <property>
+ <name>showButtonLabels</name>
+ <classname>boolean</classname>
+ <description>
+ </description>
+ <defaultvalue><![CDATA[true]]></defaultvalue>
+ </property>
+
+ <property>
+ <name>topControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>upControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>downControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>bottomControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+
+ <property>
+ <name>copyAllControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>copyControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>removeControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>removeAllControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
</component>
</components>
Modified:
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java
===================================================================
---
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java 2007-11-29
20:58:01 UTC (rev 4365)
+++
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java 2007-11-29
20:58:10 UTC (rev 4366)
@@ -67,12 +67,9 @@
private final static String DEFAULT_LABEL_REMOVE = "Remove";
private final static String DEFAULT_LABEL_REMOVE_ALL = "Remove All";
- private final static String ATTRIBUTE_CLASS_BUTTON = "ol_button";
- private final static String ATTRIBUTE_CLASS_BUTTON_DISABLED =
"ol_button_disabled";
-
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,
- " rich-shuttle-top", ATTRIBUTE_CLASS_COPY_ALL_CONTROL,
ATTRIBUTE_CLASS_BUTTON,
+ "-copyall", ATTRIBUTE_CLASS_COPY_ALL_CONTROL, "",
CONTROL_ID_COPY_ALL, ATTRIBUTE_CE_ONCOPYALLCLICK, true) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -81,7 +78,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledCopyAll",
"COPY_ALL_LABEL", DEFAULT_LABEL_COPY_ALL,
ListShuttleIconCopyAllDisabled.class.getName(), FACET_DIS_COPY_ALL,
- " rich-shuttle-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL,
ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY_ALL), null, false) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -90,7 +87,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("copy",
"COPY_LABEL", DEFAULT_LABEL_COPY, ListShuttleIconCopy.class.getName(),
FACET_COPY,
- " rich-shuttle-up", ATTRIBUTE_CLASS_COPY_CONTROL,
ATTRIBUTE_CLASS_BUTTON,
+ "-copy", ATTRIBUTE_CLASS_COPY_CONTROL, "",
CONTROL_ID_COPY, ATTRIBUTE_CE_ONCOPYCLICK ,true) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -99,7 +96,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledCopy",
"COPY_LABEL", DEFAULT_LABEL_COPY, ListShuttleIconCopyDisabled.class.getName(),
FACET_DIS_COPY,
- " rich-shuttle-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL,
ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY), null, false) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -108,7 +105,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("remove",
"REMOVE_LABEL", DEFAULT_LABEL_REMOVE, ListShuttleIconRemove.class.getName(),
FACET_REMOVE,
- " rich-shuttle-down", ATTRIBUTE_CLASS_REMOVE_CONTROL,
ATTRIBUTE_CLASS_BUTTON,
+ "-remove", ATTRIBUTE_CLASS_REMOVE_CONTROL, "",
CONTROL_ID_REMOVE, ATTRIBUTE_CE_ONREMOVECLICK, true) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -117,7 +114,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledRemove",
"REMOVE_LABEL", DEFAULT_LABEL_REMOVE,
ListShuttleIconRemoveDisabled.class.getName(), FACET_DIS_REMOVE,
- " rich-shuttle-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL,
ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE), null, false) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -126,7 +123,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("removeAll",
"REMOVE_ALL_LABEL", DEFAULT_LABEL_REMOVE_ALL,
ListShuttleIconRemoveAll.class.getName(), FACET_REMOVE_ALL,
- " rich-shuttle-bottom", ATTRIBUTE_CLASS_REMOVE_ALL_CONTROL,
ATTRIBUTE_CLASS_BUTTON,
+ "-removeall", ATTRIBUTE_CLASS_REMOVE_ALL_CONTROL, "",
CONTROL_ID_REMOVE_ALL, ATTRIBUTE_CE_ONREMOVEALLCLICK, true) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -135,7 +132,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledRemoveAll",
"REMOVE_ALL_LABEL", DEFAULT_LABEL_REMOVE_ALL,
ListShuttleIconRemoveAllDisabled.class.getName(), FACET_DIS_REMOVE_ALL,
- " rich-shuttle-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL,
ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE_ALL), null, false) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
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-29
20:58:01 UTC (rev 4365)
+++
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java 2007-11-29
20:58:10 UTC (rev 4366)
@@ -7,9 +7,6 @@
import java.io.StringWriter;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
@@ -161,16 +158,14 @@
int divider = SHUTTLE_HELPERS.length / 2;
- int metric;
for (int i = 0; i < SHUTTLE_HELPERS.length; i++) {
- metric = Math.abs(i - divider) / 2;
SelectionState state = (i < divider ? sourceSelectionState :
targetSelectionState);
boolean enabled;
- if (metric <= 1) {
- enabled = state.isSelected();
- } else {
+ if (i <= 1 || i >= SHUTTLE_HELPERS.length - 2) {
enabled = state.isItemExist();
+ } else {
+ enabled = state.isSelected();
}
if (i % 2 == 1) {
@@ -179,7 +174,8 @@
if (SHUTTLE_HELPERS[i].isRendered(context, component)) {
//proper assumption about helpers ordering
- encodeControlFacet(context, component, SHUTTLE_HELPERS[i], clientId, writer,
enabled);
+ encodeControlFacet(context, component, SHUTTLE_HELPERS[i], clientId, writer, enabled,
+ "rich-list-shuttle-button", " rich-shuttle-control");
}
}
}
@@ -201,81 +197,12 @@
if (TL_HELPERS[i].isRendered(context, component)) {
//proper assumption about helpers ordering
- encodeControlFacet(context, component, TL_HELPERS[i], clientId, writer, enabled);
+ encodeControlFacet(context, component, TL_HELPERS[i], clientId, writer, enabled,
+ "rich-list-shuttle-button", " rich-shuttle-control");
}
}
}
- protected void renderDefaultControl(FacesContext context,
- UIOrderingBaseComponent orderingList, ResponseWriter writer,
- boolean useFacet, OrderingComponentRendererBase.ControlsHelper helper, String
clientId, ResourceBundle bundle, boolean enabled)
- 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 currentStyle = helper.getStyleClassName();
-
- if (styleFromAttribute != null) {
- currentStyle = styleFromAttribute.concat(currentStyle);
- }
-
- writer.startElement(HTML.DIV_ELEM, orderingList);
- writer.writeAttribute(HTML.id_ATTRIBUTE, clientId + helper.getIdSuffix(), null);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "shuttle_button " + currentStyle,
null);
- if (helper.enable) {
- writer.writeAttribute(HTML.onmousedown_ATTRIBUTE,
- "Element.addClassName(this, 'shuttle_button_press');
Element.removeClassName(this, 'shuttle_button');", null);
- writer.writeAttribute(HTML.onmouseup_ATTRIBUTE,
- "Element.addClassName(this, 'shuttle_button');
Element.removeClassName(this, 'shuttle_button_press');", null);
- writer.writeAttribute(HTML.onmouseout_ATTRIBUTE,
- "Element.addClassName(this, 'shuttle_button');
Element.removeClassName(this, 'shuttle_button_press');", 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 (Boolean.TRUE.equals(attributes.get(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.endElement(HTML.DIV_ELEM);
- }
-
private boolean isEmpty(String s) {
return s == null || s.length() == 0;
}
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-29
20:58:01 UTC (rev 4365)
+++
branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss 2007-11-29
20:58:10 UTC (rev 4366)
@@ -187,78 +187,49 @@
<f:verbatim><![CDATA[
-.rich-ordering-control-disabled {
+.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-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 {
+.rich-list-shuttle-button, .rich-list-shuttle-button-disabled {
background : top left repeat-x;
- cursor : pointer;
padding : 2px;
}
-.rich-ordering-list-button-disabled {
- background : top left repeat-x;
- padding : 2px;
+.rich-list-shuttle-button {
+ cursor : pointer;
}
-.rich-ordering-list-button-light {
+.rich-list-shuttle-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 {
+.rich-list-shuttle-button-press {
background : top left repeat-x;
border-style: solid;
padding : 2px 0px 0px 2px;
}
-.rich-ordering-list-button-valign {
+.rich-list-shuttle-button-valign {
vertical-align : middle;
}
-.rich-ordering-list-button-layout {
+.rich-list-shuttle-button-layout {
padding : 15px 8px 15px 0px;
}
-.rich-ordering-list-button-content {
+.rich-list-shuttle-button-content {
padding : 0px 4px 0px 1px;
text-align : left;
white-space: nowrap;
}
-.rich-ordering-list-button-content img {
+.rich-list-shuttle-button-content img {
margin-right: 2px;
vertical-align: middle;
}
@@ -338,8 +309,13 @@
white-space: nowrap;
}
-.rich-ordering-list-cell-active, .rich-ordering-list-cell-active * {
+.rich-ordering-list-cell-active {
+ border-top: 1px dotted gray;
+ border-bottom: 1px dotted gray;
+}
+.rich-ordering-list-cell-active * {
+
}
.rich-ordering-list-ds {
@@ -358,7 +334,7 @@
]]>
</f:verbatim>
-<u:selector name=".rich-ordering-list-button">
+<u:selector name=".rich-list-shuttle-button">
<u:style name="background-image">
<f:resource
f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient"
/>
</u:style>
@@ -368,7 +344,7 @@
<u:style name="font-size" skin="headerSizeFont"/>
</u:selector>
-<u:selector name=".rich-ordering-list-button-disabled">
+<u:selector name=".rich-list-shuttle-button-disabled">
<u:style name="background-image">
<f:resource
f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient"
/>
</u:style>
@@ -378,7 +354,7 @@
<u:style name="font-size" skin="headerSizeFont"/>
</u:selector>
- <u:selector name=".rich-ordering-list-button-light">
+ <u:selector name=".rich-list-shuttle-button-light">
<u:style name="background-image">
<f:resource
f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient"
/>
</u:style>
@@ -390,7 +366,7 @@
<u:style name="color" skin="generalTextColor"/>
</u:selector>
- <u:selector name=".rich-ordering-list-button-press">
+ <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>
@@ -461,23 +437,11 @@
<u:style name="font-family" skin="generalFamilyFont" />
</u:selector>
- <u:selector name=".rich-ordering-control-disabled">
+ <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="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:selector name=".rich-list-shuttle-button-content">
<u:style name="font-family" skin="headerFamilyFont" />
<u:style name="font-size" skin="headerSizeFont" />
</u:selector>
@@ -492,10 +456,6 @@
<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">
Modified:
branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
===================================================================
---
branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2007-11-29
20:58:01 UTC (rev 4365)
+++
branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2007-11-29
20:58:10 UTC (rev 4366)
@@ -120,18 +120,18 @@
</div>
</div>
</td>
- <td class="ol_center_button_col_valign">
- <div class="shuttle_button_layout rich-ordering-controls">
- <jsp:scriptlet><![CDATA[
- encodeTLControlsFacets(context, component, targetSelectionState);
- ]]></jsp:scriptlet>
- </div>
- </td>
</tr>
</tbody>
</table>
</div>
</td>
+ <td class="ol_center_button_col_valign">
+ <div class="shuttle_button_layout rich-orderingcontrols">
+ <jsp:scriptlet><![CDATA[
+ encodeTLControlsFacets(context, component, targetSelectionState);
+ ]]></jsp:scriptlet>
+ </div>
+ </td>
</tr>
</table>
</vcp:body>