Author: dmorozov
Date: 2008-10-28 11:04:43 -0400 (Tue, 28 Oct 2008)
New Revision: 10945
Modified:
trunk/ui/inplaceSelect/src/main/java/org/richfaces/component/UIInplaceSelect.java
trunk/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
Log:
https://jira.jboss.org/jira/browse/RF-4302
Modified:
trunk/ui/inplaceSelect/src/main/java/org/richfaces/component/UIInplaceSelect.java
===================================================================
---
trunk/ui/inplaceSelect/src/main/java/org/richfaces/component/UIInplaceSelect.java 2008-10-28
15:03:43 UTC (rev 10944)
+++
trunk/ui/inplaceSelect/src/main/java/org/richfaces/component/UIInplaceSelect.java 2008-10-28
15:04:43 UTC (rev 10945)
@@ -32,4 +32,6 @@
public abstract class UIInplaceSelect extends UISelectOne{
public static final String COMPONENT_TYPE = "org.richfaces.InplaceSelect";
public static final String COMPONENT_FAMILY =
"org.richfaces.InplaceSelect";
+ public abstract boolean isShowValueInView();
+ public abstract void setShowValueInView(boolean showValueInView);
}
Modified:
trunk/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
===================================================================
---
trunk/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2008-10-28
15:03:43 UTC (rev 10944)
+++
trunk/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2008-10-28
15:04:43 UTC (rev 10945)
@@ -137,14 +137,14 @@
return getItemLabel(context, component, value);
}
- protected String getItemLabel(FacesContext context, UIComponent component, Object
value) {
+ protected String getItemLabel(FacesContext context, UIInplaceSelect component, Object
value) {
String itemLabel = null;
// TODO: SelectUtils.getSelectItems is called minimum twice during encode
List<SelectItem> selectItems = SelectUtils.getSelectItems(context, component);
if (!selectItems.isEmpty()) {
for (SelectItem item : selectItems) {
if (value.equals(item.getValue())) {
- itemLabel = item.getLabel();
+ itemLabel = component.isShowValueInView() ? getConvertedStringValue(context,
component, item.getValue()) : item.getLabel();
break;
}
}
Modified:
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
===================================================================
---
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-10-28
15:03:43 UTC (rev 10944)
+++
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-10-28
15:04:43 UTC (rev 10945)
@@ -3,6 +3,7 @@
initialize : function($super, listObj, clientId, temValueKeepId, valueKeepId, tabberId,
attributes, events, userStyles, commonStyles, barParams, buttonId) {
this.button = $(buttonId);
this.comboList = listObj;
+ this.showValueInView = attributes.showValueInView;
$super(clientId, temValueKeepId, valueKeepId, tabberId, attributes, events, userStyles,
commonStyles, barParams);
this.clickOnBar = false;
this.inplaceSelect = $(clientId);
@@ -233,6 +234,9 @@
if (this.comboList.activeItem) {
var userLabel = this.comboList.activeItem.innerHTML.unescapeHTML();
this.currentItemValue = this.comboList.activeItem.value;
+ if(this.showValueInView) {
+ userLabel = this.currentItemValue;
+ }
this.tempValueKeeper.value = userLabel;
this.comboList.selectedItem = this.comboList.activeItem;
}
@@ -280,7 +284,8 @@
this.comboList.hide();
if (item) {
this.comboList.doSelectItem(item);
- $super(e, item.innerHTML.unescapeHTML());
+ var value = this.showValueInView ? this.valueKeeper.value :
item.innerHTML.unescapeHTML();
+ $super(e, value);
} else {
$super(e, "");
}
Modified: trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
===================================================================
--- trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-10-28 15:03:43 UTC
(rev 10944)
+++ trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-10-28 15:04:43 UTC
(rev 10945)
@@ -37,13 +37,13 @@
value = component.getAttributes().get("value");
value = getConvertedStringValue(context, component,value);
}
+
+ String fieldValue = (String)value;
String fieldLabel = getSelectedItemLabel(context, component);
- String fieldValue = (String)value;
-
- if (value == null || value.equals("")) {
+
+ if (value == null || value.equals("")) {
fieldValue = "";
}
-
String encodedFieldValue = encodeValue(fieldValue);
@@ -231,7 +231,8 @@
minInputWidth :
'#{component.attributes["minSelectWidth"]}',
maxInputWidth :
'#{component.attributes["maxSelectWidth"]}',
openOnEdit: #{component.attributes["openOnEdit"]},
- closeOnSelect: true},
+ showValueInView: #{component.attributes["showValueInView"]},
+ closeOnSelect: true},
{oneditactivation : #{this:getAsEventHandler(context, component,
"oneditactivation")},
onviewactivation : #{this:getAsEventHandler(context, component,
"onviewactivation")},
oneditactivated : #{this:getAsEventHandler(context, component,
"oneditactivated")},