Author: abelevich
Date: 2010-12-13 09:10:29 -0500 (Mon, 13 Dec 2010)
New Revision: 20528
Modified:
trunk/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java
trunk/ui/input/api/src/main/java/org/richfaces/component/InplaceState.java
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.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.js
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml
trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
Log:
Rf-9874, RF-9896
Modified: trunk/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java
===================================================================
---
trunk/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java 2010-12-13
13:53:13 UTC (rev 20527)
+++
trunk/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java 2010-12-13
14:10:29 UTC (rev 20528)
@@ -29,6 +29,8 @@
*/
public interface InplaceComponent {
+ public boolean isDisabled();
+
public String getDefaultLabel();
public String getEditEvent();
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-12-13
13:53:13 UTC (rev 20527)
+++ trunk/ui/input/api/src/main/java/org/richfaces/component/InplaceState.java 2010-12-13
14:10:29 UTC (rev 20528)
@@ -31,6 +31,5 @@
public enum InplaceState {
ready,
edit,
- changed,
- disable
+ changed
}
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 2010-12-13
13:53:13 UTC (rev 20527)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java 2010-12-13
14:10:29 UTC (rev 20528)
@@ -45,8 +45,11 @@
public static final String COMPONENT_TYPE = "org.richfaces.InplaceInput";
public static final String COMPONENT_FAMILY =
"org.richfaces.InplaceInput";
-
+
@Attribute
+ public abstract boolean isDisabled();
+
+ @Attribute
public abstract String getDefaultLabel();
@Attribute(defaultValue="true")
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2010-12-13
13:53:13 UTC (rev 20527)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2010-12-13
14:10:29 UTC (rev 20528)
@@ -50,6 +50,9 @@
@Attribute(defaultValue="InplaceState.ready")
public abstract InplaceState getState();
+ @Attribute
+ public abstract boolean isDisabled();
+
@Attribute(defaultValue="true")
public abstract boolean isOpenOnEdit();
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java 2010-12-13
13:53:13 UTC (rev 20527)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java 2010-12-13
14:10:29 UTC (rev 20528)
@@ -50,6 +50,18 @@
public abstract String getSelectItemClass();
@Attribute
+ public abstract String getReadyStateClass();
+
+ @Attribute
+ public abstract String getEditStateClass();
+
+ @Attribute
+ public abstract String getChangedStateClass();
+
+ @Attribute
+ public abstract String getDisabledStateClass();
+
+ @Attribute
public abstract String getListClass();
@Attribute(events=@EventName("blur"))
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 2010-12-13
13:53:13 UTC (rev 20527)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2010-12-13
14:10:29 UTC (rev 20528)
@@ -30,6 +30,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import org.richfaces.component.AbstractInplaceInput;
import org.richfaces.component.InplaceComponent;
import org.richfaces.component.InplaceState;
@@ -130,9 +131,10 @@
}
public String getValue(FacesContext facesContext, UIComponent component) throws
IOException {
- String value = getInputValue(facesContext, component);
- if (!isDisable(getInplaceState(component)) && (value == null ||
"".equals(value)) ) {
- value = ((InplaceComponent) component).getDefaultLabel();
+ AbstractInplaceInput inplaceInput = (AbstractInplaceInput)component;
+ String value = getInputValue(facesContext, inplaceInput);
+ if (!inplaceInput.isDisabled() && (value == null ||
"".equals(value)) ) {
+ value = inplaceInput.getDefaultLabel();
}
return value;
}
@@ -144,29 +146,22 @@
public String getStateStyleClass(UIComponent component, InplaceState inplaceState) {
InplaceComponent inplaceComponent = (InplaceComponent)component;
String style = getReadyStateCss(inplaceComponent);
- switch (inplaceState) {
- case edit:
- style = concatClasses(style, getEditStateCss(inplaceComponent));
- break;
-
- case changed:
- style = concatClasses(style, getChangedStateCss(inplaceComponent));
- break;
-
- case disable:
- style = getDisableStateCss(inplaceComponent);
- break;
-
- default:
- break;
+ if(!inplaceComponent.isDisabled()) {
+ switch (inplaceState) {
+ case edit:
+ style = concatClasses(style, getEditStateCss(inplaceComponent));
+ break;
+ case changed:
+ style = concatClasses(style, getChangedStateCss(inplaceComponent));
+ break;
+ default:
+ break;
+ }
+ } else {
+ style = getDisableStateCss(inplaceComponent);
}
-
return style;
}
-
- public boolean isDisable(InplaceState currentState) {
- return (InplaceState.disable == currentState);
- }
public String getEditStyleClass(UIComponent component, InplaceState inplaceState) {
InplaceComponent inplaceComponent = (InplaceComponent)component;
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2010-12-13
13:53:13 UTC (rev 20527)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2010-12-13
14:10:29 UTC (rev 20528)
@@ -89,7 +89,7 @@
public String getSelectLabel(FacesContext facesContext, UIComponent component) {
AbstractInplaceSelect select = (AbstractInplaceSelect) component;
String label = getSelectInputLabel(facesContext, select);
- if (!isDisable(getInplaceState(component)) && (label == null)) {
+ if (!select.isDisabled() && (label == null)) {
label = select.getDefaultLabel();
}
return label;
@@ -124,4 +124,11 @@
String css = component.getNoneClass();
return concatClasses("rf-is-none", css);
}
+
+ public String getListCss(UIComponent component) {
+ AbstractInplaceSelect inplaceSelect = (AbstractInplaceSelect)component;
+ String css = inplaceSelect.getListClass();
+ css = (css != null) ? concatClasses("rf-is-lst-cord", css) :
"rf-is-lst-cord";
+ return css;
+ }
}
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-12-13
13:53:13 UTC (rev 20527)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js 2010-12-13
14:10:29 UTC (rev 20528)
@@ -8,6 +8,7 @@
this.editEvent = mergedOptions.editEvent;
this.noneCss = mergedOptions.noneCss;
this.changedCss = mergedOptions.changedCss;
+ this.editCss = mergedOptions.editCss;
this.defaultLabel = mergedOptions.defaultLabel;
this.state = mergedOptions.state;
@@ -114,11 +115,13 @@
}
this.editState = false;
this.editContainer.addClass(this.noneCss);
+ this.element.removeClass(this.editCss);
this.onhide();
},
__editHandler: function(e) {
this.isSaved = false;
+ this.element.addClass(this.editCss);
this.editContainer.removeClass(this.noneCss);
this.__show();
},
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
===================================================================
---
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-12-13
13:53:13 UTC (rev 20527)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-12-13
14:10:29 UTC (rev 20528)
@@ -28,12 +28,9 @@
defaultLabel: "",
saveOnBlur: true,
showControl: true,
- itemCss: "rf-ii-opt",
- selectItemCss: "rf-ii-sel",
- listCss: "rf-ii-lst-cord",
noneCss: "rf-ii-none",
- //not used in inputBase?
- editCss: "rf-ii-edit",
+ readyCss: "rf-ii-d-s",
+ editCss: "rf-ii-e-s",
changedCss: "rf-ii-c-s"
};
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
===================================================================
---
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-12-13
13:53:13 UTC (rev 20527)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-12-13
14:10:29 UTC (rev 20528)
@@ -101,7 +101,7 @@
processItem: function(item) {
var label = this.getItemLabel(item);
this.setValue(label);
-
+
this.__setInputFocus();
this.hidePopup();
Modified: trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-12-13 13:53:13 UTC
(rev 20527)
+++ trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-12-13 14:10:29 UTC
(rev 20528)
@@ -47,7 +47,7 @@
#{inplaceValue}
</span>
- <c:if test="#{!isDisable(inplaceState)}">
+ <c:if test="#{!component.attributes['disabled']}">
<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}"
@@ -83,9 +83,10 @@
</span>
<script type="text/javascript">
<cdk:scriptObject name="options">
- <cdk:scriptOption name="noneCss"
value="#{concatClasses('rf-ii-none',
component.attributes['noneClass'])}"/>
- <cdk:scriptOption name="changedCss"
value="#{concatClasses('rf-ii-c-s',
component.attributes['changedClass'])}"/>
- <cdk:scriptOption name="editCss"
value="#{concatClasses('rf-ii-e-s',
component.attributes['editClass'])}"/>
+ <cdk:scriptOption name="readyCss"
value="#{concatClasses('rf-ii-d-s',
component.attributes['readyStateClass'])}"/>
+ <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 attributes="onbegin oncomplete onerror
onbeforedomupdate onselectitem onchange onblur onfocus"
wrapper="eventHandler"/>
</cdk:scriptObject>
Modified: trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-12-13 13:53:13
UTC (rev 20527)
+++ trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-12-13 14:10:29
UTC (rev 20528)
@@ -43,7 +43,7 @@
#{inplaceValue}
</span>
- <c:if test="#{!isDisable(inplaceState)}">
+ <c:if test="#{!component.attributes['disabled']}">
<input id="#{clientId}Focus" type="image"
name="#{clientId}Focus" style="position: absolute; top: 0px; left: 0px;
outline-style: none;" class="rf-is-none" />
<span id="#{clientId}Edit" class="#{getEditStyleClass(component,
inplaceState)}">
@@ -78,7 +78,7 @@
</span>
</span>
</c:if>
- <span id="#{clientId}List" style="display: none"
class="rf-is-lst-cord">
+ <span id="#{clientId}List" style="display: none"
class="#{getListCss(component)}">
<cdk:call expression="renderListHandlers(facesContext,
component);"/>
<span class="rf-is-lst-pos" style="width:
#{component.attributes['listWidth']}">
<span class="rf-is-shdw">
@@ -100,9 +100,10 @@
<script type="text/javascript">
<cdk:scriptObject name="options">
<cdk:scriptOption name="items" value="#{clientSelectItems}"
/>
- <cdk:scriptOption name="noneCss"
value="#{concatClasses('rf-is-none',
component.attributes['noneClass'])}"/>
- <cdk:scriptOption name="changedCss"
value="#{concatClasses('rf-is-c-s',
component.attributes['changedClass'])}"/>
- <cdk:scriptOption name="editCss"
value="#{concatClasses('rf-is-e-s',
component.attributes['editClass'])}"/>
+ <cdk:scriptOption name="noneCss"
value="#{concatClasses('rf-is-none',
component.attributes['noneStateClass'])}"/>
+ <cdk:scriptOption name="changedCss"
value="#{concatClasses('rf-is-c-s',
component.attributes['changedStateClass'])}"/>
+ <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 attributes="editEvent state defaultLabel saveOnBlur
showControls openOnEdit saveOnSelect" />
<cdk:scriptOption attributes="onbegin oncomplete onerror
onbeforedomupdate onselectitem onchange onblur onfocus"
wrapper="eventHandler"/>
</cdk:scriptObject>