Author: nbelaevski
Date: 2007-11-15 15:06:03 -0500 (Thu, 15 Nov 2007)
New Revision: 4031
Modified:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/Control.js
Log:
Latest changes for orderingList
Modified:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
===================================================================
---
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-15
19:18:19 UTC (rev 4030)
+++
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-15
20:06:03 UTC (rev 4031)
@@ -1043,6 +1043,10 @@
return activeItem != null && activeItem.equals(getRowData()) ||
submittedValueHolder != null && (submittedValueHolder.activeItem != null
&& submittedValueHolder.activeItem.equals(getTranslatedRowKey()));
}
+ public int getModelSize() {
+ return getExtendedDataModel().getRowCount();
+ }
+
public boolean isSelected() {
return selection != null && selection.contains(getRowData()) ||
submittedValueHolder != null &&
submittedValueHolder.selectedItems.contains(getTranslatedRowKey());
}
Modified:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
===================================================================
---
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-15
19:18:19 UTC (rev 4030)
+++
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-15
20:06:03 UTC (rev 4031)
@@ -313,14 +313,42 @@
String clientId = orderingList.getClientId(context);
ResponseWriter writer = context.getResponseWriter();
+ Object key = orderingList.getRowKey();
+ boolean selectedFirst = false;
+ boolean selectedLast = false;
+
+ try {
+ orderingList.setRowKey(new Integer(0));
+ selectedFirst = orderingList.isSelected();
+ orderingList.setRowKey(new Integer(orderingList.getModelSize() - 1));
+ selectedLast = orderingList.isSelected();
+ } finally {
+ try {
+ orderingList.setRowKey(key);
+ } catch (Exception e) {
+ context.getExternalContext().log(e.getLocalizedMessage(), e);
+ }
+ }
+
+ //proper assumption about helpers ordering
+ int divider = HELPERS.length / 2;
+
for (int i = 0; i < HELPERS.length; i++) {
+ boolean enabled = i < divider ? !selectedFirst : !selectedLast;
+ if (i % 2 == 0) {
+ enabled = !enabled;
+ }
+
if (HELPERS[i].isRendered(context, orderingList)) {
- encodeControlFacet(context, orderingList, HELPERS[i], clientId, writer);
+ //proper assumption about helpers ordering
+ encodeControlFacet(context, orderingList, HELPERS[i], clientId, writer,
+ enabled);
}
}
}
- protected void encodeControlFacet(FacesContext context, UIOrderingList orderingList,
ControlsHelper helper, String clientId, ResponseWriter writer)
+ protected void encodeControlFacet(FacesContext context, UIOrderingList orderingList,
ControlsHelper helper, String clientId, ResponseWriter writer,
+ boolean enabled)
throws IOException {
Locale locale = null;
@@ -371,7 +399,7 @@
if (encodeDiv) {
writer.startElement(HTML.DIV_ELEM, orderingList);
writer.writeAttribute(HTML.id_ATTRIBUTE, clientId + helper.getIdSuffix(), null);
//FIXME:
- writer.writeAttribute(HTML.class_ATTRIBUTE, "ol_button_border", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "ol_button_border " + (enabled ?
"ol_control_shown" : "ol_control_hidden"), null);
writer.startElement(HTML.DIV_ELEM, orderingList);
writer.writeAttribute(HTML.class_ATTRIBUTE, "ol_button", null);
Modified:
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss
===================================================================
---
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss 2007-11-15
19:18:19 UTC (rev 4030)
+++
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss 2007-11-15
20:06:03 UTC (rev 4031)
@@ -8,10 +8,10 @@
.ol_button_layout{padding : 15px 8px 15px 0px;}
.ol_button_border{border : 1px solid #bfbfc0; margin-bottom : 3px;}
-.ol_button{background : url(none) top left #C6D6EA repeat-x; cursor : pointer; padding
: 2px; font-family : Arial; font-size :11px;}
-.ol_button_light{background : url(none) top left #C6D6EA repeat-x; border : 1px solid
#E79A00;cursor : pointer; padding : 1px; font-family : Arial; font-size :11px;}
+.ol_button{background : none top left #C6D6EA repeat-x; cursor : pointer; padding :
2px; font-family : Arial; font-size :11px;}
+.ol_button_light{background : none top left #C6D6EA repeat-x; border : 1px solid
#E79A00;cursor : pointer; padding : 1px; font-family : Arial; font-size :11px;}
.ol_button_dis{background : #bfbfc0; border : 1px solid #bfbfc0; margin-bottom : 3px;
padding : 1px}
-.ol_button_press{background : url(none) top left repeat-x #EAF0F8; border : 1px solid
#E79A00; padding : 2px 0px 0px 2px;font-family : Arial; font-size :11px;}
+.ol_button_press{background : none top left repeat-x #EAF0F8; border : 1px solid #E79A00;
padding : 2px 0px 0px 2px;font-family : Arial; font-size :11px;}
.ol_center_button_col_valign{vertical-align : middle}
.ol_right_button_col_valign{vertical-align : middle}
.ol_button_content{font-family : Arial; font-size :11px; padding : 0px 0px 0px 0px;
text-align : center;}
@@ -75,7 +75,7 @@
/*width : 100%;*/
}
-.ol_internal_header_tab th{background : url(none) top left repeat-x #C6D6EA; color :
#000000; font-family : Arial; font-size :11px; font-weight : normal; border-bottom : 1px
solid #bfbfc0;border-right : 1px solid #bfbfc0;border-left : 1px solid #EAF0F8;border-top
: 1px solid #FFFFFF; padding : 2px}
+.ol_internal_header_tab th{background : none top left repeat-x #C6D6EA; color : #000000;
font-family : Arial; font-size :11px; font-weight : normal; border-bottom : 1px solid
#bfbfc0;border-right : 1px solid #bfbfc0;border-left : 1px solid #EAF0F8;border-top : 1px
solid #FFFFFF; padding : 2px}
.ol_internal_header_tab .ol_endcol {
border-right : 0px;
Modified:
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/Control.js
===================================================================
---
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/Control.js 2007-11-15
19:18:19 UTC (rev 4030)
+++
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/Control.js 2007-11-15
20:06:03 UTC (rev 4031)
@@ -4,8 +4,8 @@
this.isShown = isShown;
this.isEnabled = isEnabled;
this.action = action;
- this.isEnabled ? this.doEnable() : this.doDisable();
- this.isShown ? this.doShow() : this.doHide();
+ //this.isEnabled ? this.doEnable() : this.doDisable();
+ //this.isShown ? this.doShow() : this.doHide();
}
Control.CLASSES = {
Show replies by date