Author: vmolotkov
Date: 2007-11-16 12:39:20 -0500 (Fri, 16 Nov 2007)
New Revision: 4046
Modified:
trunk/sandbox/ui/orderingList/src/main/config/component/orderinglist.xml
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
Log:
controls list was corrected
Modified: trunk/sandbox/ui/orderingList/src/main/config/component/orderinglist.xml
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/config/component/orderinglist.xml 2007-11-16
17:09:28 UTC (rev 4045)
+++ trunk/sandbox/ui/orderingList/src/main/config/component/orderinglist.xml 2007-11-16
17:39:20 UTC (rev 4046)
@@ -30,15 +30,6 @@
&ui_component_attributes;
- <property>
- <name>onmousemove</name>
- <classname>java.lang.String</classname>
- <description>
- HTML: script expression; a pointer was moved within.
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
-
<property>
<name>captionLabel</name>
<classname>java.lang.String</classname>
@@ -46,6 +37,13 @@
Defines caption representation text
</description>
</property>
+ <property>
+ <name>label</name>
+ <classname>java.lang.Boolean</classname>
+ <description>
+ </description>
+ <defaultvalue><![CDATA[true]]></defaultvalue>
+ </property>
<property>
<name>listWidth</name>
<classname>int</classname>
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-16
17:09:28 UTC (rev 4045)
+++
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-16
17:39:20 UTC (rev 4046)
@@ -61,6 +61,8 @@
private final static String CONTROL_TYPE_NONE = "none";
+ private final static String ATTRIBUTE_LABEL = "label";
+
private final static String ATTRIBUTE_CONTROLS_TYPE = "controlsType";
private final static String ATTRIBUTE_CE_ONORDERCHANGED = "onorderchanged";
@@ -347,10 +349,9 @@
}
}
- protected void encodeControlFacet(FacesContext context, UIOrderingList orderingList,
ControlsHelper helper, String clientId, ResponseWriter writer,
- boolean enabled)
- throws IOException {
-
+ protected void encodeControlFacet(FacesContext context,
+ UIOrderingList orderingList, ControlsHelper helper,
+ String clientId, ResponseWriter writer, boolean enabled) throws IOException {
Locale locale = null;
UIViewRoot viewRoot = context.getViewRoot();
@@ -369,72 +370,82 @@
}
}
+ Map attributes = orderingList.getAttributes();
UIComponent facet = orderingList.getFacet(helper.getFacetName());
- boolean isButton = false;
boolean useFacet = (facet != null && facet.isRendered());
- Map attributes = orderingList.getAttributes();
-
String controlType = (String) attributes.get(ATTRIBUTE_CONTROLS_TYPE);
- String customEvent = null;
- 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);
- }
- String htmlElem = null;
- if (CONTROL_TYPE_BUTTON.equals(controlType)) {
- isButton = true;
- htmlElem = HTML.BUTTON;
- } else if (CONTROL_TYPE_LINK.equals(controlType)) {
- htmlElem = HTML.a_ELEMENT;
+
+ if (CONTROL_TYPE_NONE.equals(controlType)) {
+ if (useFacet) {
+ renderChild(context, facet);
+ }
} else {
- //none
+ renderDefaultControl(context, orderingList, writer, useFacet,
+ helper, clientId, bundle ,enabled);
}
+ }
- boolean encodeDiv = !isButton && (useFacet || htmlElem != null);
-
- if (encodeDiv) {
+ protected void renderDefaultControl(FacesContext context,
+ UIOrderingList orderingList, ResponseWriter writer,
+ boolean useFacet, ControlsHelper helper, String clientId, ResourceBundle bundle,
boolean enabled)
+ throws IOException {
+ String htmlElem = HTML.a_ELEMENT;
+ UIComponent facet = orderingList.getFacet(helper.getFacetName());
+ String customEvent = null;
+ if (useFacet) {
+ renderChild(context, facet);
+ } else {
+ 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);
//FIXME:
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);
- writer.writeAttribute(HTML.onmouseover_ATTRIBUTE,
"this.className='ol_button_light'", null);
- writer.writeAttribute(HTML.onmousedown_ATTRIBUTE,
"this.className='ol_button_press'", null);
- writer.writeAttribute(HTML.onmouseup_ATTRIBUTE,
"this.className='ol_button'", null);
- writer.writeAttribute(HTML.onmouseout_ATTRIBUTE,
"this.className='ol_button'", null);
+ if (helper.enable) {
+ writer.writeAttribute(HTML.onmouseover_ATTRIBUTE,
"this.className='ol_button_light'", null);
+ writer.writeAttribute(HTML.onmousedown_ATTRIBUTE,
"this.className='ol_button_press'", null);
+ writer.writeAttribute(HTML.onmouseup_ATTRIBUTE,
"this.className='ol_button'", null);
+ writer.writeAttribute(HTML.onmouseout_ATTRIBUTE,
"this.className='ol_button'", null);
+ }
writer.startElement(HTML.DIV_ELEM, orderingList);
writer.writeAttribute(HTML.class_ATTRIBUTE, "ol_button_content", null);
-
- /*writer.writeAttribute("onmousedown",
- "Element.removeClassName(this, 'ol_button'); Element.addClassName(this,
'ol_button_clicked'); ", null);
- writer.writeAttribute("onmouseup",
- "Element.removeClassName(this, 'ol_button_clicked');
Element.addClassName(this, 'ol_button'); ", null);*/
- }
-
- if (htmlElem != null) {
+
writer.startElement(htmlElem, orderingList);
- //writer.writeAttribute(HTML.id_ATTRIBUTE, clientId + helper.getIdSuffix(), null);
+ // writer.writeAttribute(HTML.id_ATTRIBUTE, clientId +
+ // helper.getIdSuffix(), null);
if (customEvent != null) {
- writer.writeAttribute(HTML.onclick_ATTRIBUTE, customEvent, null);
+ writer
+ .writeAttribute(HTML.onclick_ATTRIBUTE, customEvent,
+ null);
}
- }
-
- if (useFacet) {
- renderChild(context, facet);
- } else {
- if (isButton) {
- currentStyle = helper.buttonStyle.concat(currentStyle);
- //writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
- if (!helper.enable) {
- writer.writeAttribute(HTML.DISABLED_ATTR, "true", null);
- }
-
+
+ // writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
+ 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) attributes.get(ATTRIBUTE_LABEL)) {
String label = null;
if (bundle != null) {
@@ -450,29 +461,9 @@
}
writer.writeText(label, null);
- } else {
- //writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
- 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 (htmlElem != null) {
writer.endElement(htmlElem);
- }
-
- if (isButton) {
- writer.startElement("br", orderingList);
- writer.endElement("br");
- }
-
- if (encodeDiv) {
+
writer.endElement(HTML.DIV_ELEM);
writer.endElement(HTML.DIV_ELEM);
writer.endElement(HTML.DIV_ELEM);
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-16
17:09:28 UTC (rev 4045)
+++
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss 2007-11-16
17:39:20 UTC (rev 4046)
@@ -6,15 +6,15 @@
<f:verbatim><![CDATA[
-.ol_button_layout{padding : 15px 8px 15px 0px;}
+ol_button_layout{padding : 15px 8px 15px 0px;}
.ol_button_border{border : 1px solid #bfbfc0; margin-bottom : 3px;}
-.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{background : top left #C6D6EA repeat-x; cursor : pointer; padding : 2px;
font-family : Arial; font-size :11px;}
+.ol_button_light{background : 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 : 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 : 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;}
+.ol_button_content{font-family : Arial; font-size :11px; padding : 0px 4px 0px 1px;
text-align : left;}
/*
.ol_button_clicked {