Author: abelevich
Date: 2010-10-11 14:04:10 -0400 (Mon, 11 Oct 2010)
New Revision: 19525
Modified:
trunk/ui/input/api/src/main/java/org/richfaces/component/InplaceState.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml
trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java
Log:
add disable state (RF-9348)
Modified: trunk/ui/input/api/src/main/java/org/richfaces/component/InplaceState.java
===================================================================
--- trunk/ui/input/api/src/main/java/org/richfaces/component/InplaceState.java 2010-10-11
17:10:02 UTC (rev 19524)
+++ trunk/ui/input/api/src/main/java/org/richfaces/component/InplaceState.java 2010-10-11
18:04:10 UTC (rev 19525)
@@ -31,5 +31,6 @@
public enum InplaceState {
ready,
edit,
- changed
+ changed,
+ disable
}
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-10-11
17:10:02 UTC (rev 19524)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-10-11
18:04:10 UTC (rev 19525)
@@ -43,148 +43,202 @@
* @author Anton Belevich
*
*/
-@ResourceDependencies({ @ResourceDependency(library = "javax.faces", name =
"jsf.js"),
- @ResourceDependency(name = "jquery.js"), @ResourceDependency(name =
"richfaces.js"),
- @ResourceDependency(name = "richfaces-event.js"),
- @ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(library="org.richfaces", name =
"inplaceBase.js"),
- @ResourceDependency(library="org.richfaces", name =
"inplaceInput.js"),
- @ResourceDependency(library="org.richfaces", name =
"inplaceInput.ecss") })
+@ResourceDependencies({
+ @ResourceDependency(library = "javax.faces", name =
"jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"inplaceBase.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"inplaceInput.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"inplaceInput.ecss") })
public class InplaceInputBaseRenderer 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";
-
private static final Map<String, ComponentAttribute>
INPLACEINPUT_HANDLER_ATTRIBUTES = Collections
- .unmodifiableMap(ComponentAttribute.createMap(
- new
ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE).setEventNames("inputclick").
- setComponentAttributeName("oninputclick"),
- new
ComponentAttribute(HtmlConstants.ONDBLCLICK_ATTRIBUTE).setEventNames("inputdblclick").
- setComponentAttributeName("oninputdblclick"),
- new
ComponentAttribute(HtmlConstants.ONMOUSEDOWN_ATTRIBUTE).setEventNames("inputmousedown").
- setComponentAttributeName("oninputmousedown"),
- new
ComponentAttribute(HtmlConstants.ONMOUSEUP_ATTRIBUTE).setEventNames("inputmouseup").
- setComponentAttributeName("oninputmouseup"),
- new
ComponentAttribute(HtmlConstants.ONMOUSEOVER_ATTRIBUTE).setEventNames("inputmouseover").
- setComponentAttributeName("oninputmouseover"),
- new
ComponentAttribute(HtmlConstants.ONMOUSEMOVE_ATTRIBUTE).setEventNames("inputmousemove").
- setComponentAttributeName("oninputmousemove"),
- new
ComponentAttribute(HtmlConstants.ONMOUSEOUT_ATTRIBUTE).setEventNames("inputmouseout").
- setComponentAttributeName("oninputmouseout"),
- new
ComponentAttribute(HtmlConstants.ONKEYPRESS_ATTRIBUTE).setEventNames("inputkeypress").
- setComponentAttributeName("oninputkeypress"),
- new
ComponentAttribute(HtmlConstants.ONKEYDOWN_ATTRIBUTE).setEventNames("inputkeydown").
- setComponentAttributeName("oninputkeydown"),
- new
ComponentAttribute(HtmlConstants.ONKEYUP_ATTRIBUTE).setEventNames("inputkeyup").
- setComponentAttributeName("oninputkeyup"),
- new
ComponentAttribute(HtmlConstants.ONBLUR_ATTRIBUTE).setEventNames("inputblur").
- setComponentAttributeName("oninputblur"),
- new
ComponentAttribute(HtmlConstants.ONFOCUS_ATTRIBUTE).setEventNames("inputfocus").
- setComponentAttributeName("oninputfocus"),
- new
ComponentAttribute(HtmlConstants.ONCHANGE_ATTRIBUTE).setEventNames("change").
- setComponentAttributeName("onchange"),
- new
ComponentAttribute(HtmlConstants.ONSELECT_ATTRIBUTE).setEventNames("select").
- setComponentAttributeName("onselect")
- ));
+ .unmodifiableMap(ComponentAttribute.createMap(
+ new ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE)
+ .setEventNames("inputclick")
+ .setComponentAttributeName("oninputclick"),
+ new ComponentAttribute(HtmlConstants.ONDBLCLICK_ATTRIBUTE)
+ .setEventNames("inputdblclick")
+ .setComponentAttributeName("oninputdblclick"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEDOWN_ATTRIBUTE)
+ .setEventNames("inputmousedown")
+ .setComponentAttributeName("oninputmousedown"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEUP_ATTRIBUTE)
+ .setEventNames("inputmouseup")
+ .setComponentAttributeName("oninputmouseup"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEOVER_ATTRIBUTE)
+ .setEventNames("inputmouseover")
+ .setComponentAttributeName("oninputmouseover"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEMOVE_ATTRIBUTE)
+ .setEventNames("inputmousemove")
+ .setComponentAttributeName("oninputmousemove"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEOUT_ATTRIBUTE)
+ .setEventNames("inputmouseout")
+ .setComponentAttributeName("oninputmouseout"),
+ new ComponentAttribute(HtmlConstants.ONKEYPRESS_ATTRIBUTE)
+ .setEventNames("inputkeypress")
+ .setComponentAttributeName("oninputkeypress"),
+ new ComponentAttribute(HtmlConstants.ONKEYDOWN_ATTRIBUTE)
+ .setEventNames("inputkeydown")
+ .setComponentAttributeName("oninputkeydown"),
+ new ComponentAttribute(HtmlConstants.ONKEYUP_ATTRIBUTE)
+ .setEventNames("inputkeyup")
+ .setComponentAttributeName("oninputkeyup"),
+ new ComponentAttribute(HtmlConstants.ONBLUR_ATTRIBUTE)
+ .setEventNames("inputblur")
+ .setComponentAttributeName("oninputblur"),
+ new ComponentAttribute(HtmlConstants.ONFOCUS_ATTRIBUTE)
+ .setEventNames("inputfocus")
+ .setComponentAttributeName("oninputfocus"),
+ new ComponentAttribute(HtmlConstants.ONCHANGE_ATTRIBUTE)
+
.setEventNames("change").setComponentAttributeName(
+ "onchange"),
+ new ComponentAttribute(HtmlConstants.ONSELECT_ATTRIBUTE)
+
.setEventNames("select").setComponentAttributeName(
+ "onselect")));
- protected void renderInputHandlers(FacesContext facesContext, UIComponent component)
throws IOException {
- RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component,
INPLACEINPUT_HANDLER_ATTRIBUTES);
+ protected void renderInputHandlers(FacesContext facesContext,
+ UIComponent component) throws IOException {
+ RenderKitUtils.renderPassThroughAttributesOptimized(facesContext,
+ component, INPLACEINPUT_HANDLER_ATTRIBUTES);
}
-
+
public InplaceState getInplaceState(UIComponent component) {
return ((InplaceComponent) component).getState();
}
public String getValue(FacesContext facesContext, UIComponent component) throws
IOException {
String value = getInputValue(facesContext, component);
- if(value == null || "".equals(value)) {
- value = ((InplaceComponent)component).getDefaultLabel();
+ if (!isDisable(getInplaceState(component)) && (value == null ||
"".equals(value)) ) {
+ value = ((InplaceComponent) component).getDefaultLabel();
}
return value;
}
-
+
public String getResourcePath(FacesContext context, String resourceName) {
if (resourceName != null) {
- ResourceHandler resourceHandler =
context.getApplication().getResourceHandler();
+ ResourceHandler resourceHandler = context.getApplication()
+ .getResourceHandler();
Resource resource = resourceHandler.createResource(resourceName);
return resource.getRequestPath();
}
return null;
}
- public String getReadyStyleClass(UIComponent component, InplaceState inplaceState) {
- return (InplaceState.changed != inplaceState) ? getReadyStateCss() :
HtmlUtil.concatClasses(getReadyStateCss(), getChangedStateCss());
+ public String getStateStyleClass(UIComponent component,
+ InplaceState inplaceState) {
+ String style = getReadyStateCss();
+ switch (inplaceState) {
+ case edit:
+ style = HtmlUtil.concatClasses(style, getEditStateCss());
+ break;
+
+ case changed:
+ style = HtmlUtil.concatClasses(style, getChangedStateCss());
+ break;
+
+ case disable:
+ style = getDisableStateCss();
+ break;
+
+ default:
+ break;
+ }
+
+ return style;
}
- public String getEditStyleClass(UIComponent component, InplaceState inplaceState) {
- return (InplaceState.edit != inplaceState)?
HtmlUtil.concatClasses(getEditStateCss(), getNoneCss()) : getEditStateCss();
+ public boolean isDisable(InplaceState currentState) {
+ return (InplaceState.disable == currentState);
}
- public String getReadyClientId(FacesContext facesContext, UIComponent component,
InplaceState inplaceState) {
+
+ public String getEditStyleClass(UIComponent component,
+ InplaceState inplaceState) {
+ return (InplaceState.edit != inplaceState) ? HtmlUtil.concatClasses(getEditCss(),
getNoneCss()) : getEditCss();
+ }
+
+ public String getReadyClientId(FacesContext facesContext,
+ UIComponent component, InplaceState inplaceState) {
String clientId = component.getClientId(facesContext);
return getId(clientId, InplaceState.ready, inplaceState);
}
- public String getChangedClientId(FacesContext facesContext, UIComponent component,
InplaceState inplaceState) {
+ public String getChangedClientId(FacesContext facesContext,
+ UIComponent component, InplaceState inplaceState) {
String clientId = component.getClientId(facesContext);
return getId(clientId, InplaceState.changed, inplaceState);
}
- private String getId(String clientId, InplaceState expect, InplaceState current) {
+ private String getId(String clientId, InplaceState expect,
+ InplaceState current) {
String result = clientId;
if (expect != current) {
result = clientId + ":" + expect;
}
return result;
}
-
- public void buildScript(ResponseWriter writer, FacesContext facesContext, UIComponent
component, Object additional) throws IOException {
- if(!(component instanceof InplaceComponent)) {
+
+ public void buildScript(ResponseWriter writer, FacesContext facesContext,
+ UIComponent component, Object additional) throws IOException {
+ if (!(component instanceof InplaceComponent)) {
return;
}
String scriptName = getScriptName();
JSFunction function = new JSFunction(scriptName);
String clientId = component.getClientId(facesContext);
- Map<String, Object> options = createInplaceComponentOptions(clientId,
(InplaceComponent)component);
+ Map<String, Object> options = createInplaceComponentOptions(clientId,
+ (InplaceComponent) component);
addToOptions(facesContext, component, options, additional);
function.addParameter(clientId);
function.addParameter(options);
writer.write(function.toString());
}
-
+
protected String getScriptName() {
return "new RichFaces.ui.InplaceInput";
}
-
- private Map<String, Object> createInplaceComponentOptions(String clientId,
InplaceComponent inplaceComponent) {
+
+ private Map<String, Object> createInplaceComponentOptions(String clientId,
+ InplaceComponent inplaceComponent) {
Map<String, Object> options = new HashMap<String, Object>();
options.put(OPTIONS_EDIT_EVENT, inplaceComponent.getEditEvent());
+ options.put(OPTIONS_STATE, inplaceComponent.getState());
options.put(OPTIONS_NONE_CSS, getNoneCss());
options.put(OPTIONS_CHANGED_CSS, getChangedStateCss());
+ options.put(OPTIONS_EDIT_CSS, getEditStateCss());
options.put(OPTIONS_EDIT_CONTAINER, clientId + ":edit");
options.put(OPTIONS_INPUT, clientId + ":input");
options.put(OPTIONS_LABEL, clientId + ":label");
@@ -193,31 +247,40 @@
options.put(OPTIONS_SAVE_ON_BLUR, inplaceComponent.isSaveOnBlur());
boolean showControls = inplaceComponent.isShowControls();
-
+
options.put(OPTIONS_SHOWCONTROLS, showControls);
- if(showControls) {
+ if (showControls) {
options.put(OPTIONS_BUTTON_OK, clientId + ":okbtn");
options.put(OPTIONS_BUTTON_CANCEL, clientId + ":cancelbtn");
}
return options;
}
- public void addToOptions(FacesContext facesContext, UIComponent component,
Map<String, Object> options, Object additional) {
- //override this method if you need additional options
+ public void addToOptions(FacesContext facesContext, UIComponent component,
+ Map<String, Object> options, Object additional) {
+ // override this method if you need additional options
}
-
+
public String getReadyStateCss() {
return "rf-ii-d-s";
}
-
+
public String getEditStateCss() {
return "rf-ii-e-s";
}
-
+
public String getChangedStateCss() {
return "rf-ii-c-s";
}
-
+
+ public String getDisableStateCss() {
+ return "rf-ii-dis-s";
+ }
+
+ public String getEditCss() {
+ return "rf-ii-edit";
+ }
+
public String getNoneCss() {
return "rf-ii-none";
}
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2010-10-11
17:10:02 UTC (rev 19524)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2010-10-11
18:04:10 UTC (rev 19525)
@@ -198,7 +198,7 @@
UIComponent component) {
AbstractInplaceSelect select = (AbstractInplaceSelect) component;
String label = getSelectInputLabel(facesContext, select);
- if (label == null) {
+ if (!isDisable(getInplaceState(component)) && (label == null)) {
label = select.getDefaultLabel();
}
return label;
@@ -240,6 +240,14 @@
return "rf-is-c-s";
}
+ public String getDisableStateCss() {
+ return "rf-is-dis-s";
+ }
+
+ public String getEditCss() {
+ return "rf-is-edit";
+ }
+
public String getNoneCss() {
return "rf-is-none";
}
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js
===================================================================
---
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js 2010-10-11
17:10:02 UTC (rev 19524)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js 2010-10-11
18:04:10 UTC (rev 19525)
@@ -33,13 +33,15 @@
this.noneCss = options.noneCss;
this.changedCss = options.changedCss;
this.defaultLabel = options.defaultLabel;
+ this.state = options.state;
this.element = $(document.getElementById(id));
this.editContainer = $(document.getElementById(options.editContainer));
+ this.state = options.state;
- this.element.bind(this.editEvent, $.proxy(this.__editHandler, this));
-
- this.isSaved = false;
+ this.element.bind(this.editEvent, $.proxy(this.__editHandler, this));
+
+ this.isSaved = false;
this.useDefaultLabel = false;
};
@@ -48,7 +50,14 @@
var $super = rf.ui.InplaceBase.$super;
$.extend(rf.ui.InplaceBase.prototype, ( function () {
-
+
+ var STATE = {
+ READY : 'ready',
+ CHANGED: 'changed',
+ DISABLE: 'disable',
+ EDIT: 'edit'
+ };
+
return {
getName: function() {
},
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
===================================================================
---
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-10-11
17:10:02 UTC (rev 19524)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-10-11
18:04:10 UTC (rev 19525)
@@ -14,6 +14,17 @@
font-size : inherit;
}
+.rf-ii-edit {
+ position : absolute;
+ top : 0px;
+ left : 0px;
+ display : inline-block;
+ width: 100%;
+}
+
+.rf-ii-dis-s {
+}
+
.rf-ii-lbl {
white-space : nowrap;
}
@@ -39,11 +50,6 @@
}
.rf-ii-e-s {
- position : absolute;
- top : 0px;
- left : 0px;
- display : inline-block;
- width: 100%;
}
.rf-ii-fld {
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
===================================================================
---
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-10-11
17:10:02 UTC (rev 19524)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-10-11
18:04:10 UTC (rev 19525)
@@ -19,6 +19,17 @@
clip: rect(0px, 0px, 1px, 1px);
}
+.rf-is-dis-s {
+}
+
+.rf-is-edit {
+ position : absolute;
+ top : 0px;
+ left : 0px;
+ width : 100px;
+ background-color : '#{richSkin.editBackgroundColor}';
+}
+
.rf-is-fnt {
}
@@ -42,11 +53,6 @@
}
.rf-is-e-s {
- position : absolute;
- top : 0px;
- left : 0px;
- width : 100px;
- background-color : '#{richSkin.editBackgroundColor}';
}
.rf-is-fld {
Modified: trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-10-11 17:10:02 UTC
(rev 19524)
+++ trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-10-11 18:04:10 UTC
(rev 19525)
@@ -41,47 +41,50 @@
<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)}" />
-
- <span id="#{clientId}" class="#{getReadyStyleClass(component,
inplaceState)}" cdk:passThroughWithExclusions="id class">
+
+ <span id="#{clientId}" class="#{getStateStyleClass(component,
inplaceState)}" cdk:passThroughWithExclusions="id class">
<span id="#{clientId}:label" class="rf-ii-lbl">
#{inplaceValue}
</span>
- <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">
- <cdk:call expression="renderInputHandlers(facesContext,
component);"/>
- </input>
- <c:if test="#{component.attributes['showControls']}">
- <span class="rf-ii-btn-prepos">
- <span class="rf-ii-btn-pos">
- <span id="#{clientId}:btnshadow"
class="rf-ii-btn-shadow">
- <span class="rf-ii-btn-shdw-t"></span>
- <span class="rf-ii-btn-shdw-l"></span>
- <span class="rf-ii-btn-shdw-r"></span>
- <span class="rf-ii-btn-shdw-b"></span>
-
- <span id="#{clientId}:btn" style="position :
relative">
- <input type="image"
- id="#{clientId}:okbtn"
- src="#{getResourcePath(facesContext,
'org.richfaces/ico_ok.gif')}"
- class="rf-ii-btn"
onmousedown="this.className='rf-ii-btn-p'"
- onmouseout="this.className='rf-ii-btn'"
onmouseup="this.className='rf-ii-btn'" />
- <input type="image"
- id="#{clientId}:cancelbtn"
- src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
- class="rf-ii-btn"
onmousedown="this.className='rf-ii-btn-press'"
- onmouseout="this.className='rf-ii-btn'"
onmouseup="this.className='rf-ii-btn'" />
- <br />
+
+ <c:if test="#{!isDisable(inplaceState)}">
+ <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">
+ <cdk:call expression="renderInputHandlers(facesContext,
component);"/>
+ </input>
+ <c:if test="#{component.attributes['showControls']}">
+ <span class="rf-ii-btn-prepos">
+ <span class="rf-ii-btn-pos">
+ <span id="#{clientId}:btnshadow"
class="rf-ii-btn-shadow">
+ <span class="rf-ii-btn-shdw-t"></span>
+ <span class="rf-ii-btn-shdw-l"></span>
+ <span class="rf-ii-btn-shdw-r"></span>
+ <span class="rf-ii-btn-shdw-b"></span>
+
+ <span id="#{clientId}:btn" style="position :
relative">
+ <input type="image"
+ id="#{clientId}:okbtn"
+ src="#{getResourcePath(facesContext,
'org.richfaces/ico_ok.gif')}"
+ class="rf-ii-btn"
onmousedown="this.className='rf-ii-btn-p'"
+ onmouseout="this.className='rf-ii-btn'"
onmouseup="this.className='rf-ii-btn'" />
+ <input type="image"
+ id="#{clientId}:cancelbtn"
+ src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
+ class="rf-ii-btn"
onmousedown="this.className='rf-ii-btn-press'"
+ onmouseout="this.className='rf-ii-btn'"
onmouseup="this.className='rf-ii-btn'" />
+ <br />
+ </span>
</span>
</span>
</span>
- </span>
- </c:if>
- </span>
- <script type="text/javascript">
- <cdk:call expression="buildScript(responseWriter, facesContext, component,
null);"/>
- </script>
+ </c:if>
+ </span>
+ <script type="text/javascript">
+ <cdk:call expression="buildScript(responseWriter, facesContext, component,
null);"/>
+ </script>
+ </c:if>
</span>
</cc:implementation>
</cdk:root>
\ No newline at end of file
Modified: trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-11 17:10:02
UTC (rev 19524)
+++ trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-11 18:04:10
UTC (rev 19525)
@@ -37,66 +37,68 @@
<cdk:object type="java.util.List"
type-arguments="InplaceSelectBaseRenderer.ClientSelectItem"
name="clientSelectItems"
value="#{getConvertedSelectItems(facesContext, component)}" />
- <span id="#{clientId}" class="#{getReadyStyleClass(component,
inplaceState)}"
+ <span id="#{clientId}" class="#{getStateStyleClass(component,
inplaceState)}"
cdk:passThroughWithExclusions="id class">
<span id="#{clientId}:label" class="rf-is-lbl">
#{inplaceValue}
</span>
- <input id="#{clientId}:focus" type="image"
style="position: absolute; top: 0px; left: 0px; outline-style: none;"
class="rf-is-none" />
-
- <span id="#{clientId}:edit" class="#{getEditStyleClass(component,
inplaceState)}">
- <input id="#{clientId}selValue" name="#{clientId}"
type="hidden" value="#{getValue(facesContext, component)}"/>
- <input id="#{clientId}:input" autocomplete="off"
- type="text" value="#{getSelectInputLabel(facesContext,
component)}"
- class="rf-is-fld" style="width:
#{component.attributes['inputWidth']};" readonly="readonly"
- cdk:passThrough="tabIndex">
- <cdk:call expression="renderInputHandlers(facesContext, component);"
/>
- </input>
- <c:if test="#{component.attributes['showControls']}">
- <span class="rf-is-btn-prepos">
- <span class="rf-is-btn-pos">
- <span id="#{clientId}:btnshadow" class="rf-is-shdw">
+ <c:if test="#{!isDisable(inplaceState)}">
+ <input id="#{clientId}:focus" type="image"
style="position: absolute; top: 0px; left: 0px; outline-style: none;"
class="rf-is-none" />
+
+ <span id="#{clientId}:edit" class="#{getEditStyleClass(component,
inplaceState)}">
+ <input id="#{clientId}selValue" name="#{clientId}"
type="hidden" value="#{getValue(facesContext, component)}"/>
+ <input id="#{clientId}:input" autocomplete="off"
+ type="text" value="#{getSelectInputLabel(facesContext,
component)}"
+ class="rf-is-fld" style="width:
#{component.attributes['inputWidth']};" readonly="readonly"
+ cdk:passThrough="tabIndex">
+ <cdk:call expression="renderInputHandlers(facesContext, component);"
/>
+ </input>
+ <c:if test="#{component.attributes['showControls']}">
+ <span class="rf-is-btn-prepos">
+ <span class="rf-is-btn-pos">
+ <span id="#{clientId}:btnshadow" class="rf-is-shdw">
+ <span class="rf-is-shdw-t"></span>
+ <span class="rf-is-shdw-l"></span>
+ <span class="rf-is-shdw-r"></span>
+ <span class="rf-is-shdw-b"></span>
+
+ <span id="#{clientId}:btn" style="position :
relative;">
+ <input type="image" id="#{clientId}:okbtn"
+ src="#{getResourcePath(facesContext,
'org.richfaces/ico_ok.gif')}"
+ class="rf-is-btn"
onmousedown="this.className='rf-is-btn-press'"
+ onmouseout="this.className='rf-is-btn'"
onmouseup="this.className='rf-is-btn'" />
+ <input type="image" id="#{clientId}:cancelbtn"
+ src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
+ class="rf-is-btn"
onmousedown="this.className='rf-is-btn-press'"
+ onmouseout="this.className='rf-is-btn'"
onmouseup="this.className='rf-is-btn'" />
+ <br />
+ </span>
+ </span>
+ </span>
+ </span>
+ </c:if>
+ <span id="#{clientId}List" class="rf-is-none
rf-is-lst-cord">
+ <span class="rf-is-lst-pos" style="width:
#{component.attributes['listWidth']}">
+ <span class="rf-is-shdw">
<span class="rf-is-shdw-t"></span>
<span class="rf-is-shdw-l"></span>
<span class="rf-is-shdw-r"></span>
<span class="rf-is-shdw-b"></span>
-
- <span id="#{clientId}:btn" style="position :
relative;">
- <input type="image" id="#{clientId}:okbtn"
- src="#{getResourcePath(facesContext,
'org.richfaces/ico_ok.gif')}"
- class="rf-is-btn"
onmousedown="this.className='rf-is-btn-press'"
- onmouseout="this.className='rf-is-btn'"
onmouseup="this.className='rf-is-btn'" />
- <input type="image" id="#{clientId}:cancelbtn"
- src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
- class="rf-is-btn"
onmousedown="this.className='rf-is-btn-press'"
- onmouseout="this.className='rf-is-btn'"
onmouseup="this.className='rf-is-btn'" />
- <br />
+ <span class="rf-is-lst-dec">
+ <span class="rf-is-lst-scrl" id="#{clientId}Items"
style="height: #{component.attributes['listHeight']}">
+ <cdk:call expression="encodeOptions(facesContext, component,
clientSelectItems);"/>
+ </span>
</span>
</span>
</span>
</span>
- </c:if>
- <span id="#{clientId}List" class="rf-is-none
rf-is-lst-cord">
- <span class="rf-is-lst-pos" style="width:
#{component.attributes['listWidth']}">
- <span class="rf-is-shdw">
- <span class="rf-is-shdw-t"></span>
- <span class="rf-is-shdw-l"></span>
- <span class="rf-is-shdw-r"></span>
- <span class="rf-is-shdw-b"></span>
- <span class="rf-is-lst-dec">
- <span class="rf-is-lst-scrl" id="#{clientId}Items"
style="height: #{component.attributes['listHeight']}">
- <cdk:call expression="encodeOptions(facesContext, component,
clientSelectItems);"/>
- </span>
- </span>
- </span>
- </span>
</span>
- </span>
- <script type="text/javascript">
- <cdk:call expression="buildScript(responseWriter, facesContext, component,
clientSelectItems);" />
- </script>
+ <script type="text/javascript">
+ <cdk:call expression="buildScript(responseWriter, facesContext, component,
clientSelectItems);" />
+ </script>
+ </c:if>
</span>
</cc:implementation>
</cdk:root>
\ No newline at end of file
Modified:
trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java
===================================================================
---
trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java 2010-10-11
17:10:02 UTC (rev 19524)
+++
trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java 2010-10-11
18:04:10 UTC (rev 19525)
@@ -69,7 +69,7 @@
HtmlElement edit = page.getFirstByXPath("//*[@id =
'form:input_default:edit']");
assertEquals("span", edit.getNodeName());
- assertEquals("rf-ii-e-s rf-ii-none",
edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-edit rf-ii-none",
edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
HtmlElement input = (HtmlElement)edit.getFirstChild();
assertEquals("input", input.getNodeName());
@@ -87,7 +87,7 @@
HtmlElement span = page.getFirstByXPath("//*[@id =
'form:input_edit']");
assertEquals("span", span.getNodeName());
- assertEquals("rf-ii-d-s",
span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-d-s rf-ii-e-s",
span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
HtmlElement label = (HtmlElement)span.getFirstChild();
assertEquals("span", label.getNodeName());
@@ -97,7 +97,7 @@
HtmlElement edit = page.getFirstByXPath("//*[@id =
'form:input_edit:edit']");
assertEquals("span", edit.getNodeName());
- assertEquals("rf-ii-e-s",
edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-edit",
edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
HtmlElement input = (HtmlElement)edit.getFirstChild();
assertEquals("input", input.getNodeName());
@@ -145,7 +145,7 @@
HtmlElement span = page.getFirstByXPath("//*[@id = 'form:" +
inplaceInputId + "']");
span.click();
HtmlElement edit = page.getFirstByXPath("//*[@id = 'form:" +
inplaceInputId + ":edit']");
- assertEquals("rf-ii-e-s",
edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-edit",
edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
typeNewValue(page, inplaceInputId, value);
}