JBoss Rich Faces SVN: r5154 - trunk/ui/menu-components/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-01-04 15:52:15 -0500 (Fri, 04 Jan 2008)
New Revision: 5154
Modified:
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
Log:
http://jira.jboss.com/jira/browse/RF-1826
Modified: trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
===================================================================
--- trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2008-01-04 19:44:57 UTC (rev 5153)
+++ trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2008-01-04 20:52:15 UTC (rev 5154)
@@ -62,9 +62,10 @@
$('#{clientId}:icon').className='dr-menu-icon dr-menu-icon-selected rich-menu-item-icon rich-menu-item-icon-selected #{component.attributes['iconClass']}';
$('#{clientId}:anchor').className='rich-menu-item-label rich-menu-item-label-selected';"
style="#{component.attributes['style']}"
- onclick="this.className='dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled #{component.attributes['styleClass']}'; #{onselect} #{onclick}">
+ onclick="this.className='dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled #{component.attributes['styleClass']}'; #{onselect} #{onclick}; Event.stop(event);"
+ onmouseup="Event.stop(event); #{component.attributes['onmouseup']}">
<f:call name="utils.encodeAttributes">
- <f:parameter value="onmousedown,onmouseup,onmousemove" />
+ <f:parameter value="onmousedown,onmousemove" />
</f:call>
<jsp:scriptlet><![CDATA[
16 years, 3 months
JBoss Rich Faces SVN: r5153 - trunk/ui/dataTable/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2008-01-04 14:44:57 -0500 (Fri, 04 Jan 2008)
New Revision: 5153
Modified:
trunk/ui/dataTable/src/main/config/component/column.xml
Log:
http://jira.jboss.com/jira/browse/RF-1763
Modified: trunk/ui/dataTable/src/main/config/component/column.xml
===================================================================
--- trunk/ui/dataTable/src/main/config/component/column.xml 2008-01-04 19:44:23 UTC (rev 5152)
+++ trunk/ui/dataTable/src/main/config/component/column.xml 2008-01-04 19:44:57 UTC (rev 5153)
@@ -64,9 +64,8 @@
<name>width</name>
<classname>java.lang.String</classname>
<description>
- Attribute defines width of column. Default value is "100px".
+ Attribute defines width of column.
</description>
- <defaultvalue>"100px"</defaultvalue>
</property>
<property>
16 years, 3 months
JBoss Rich Faces SVN: r5152 - trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2008-01-04 14:44:23 -0500 (Fri, 04 Jan 2008)
New Revision: 5152
Modified:
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
Log:
http://jira.jboss.com/jira/browse/RF-1763
Modified: trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
===================================================================
--- trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2008-01-04 19:15:18 UTC (rev 5151)
+++ trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2008-01-04 19:44:23 UTC (rev 5152)
@@ -72,7 +72,7 @@
int width = 0;
- String widthPx = (String)column.getAttributes().get("width");
+ String widthPx = getColumnWidth(column);
widthPx = getFormattedWidth(widthPx);
prevWidth = state.getSumWidth();
width = prevWidth + Integer.parseInt(widthPx);
@@ -86,7 +86,7 @@
public void renderContent(FacesContext context, UIComponent column, ResponseWriter writer, ScrollableDataTableRendererState state) throws IOException {
writer.startElement("col", column);
- getUtils().writeAttribute(writer, "width", column.getAttributes().get("width"));
+ getUtils().writeAttribute(writer, "width", getColumnWidth(column));
getUtils().writeAttribute(writer, "style", column.getAttributes().get("style"));
//int cell_index = state.getCellIndex();
//Object columnClass = state.getColumnClass(cell_index);
@@ -108,7 +108,7 @@
ComponentVariables variables =
ComponentsVariableResolver.getVariables(headerCellTemplate, column);
- String widthPx = (String)column.getAttributes().get("width");
+ String widthPx = getColumnWidth(column);
widthPx = getFormattedWidth(widthPx);
int width = Integer.parseInt(widthPx);
@@ -956,4 +956,11 @@
return sorting;
}
+ private String getColumnWidth(UIComponent column) {
+ String width = (String) column.getAttributes().get("width");
+ if (width == null) {
+ width = "100px";
+ }
+ return width;
+ }
}
16 years, 3 months
JBoss Rich Faces SVN: r5151 - in trunk/ui/modal-panel/src/main: templates/org/richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-01-04 14:15:18 -0500 (Fri, 04 Jan 2008)
New Revision: 5151
Modified:
trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss
trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
Log:
http://jira.jboss.com/jira/browse/RF-1806
Modified: trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss
===================================================================
--- trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss 2008-01-04 18:34:33 UTC (rev 5150)
+++ trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss 2008-01-04 19:15:18 UTC (rev 5151)
@@ -42,7 +42,9 @@
.dr-mpnl-header {
height: 20px;
- /*position: absolute;*/
+ width: 100%;
+ vertical-align: middle;
+ z-index: 5;
}
.dr-mpnl-pnl-a {
Modified: trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
===================================================================
--- trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2008-01-04 18:34:33 UTC (rev 5150)
+++ trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2008-01-04 19:15:18 UTC (rev 5151)
@@ -81,7 +81,7 @@
<![CDATA[if(component.getFacet("header")!=null && component.getFacet("header").isRendered()) {]]>
</jsp:scriptlet>
<tr style="height: 1%;">
- <td class="dr-mpnl-header rich-mpnl-header-cell" style="position: relative; vertical-align: middle; z-index: 5;" width="100%">
+ <td class="dr-mpnl-header rich-mpnl-header-cell" >
<jsp:scriptlet>
<![CDATA[if(component.getFacet("controls")!=null && component.getFacet("controls").isRendered()) {]]>
</jsp:scriptlet>
16 years, 3 months
JBoss Rich Faces SVN: r5150 - trunk/framework/impl/src/main/javacc.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-01-04 13:34:33 -0500 (Fri, 04 Jan 2008)
New Revision: 5150
Modified:
trunk/framework/impl/src/main/javacc/RichMacroDefinition.jj
Log:
http://jira.jboss.com/jira/browse/RF-1665
Modified: trunk/framework/impl/src/main/javacc/RichMacroDefinition.jj
===================================================================
--- trunk/framework/impl/src/main/javacc/RichMacroDefinition.jj 2008-01-04 18:23:38 UTC (rev 5149)
+++ trunk/framework/impl/src/main/javacc/RichMacroDefinition.jj 2008-01-04 18:34:33 UTC (rev 5150)
@@ -5,6 +5,7 @@
options {
JDK_VERSION="1.3";
STATIC = false;
+ UNICODE_INPUT = true;
}
PARSER_BEGIN(RichMacroDefinition)
16 years, 3 months
JBoss Rich Faces SVN: r5149 - trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-01-04 13:23:38 -0500 (Fri, 04 Jan 2008)
New Revision: 5149
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js
Log:
latest version
Modified: trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js
===================================================================
--- trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js 2008-01-04 18:23:12 UTC (rev 5148)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js 2008-01-04 18:23:38 UTC (rev 5149)
@@ -0,0 +1,14 @@
+if (!window.Richfaces) window.Richfaces = {};
+
+Richfaces.getDocumentHeight = function() {
+ if (self.innerHeight) { // all except Explorer
+ return self.innerHeight;
+ }
+ else if (document.documentElement && document.documentElement.clientHeight) {
+ // Explorer 6 Strict Mode
+ return document.documentElement.clientHeight;
+ }
+ else if (document.body) { // other Explorers
+ return document.body.clientHeight;
+ }
+}
\ No newline at end of file
16 years, 3 months
JBoss Rich Faces SVN: r5148 - in trunk/sandbox/ui/combobox/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-01-04 13:23:12 -0500 (Fri, 04 Jan 2008)
New Revision: 5148
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
Log:
latest version
Modified: trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss
===================================================================
--- trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss 2008-01-04 18:16:08 UTC (rev 5147)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss 2008-01-04 18:23:12 UTC (rev 5148)
@@ -6,13 +6,19 @@
<f:verbatim>
<![CDATA[
+.rich-combobox-button-disabled {
+}
+
+.rich-combobox-field-disabled {
+}
+
.rich-combobox-list {
z-index: 1000;
overflow: auto;
white-space:nowrap;
}
-.cb_list_position{ position : absolute; top:-5px; left:0px;}
+.cb_list_position{ position : absolute;}
.cb_list_decoration{ border : 1px solid #c0c0c0 /*panelBorderColor*/; padding : 0px; background : #FFFFFF; /*tableBackgroundColor*/}
.cb_list_scroll{ overflow : auto;}
.cb_list_cord{ position : relative; font-size : 0px; /*display:none;*/ top: 2px;}/*DDL is hidden!!!!!*/
Modified: trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
===================================================================
--- trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-01-04 18:16:08 UTC (rev 5147)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-01-04 18:23:12 UTC (rev 5148)
@@ -3,14 +3,17 @@
Richfaces.ComboBox.prototype = {
- initialize: function(combobox, listId, fieldId, buttonId, classes, listWidth, listHeight, itemsText, directInputSuggestions, filterNewValue, onlistcall, onselected, defaultMessage) {
+ initialize: function(combobox, listId, parentListId, fieldId, buttonId, classes, listWidth, listHeight, itemsText, directInputSuggestions, filterNewValue, onlistcall, onselected, defaultMessage) {
this.directInputSuggestions = directInputSuggestions;
this.filterNewValue = filterNewValue;
this.combobox = $(combobox);
- this.comboList = new Richfaces.ComboBoxList(listId, classes, listWidth, listHeight, itemsText, onlistcall);
this.field = $(fieldId);
this.button = $(buttonId);
+ //listWidth = (listWidth.length == 0) ? this.combobox.offsetWidth : listWidth;
+ var fieldDem = Richfaces.ComboBoxList.getElemXY(this.field);
+ fieldDem.height = this.field.offsetHeight;
+ this.comboList = new Richfaces.ComboBoxList(listId, parentListId, classes, listWidth, listHeight, itemsText, onlistcall, fieldDem);
this.defaultMessage = defaultMessage;
@@ -25,7 +28,8 @@
this.field.observe("blur", function(e){this.focusHandler(e);}.bindAsEventListener(this));
this.field.observe("focus", function(e){this.fieldHandler(e);}.bindAsEventListener(this));
- this.comboList.listParent.observe("mousedown", function(e){this.listMousedownHandler(e);}.bindAsEventListener(this))
+ this.comboList.listParent.observe("mousedown", function(e){this.listMousedownHandler(e);}.bindAsEventListener(this));
+ this.button.observe("mousedown", function(e){this.listMousedownHandler(e);}.bindAsEventListener(this));
this.field.observe("keyup", function(e){this.dataUpdating(e);}.bindAsEventListener(this));
@@ -33,7 +37,7 @@
this.comboList.listParent.observe("click", function(e){this.valueHandler(e);}.bindAsEventListener(this));
if (this.onselected) {
- this.combobox.observe("rich:onselected", this.onselected);
+ this.combobox.observe("rich:onitemselected", this.onselected);
}
if (this.defaultMessage) {
@@ -47,6 +51,7 @@
} else {
this.comboList.createDefaultList();
this.comboList.show();
+ this.comboList.isList = false;
}
this.field.focus();
},
@@ -84,7 +89,7 @@
var value = this.comboList.selectedItem.innerHTML;
if (toSetOnly) {
this.field.value = value;
- this.combobox.fire("rich:onselected", {});
+ this.combobox.fire("rich:onitemselected", {});
} else {
if (this.directInputSuggestions) {
var startInd = this.field.value.length;
@@ -116,13 +121,6 @@
}
},
- /*doForce : function(){
- if (this.el.dom.value.length > 0) {
- this.el.dom.value = ((this.lastSelectionText === undefined) ? "" : this.lastSelectionText);
- this.applyEmptyText();
- }
- },*/
-
focusHandler : function(event) {
if (!this.comboList.isList) {
var value = this.field.value;
@@ -130,6 +128,9 @@
this.applyDefaultText();
}
this.comboList.hide();
+
+ this.button.className = "rich-combobox-button-disabled"; //FIXME
+ this.field.className = "rich-combobox-field-disabled"; //FIXME
}
},
@@ -163,9 +164,9 @@
Richfaces.ComboBoxList = Class.create();
Richfaces.ComboBoxList.prototype = {
- initialize: function(listId, classes, width, height, itemsText, onlistcall) {
+ initialize: function(listId, parentListId, classes, width, height, itemsText, onlistcall, fieldXY) {
this.list = $(listId);
- this.listParent = this.list.parentNode;
+ this.listParent = $(parentListId);
this.itemsText = itemsText;
@@ -178,9 +179,19 @@
this.classes = classes;
this.isList = false;
+ this.defaultRowsAmount = 15;
+
this.selectedItem = null;
+ this.width = width;
+ this.height = height;
+ this.fieldDimensions = fieldXY;
+ //this.initList(width, height, fieldXY);
+ },
+
+ initList : function(width, height, fieldXY) {
this.setSize(width, height);
+ this.setPosition(fieldXY.top, fieldXY.left, fieldXY.height);
},
createDefaultList : function() {
@@ -196,6 +207,9 @@
},
show : function() {
+ this.setSize();
+ this.setPosition(this.fieldDimensions.top, this.fieldDimensions.left, this.fieldDimensions.height);
+
var curItems = this.getItems();
if (curItems.length != 0) {
this.selectItem(curItems[0]);
@@ -214,11 +228,49 @@
return this.listParent.visible();
},
- setSize : function(width, height) {
- this.listParent.style.width = width;
+ setSize : function() {
+ this.listParent.style.width = this.width;
+
+ var height = this.height;
+ if (!this.height) {
+ var item = this.list.childNodes[0];
+ if (item) {
+ //FIXME
+ this.listParent.style.visibility = "hidden";
+ this.listParent.show();
+
+ var itemHeight = item.offsetHeight;
+
+ this.listParent.hide();
+ this.listParent.style.visibility = "visible";
+
+ var rowsAmount = this.getItems().length;
+ var k = this.defaultRowsAmount;
+ if (rowsAmount < this.defaultRowsAmount) {
+ k = rowsAmount;
+ }
+ height = k * itemHeight;
+ }
+ }
this.listParent.style.height = height;
},
+ setPosition : function(fieldTop, fieldLeft, fieldHeight) {
+ var docHeight = Richfaces.getDocumentHeight();
+ var comBottom = fieldTop + fieldHeight;
+ var listHeight = this.listParent.style.height;
+
+ var top = -4;
+ if (parseInt(listHeight) > (docHeight - comBottom)) {
+ if (fieldTop > (docHeight - comBottom)) {
+ //this.listParent.style.bottom = 0 + "px"; //FIXME
+ top -= (parseInt(listHeight) + fieldHeight);
+ }
+ }
+ this.listParent.style.top = top + "px";
+ this.listParent.style.left = 0 + "px";
+ },
+
scrolling : function(event) {
var increment;
var listTop = Richfaces.ComboBoxList.getElemXY(this.listParent).top;
@@ -306,7 +358,6 @@
},
getFilteredItems : function(text) {
-
var items = new Array();
for (var i = 0; i < this.itemsText.length; i++) {
var itText = this.itemsText[i];
@@ -369,5 +420,5 @@
Richfaces.ComboBoxList.CLASSES = {
ITEM : {NORMAL : "rich-combobox-item rich-combobox-item-normal", SELECTED : "rich-combobox-item rich-combobox-item-selected"},
- LIST : {}
+ LIST : {},
}
\ No newline at end of file
Modified: trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-04 18:16:08 UTC (rev 5147)
+++ trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-04 18:23:12 UTC (rev 5148)
@@ -42,9 +42,6 @@
variables.setVariable("listWidth", listWidth);
String inputSize = (String) component.getAttributes().get("inputSize");
- if (inputSize != null) {
- inputSize = HtmlUtil.qualifySize(inputSize);
- }
variables.setVariable("inputSize", inputSize);
String defaultMessage = (String) component.getAttributes().get("defaultMessage");
@@ -63,29 +60,26 @@
</input>
<input type="text" class="rich_cb_width rich_cb_strut rich_cb_font">
</input>
- <div class="cb_list_cord">
- <div class="cb_list_position">
- <div id="listParent#{clientId}" class="cb_list_decoration cb_list_scroll" style="display:none">
- <div id="list#{clientId}">
- <f:call name="encodeItems"/>
- </div>
- </div>
+ <div id="listParent#{clientId}" class="cb_list_cord cb_list_scroll cb_list_decoration cb_list_position" style="display:none">
+ <div id="list#{clientId}">
+ <f:call name="encodeItems"/>
</div>
</div>
</div>
<script type="text/javascript">
- var combobox = new Richfaces.ComboBox("#{clientId}",
- "list#{clientId}",
- "comboboxField#{clientId}",
- "comboboxButton#{clientId}", Richfaces.ComboBoxList.CLASSES,
- "#{listWidth}", "#{listHeight}",
- #{this:getItemsTextAsJSArray(context, component)},
- #{directInputSuggestions},
- #{filterNewValues},
- #{this:getAsEventHandler(context, component, "onlistcall")},
- #{this:getAsEventHandler(context, component, "onselected")},
- "#{defaultMessage}");
+ var combobox = new Richfaces.ComboBox( "#{clientId}",
+ "list#{clientId}",
+ "listParent#{clientId}",
+ "comboboxField#{clientId}",
+ "comboboxButton#{clientId}", Richfaces.ComboBoxList.CLASSES,
+ "#{listWidth}", "#{listHeight}",
+ #{this:getItemsTextAsJSArray(context, component)},
+ #{directInputSuggestions},
+ #{filterNewValues},
+ #{this:getAsEventHandler(context, component, "onlistcall")},
+ #{this:getAsEventHandler(context, component, "onitemselected")},
+ "#{defaultMessage}");
</script>
</f:root>
\ No newline at end of file
16 years, 3 months
JBoss Rich Faces SVN: r5147 - trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-01-04 13:16:08 -0500 (Fri, 04 Jan 2008)
New Revision: 5147
Modified:
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java
Log:
add SelectItem, SelectItems support
Modified: trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java
===================================================================
--- trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java 2008-01-04 18:15:04 UTC (rev 5146)
+++ trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java 2008-01-04 18:16:08 UTC (rev 5147)
@@ -1,11 +1,16 @@
package org.richfaces.renderkit;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import javax.faces.convert.Converter;
+import javax.faces.model.SelectItem;
import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSReference;
@@ -13,6 +18,7 @@
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.util.SelectUtils;
import org.richfaces.component.UIComboBox;
/**
@@ -23,6 +29,8 @@
*/
public class ComboBoxBaseRenderer extends HeaderResourcesRendererBase {
+ private ArrayList <String> valuesList = null;
+
protected Class<UIComboBox> getComponentClass() {
return UIComboBox.class;
}
@@ -32,27 +40,58 @@
Object suggestionValues = comboBox.getSuggestionValues();
ResponseWriter writer = context.getResponseWriter();
+ valuesList = new ArrayList<String>();
+
if (suggestionValues != null) {
- Object [] items = null;
-
if (suggestionValues instanceof Collection) {
- Collection <String> itemsCollection = (Collection<String>)suggestionValues;
- items = itemsCollection.toArray();
+ for (Iterator iterator = ((Collection)suggestionValues).iterator(); iterator.hasNext();) {
+ String value = getConvertedStringValue(context, comboBox, iterator.next()) ;
+ valuesList.add(value);
+ encodeSuggestion(writer, comboBox, value);
+ }
} else if (suggestionValues.getClass().isArray()) {
- items = (Object []) suggestionValues;
+ Object [] suggestions = (Object [])suggestionValues;
+ for (int i = 0; i < suggestions.length; i++) {
+ String value = getConvertedStringValue(context, comboBox, suggestions[i]);
+ valuesList.add(value);
+ encodeSuggestion(writer, comboBox, value );
+ }
} else {
- throw new IllegalArgumentException("suggestionValues should be Collection of objects or array");
+ throw new IllegalArgumentException("suggestionValues should be Collection or array");
}
-
- for (int i = 0; i < items.length; i++) {
- String suggestion = (String)items[i];
- encodeSuggestion(writer, comboBox, suggestion);
+
+ }
+
+ List <SelectItem> selectItems = SelectUtils.getSelectItems(context, component);
+ if(!selectItems.isEmpty()) {
+ for (Iterator <SelectItem> iterator = selectItems.iterator(); iterator.hasNext();) {
+ SelectItem selectItem = iterator.next();
+ String value = getConvertedStringValue(context, comboBox, selectItem.getValue());
+ valuesList.add(value);
+ encodeSuggestion(writer, comboBox, value);
}
}
+
+ }
+
+ protected String getConvertedStringValue(FacesContext context, UIComboBox comboBox, Object value) {
+ Converter converter = comboBox.getConverter();
+ if (converter == null) {
+ if (value == null) {
+ return "";
+ } else if (value instanceof String) {
+ return (String) value;
+ } else {
+ String message = "Value is not String (class=" + value.getClass().getName() + ", value=" + value
+ + ") and component " + comboBox.getClientId(context) + " does not have a Converter";
+ throw new IllegalArgumentException(message);
+ }
+ }
+ return converter.getAsString(context, comboBox, value);
}
- protected void encodeSuggestion(ResponseWriter writer, UIComboBox comboBox, String value) throws IOException{
+ public void encodeSuggestion(ResponseWriter writer, UIComboBox comboBox, String value) throws IOException{
writer.startElement(HTML.DIV_ELEM, comboBox);
writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-combobox-item rich-combobox-item-normal", null);
writer.write(value);
@@ -60,9 +99,11 @@
}
public String getItemsTextAsJSArray(FacesContext context, UIComponent component) {
- UIComboBox comboBox = (UIComboBox)component;
- Object suggestionValues = comboBox.getSuggestionValues();
- return ScriptUtils.toScript(suggestionValues);
+ String script = "";
+ if (valuesList != null) {
+ script = ScriptUtils.toScript(valuesList);
+ }
+ return script;
}
public String getAsEventHandler(FacesContext context, UIComponent component, String attributeName) {
@@ -83,4 +124,9 @@
return ScriptUtils.toScript(result);
}
+
+ @Override
+ public boolean getRendersChildren() {
+ return super.getRendersChildren();
+ }
}
16 years, 3 months
JBoss Rich Faces SVN: r5146 - in trunk/sandbox/samples/combobox-sample/src/main: webapp/pages and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-01-04 13:15:04 -0500 (Fri, 04 Jan 2008)
New Revision: 5146
Modified:
trunk/sandbox/samples/combobox-sample/src/main/java/org/richfaces/samples/Bean.java
trunk/sandbox/samples/combobox-sample/src/main/webapp/pages/index.jsp
Log:
Modified: trunk/sandbox/samples/combobox-sample/src/main/java/org/richfaces/samples/Bean.java
===================================================================
--- trunk/sandbox/samples/combobox-sample/src/main/java/org/richfaces/samples/Bean.java 2008-01-04 17:10:17 UTC (rev 5145)
+++ trunk/sandbox/samples/combobox-sample/src/main/java/org/richfaces/samples/Bean.java 2008-01-04 18:15:04 UTC (rev 5146)
@@ -21,10 +21,13 @@
package org.richfaces.samples;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import javax.faces.model.SelectItem;
+
/**
* @author $Autor$
*
@@ -32,8 +35,15 @@
public class Bean {
String suggestions = "Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware,Florida,Maryland,Massachusetts,Michigan,Georgia,Hawaii,Idaho,Indiana,Iowa,Kansas,Kentucky,Louisiana,Maine,Minnesota,Mississippi,Missouri,Montana,Nebraska";
-
+ List selectItems = new ArrayList();
+
public Bean() {
+ selectItems.add(new SelectItem("District of Columbia"));
+ selectItems.add(new SelectItem("Illinois"));
+ selectItems.add(new SelectItem("Maryland"));
+ selectItems.add(new SelectItem("Nevada"));
+ selectItems.add(new SelectItem("New Hampshire"));
+ selectItems.add(new SelectItem("New Jersey"));
}
public List getSuggestions() {
@@ -45,5 +55,13 @@
public void setSuggestions(List suggestions) {
//this.suggestions = suggestions;
}
+
+ public List getSelectItems() {
+ return selectItems;
+ }
+
+ public void setSelectItems(List selectItems) {
+ this.selectItems = selectItems;
+ }
}
\ No newline at end of file
Modified: trunk/sandbox/samples/combobox-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/combobox-sample/src/main/webapp/pages/index.jsp 2008-01-04 17:10:17 UTC (rev 5145)
+++ trunk/sandbox/samples/combobox-sample/src/main/webapp/pages/index.jsp 2008-01-04 18:15:04 UTC (rev 5146)
@@ -8,10 +8,15 @@
<body>
<f:view>
<h:form>
- <cmb:comboBox suggestionValues="#{bean.suggestions}"
- listWidth="100"
- listHeight="150"
+ <cmb:comboBox suggestionValues="#{bean.suggestions}"
+ listWidth="300"
+ listHeight="200"
inputSize="30">
+ <f:selectItems value="#{bean.selectItems}"/>
+ <f:selectItem itemValue="Oregon"/>
+ <f:selectItem itemValue="Pennsylvania"/>
+ <f:selectItem itemValue="Rhode Island"/>
+ <f:selectItem itemValue="South Carolina"/>
</cmb:comboBox>
</h:form>
</f:view>
16 years, 3 months
JBoss Rich Faces SVN: r5145 - in branches/3.1.x/ui/modal-panel/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-01-04 12:10:17 -0500 (Fri, 04 Jan 2008)
New Revision: 5145
Modified:
branches/3.1.x/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
branches/3.1.x/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
Log:
http://jira.jboss.com/jira/browse/RF-1811
Modified: branches/3.1.x/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
===================================================================
--- branches/3.1.x/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java 2008-01-04 16:25:25 UTC (rev 5144)
+++ branches/3.1.x/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java 2008-01-04 17:10:17 UTC (rev 5145)
@@ -151,4 +151,27 @@
}
return result.toString();
}
+
+ public String getContentStyle(FacesContext context, UIModalPanel panel) {
+ StringBuffer result = new StringBuffer();
+
+ result.append("overflow: hidden; ");
+
+ String style = (String)panel.getAttributes().get("style");
+ if (null != style && !"".equals(style)) {
+ result.append(style).
+ append(" ");
+
+ }
+ int minHeight = panel.getMinHeight();
+ int minWidth = panel.getMinWidth();
+ if (minWidth > -1) {
+ result.append("min-width: " + minWidth + "; ");
+ }
+ if (minHeight > -1) {
+ result.append("min-height: " + minHeight + "; ");
+ }
+
+ return result.toString();
+ }
}
Modified: branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
===================================================================
--- branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2008-01-04 16:25:25 UTC (rev 5144)
+++ branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2008-01-04 17:10:17 UTC (rev 5145)
@@ -70,7 +70,7 @@
ModalPanel.Context = Class.create();
ModalPanel.Context.prototype = {
initialize: function(modalPanel) {
- this.cdiv = modalPanel.contentDiv;
+ this.cdiv = modalPanel.contentTable;
this.isPositionFixed = Richfaces.getComputedStyle(this.cdiv, "position") == "fixed";
},
@@ -121,6 +121,7 @@
this.cursorDiv = id + "CursorDiv";
this.cdiv = id + "CDiv";
this.contentDiv = id + "ContentDiv";
+ this.contentTable = id + "ContentTable";
this.shadowDiv = id + "ShadowDiv";
this.context = new ModalPanel.Context(this);
Modified: branches/3.1.x/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
===================================================================
--- branches/3.1.x/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2008-01-04 16:25:25 UTC (rev 5144)
+++ branches/3.1.x/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2008-01-04 17:10:17 UTC (rev 5145)
@@ -17,10 +17,10 @@
</h:styles>
<h:scripts>
new org.ajax4jsf.javascript.PrototypeScript(),
- /org/richfaces/renderkit/html/scripts/utils.js,
+ /org/richfaces/renderkit/html/scripts/utils.js,
+ /org/richfaces/renderkit/html/scripts/browser_info.js,
/org/richfaces/renderkit/html/scripts/modalPanel.js,
- /org/richfaces/renderkit/html/scripts/modalPanelBorders.js,
- /org/richfaces/renderkit/html/scripts/browser_info.js
+ /org/richfaces/renderkit/html/scripts/modalPanelBorders.js
</h:scripts>
<f:clientid var="clientId"/>
@@ -42,7 +42,7 @@
<div class="dr-mpnl-mask-div rich-mpnl-mask-div" id="#{clientId}Div"
style="z-index: 1;"></div>
<div class="dr-mpnl-mask-div rich-mpnl-mask-div" id="#{clientId}CursorDiv"
- style="filter: alpha(opacity=1); opacity: 0.01; z-index: -200"></div>
+ style="filter: alpha(opacity=1); z-index: -200"></div>
<div id="#{clientId}CDiv" class="dr-mpnl-panel rich-mpnl_panel" style="width: 1px; height: 1px; z-index: 2;">
@@ -72,9 +72,8 @@
<div id="#{clientId}ShadowDiv" class="dr-mpnl-shadow rich-mpnl-shadow"
style="#{component.shadowStyle}" >
</div>
-
- <div style="position: absolute; overflow: hidden; z-index: 2; #{component.attributes['style']}"
- class="dr-mpnl-pnl" id="#{clientId}ContentDiv">
+ <table id="#{clientId}ContentTable" cellpadding="0" cellspacing="0" border="0" style="position: absolute; z-index: 2;"><tbody><tr><td class="dr-mpnl-pnl">
+ <div id="#{clientId}ContentDiv" style="#{this:getContentStyle(context, component)}" class="rich-mp-content">
<a href="#" class="dr-mpnl-pnl-a" id="#{clientId}FirstHref" >_</a>
<table style="height: 100%; width: 100%;" border="0" cellpadding="0" cellspacing="0">
@@ -113,6 +112,7 @@
</tr>
</table>
</div>
+ </td></tr></tbody></table>
</div>
<script type="text/javascript">
@@ -131,10 +131,9 @@
top: "#{component.top}",
zindex: #{component.zindex},
-
- onshow: #{onshow},
+
onhide: #{onhide},
-
+
keepVisualState: #{component.keepVisualState},
showWhenRendered: #{component.showWhenRendered},
selectBehavior: "#{component.tridentIVEngineSelectBehavior}",
16 years, 3 months