Author: konstantin.mishin
Date: 2009-06-24 13:28:18 -0400 (Wed, 24 Jun 2009)
New Revision: 14718
Modified:
branches/community/3.3.X/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java
branches/community/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
branches/community/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js
branches/community/3.3.X/ui/combobox/src/main/templates/combobox.jspx
Log:
RF-7398
Modified:
branches/community/3.3.X/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java
===================================================================
---
branches/community/3.3.X/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java 2009-06-24
17:12:01 UTC (rev 14717)
+++
branches/community/3.3.X/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java 2009-06-24
17:28:18 UTC (rev 14718)
@@ -87,7 +87,7 @@
}
}
- public List<Object> encodeItems(FacesContext context, UIComponent component)
throws IOException, IllegalArgumentException {
+ public List<Object> getItems(FacesContext context, UIComponent component)
throws IOException, IllegalArgumentException {
List <Object>values = new ArrayList<Object>();
if (isAcceptableComponent(component)) {
UIComboBox comboBox = (UIComboBox) component;
@@ -95,7 +95,6 @@
List<SelectItem> selectItems = SelectUtils.getSelectItems(context, component);
for (SelectItem selectItem : selectItems) {
String convertedValue = getConvertedStringValue(context, component,
selectItem.getValue());
- encodeSuggestion(context, comboBox, convertedValue, RICH_COMBOBOX_ITEM_CLASSES);
values.add(convertedValue);
}
}
@@ -111,14 +110,12 @@
Collection collection = (Collection) suggestionValues;
for (Object suggestionValue : collection) {
String convertedValue = getConvertedStringValue(context, combobox,
suggestionValue);
- encodeSuggestion(context, combobox, convertedValue, RICH_COMBOBOX_ITEM_CLASSES);
values.add(convertedValue);
}
} else if (suggestionValues.getClass().isArray()) {
Object[] suggestions = (Object[]) suggestionValues;
for (Object suggestionValue: suggestions) {
String convertedValue = getConvertedStringValue(context, combobox,
suggestionValue);
- encodeSuggestion(context, combobox, convertedValue, RICH_COMBOBOX_ITEM_CLASSES);
values.add(convertedValue);
}
} else {
@@ -137,30 +134,7 @@
return InputUtils.getConvertedStringValue(context, component, value);
}
- protected void encodeSuggestion(FacesContext context, UIComponent component, String
value, String classes) throws IOException {
- ResponseWriter writer = context.getResponseWriter();
- if(writer != null) {
- writer.startElement(HTML.SPAN_ELEM, component);
- writer.writeAttribute(HTML.class_ATTRIBUTE, classes, null);
- writer.writeText(value, null);
- writer.endElement(HTML.SPAN_ELEM);
- }
- }
-
protected boolean isAcceptableComponent(UIComponent component) {
return component != null &&
this.getComponentClass().isAssignableFrom(component.getClass());
}
-
- public String getItemsTextAsJSArray(FacesContext context, UIComponent component, List
items) {
- return ScriptUtils.toScript(items);
- }
-
- public String getAsEventHandler(FacesContext context, UIComponent component, String
attributeName) {
- JSFunctionDefinition script = getUtils().getAsEventHandler(context, component,
attributeName, null);
- return ScriptUtils.toScript(script);
- }
-
- public String encodeValue(String value){
- return ScriptUtils.toScript(value);
- }
}
Modified:
branches/community/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
===================================================================
---
branches/community/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2009-06-24
17:12:01 UTC (rev 14717)
+++
branches/community/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2009-06-24
17:28:18 UTC (rev 14718)
@@ -4,62 +4,53 @@
Richfaces.ComboBox.prototype = {
- initialize: function(combobox, listId, parentListId, valueFieldId, fieldId, buttonId,
buttonBGId, shadowId, commonStyles, userStyles,
- listWidth, listHeight, itemsText, directInputSuggestions, filterNewValue,
- selectFirstOnUpdate, onlistcall, onlistclose, onselected, defaultMessage,
isDisabled, value,
- showDelay, hideDelay, onchange) {
-
- this.directInputSuggestions = directInputSuggestions;
- this.filterNewValue = filterNewValue;
- this.combobox = $(combobox);
- this.comboValue = document.getElementById(valueFieldId);
- this.field = document.getElementById(fieldId);
+ //default values
+ filterNewValues : true,
+ defaultLabel : "",
+
+ initialize: function(id, options) {
+ options = options || {};
+ Object.extend(this, options.fields);
+ this.combobox = $(id);
+ this.comboValue = document.getElementById(id + "comboboxValue");
+ this.field = document.getElementById(id + "comboboxField");
this.tempItem;
- this.onchange = onchange;
this.BUTTON_WIDTH = 17; //px
- this.classes = Richfaces.mergeStyles(userStyles,commonStyles.getCommonStyles());
+ this.classes = Richfaces.mergeStyles(options.userStyles,new
Richfaces.ComboBoxStyles().getCommonStyles());
- this.button = document.getElementById(buttonId);
- this.buttonBG = document.getElementById(buttonBGId);
+ this.button = document.getElementById(id + "comboboxButton");
+ this.buttonBG = document.getElementById(id + "comboBoxButtonBG");
this.setInputWidth();
- listWidth = (!listWidth) ? this.getCurrentWidth() : listWidth;
+ var listOptions = options.listOptions || {};
+ listOptions.listWidth = listOptions.listWidth || this.getCurrentWidth();
+ this.comboList = new Richfaces.ComboBoxList(id, this.filterNewValues,
this.classes.combolist, listOptions);
- this.comboList = new Richfaces.ComboBoxList(listId, parentListId, selectFirstOnUpdate,
filterNewValue, this.classes.combolist, listWidth,
- listHeight, itemsText, onlistcall, onlistclose, fieldId, shadowId,
showDelay, hideDelay);
- this.defaultMessage = defaultMessage;
-
- if (value) {
- var item = this.comboList.findItemBySubstr(value);
+ if (options.value) {
+ var item = this.comboList.findItemBySubstr(options.value);
if (item) {
this.comboList.doSelectItem(item);
}
// RF-5056
- this.comboValue.value = value;
+ this.comboValue.value = options.value;
} else {
- if (this.defaultMessage) {
+ if (this.defaultLabel) {
this.applyDefaultText();
}
}
- this.onselected = onselected;
this.isSelection = true;
- this.isDisabled = isDisabled;
if (this.onselected) {
this.combobox.observe("rich:onselect", this.onselected);
}
- if (this.isDisabled) {
+ if (this.disabled) {
this.disable(); //TODO rename to 'disable'
}
- if (Richfaces.browser.isIE6) {
- this.comboList.createIframe(this.comboList.listParent.parentNode, listWidth,
this.combobox.id,
- "rich-combobox-list-width rich-combobox-list-scroll
rich-combobox-list-position");
- }
this.combobox.component = this;
this.initHandlers();
this["rich:destructor"] = "destroy";
@@ -274,7 +265,7 @@
fieldFocusHandler : function() {
this.doActive();
- if ((this.field.value == this.defaultMessage) && (this.comboValue.value ==
"")) {
+ if ((this.field.value == this.defaultLabel) && (this.comboValue.value ==
"")) {
this.field.value = "";
} else {
if (this.isSelection) {
@@ -311,7 +302,7 @@
dataUpdating : function(event) {
if (Richfaces.ComboBox.SPECIAL_KEYS.indexOf(event.keyCode) == -1) {
- if (this.filterNewValue) {
+ if (this.filterNewValues) {
this.comboList.hideWithDelay();
this.comboList.dataFilter(this.field.value);
if (this.comboList.getItems() && this.comboList.getItems().length != 0) {
@@ -401,7 +392,7 @@
applyDefaultText : function() {
this.field.className = this.classes.field.classes.disabled;
- this.field.value = this.defaultMessage;
+ this.field.value = this.defaultLabel;
this.comboValue.value = "";
},
@@ -424,7 +415,7 @@
this.field.className = this.classes.field.classes.active;
Element.setStyle(this.field, this.classes.field.style.active);
- this.isDisabled = false;
+ this.disabled = false;
},
disable : function() {
@@ -446,7 +437,7 @@
this.button.disabled = true;
this.field.disabled = true;
- this.isDisabled = true;
+ this.disabled = true;
},
enable : function() {
@@ -468,7 +459,7 @@
this.button.disabled = false;
this.field.disabled = false;
- this.isDisabled = false;
+ this.disabled = false;
},
doDisable : function() {
@@ -487,7 +478,7 @@
* user's JavaScript API
*/
showList : function() {
- if (this.isDisabled) {
+ if (this.disabled) {
return;
}
this.field.focus();
Modified:
branches/community/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js
===================================================================
---
branches/community/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js 2009-06-24
17:12:01 UTC (rev 14717)
+++
branches/community/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js 2009-06-24
17:28:18 UTC (rev 14718)
@@ -1,19 +1,26 @@
if(!window.Richfaces) window.Richfaces = {};
Richfaces.ComboBoxList = Class.create();
Richfaces.ComboBoxList.prototype = {
-
- initialize: function(listId, parentListId, selectFirstOnUpdate, filterNewValues,
classes, width, height, itemsText, onlistcall, onlistclose, fieldId,
shadowId,decorationId,
- showDelay, hideDelay) {
-
- this.list = document.getElementById(listId);
- this.listParent = $(parentListId);
+
+ //default values
+ selectFirstOnUpdate : true,
+ listHeight : "200px",
+ itemsText : [],
+ showDelay : 0,
+ hideDelay : 0,
+
+ initialize: function(id, filterNewValues, classes, options) {
+
+ Object.extend(this, options);
+ this.list = document.getElementById(id + "list");
+ this.listParent = $(id + "listParent");
this.listParentContainer = this.listParent.parentNode;
this.iframe = null;
- this.fieldElem = document.getElementById(fieldId);
- this.itemsText = itemsText;
- this.shadowElem = document.getElementById(shadowId);
- this.onlistcall = onlistcall;
- this.onlistclose = onlistclose;
+ this.fieldElem = document.getElementById(id + "comboboxField");
+ //this.itemsText = itemsText || [];
+ this.shadowElem = document.getElementById(id + "shadow");
+ //this.onlistcall = onlistcall;
+ //this.onlistclose = onlistclose;
if (this.onlistcall) {
this.listParent.observe("rich:onlistcall", this.onlistcall);
@@ -23,7 +30,7 @@
this.listParent.observe("rich:onlistclose", this.onlistclose);
}
- this.selectFirstOnUpdate = selectFirstOnUpdate;
+ //this.selectFirstOnUpdate = selectFirstOnUpdate;
this.filterNewValues = filterNewValues;
this.isList = false;
@@ -33,15 +40,19 @@
this.selectedItem = null;
this.activeItem = null;
- this.showDelay = showDelay;
- this.hideDelay = hideDelay;
+ //this.showDelay = showDelay;
+ //this.hideDelay = hideDelay;
this.classes = classes;
- this.width = width;
- this.height = height;
+ //this.listWidth = width;
+ //this.listHeight = height;
this.initDimensions();
this.scrollElements = null;
this.eventOnScroll = this.eventOnScroll.bindAsEventListener(this);
+ if (Richfaces.browser.isIE6) {
+ this.createIframe(this.listParent.parentNode, this.listWidth, id,
+ "rich-combobox-list-width rich-combobox-list-scroll
rich-combobox-list-position");
+ }
},
initDimensions : function() {
@@ -177,7 +188,7 @@
},
setSize : function() {
- var height = this.height;
+ var height = this.listHeight;
var currentItemsHeight;
var rowsAmount;
@@ -188,8 +199,8 @@
rowsAmount = this.getItems().length;
currentItemsHeight = itemHeight * rowsAmount;
- if (this.height) {
- if (parseInt(this.height) > currentItemsHeight) {
+ if (this.listHeight) {
+ if (parseInt(this.listHeight) > currentItemsHeight) {
height = currentItemsHeight;
}
} else {
@@ -207,7 +218,7 @@
if (this.shadowElem) {
if (!Richfaces.browser.isIE6) {
// shadow offset
- this.shadowElem.style.width = (parseInt(this.width) + 7) + "px";
+ this.shadowElem.style.width = (parseInt(this.listWidth) + 7) + "px";
this.shadowElem.style.height = (parseInt(height) + 9)+ "px";
} else {
this.shadowElem.style.visibility = "hidden";
@@ -216,7 +227,7 @@
if (this.iframe) {
this.iframe.style.height = height;
}
- this.setWidth(this.width);
+ this.setWidth(this.listWidth);
}
},
Modified: branches/community/3.3.X/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- branches/community/3.3.X/ui/combobox/src/main/templates/combobox.jspx 2009-06-24
17:12:01 UTC (rev 14717)
+++ branches/community/3.3.X/ui/combobox/src/main/templates/combobox.jspx 2009-06-24
17:28:18 UTC (rev 14718)
@@ -29,12 +29,6 @@
<jsp:scriptlet>
<![CDATA[
- Boolean directInputSuggestions = (Boolean)
component.getAttributes().get("directInputSuggestions");
- variables.setVariable("directInputSuggestions",
directInputSuggestions);
-
- Boolean filterNewValues = (Boolean)
component.getAttributes().get("filterNewValues");
- variables.setVariable("filterNewValues", filterNewValues);
-
Boolean disabled = (Boolean)
component.getAttributes().get("disabled");
variables.setVariable("disabled", disabled);
@@ -65,8 +59,6 @@
String listWidth = (String) component.getAttributes().get("listWidth");
if (listWidth == null || listWidth.length() == 0 ||
listWidth.trim().startsWith("0")) {
- // String listCorrection = width.substring(0,width.indexOf("px"));
- // listCorrection = (Integer.parseInt(listCorrection) - 2) + "px";
listWidth = width;
} else {
listWidth = HtmlUtil.qualifySize(listWidth);
@@ -77,12 +69,6 @@
String inputSize = (String) component.getAttributes().get("inputSize");
variables.setVariable("inputSize", inputSize);
- String defaultLabel = (String)
component.getAttributes().get("defaultLabel");
- variables.setVariable("defaultLabel", defaultLabel);
-
- Boolean selectFirstOnUpdate = (Boolean)
component.getAttributes().get("selectFirstOnUpdate");
- variables.setVariable("selectFirstOnUpdate", selectFirstOnUpdate);
-
Object value = component.getSubmittedValue();
if (value == null) {
value = component.getAttributes().get("value");
@@ -92,96 +78,17 @@
value = getConvertedStringValue(context, component,value);
if ("".equals(value)) {
valueStyle = "rich-combobox-font-disabled";
- //value = defaultLabel;
}
variables.setVariable("value", value);
- String convertedValue = encodeValue((String)value);
- variables.setVariable("convertedValue", convertedValue);
variables.setVariable("valueStyle", valueStyle);
- Object inputStyle = component.getAttributes().get("inputStyle");
- variables.setVariable("inputStyle", inputStyle);
-
- Object inputClass = component.getAttributes().get("inputClass");
- if("".equals(inputClass)) {
- inputClass = null;
- }
- variables.setVariable("inputClass", inputClass);
-
- Object inputDisabledStyle =
component.getAttributes().get("inputDisabledStyle");
- variables.setVariable("inputDisabledStyle", inputDisabledStyle);
-
- Object inputDisabledClass =
component.getAttributes().get("inputDisabledClass");
- if("".equals(inputDisabledClass)) {
- inputDisabledClass = null;
- }
- variables.setVariable("inputDisabledClass", inputDisabledClass);
-
- Object inputInactiveStyle =
component.getAttributes().get("inputInactiveStyle");
- variables.setVariable("inputInactiveStyle", inputInactiveStyle);
-
- Object inputInactiveClass =
component.getAttributes().get("inputInactiveClass");
- if("".equals(inputInactiveClass)) {
- inputInactiveClass = null;
- }
- variables.setVariable("inputInactiveClass", inputInactiveClass);
-
-
- Object buttonInactiveClass =
component.getAttributes().get("buttonInactiveClass");
- if("".equals(buttonInactiveClass)) {
- buttonInactiveClass = null;
- }
- variables.setVariable("buttonInactiveClass", buttonInactiveClass);
-
- Object buttonInactiveStyle =
component.getAttributes().get("buttonInactiveStyle");
- variables.setVariable("buttonInactiveStyle", buttonInactiveStyle);
-
- Object buttonDisabledClass =
component.getAttributes().get("buttonDisabledClass");
- if("".equals(buttonDisabledClass)) {
- buttonDisabledClass = null;
- }
- variables.setVariable("buttonDisabledClass", buttonDisabledClass);
-
- Object buttonDisabledStyle =
component.getAttributes().get("buttonDisabledStyle");
- variables.setVariable("buttonDisabledStyle", buttonDisabledStyle);
-
- Object buttonClass = component.getAttributes().get("buttonClass");
- if("".equals(buttonClass)) {
- buttonClass = null;
- }
- variables.setVariable("buttonClass", buttonClass);
-
- Object buttonStyle = component.getAttributes().get("buttonStyle");
- variables.setVariable("buttonStyle", buttonStyle);
-
- Object listStyle = component.getAttributes().get("listStyle");
- variables.setVariable("listStyle", listStyle);
-
- Object listClass = component.getAttributes().get("listClass");
- if("".equals(listClass)) {
- listClass = null;
- }
- variables.setVariable("listClass", listClass);
-
Object styleClass = component.getAttributes().get("styleClass");
variables.setVariable("styleClass", styleClass);
Object style = component.getAttributes().get("style");
variables.setVariable("style", style);
-
- Object itemClass = component.getAttributes().get("itemClass");
- if("".equals(itemClass)) {
- itemClass = null;
- }
- variables.setVariable("itemClass", itemClass);
-
- Object itemSelectedClass =
component.getAttributes().get("itemSelectedClass");
- if("".equals(itemSelectedClass)) {
- itemSelectedClass = null;
- }
- variables.setVariable("itemSelectedClass", itemSelectedClass);
-
+
String buttonIcon = (String)component.getAttributes().get("buttonIcon");
if (!"".equals(buttonIcon)) {
buttonIcon = "url('" + getResource(buttonIcon).getUri(context,
component) + "')";
@@ -212,12 +119,12 @@
<input id="#{clientId}comboboxField"
name="#{clientId}comboboxField"
disabled="#{disabled}"
- class="#{valueStyle} rich-combobox-input-inactive
#{inputInactiveClass}" type="text"
+ class="#{valueStyle} rich-combobox-input-inactive
#{component.attributes['inputInactiveClass']}" type="text"
readonly="#{enableManualInput}"
value="#{value}"
x:onblur="#{component.attributes['onblur']}"
onfocus = "#{component.attributes['onfocus']}"
- style="width:#{correction}; #{inputInactiveStyle}"
+ style="width:#{correction};
#{component.attributes['inputInactiveStyle']}"
autocomplete="off"
tabindex="#{component.attributes['tabindex']}"
/>
@@ -233,12 +140,12 @@
disabled="#{disabled}"
type="text"
value=""
- style="#{buttonStyle}; background-image: #{buttonIconInactive};"
+ style="#{component.attributes['buttonStyle']}; background-image:
#{buttonIconInactive};"
class="rich-combobox-font-inactive rich-combobox-button-icon-inactive
rich-combobox-button-inactive #{buttonInactiveClass}"/>
<div class="rich-combobox-strut rich-combobox-font"
style="width:#{correction}">Strut</div>
</div>
- <div id="#{clientId}listParent" class="rich-combobox-list-cord
#{listClass}" style="display:none; #{listStyle};
position:absolute;z-index:1000;">
+ <div id="#{clientId}listParent" class="rich-combobox-list-cord
#{component.attributes['listClass']}" style="display:none;
#{component.attributes['listStyle']}; position:absolute;z-index:1000;">
<div class="rich-combobox-shadow">
<table id="#{clientId}shadow" cellpadding="0"
cellspacing="0" border="0">
<tr>
@@ -262,8 +169,6 @@
<div id="#{clientId}listPosition"
class="rich-combobox-list-position">
<div id="#{clientId}listDecoration"
class="rich-combobox-list-decoration">
<div id="#{clientId}list"
class="rich-combobox-list-scroll">
- <c:object type="java.util.List" var="items"
value="#{this:encodeItems(context,component)}">
- </c:object>
</div>
</div>
</div>
@@ -277,89 +182,84 @@
</div>
-
+ <c:scriptObject var="classes">
+ <c:scriptOption name="normal"
value="#{component.attributes['buttonInactiveClass']}" />
+ <c:scriptOption name="active"
value="#{component.attributes['buttonClass']}" />
+ <c:scriptOption name="disabled"
value="#{component.attributes['buttonDisabledClass']}" />
+ </c:scriptObject>
+ <c:scriptObject var="style1">
+ <c:scriptOption name="normal"
value="#{component.attributes['buttonInactiveStyle']}" />
+ <c:scriptOption name="active"
value="#{component.attributes['buttonStyle']}" />
+ <c:scriptOption name="disabled"
value="#{component.attributes['buttonDisabledStyle']}" />
+ </c:scriptObject>
+ <c:scriptObject var="button">
+ <c:scriptOption variables="classes" />
+ <c:scriptOption name="style" value="#{style1}" />
+ </c:scriptObject>
+ <c:scriptObject var="style2">
+ <c:scriptOption name="normal" value="#{buttonIconInactive}"
/>
+ <c:scriptOption name="active" value="#{buttonIcon}" />
+ <c:scriptOption name="disabled" value="#{buttonIconDisabled}"
/>
+ </c:scriptObject>
+ <c:scriptObject var="buttonicon">
+ <c:scriptOption name="style" value="#{style2}" />
+ </c:scriptObject>
+ <c:scriptObject var="classes2">
+ <c:scriptOption name="normal"
value="#{component.attributes['inputInactiveClass']}" />
+ <c:scriptOption name="active"
value="#{component.attributes['inputClass']}" />
+ <c:scriptOption name="disabled"
value="#{component.attributes['inputDisabledClass']}" />
+ </c:scriptObject>
+ <c:scriptObject var="style3">
+ <c:scriptOption name="normal"
value="#{component.attributes['inputInactiveStyle']}" />
+ <c:scriptOption name="active"
value="#{component.attributes['inputStyle']}" />
+ <c:scriptOption name="disabled"
value="#{component.attributes['inputDisabledStyle']}" />
+ </c:scriptObject>
+ <c:scriptObject var="field">
+ <c:scriptOption name="classes" value="#{classes2}" />
+ <c:scriptOption name="style" value="#{style3}" />
+ </c:scriptObject>
+ <c:scriptObject var="classes3">
+ <c:scriptOption name="active"
value="#{component.attributes['listClass']}" />
+ </c:scriptObject>
+ <c:scriptObject var="style4">
+ <c:scriptOption name="active"
value="#{component.attributes['listStyle']}" />
+ </c:scriptObject>
+ <c:scriptObject var="list">
+ <c:scriptOption name="classes" value="#{classes3}" />
+ <c:scriptOption name="style" value="#{style4}" />
+ </c:scriptObject>
+ <c:scriptObject var="item">
+ <c:scriptOption name="normal"
value="#{component.attributes['itemClass']}" />
+ <c:scriptOption name="selected"
value="#{component.attributes['itemSelectedClass']}" />
+ </c:scriptObject>
+ <c:scriptObject var="combolist">
+ <c:scriptOption variables="list, item" />
+ </c:scriptObject>
+ <c:scriptObject var="userStyles">
+ <c:scriptOption variables="button, buttonicon, field, combolist" />
+ </c:scriptObject>
+ <c:scriptObject var="listOptions">
+ <c:scriptOption variables="listWidth" />
+ <c:scriptOption variables="listHeight"
defaultValue="200px"/>
+ <c:scriptOption name="itemsText"
value="#{this:getItems(context,component)}" />
+ <c:scriptOption attributes="onlistcall, onlistclose"
wrapper="eventHandler"/>
+ <c:scriptOption attributes="selectFirstOnUpdate"
defaultValue="true"/>
+ <c:scriptOption attributes="showDelay, hideDelay"
defaultValue="0"/>
+ </c:scriptObject>
+ <c:scriptObject var="fields">
+ <c:scriptOption attributes="directInputSuggestions, defaultLabel"
variables="disabled" />
+ <c:scriptOption attributes="filterNewValues"
defaultValue="true"/>
+ <c:scriptOption attributes="onselect, onchange"
wrapper="eventHandler"/>
+ </c:scriptObject>
+ <c:scriptObject var="options">
+ <c:scriptOption variables="userStyles, listOptions, fields, value" />
+ </c:scriptObject>
<script type="text/javascript">
-
- var clientId = '#{clientId}';
-
-
- var comboboxUserStyles = {
- button : {
- classes :
- {
- normal: "#{buttonInactiveClass}",
- active: "#{buttonClass}",
- disabled: "#{buttonDisabledClass}"
- },
- style :
- {
- normal: "#{buttonInactiveStyle}",
- active: "#{buttonStyle}",
- disabled: "#{buttonDisabledStyle}"
- }
- },
- buttonicon : {
- style :
- {
- normal: "#{buttonIconInactive}",
- active: "#{buttonIcon}",
- disabled: "#{buttonIconDisabled}"
- }
- },
- field : {
- classes :
- {
- normal: "#{inputInactiveClass}",
- active: "#{inputClass}",
- disabled: "#{inputDisabledClass}"
- },
- style :
- {
- normal : "#{inputInactiveStyle}",
- active : "#{inputStyle}",
- disabled : "#{inputDisabledStyle}"
- }
- },
- combolist : {
- list: {
- classes:
- {
- active: "#{listClass}"
- },
- style:
- {
- active: "'#{listStyle}"
- }
- },
- item: {
- normal : "#{itemClass}",
- selected: "#{itemSelectedClass}"
- }
- }
- };
-
-
- var combobox = new Richfaces.ComboBox( "#{clientId}",
- "#{clientId}list",
- "#{clientId}listParent",
- "#{clientId}comboboxValue",
- "#{clientId}comboboxField",
- "#{clientId}comboboxButton",
- "#{clientId}comboBoxButtonBG",
- "#{clientId}shadow",
- new Richfaces.ComboBoxStyles(),
- comboboxUserStyles,
- "#{listWidth}", "#{listHeight}",
- #{this:getItemsTextAsJSArray(context, component,items)},
- #{directInputSuggestions},
- #{filterNewValues},
- #{selectFirstOnUpdate},
- #{this:getAsEventHandler(context, component, "onlistcall")},
- #{this:getAsEventHandler(context, component, "onlistclose")},
- #{this:getAsEventHandler(context, component, "onselect")},
- "#{defaultLabel}",
- #{disabled}, #{convertedValue},
- #{component.attributes["showDelay"]},
#{component.attributes["hideDelay"]}, #{this:getAsEventHandler(context,
component, "onchange")});
+ new Richfaces.ComboBox("#{clientId}"
+ <c:if test="#{not empty options}">
+ , <f:writeAsScript value="#{options}" />
+ </c:if>
+ );
</script>
</div>
</f:root>