Author: Alex.Kolonitsky
Date: 2010-12-31 07:04:09 -0500 (Fri, 31 Dec 2010)
New Revision: 20857
Added:
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/CollapsiblePanelRendererTest.java
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TableIconsRendererHelper.java
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuGroupRendererTest.java
Log:
RF-9435
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-12-31
10:16:36 UTC (rev 20856)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-12-31
12:04:09 UTC (rev 20857)
@@ -59,16 +59,16 @@
public static final String SWITCH = "switch";
public static final String BEFORE_SWITCH = "beforeswitch";
- private final TableIconsRendererHelper headerRenderer = new
TableIconsRendererHelper("header", "rf-cp-") {
+ private final TableIconsRendererHelper headerRenderer = new
TableIconsRendererHelper("header", "rf-cp", "rf-cp-ico-") {
- protected void encodeHeaderGroupIconLeft(ResponseWriter writer, FacesContext
context, UIComponent component) throws IOException {
+ protected void encodeHeaderIconLeft(ResponseWriter writer, FacesContext context,
UIComponent component) throws IOException {
HtmlCollapsiblePanel panel = (HtmlCollapsiblePanel) component;
encodeTdIcon(writer, context, cssClassPrefix + "-ico",
panel.isExpanded(),
panel.getLeftCollapsedIcon(), panel.getLeftExpandedIcon());
}
- protected void encodeHeaderGroupIconRight(ResponseWriter writer, FacesContext
context, UIComponent component) throws IOException {
+ protected void encodeHeaderIconRight(ResponseWriter writer, FacesContext context,
UIComponent component) throws IOException {
HtmlCollapsiblePanel panel = (HtmlCollapsiblePanel) component;
//TODO nick - should this be "-ico-exp"? also why expanded icon
state is connected with right icon alignment?
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2010-12-31
10:16:36 UTC (rev 20856)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2010-12-31
12:04:09 UTC (rev 20857)
@@ -59,10 +59,10 @@
private static class HeaderRenderer extends TableIconsRendererHelper {
public HeaderRenderer(String cssClassPrefix) {
- super("label", cssClassPrefix);
+ super("label", cssClassPrefix, "rf-pm-ico-");
}
- protected void encodeHeaderGroupIconLeft(ResponseWriter writer, FacesContext
context, UIComponent component) throws IOException {
+ protected void encodeHeaderIconLeft(ResponseWriter writer, FacesContext context,
UIComponent component) throws IOException {
HtmlPanelMenuGroup group = (HtmlPanelMenuGroup) component;
String iconCollapsed = group.isDisabled() ? group.getIconLeftDisabled() :
group.getIconLeftCollapsed();
@@ -71,7 +71,7 @@
encodeTdIcon(writer, context, cssClassPrefix + "-ico",
group.isExpanded(), iconCollapsed, iconExpanded);
}
- protected void encodeHeaderGroupIconRight(ResponseWriter writer, FacesContext
context, UIComponent component) throws IOException {
+ protected void encodeHeaderIconRight(ResponseWriter writer, FacesContext context,
UIComponent component) throws IOException {
HtmlPanelMenuGroup group = (HtmlPanelMenuGroup) component;
String iconCollapsed = group.isDisabled() ? group.getIconRightDisabled() :
group.getIconRightCollapsed();
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TableIconsRendererHelper.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TableIconsRendererHelper.java 2010-12-31
10:16:36 UTC (rev 20856)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TableIconsRendererHelper.java 2010-12-31
12:04:09 UTC (rev 20857)
@@ -15,10 +15,12 @@
protected final String text;
protected final String cssClassPrefix;
+ protected final String cssIconsClassPrefix;
- public TableIconsRendererHelper(String text, String cssClassPrefix) {
+ public TableIconsRendererHelper(String text, String cssClassPrefix, String
cssIconsClassPrefix) {
this.text = text;
this.cssClassPrefix = cssClassPrefix;
+ this.cssIconsClassPrefix = cssIconsClassPrefix;
}
public void encodeHeader(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
@@ -27,11 +29,23 @@
writer.startElement(TBODY_ELEMENT, null);
writer.startElement(TR_ELEMENT, null);
- encodeHeaderGroupIconLeft(writer, context, component);
+ encodeHeaderIconLeft(writer, context, component);
+ encodeHeaderText(writer, context, component);
+ encodeHeaderIconRight(writer, context, component);
+ writer.endElement(TR_ELEMENT);
+ writer.endElement(TBODY_ELEMENT);
+ writer.endElement(TABLE_ELEMENT);
+ }
+
+ private void encodeHeaderText(ResponseWriter writer, FacesContext context,
UIComponent component) throws IOException {
writer.startElement(TD_ELEM, null);
writer.writeAttribute(CLASS_ATTRIBUTE, cssClassPrefix + "-lbl", null);
+ encodeHeaderTextValue(writer, context, component);
+ writer.endElement(TD_ELEM);
+ }
+ protected void encodeHeaderTextValue(ResponseWriter writer, FacesContext context,
UIComponent component) throws IOException {
UIComponent headerFacet = component.getFacet(text);
if (headerFacet != null && headerFacet.isRendered()) {
headerFacet.encodeAll(context);
@@ -41,26 +55,18 @@
writer.writeText(label, null);
}
}
-
- writer.endElement(TD_ELEM);
-
- encodeHeaderGroupIconRight(writer, context, component);
-
- writer.endElement(TR_ELEMENT);
- writer.endElement(TBODY_ELEMENT);
- writer.endElement(TABLE_ELEMENT);
}
- protected abstract void encodeHeaderGroupIconLeft(ResponseWriter writer, FacesContext
context, UIComponent component) throws IOException;
+ protected abstract void encodeHeaderIconLeft(ResponseWriter writer, FacesContext
context, UIComponent component) throws IOException;
- protected abstract void encodeHeaderGroupIconRight(ResponseWriter writer,
FacesContext context, UIComponent menuItem) throws IOException;
+ protected abstract void encodeHeaderIconRight(ResponseWriter writer, FacesContext
context, UIComponent menuItem) throws IOException;
protected void encodeTdIcon(ResponseWriter writer, FacesContext context, String
cssClass, boolean isExpanded, String attrIconCollapsedValue, String attrIconExpandedValue)
throws IOException {
writer.startElement(TD_ELEM, null);
writer.writeAttribute(CLASS_ATTRIBUTE, cssClass, null);
- encodeIdIcon(writer, context, isExpanded, attrIconCollapsedValue, cssClassPrefix
+ "-colps");
- encodeIdIcon(writer, context, !isExpanded, attrIconExpandedValue, cssClassPrefix
+ "-exp");
+ encodeIdIcon(writer, context, isExpanded, attrIconCollapsedValue,
cssIconsClassPrefix + "colps");
+ encodeIdIcon(writer, context, !isExpanded, attrIconExpandedValue,
cssIconsClassPrefix + "exp");
writer.endElement(TD_ELEM);
}
Added:
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/CollapsiblePanelRendererTest.java
===================================================================
---
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/CollapsiblePanelRendererTest.java
(rev 0)
+++
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/CollapsiblePanelRendererTest.java 2010-12-31
12:04:09 UTC (rev 20857)
@@ -0,0 +1,14 @@
+package org.richfaces.renderkit.html;
+
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+
+public class CollapsiblePanelRendererTest extends RendererTestBase {
+
+ @Test
+ public void testEmpty() throws IOException, SAXException {
+// doTest("panelMenuGroup", "f:panelMenuGroup");
+ }
+}
Modified:
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuGroupRendererTest.java
===================================================================
---
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuGroupRendererTest.java 2010-12-31
10:16:36 UTC (rev 20856)
+++
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuGroupRendererTest.java 2010-12-31
12:04:09 UTC (rev 20857)
@@ -37,7 +37,6 @@
* @author akolonitsky
* @since 2010-10-25
*/
-@Ignore
public class PanelMenuGroupRendererTest extends RendererTestBase {
@Test