Author: abelevich
Date: 2008-04-08 10:36:30 -0400 (Tue, 08 Apr 2008)
New Revision: 7667
Modified:
branches/3.2.x/ui/inplaceInput/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
branches/3.2.x/ui/inplaceInput/src/main/templates/inplaceinput.jspx
Log:
http://jira.jboss.com/jira/browse/RF-2981
Modified:
branches/3.2.x/ui/inplaceInput/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
===================================================================
---
branches/3.2.x/ui/inplaceInput/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2008-04-08
14:16:32 UTC (rev 7666)
+++
branches/3.2.x/ui/inplaceInput/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2008-04-08
14:36:30 UTC (rev 7667)
@@ -53,8 +53,9 @@
private static final String INPLACE_CSS_CHANGE = "changed";
private static final String INPLACE_CSS_HOVER = "hover";
+
+ private static final String EMPTY_DEFAULT_LABEL =
"   ";
-
protected Class<UIInplaceInput> getComponentClass() {
return UIInplaceInput.class;
@@ -120,7 +121,7 @@
String defaultLabel =
(String)component.getAttributes().get("defaultLabel");
if (defaultLabel == null || defaultLabel.equals("")) {
- defaultLabel = "   ";
+ defaultLabel = EMPTY_DEFAULT_LABEL;
}
options.addOption("defaultLabel", defaultLabel);
@@ -150,7 +151,7 @@
return events.toString();
}
-
+
public String encodeInplaceInputCss(FacesContext context, UIComponent component) {
StringBuffer cssMap = new StringBuffer();
cssMap.append("var classes = ");
@@ -239,4 +240,11 @@
protected String getConvertedStringValue(FacesContext context, UIInplaceInput
component, Object value) {
return InputUtils.getConvertedStringValue(context, component, value);
}
+
+ protected boolean isEmptyDefaultLabel(String defaultLabel) {
+ if (defaultLabel != null && EMPTY_DEFAULT_LABEL.equals(defaultLabel)) {
+ return true;
+ }
+ return false;
+ }
}
Modified: branches/3.2.x/ui/inplaceInput/src/main/templates/inplaceinput.jspx
===================================================================
--- branches/3.2.x/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-04-08
14:16:32 UTC (rev 7666)
+++ branches/3.2.x/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-04-08
14:36:30 UTC (rev 7667)
@@ -30,8 +30,8 @@
if (value == null) {
value = component.getValue();
}
+ value = getConvertedStringValue(context, component,value);
Object fieldValue = value;
- value = getConvertedStringValue(context, component,value);
if (value == null || value.equals("")) {
fieldValue = "";
String defaultValue =
(String)component.getAttributes().get("defaultLabel");
@@ -174,8 +174,12 @@
</div>
<jsp:scriptlet>
- writer.write(convertToString(variables.getVariable("value")));
- if (!layout.equals("inline")) {
+ if(isEmptyDefaultLabel(convertToString(variables.getVariable("value")))) {
+ writer.write(convertToString(variables.getVariable("value")));
+ } else {
+ writer.writeText(convertToString(variables.getVariable("value")),null);
+ }
+ if (!layout.equals("inline")) {
</jsp:scriptlet>
</div>
<jsp:scriptlet>