Author: artdaw
Date: 2011-03-09 09:38:43 -0500 (Wed, 09 Mar 2011)
New Revision: 22105
Modified:
branches/4.0.X/examples/input-demo/src/main/webapp/examples/inplaceInput.xhtml
branches/4.0.X/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml
branches/4.0.X/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
branches/4.0.X/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
branches/4.0.X/ui/input/ui/src/main/templates/inplaceInput.template.xml
branches/4.0.X/ui/input/ui/src/main/templates/inplaceSelect.template.xml
Log:
RF-10689: @defaultValue is fixed for null value. Reviewed by Anton Belevich.
Modified: branches/4.0.X/examples/input-demo/src/main/webapp/examples/inplaceInput.xhtml
===================================================================
---
branches/4.0.X/examples/input-demo/src/main/webapp/examples/inplaceInput.xhtml 2011-03-09
13:56:43 UTC (rev 22104)
+++
branches/4.0.X/examples/input-demo/src/main/webapp/examples/inplaceInput.xhtml 2011-03-09
14:38:43 UTC (rev 22105)
@@ -1,22 +1,20 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
-
xmlns:h="http://java.sun.com/jsf/html"
-
xmlns:f="http://java.sun.com/jsf/core"
-
xmlns:ui="http://java.sun.com/jsf/facelets"
-
xmlns:in="http://richfaces.org/input">
-<f:view contentType="text/html" />
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:in="http://richfaces.org/input">
+<f:view contentType="text/html"/>
<h:head>
- <title>InplaceInput</title>
+ <title>InplaceInput</title>
</h:head>
<h:body>
- <h:form id="form">
- <in:inplaceInput showControls="true" value="New York">
- </in:inplaceInput>
- <h:commandButton value="submit"/>
- <in:inplaceInput showControls="true" defaultLabel="click to enter
your name" saveOnBlur="true"
onblur="RichFaces.$('form:ii').cancel()" id="ii">
- </in:inplaceInput>
- </h:form>
+ <h:form id="form">
+ <in:inplaceInput defaultLabel="#{null}">
+ </in:inplaceInput>
+ </h:form>
</h:body>
</html>
Modified: branches/4.0.X/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml
===================================================================
---
branches/4.0.X/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml 2011-03-09
13:56:43 UTC (rev 22104)
+++
branches/4.0.X/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml 2011-03-09
14:38:43 UTC (rev 22105)
@@ -19,7 +19,7 @@
<fieldset>
<legend>InplaceSelect Test App</legend>
Fresh off his victory in the Florida primary, Sen. John McCain is poised to take
another big prize. Former
- <in:inplaceSelect id='ii' defaultLabel="Edit Text"
value="#{inputBean.value}" openOnEdit="true"
saveOnSelect="false">
+ <in:inplaceSelect id='ii' defaultLabel=""
value="#{inputBean.value}" openOnEdit="true"
saveOnSelect="false">
<f:selectItem itemLabel="Label#1" itemValue="Value#1"/>
<f:selectItem itemLabel="Label#2" itemValue="Value#2"/>
<f:selectItem itemLabel="Label#3" itemValue="Value#3"/>
Modified:
branches/4.0.X/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
===================================================================
---
branches/4.0.X/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2011-03-09
13:56:43 UTC (rev 22104)
+++
branches/4.0.X/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2011-03-09
14:38:43 UTC (rev 22105)
@@ -21,20 +21,19 @@
*/
package org.richfaces.renderkit;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Map;
+import org.richfaces.component.AbstractInplaceInput;
+import org.richfaces.component.InplaceComponent;
+import org.richfaces.component.InplaceState;
+import org.richfaces.renderkit.util.HtmlDimensions;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Map;
-import org.richfaces.component.AbstractInplaceInput;
-import org.richfaces.component.InplaceComponent;
-import org.richfaces.component.InplaceState;
-import org.richfaces.renderkit.util.HtmlDimensions;
-
/**
* @author Anton Belevich
*
@@ -51,38 +50,6 @@
@ResourceDependency(library = "org.richfaces", name =
"inplaceInput.ecss") })
public class InplaceInputRendererBase extends InputRendererBase {
- public static final String OPTIONS_EDIT_EVENT = "editEvent";
-
- public static final String OPTIONS_STATE = "state";
-
- public static final String OPTIONS_EDIT_CONTAINER = "editContainer";
-
- public static final String OPTIONS_INPUT = "input";
-
- public static final String OPTIONS_FOCUS = "focusElement";
-
- public static final String OPTIONS_BUTTON_OK = "okbtn";
-
- public static final String OPTIONS_LABEL = "label";
-
- public static final String OPTIONS_DEFAULT_LABEL = "defaultLabel";
-
- public static final String OPTIONS_BUTTON_CANCEL = "cancelbtn";
-
- public static final String OPTIONS_SHOWCONTROLS = "showControls";
-
- public static final String OPTIONS_NONE_CSS = "noneCss";
-
- public static final String OPTIONS_CHANGED_CSS = "changedCss";
-
- public static final String OPTIONS_EDIT_CSS = "editCss";
-
- public static final String OPTIONS_INITIAL_VALUE = "initialValue";
-
- public static final String OPTIONS_SAVE_ON_BLUR = "saveOnBlur";
-
-
-
//TODO: anton - move to RenderUtils (we use the same in the calendar base renderer) ?
protected static final Map<String, ComponentAttribute>
INPLACE_INPUT_HANDLER_ATTRIBUTES = Collections
Modified:
branches/4.0.X/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
===================================================================
---
branches/4.0.X/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2011-03-09
13:56:43 UTC (rev 22104)
+++
branches/4.0.X/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2011-03-09
14:38:43 UTC (rev 22105)
@@ -22,18 +22,17 @@
package org.richfaces.renderkit;
-import java.io.IOException;
-import java.util.List;
+import org.richfaces.component.AbstractInplaceSelect;
+import org.richfaces.component.InplaceComponent;
+import org.richfaces.renderkit.util.HtmlDimensions;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import java.io.IOException;
+import java.util.List;
-import org.richfaces.component.AbstractInplaceSelect;
-import org.richfaces.component.InplaceComponent;
-import org.richfaces.renderkit.util.HtmlDimensions;
-
/**
* @author Anton Belevich
*
@@ -55,17 +54,9 @@
@ResourceDependency(library = "org.richfaces", name =
"inplaceSelect.js"),
@ResourceDependency(library = "org.richfaces", name =
"inplaceSelect.ecss") })
public class InplaceSelectRendererBase extends InplaceInputRendererBase {
-
- public static final String OPTIONS_OPEN_ON_EDIT = "openOnEdit";
-
- public static final String OPTIONS_SAVE_ON_SELECT = "saveOnSelect";
-
+
public static final String ITEM_CSS = "rf-is-opt";
-
- public static final String SELECT_ITEM_CSS = "rf-is-sel";
- public static final String LIST_CSS = "rf-is-lst-cord";
-
public List<ClientSelectItem> getConvertedSelectItems(FacesContext
facesContext, UIComponent component) {
return SelectHelper.getConvertedSelectItems(facesContext, component);
}
Modified: branches/4.0.X/ui/input/ui/src/main/templates/inplaceInput.template.xml
===================================================================
--- branches/4.0.X/ui/input/ui/src/main/templates/inplaceInput.template.xml 2011-03-09
13:56:43 UTC (rev 22104)
+++ branches/4.0.X/ui/input/ui/src/main/templates/inplaceInput.template.xml 2011-03-09
14:38:43 UTC (rev 22105)
@@ -41,11 +41,12 @@
<cc:implementation>
<cdk:object type="org.richfaces.component.InplaceState"
name="inplaceState" value="#{getInplaceState(component)}" />
<cdk:object type="java.lang.String" name="inplaceValue"
value="#{getValue(facesContext, component)}" />
-
+ <cdk:object type="java.lang.String" name="defaultLabel"
value="#{inplaceValue != null and inplaceValue.length() != 0 ? inplaceValue :
'   '}" />
+
<span id="#{clientId}" cdk:passThroughWithExclusions="id class"
class="#{concatClasses(getStateStyleClass(component, inplaceState),
component.attributes['styleClass'])}">
<span id="#{clientId}Label" class="rf-ii-lbl#{inplaceValue ==
component.attributes['defaultLabel'] ? ' rf-ii-dflt-lbl' :
''}">
- #{inplaceValue}
+ #{defaultLabel}
</span>
<c:if test="#{!component.attributes['disabled']}">
@@ -89,7 +90,8 @@
<cdk:scriptOption name="changedCss"
value="#{concatClasses('rf-ii-c-s',
component.attributes['changedStateClass'])}"/>
<cdk:scriptOption name="editCss"
value="#{concatClasses('rf-ii-e-s',
component.attributes['editStateClass'])}"/>
<cdk:scriptOption name="editEvent"
value="#{getEditEvent(component)}"/>
- <cdk:scriptOption attributes="state defaultLabel saveOnBlur
showControls" />
+ <cdk:scriptOption name="defaultLabel"
value="#{defaultLabel}" />
+ <cdk:scriptOption attributes="state saveOnBlur showControls" />
<cdk:scriptOption attributes="onbegin oncomplete onerror
onbeforedomupdate onselectitem onchange onblur onfocus"
wrapper="eventHandler"/>
</cdk:scriptObject>
new RichFaces.ui.InplaceInput("#{clientId}", #{toScriptArgs(options)});
Modified: branches/4.0.X/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- branches/4.0.X/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2011-03-09
13:56:43 UTC (rev 22104)
+++ branches/4.0.X/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2011-03-09
14:38:43 UTC (rev 22105)
@@ -36,12 +36,13 @@
<cdk:object type="java.util.List"
type-arguments="InplaceSelectBaseRenderer.ClientSelectItem"
name="clientSelectItems"
value="#{getConvertedSelectItems(facesContext, component)}" />
-
+ <cdk:object type="java.lang.String" name="defaultLabel"
value="#{inplaceValue != null and inplaceValue.length() != 0 ? inplaceValue :
'   '}" />
+
<span id="#{clientId}" cdk:passThroughWithExclusions="id class"
class="#{concatClasses(getStateStyleClass(component, inplaceState),
component.attributes['styleClass'])}" >
<span id="#{clientId}Label" class="rf-is-lbl#{inplaceValue ==
component.attributes['defaultLabel'] ? ' rf-is-dflt-lbl' :
''}">
- #{inplaceValue}
+ #{defaultLabel}
</span>
<c:if test="#{!component.attributes['disabled']}">
@@ -106,7 +107,8 @@
<cdk:scriptOption name="editCss"
value="#{concatClasses('rf-is-e-s',
component.attributes['editStateClass'])}"/>
<cdk:scriptOption name="selectItemCss"
value="#{concatClasses('rf-is-sel',
component.attributes['selectItemClass'])}"/>
<cdk:scriptOption name="editEvent"
value="#{getEditEvent(component)}"/>
- <cdk:scriptOption attributes="state defaultLabel saveOnBlur showControls
openOnEdit saveOnSelect inputWidth" />
+ <cdk:scriptOption name="defaultLabel"
value="#{defaultLabel}" />
+ <cdk:scriptOption attributes="state saveOnBlur showControls openOnEdit
saveOnSelect inputWidth" />
<cdk:scriptOption attributes="onbegin oncomplete onerror
onbeforedomupdate onselectitem onchange onblur onfocus"
wrapper="eventHandler"/>
</cdk:scriptObject>
new RichFaces.ui.InplaceSelect("#{clientId}", #{toScriptArgs(options)});