Author: abelevich
Date: 2011-01-13 11:40:17 -0500 (Thu, 13 Jan 2011)
New Revision: 20997
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml
Log:
RF-10096 Inline default values: input components III
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java 2011-01-13
16:36:05 UTC (rev 20996)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java 2011-01-13
16:40:17 UTC (rev 20997)
@@ -55,16 +55,16 @@
@Attribute(defaultValue="true")
public abstract boolean isSaveOnBlur();
- @Attribute(defaultValue="InplaceState.ready")
+ @Attribute()
public abstract InplaceState getState();
- @Attribute(defaultValue="click")
+ @Attribute()
public abstract String getEditEvent();
- @Attribute(defaultValue="false")
+ @Attribute()
public abstract boolean isShowControls();
- @Attribute(defaultValue="100%")
+ @Attribute()
public abstract String getInputWidth();
@Attribute
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2011-01-13
16:36:05 UTC (rev 20996)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2011-01-13
16:40:17 UTC (rev 20997)
@@ -127,7 +127,11 @@
}
public InplaceState getInplaceState(UIComponent component) {
- return ((InplaceComponent) component).getState();
+ InplaceState state = ((InplaceComponent) component).getState();
+ if (state == null) {
+ state = InplaceState.ready;
+ }
+ return state;
}
public String getValue(FacesContext facesContext, UIComponent component) throws
IOException {
@@ -197,4 +201,20 @@
String css = component.getNoneClass();
return concatClasses("rf-ii-none", css);
}
+
+ protected String getInputWidth(UIComponent component) {
+ String value = ((AbstractInplaceInput) component).getInputWidth();
+ if (value == null || "".equals(value)) {
+ value = "100%";
+ }
+ return value;
+ }
+
+ protected String getEditEvent(UIComponent component) {
+ String value = ((AbstractInplaceInput) component).getEditEvent();
+ if (value == null || "".equals(value)) {
+ value = "click";
+ }
+ return value;
+ }
}
Modified: trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml 2011-01-13 16:36:05 UTC
(rev 20996)
+++ trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml 2011-01-13 16:40:17 UTC
(rev 20997)
@@ -51,7 +51,7 @@
<input id="#{clientId}Focus" type="image"
style="position: absolute; top: 0px; left: 0px; outline-style: none;"
class="rf-ii-none"/>
<span id="#{clientId}Edit" class="#{getEditStyleClass(component,
inplaceState)}">
<input id="#{clientId}Input" autocomplete="off"
name="#{clientId}"
- type="text" value="#{getInputValue(facesContext,
component)}" class="rf-ii-fld" style="width:
#{component.attributes['inputWidth']};"
cdk:passThrough="tabindex">
+ type="text" value="#{getInputValue(facesContext,
component)}" class="rf-ii-fld" style="width:
#{getInputWidth(component)};" cdk:passThrough="tabindex">
<cdk:call expression="renderInputHandlers(facesContext,
component);"/>
</input>
<c:if test="#{component.attributes['showControls']}">
@@ -87,7 +87,8 @@
<cdk:scriptOption name="noneCss"
value="#{concatClasses('rf-ii-none',
component.attributes['noneStateClass'])}"/>
<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 attributes="editEvent state defaultLabel saveOnBlur
showControls" />
+ <cdk:scriptOption name="editEvent"
value="#{getEditEvent(component)}"/>
+ <cdk:scriptOption attributes="state defaultLabel saveOnBlur
showControls" />
<cdk:scriptOption attributes="onbegin oncomplete onerror
onbeforedomupdate onselectitem onchange onblur onfocus"
wrapper="eventHandler"/>
</cdk:scriptObject>
new RichFaces.ui.InplaceInput("#{clientId}", #{toScriptArgs(options)});
Show replies by date