Author: abelevich
Date: 2010-12-03 12:21:42 -0500 (Fri, 03 Dec 2010)
New Revision: 20373
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarGroupRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java
trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
Log:
add itemClass, itemStyle attributes RF-9883
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java 2010-12-03
17:10:51 UTC (rev 20372)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java 2010-12-03
17:21:42 UTC (rev 20373)
@@ -47,6 +47,12 @@
public abstract String getWidth();
@Attribute
+ public abstract String getItemClass();
+
+ @Attribute
+ public abstract String getItemStyle();
+
+ @Attribute
public abstract String getItemSeparator();
@Attribute(events=@EventName("itemclick"))
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarGroupRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarGroupRenderer.java 2010-12-03
17:10:51 UTC (rev 20372)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarGroupRenderer.java 2010-12-03
17:21:42 UTC (rev 20373)
@@ -74,9 +74,9 @@
private void writeStyleValue(AbstractToolbarGroup toolbarGroup, ResponseWriter
writer) throws IOException {
String style = getStringAttribute(toolbarGroup, HtmlConstants.STYLE_ATTRIBUTE);
- String contentStyle = getStringAttribute(getParentToolBar(toolbarGroup),
"contentStyle");
+ String itemStyle = getStringAttribute(getParentToolBar(toolbarGroup),
"itemStyle");
- String value = concatStyles(contentStyle, style);
+ String value = concatStyles(itemStyle, style);
if (isPropertyRendered(value)) {
writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, value, null);
@@ -86,13 +86,13 @@
private void writeClassValue(AbstractToolbarGroup toolbarGroup, ResponseWriter
writer) throws IOException {
String styleClass = getStringAttribute(toolbarGroup,
HtmlConstants.STYLE_CLASS_ATTR);
AbstractToolbar toolbar = getParentToolBar(toolbarGroup);
- String contentClass = null;
+ String itemClass = null;
if(toolbar != null) {
- contentClass = getStringAttribute(toolbar, "contentClass");
+ itemClass = getStringAttribute(toolbar, "itemClass");
}
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
concatClasses("rf-tb-itm", contentClass, styleClass), null);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
concatClasses("rf-tb-itm", itemClass, styleClass), null);
}
private String getStringAttribute(UIComponent toolbarGroup, String attribute) {
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java 2010-12-03
17:10:51 UTC (rev 20372)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java 2010-12-03
17:21:42 UTC (rev 20373)
@@ -92,8 +92,8 @@
@Override
public void encodeChildren(FacesContext context, UIComponent component) throws
IOException {
AbstractToolbar toolbar = (AbstractToolbar) component;
- String contentClass = (String)
toolbar.getAttributes().get("contentClass");
- String contentStyle = (String)
toolbar.getAttributes().get("contentStyle");
+ String itemClass = (String) toolbar.getAttributes().get("itemClass");
+ String itemStyle = (String) toolbar.getAttributes().get("itemStyle");
List<UIComponent> children = toolbar.getChildren();
@@ -123,9 +123,9 @@
if (!(child instanceof AbstractToolbarGroup)) {
writer.startElement(HtmlConstants.TD_ELEM, component);
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
concatClasses("rf-tb-itm", contentClass), null);
- if (isPropertyRendered(contentStyle)) {
- writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE,
contentStyle, null);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
concatClasses("rf-tb-itm", itemClass), null);
+ if (isPropertyRendered(itemStyle)) {
+ writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, itemStyle,
null);
}
encodeEventsAttributes(context, toolbar);
}
@@ -156,24 +156,7 @@
}
}
}
-
- public void encodeItem(FacesContext facesContext, UIComponent component,
ResponseWriter writer, String contentStyle, String contentClass) throws IOException {
- if (!(component instanceof AbstractToolbarGroup)) {
- writer.startElement(HtmlConstants.TD_ELEM, component);
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
concatClasses("rf-tb-itm", contentClass), null);
- if (isPropertyRendered(contentStyle)) {
- writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, contentStyle,
null);
- }
- encodeEventsAttributes(facesContext, component);
- }
-
- component.encodeAll(facesContext);
-
- if (!(component instanceof AbstractToolbarGroup)) {
- writer.endElement(HtmlConstants.TD_ELEM);
- }
- }
-
+
/**
* Inserts separator between toolbar items. Uses facet "itemSeparator" if
it
* is set and default separator implementation if facet is not set.
Modified: trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-12-03 17:10:51
UTC (rev 20372)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-12-03 17:21:42
UTC (rev 20373)
@@ -239,6 +239,30 @@
</property-extension>
</property>
<property>
+ <property-name>itemClass</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:hidden>false</cdk:hidden>
+ <cdk:literal>false</cdk:literal>
+ <cdk:pass-through>false</cdk:pass-through>
+ <cdk:read-only>false</cdk:read-only>
+ <cdk:required>false</cdk:required>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>itemStyle</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:hidden>false</cdk:hidden>
+ <cdk:literal>false</cdk:literal>
+ <cdk:pass-through>false</cdk:pass-through>
+ <cdk:read-only>false</cdk:read-only>
+ <cdk:required>false</cdk:required>
+ </property-extension>
+ </property>
+ <property>
<property-name>onitemkeydown</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
@@ -429,6 +453,30 @@
</property-extension>
</property>
<property>
+ <property-name>itemClass</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:hidden>false</cdk:hidden>
+ <cdk:literal>false</cdk:literal>
+ <cdk:pass-through>false</cdk:pass-through>
+ <cdk:read-only>false</cdk:read-only>
+ <cdk:required>false</cdk:required>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>itemStyle</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:hidden>false</cdk:hidden>
+ <cdk:literal>false</cdk:literal>
+ <cdk:pass-through>false</cdk:pass-through>
+ <cdk:read-only>false</cdk:read-only>
+ <cdk:required>false</cdk:required>
+ </property-extension>
+ </property>
+ <property>
<description>
The number of child components associated with
this component.
Modified: trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-03 17:10:51 UTC
(rev 20372)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-03 17:21:42 UTC
(rev 20373)
@@ -29,7 +29,15 @@
<name>id</name>
<type>java.lang.String</type>
</attribute>
+ <attribute>
+ <name>itemClass</name>
+ <type>java.lang.String</type>
+ </attribute>
<attribute>
+ <name>itemStyle</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
<name>itemSeparator</name>
<type>java.lang.String</type>
</attribute>
@@ -104,7 +112,15 @@
<name>id</name>
<type>java.lang.String</type>
</attribute>
+ <attribute>
+ <name>itemClass</name>
+ <type>java.lang.String</type>
+ </attribute>
<attribute>
+ <name>itemStyle</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
<name>itemSeparator</name>
<type>java.lang.String</type>
</attribute>