SWF-770 and SWF-786 - IE 6 bugs with <sf:commandButton> and <sf:commandLink>

This commit is contained in:
Jeremy Grelle
2008-09-03 20:09:56 +00:00
parent f97fd54534
commit 8ac1cbeaba
2 changed files with 26 additions and 13 deletions

View File

@@ -43,7 +43,7 @@ public class ProgressiveCommandButtonRenderer extends BaseDojoComponentRenderer
private static String[] ATTRIBUTES_TO_RENDER;
private static String BUTTON_TAG_NAME = "button";
private static String INPUT_TAG_NAME = "input";
static {
List tempList = new ArrayList();
@@ -120,7 +120,7 @@ public class ProgressiveCommandButtonRenderer extends BaseDojoComponentRenderer
}
protected String getRenderedTagName(UIComponent component) {
return BUTTON_TAG_NAME;
return INPUT_TAG_NAME;
}
public void decode(FacesContext context, UIComponent component) {
@@ -129,18 +129,8 @@ public class ProgressiveCommandButtonRenderer extends BaseDojoComponentRenderer
}
}
public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
// If the button has no children, render out the "value" as text.
ResponseWriter writer = context.getResponseWriter();
String valueAttr = "value";
if (component.getAttributes().get(valueAttr) != null) {
writer.writeText(component.getAttributes().get(valueAttr), valueAttr);
}
super.encodeChildren(context, component);
}
public boolean getRendersChildren() {
return true;
return false;
}
protected String encodeParamsAsObject(FacesContext context, UIComponent component) {

View File

@@ -89,6 +89,14 @@ public class ProgressiveCommandLinkRenderer extends ProgressiveCommandButtonRend
}
};
private RenderAttributeCallback noOpCallback = new RenderAttributeCallback() {
public void doRender(FacesContext context, ResponseWriter writer, UIComponent component, String attribute,
Object attributeValue, String property) throws IOException {
// No-op
}
};
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
// No need to be progressive if this is an AJAX request since it can be assumed JavaScript is enabled
if (!JsfUtils.isAsynchronousFlowRequest()) {
@@ -114,6 +122,16 @@ public class ProgressiveCommandLinkRenderer extends ProgressiveCommandButtonRend
super.encodeBegin(context, component);
}
public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
// If the link has no children, render out the "value" as text.
ResponseWriter writer = context.getResponseWriter();
String valueAttr = "value";
if (component.getAttributes().get(valueAttr) != null) {
writer.writeText(component.getAttributes().get(valueAttr), valueAttr);
}
super.encodeChildren(context, component);
}
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
super.encodeEnd(context, component);
@@ -147,6 +165,10 @@ public class ProgressiveCommandLinkRenderer extends ProgressiveCommandButtonRend
ResourceHelper.endScriptBlock(context);
}
public boolean getRendersChildren() {
return true;
}
protected String[] getAttributesToRender(UIComponent component) {
return ATTRIBUTES_TO_RENDER;
}
@@ -161,6 +183,7 @@ public class ProgressiveCommandLinkRenderer extends ProgressiveCommandButtonRend
attributeCallbacks.putAll(super.getAttributeCallbacks(component));
attributeCallbacks.put("href", hrefCallback);
attributeCallbacks.put("class", classCallback);
attributeCallbacks.put("type", noOpCallback);
}
return attributeCallbacks;
}