JBoss Rich Faces SVN: r14855 - in branches/enterprise/3.3.X/ui/combobox/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-07-08 12:54:52 -0400 (Wed, 08 Jul 2009)
New Revision: 14855
Modified:
branches/enterprise/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
branches/enterprise/3.3.X/ui/combobox/src/main/templates/combobox.jspx
Log:
https://jira.jboss.org/jira/browse/RF-7286
Modified: branches/enterprise/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
===================================================================
--- branches/enterprise/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2009-07-08 15:38:28 UTC (rev 14854)
+++ branches/enterprise/3.3.X/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2009-07-08 16:54:52 UTC (rev 14855)
@@ -7,7 +7,7 @@
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) {
+ showDelay, hideDelay, onchange) {
this.directInputSuggestions = directInputSuggestions;
this.filterNewValue = filterNewValue;
@@ -51,6 +51,7 @@
if (this.onselected) {
this.combobox.observe("rich:onselect", this.onselected);
}
+ this.onchange = onchange;
if (this.isDisabled) {
this.disable(); //TODO rename to 'disable'
}
@@ -296,6 +297,7 @@
}
}
this.comboList.hideWithDelay();
+ this.setValue(false);
} else {
this.doActive();
}
@@ -330,12 +332,32 @@
}
if (this.isValueSet(event) && isSearchSuccessful) {
- this.setValue();
+ var value = this.getActiveItemValue();
+ if(value && this.directInputSuggestions) {
+ this.doDirectSuggestion(value);
+ }
}
+
this.comboValue.value = this.field.value;
}
},
+ getActiveItemValue: function(){
+ var value;
+ if (this.comboList.activeItem) {
+ value = jQuery(this.comboList.activeItem).text();
+ value = value.replace(/\xA0/g," ").strip();
+ }
+ return value;
+ },
+
+ doDirectSuggestion: function(value) {
+ var startInd = this.field.value.length;
+ var endInd = value.length;
+ this.field.value = value;
+ Richfaces.ComboBox.textboxSelect(this.field, startInd, endInd);
+ },
+
wasTextDeleted : function(event) {
if ((event.keyCode == Event.KEY_BACKSPACE)
|| (event.keyCode == Event.KEY_DELETE)
@@ -364,33 +386,23 @@
},
setValue : function(toSetOnly) {
- if (!this.comboList.activeItem) {
- return;
- }
-
- var value = jQuery(this.comboList.activeItem).text();
-
- if (toSetOnly) {
- var oV = this.field.value;
- if (oV == value) {
- if (Prototype.Browser.Gecko) {
- this.field.value = "";
- this.comboValue.value = "";
- }
- }
- this.field.prevValue = value;
- this.field.value = value;
+
+ var value = this.getActiveItemValue();
+ if(value && toSetOnly) {
this.comboValue.value = value;
this.comboList.doSelectItem(this.comboList.activeItem);
this.combobox.fire("rich:onselect", {});
- } else {
- if (this.directInputSuggestions) {
- var startInd = this.field.value.length;
- var endInd = value.length;
- this.field.value = value;
- Richfaces.ComboBox.textboxSelect(this.field, startInd, endInd);
- }
}
+
+
+ var newValue = this.comboValue.value;
+ var oldValue = this.field.prevValue;
+
+ if(newValue && (newValue != oldValue)) {
+ this.field.prevValue = newValue;
+ this.field.value = newValue;
+ Richfaces.invokeEvent(this.onchange, this.combobox, "onchange", {value:newValue});
+ }
},
applyDefaultText : function() {
Modified: branches/enterprise/3.3.X/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- branches/enterprise/3.3.X/ui/combobox/src/main/templates/combobox.jspx 2009-07-08 15:38:28 UTC (rev 14854)
+++ branches/enterprise/3.3.X/ui/combobox/src/main/templates/combobox.jspx 2009-07-08 16:54:52 UTC (rev 14855)
@@ -217,7 +217,6 @@
value="#{value}"
x:onblur="#{component.attributes['onblur']}"
onfocus = "#{component.attributes['onfocus']}"
- onchange = "#{component.attributes['onchange']}"
style="width:#{correction}; #{inputInactiveStyle}"
autocomplete="off"
tabindex="#{component.attributes['tabindex']}"
@@ -360,7 +359,7 @@
#{this:getAsEventHandler(context, component, "onselect")},
"#{defaultLabel}",
#{disabled}, #{convertedValue},
- #{component.attributes["showDelay"]}, #{component.attributes["hideDelay"]});
+ #{component.attributes["showDelay"]}, #{component.attributes["hideDelay"]}, #{this:getAsEventHandler(context, component, "onchange")});
</script>
</div>
</f:root>
15 years, 6 months
JBoss Rich Faces SVN: r14854 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-07-08 11:38:28 -0400 (Wed, 08 Jul 2009)
New Revision: 14854
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/colorPicker.desc.xml
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/layout.desc.xml
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/layoutPanel.desc.xml
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/listShuttle.desc.xml
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/orderingList.desc.xml
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_page.desc.xml
Log:
https://jira.jboss.org/jira/browse/RF-5525 - adding stamps
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/colorPicker.desc.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/colorPicker.desc.xml 2009-07-08 14:01:03 UTC (rev 14853)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/colorPicker.desc.xml 2009-07-08 15:38:28 UTC (rev 14854)
@@ -4,7 +4,8 @@
<keywordset>
<keyword>rich:colorPicker</keyword>
<keyword>colorPicker</keyword>
- </keywordset>
+ </keywordset>
+ <releaseinfo>3.3.1</releaseinfo>
</sectioninfo>
<section>
<title>Description</title>
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/layout.desc.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/layout.desc.xml 2009-07-08 14:01:03 UTC (rev 14853)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/layout.desc.xml 2009-07-08 15:38:28 UTC (rev 14854)
@@ -4,7 +4,8 @@
<keywordset>
<keyword>layout</keyword>
<keyword>rich:layout</keyword>
- </keywordset>
+ </keywordset>
+ <releaseinfo>3.3.1</releaseinfo>
</sectioninfo>
<section>
<title>Description</title>
@@ -30,4 +31,4 @@
</itemizedlist>
</section>
</section>
-
\ No newline at end of file
+
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/layoutPanel.desc.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/layoutPanel.desc.xml 2009-07-08 14:01:03 UTC (rev 14853)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/layoutPanel.desc.xml 2009-07-08 15:38:28 UTC (rev 14854)
@@ -3,7 +3,8 @@
<sectioninfo>
<keywordset>
<keyword>rich:layoutPanel</keyword>
- </keywordset>
+ </keywordset>
+ <releaseinfo>3.3.1</releaseinfo>
</sectioninfo>
<section>
<title>Description</title>
@@ -23,4 +24,4 @@
</itemizedlist>
</section>
-</section>
\ No newline at end of file
+</section>
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/listShuttle.desc.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/listShuttle.desc.xml 2009-07-08 14:01:03 UTC (rev 14853)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/listShuttle.desc.xml 2009-07-08 15:38:28 UTC (rev 14854)
@@ -3,7 +3,8 @@
<sectioninfo>
<keywordset>
<keyword>rich:listShuttle</keyword>
- </keywordset>
+ </keywordset>
+ <releaseinfo>3.1.3</releaseinfo>
</sectioninfo>
<section>
<title>Description</title>
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/orderingList.desc.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/orderingList.desc.xml 2009-07-08 14:01:03 UTC (rev 14853)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/orderingList.desc.xml 2009-07-08 15:38:28 UTC (rev 14854)
@@ -3,7 +3,8 @@
<sectioninfo>
<keywordset>
<keyword>rich:orderingList</keyword>
- </keywordset>
+ </keywordset>
+ <releaseinfo>3.1.3</releaseinfo>
</sectioninfo>
<section>
<title>Description</title>
@@ -40,4 +41,4 @@
</itemizedlist>
</section>
</section>
-
\ No newline at end of file
+
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_page.desc.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_page.desc.xml 2009-07-08 14:01:03 UTC (rev 14853)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_page.desc.xml 2009-07-08 15:38:28 UTC (rev 14854)
@@ -3,7 +3,8 @@
<sectioninfo>
<keywordset>
<keyword>rich:page</keyword>
- </keywordset>
+ </keywordset>
+ <releaseinfo>3.3.1</releaseinfo>
</sectioninfo>
<section>
<title>Description</title>
@@ -24,4 +25,4 @@
<listitem><para>Provides styling based on RichFaces skinnability</para></listitem>
</itemizedlist>
</section>
-</section>
\ No newline at end of file
+</section>
15 years, 6 months
JBoss Rich Faces SVN: r14853 - branches/community/3.3.X/ui/panelmenu/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-07-08 10:01:03 -0400 (Wed, 08 Jul 2009)
New Revision: 14853
Modified:
branches/community/3.3.X/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
Log:
panelMenu: There are some problems with icons
https://jira.jboss.org/jira/browse/RF-7390
Modified: branches/community/3.3.X/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
===================================================================
--- branches/community/3.3.X/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2009-07-08 12:42:12 UTC (rev 14852)
+++ branches/community/3.3.X/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2009-07-08 14:01:03 UTC (rev 14853)
@@ -89,7 +89,7 @@
UIPanelMenu panelMenu = findMenu(component);
ResponseWriter writer = context.getResponseWriter();
- boolean isTopLevel = isTopLevel(component);
+ boolean isTopLevel = false;
String iconType = null;
UIPanelMenuItem item = (UIPanelMenuItem)component;
15 years, 6 months
JBoss Rich Faces SVN: r14852 - in branches/community/3.3.X/samples/pickList-sample/src/main: webapp/WEB-INF and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-07-08 08:42:12 -0400 (Wed, 08 Jul 2009)
New Revision: 14852
Added:
branches/community/3.3.X/samples/pickList-sample/src/main/java/org/richfaces/rf7472.java
branches/community/3.3.X/samples/pickList-sample/src/main/webapp/pages/RF-7472.jsp
Modified:
branches/community/3.3.X/samples/pickList-sample/src/main/webapp/WEB-INF/faces-config.xml
Log:
PickList: converter is called too much times.
https://jira.jboss.org/jira/browse/RF-7472
Added: branches/community/3.3.X/samples/pickList-sample/src/main/java/org/richfaces/rf7472.java
===================================================================
--- branches/community/3.3.X/samples/pickList-sample/src/main/java/org/richfaces/rf7472.java (rev 0)
+++ branches/community/3.3.X/samples/pickList-sample/src/main/java/org/richfaces/rf7472.java 2009-07-08 12:42:12 UTC (rev 14852)
@@ -0,0 +1,65 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces;
+
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+public class rf7472 {
+
+ private List<String> value;
+
+ public Converter getConvert() {
+ return new Converter() {
+ public Object getAsObject(FacesContext context,
+ UIComponent component, String newValue)
+ throws ConverterException {
+
+ System.out.println("***> toObject ** " + newValue);
+// new Exception().printStackTrace();
+
+ return newValue;
+ }
+
+ public String getAsString(FacesContext context,
+ UIComponent component, Object value)
+ throws ConverterException {
+
+ System.out.println("***> toString ** " + value.toString());
+// new Exception().printStackTrace();
+
+ return value.toString();
+ }
+ };
+ }
+
+ public List<String> getValue() {
+ return value;
+ }
+
+ public void setValue(List<String> value) {
+ this.value = value;
+ }
+}
Modified: branches/community/3.3.X/samples/pickList-sample/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/community/3.3.X/samples/pickList-sample/src/main/webapp/WEB-INF/faces-config.xml 2009-07-08 12:41:15 UTC (rev 14851)
+++ branches/community/3.3.X/samples/pickList-sample/src/main/webapp/WEB-INF/faces-config.xml 2009-07-08 12:42:12 UTC (rev 14852)
@@ -8,6 +8,11 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
+ <managed-bean-name>rf7472</managed-bean-name>
+ <managed-bean-class>org.richfaces.rf7472</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
<managed-bean-name>skinBean</managed-bean-name>
<managed-bean-class>org.richfaces.SkinBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
Added: branches/community/3.3.X/samples/pickList-sample/src/main/webapp/pages/RF-7472.jsp
===================================================================
--- branches/community/3.3.X/samples/pickList-sample/src/main/webapp/pages/RF-7472.jsp (rev 0)
+++ branches/community/3.3.X/samples/pickList-sample/src/main/webapp/pages/RF-7472.jsp 2009-07-08 12:42:12 UTC (rev 14852)
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/pickList" prefix="rich"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<f:view>
+ <html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title><h:outputText value="PickList" /></title>
+ </head>
+ <body>
+ <h:form>
+ <rich:pickList value="#{rf7472.value}" converter="#{rf7472.convert}">
+ <f:selectItem itemLabel="item-1" itemValue="item-1" />
+ <f:selectItem itemLabel="item-2" itemValue="item-2" />
+ </rich:pickList>
+ <h:commandButton value="submit();" />
+ </h:form>
+ </body>
+ </html>
+</f:view>
\ No newline at end of file
15 years, 6 months
JBoss Rich Faces SVN: r14851 - in branches/community/3.3.X/ui/pickList/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-07-08 08:41:15 -0400 (Wed, 08 Jul 2009)
New Revision: 14851
Added:
branches/community/3.3.X/ui/pickList/src/main/java/org/richfaces/renderkit/ConvertedSelectItem.java
Modified:
branches/community/3.3.X/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
branches/community/3.3.X/ui/pickList/src/main/templates/htmlPickList.jspx
Log:
PickList: converter is called too much times.
https://jira.jboss.org/jira/browse/RF-7472
Added: branches/community/3.3.X/ui/pickList/src/main/java/org/richfaces/renderkit/ConvertedSelectItem.java
===================================================================
--- branches/community/3.3.X/ui/pickList/src/main/java/org/richfaces/renderkit/ConvertedSelectItem.java (rev 0)
+++ branches/community/3.3.X/ui/pickList/src/main/java/org/richfaces/renderkit/ConvertedSelectItem.java 2009-07-08 12:41:15 UTC (rev 14851)
@@ -0,0 +1,85 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.renderkit;
+
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.model.SelectItem;
+
+import org.richfaces.component.UIPickList;
+
+public class ConvertedSelectItem {
+ private SelectItem item;
+
+ private Object itemValue;
+
+ private String suffix;
+
+ private String convertedValue;
+
+ private boolean isSelected = false;
+
+ public static ConvertedSelectItem get(FacesContext context, UIPickList pickList, SelectItem item, String suffix) {
+ Converter converter = pickList.getConverter();
+ Object itemValue = item.getValue();
+
+ String convertedItem;
+ if (converter == null) {
+ convertedItem = itemValue == null ? "" : itemValue.toString();
+ } else {
+ convertedItem = converter.getAsString(context, pickList, itemValue);
+ }
+
+ return new ConvertedSelectItem(item, itemValue, convertedItem, suffix);
+ }
+
+ private ConvertedSelectItem(SelectItem item, Object itemValue, String convertedValue, String suffix) {
+ super();
+ this.item = item;
+ this.itemValue = itemValue;
+ this.convertedValue = convertedValue;
+ this.suffix = suffix;
+ }
+
+ public String getSuffix() {
+ return this.suffix;
+ }
+
+ public SelectItem getItem() {
+ return item;
+ }
+
+ public Object getValue() {
+ return itemValue;
+ }
+
+ public String getConvertedValue() {
+ return convertedValue;
+ }
+
+ public void setSelected() {
+ this.isSelected = true;
+ }
+
+ public boolean isSelected() {
+ return this.isSelected;
+ }
+}
Modified: branches/community/3.3.X/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
===================================================================
--- branches/community/3.3.X/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2009-07-08 12:34:18 UTC (rev 14850)
+++ branches/community/3.3.X/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2009-07-08 12:41:15 UTC (rev 14851)
@@ -38,7 +38,6 @@
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import javax.faces.model.SelectItem;
import javax.faces.model.SelectItemGroup;
@@ -69,7 +68,6 @@
private static final OrderingComponentRendererBase.ControlsHelper[] SHUTTLE_HELPERS = PickListControlsHelper.HELPERS;
protected static final class ListStateFlags {
-
public ListStateFlags() {
super();
}
@@ -79,40 +77,19 @@
protected boolean isAvailableList;
}
- protected List<SelectItem> selectItemsForSelectedList(FacesContext facesContext, UIComponent uiComponent, List<SelectItem> selectItemList, List<Object> lookupList) {
-
- List<SelectItem> selectItemForSelectedValues = new ArrayList<SelectItem>();
+ protected List<ConvertedSelectItem> selectItemsForSelectedList(List<ConvertedSelectItem> selectItems) {
+ List<ConvertedSelectItem> result = new ArrayList<ConvertedSelectItem>();
- for (Object lookupItem: lookupList) {
-
- for (SelectItem selectItem: selectItemList) {
-
- if(selectItem instanceof SelectItemGroup) {
-
- SelectItem[] items = ((SelectItemGroup) selectItem).getSelectItems();
- for (int j = 0; j < items.length; j++) {
- if(lookupItem.equals(items[j].getValue())) {
- selectItemForSelectedValues.add(items[j]);
- }
- }
-
- } else {
-
- if (lookupItem.equals(selectItem.getValue())) {
- selectItemForSelectedValues.add(selectItem);
- }
-
- }
-
+ for (ConvertedSelectItem selectItem: selectItems) {
+ if (selectItem.isSelected()) {
+ result.add(selectItem);
}
-
- }
+ }
- return selectItemForSelectedValues;
+ return result;
}
protected List<Object> getValuesList(UIPickList pickList) {
-
List <Object> valuesList = new ArrayList<Object>();
Object value = getCurrentValue(FacesContext.getCurrentInstance(), pickList);
@@ -130,19 +107,13 @@
if(localValue != null) {
valuesList.add(localValue);
}
-
}
return valuesList;
} else if(value instanceof List) {
- List <?> list = (List<?>) value;
-
- for (Object item: list) {
- valuesList.add(item);
- }
-
- return valuesList;
-
+ valuesList.addAll((List<?>)value);
+
+ return valuesList;
} else {
throw new IllegalArgumentException("Error: value of UIPickList component is not of type Array or List");
}
@@ -165,37 +136,20 @@
return submittedValue;
}
}
- Object currentValue = ((UIPickList)component).getValue();
- return currentValue;
+ return ((UIPickList)component).getValue();
}
- protected List <SelectItem> selectItemsForAvailableList(FacesContext facesContext, UIComponent uiComponent, List<SelectItem> selectItemList,
- List<SelectItem> selectItemsForSelectedList) {
-
- List <SelectItem> processItems = new ArrayList<SelectItem>();
-
- for(SelectItem item: selectItemList) {
-
- if(item instanceof SelectItemGroup) {
-
- SelectItem items[] = ((SelectItemGroup)item).getSelectItems();
- for (int i = 0; i < items.length; i++) {
- processItems.add(items[i]);
- }
-
- } else {
- processItems.add(item);
- }
-
- }
-
- for (SelectItem selectItem: selectItemsForSelectedList) {
- processItems.remove(selectItem);
- }
-
- return processItems;
-
+ protected List<ConvertedSelectItem> selectItemsForAvailableList(List<ConvertedSelectItem> selectItems) {
+ List<ConvertedSelectItem> result = new ArrayList<ConvertedSelectItem>();
+
+ for (ConvertedSelectItem selectItem: selectItems) {
+ if (!selectItem.isSelected()) {
+ result.add(selectItem);
+ }
+ }
+
+ return result;
}
protected List <SelectItem> getSelectItemsList(FacesContext context, UIComponent component) {
@@ -238,7 +192,6 @@
}
private static boolean isTrue(Object obj) {
-
if (!(obj instanceof Boolean)) {
return false;
}
@@ -260,56 +213,13 @@
return convertedValue;
}
- private void encodeRows(FacesContext context, UIPickList pickList, boolean source, ListStateFlags flags) throws IOException {
-
- List <SelectItem> selectItemsList = SelectUtils.getSelectItems(context, pickList);
-
- Converter converter = pickList.getConverter();
-
- List <Object> values = getValuesList(pickList); // PickListUtils.getValuesList(context, pickList, converter);
-
- List <SelectItem> selectItemsForSelectedValues = selectItemsForSelectedList(context, pickList, selectItemsList, values);
- List <SelectItem> selectItemsForAvailableList = selectItemsForAvailableList(context, pickList, selectItemsList, selectItemsForSelectedValues);
-
- flags.isSelectedList = !selectItemsForSelectedValues.isEmpty();
- flags.isAvailableList = !selectItemsForAvailableList.isEmpty();
-
- List <SelectItem> selectItemList = null;
-
- if (source) {
- selectItemList = selectItemsForAvailableList;
- } else {
- selectItemList = selectItemsForSelectedValues;
+ private void encodeRows(FacesContext context, UIPickList pickList, boolean source, ListStateFlags flags, List<ConvertedSelectItem> selectItemList) throws IOException {
+ for (ConvertedSelectItem item : selectItemList) {
+ encodeItem(context, pickList, item, source);
}
-
- if(selectItemList != null) {
-
- SelectItem [] itemsList = selectItemList.toArray(new SelectItem[selectItemList.size()]);
-
- for (int i = 0; i < itemsList.length; i++) {
-
- SelectItem selectItem = itemsList[i];
-
- if (selectItem instanceof SelectItemGroup) {
-
- SelectItem[] items = ((SelectItemGroup) selectItem).getSelectItems();
- for (int j = 0; j < items.length; j++) {
- encodeItem(context, pickList, converter, items[j], source, "group:" + j);
- }
-
- } else {
-
- encodeItem(context, pickList, converter, selectItem, source, Integer.toString(i));
-
- }
-
- }
-
- }
-
}
- public void encodeItem(FacesContext context, UIComponent component, Converter converter, SelectItem selectItem, boolean source, String suff)
+ public void encodeItem(FacesContext context, UIComponent component, ConvertedSelectItem selectItem, boolean source)
throws IOException {
ResponseWriter writer = context.getResponseWriter();
@@ -321,23 +231,18 @@
clientId += ":source:";
}
- String id = clientId + ":" + suff;
-
+ String id = clientId + ":" + selectItem.getSuffix();
writer.writeAttribute("id", id, null);
StringBuffer rowClassName = new StringBuffer();
StringBuffer cellClassName = new StringBuffer();
if (source) {
-
rowClassName.append("rich-picklist-source-row");
cellClassName.append("rich-picklist-source-cell");
-
} else {
-
rowClassName.append("rich-picklist-target-row");
cellClassName.append("rich-picklist-target-cell");
-
}
writer.writeAttribute("class", rowClassName.toString(), null);
@@ -353,32 +258,34 @@
boolean escape = isTrue(component.getAttributes().get("escape"));
if (escape) {
- writer.writeText(selectItem.getLabel(), null);
+ writer.writeText(selectItem.getItem().getLabel(), null);
} else {
- writer.write(selectItem.getLabel());
+ writer.write(selectItem.getItem().getLabel());
}
+ encodeItemValue(context, component, writer, id, selectItem.getConvertedValue());
- String itemValue;
- if (converter != null) {
- itemValue = converter.getAsString(context, component, selectItem.getValue());
- } else {
- Object valueObject = selectItem.getValue();
- itemValue = (valueObject != null ? valueObject.toString() : "");
- }
-
- encodeItemValue(context, component, writer, id, itemValue);
-
writer.endElement(HTML.td_ELEM);
writer.endElement(HTML.TR_ELEMENT);
-
}
- public void encodeTargetRows(FacesContext context, UIPickList pickList, ListStateFlags flags) throws IOException {
- encodeRows(context, pickList, false, flags);
+ public void encodeTargetRows(FacesContext context, UIPickList pickList, ListStateFlags flags, List<ConvertedSelectItem> convertedItems) throws IOException {
+ List<ConvertedSelectItem> selectItemsForSelectedValues =
+ selectItemsForSelectedList(convertedItems);
+
+ flags.isSelectedList = !selectItemsForSelectedValues.isEmpty();
+ flags.isAvailableList = selectItemsForSelectedValues.size() != convertedItems.size();
+
+ encodeRows(context, pickList, false, flags, selectItemsForSelectedValues);
}
- public void encodeSourceRows(FacesContext context, UIPickList pickList, ListStateFlags flags) throws IOException {
- encodeRows(context, pickList, true, flags);
+ public void encodeSourceRows(FacesContext context, UIPickList pickList, ListStateFlags flags, List<ConvertedSelectItem> convertedItems) throws IOException {
+ List<ConvertedSelectItem> selectItemsForAvailableList =
+ selectItemsForAvailableList(convertedItems);
+
+ flags.isSelectedList = selectItemsForAvailableList.size() != convertedItems.size();
+ flags.isAvailableList = !selectItemsForAvailableList.isEmpty();
+
+ encodeRows(context, pickList, true, flags, selectItemsForAvailableList);
}
private void encodeItemValue(FacesContext context, UIComponent component, ResponseWriter writer, String id, String itemValue) throws IOException { //rowKey = i
@@ -408,26 +315,8 @@
writer.endElement(HTML.IMG_ELEMENT);
}
- public void encodeHiddenField(FacesContext context, UIPickList pickList) throws IOException {
-
- Converter converter = pickList.getConverter();
- List <String> lookupList = new ArrayList<String>();
- List <Object> values = getValuesList(pickList);
+ public void encodeHiddenField(FacesContext context, UIPickList component, List<ConvertedSelectItem> lookupList) throws IOException {
- for (Object value: values) {
- if(converter != null) {
- lookupList.add(converter.getAsString(context, pickList, value));
- } else {
- lookupList.add(value != null ? value.toString() : "");
- }
- }
-
- encodeHiddenField(context, pickList, lookupList);
-
- }
-
- private void encodeHiddenField(FacesContext context, UIComponent component, List <String> lookupList) throws IOException {
-
String hiddenFieldCliendId = component.getClientId(context) + HIDDEN_SUFFIX;
ResponseWriter writer = context.getResponseWriter();
@@ -439,19 +328,16 @@
writer.writeAttribute("name", hiddenFieldCliendId, null);
StringBuffer sb = new StringBuffer();
-
- int n = 0;
- for (Iterator <String> i = lookupList.iterator(); i.hasNext();) {
-
+ int n = 0;
+ for (Iterator<ConvertedSelectItem> i = selectItemsForSelectedList(lookupList).iterator(); i.hasNext();) {
if (n > 0) {
sb.append(",");
}
- String value = i.next();
- sb.append(value);
+ ConvertedSelectItem value = i.next();
+ sb.append(value.getConvertedValue());
n++;
-
}
writer.writeAttribute(HTML.value_ATTRIBUTE, sb.toString(), null);
@@ -560,6 +446,34 @@
}
+ public List<ConvertedSelectItem> getConvertedItems(FacesContext context, UIPickList pickList) {
+ List<ConvertedSelectItem> convertedItems = new ArrayList<ConvertedSelectItem>();
+ final List<SelectItem> selectItems = SelectUtils.getSelectItems(context, pickList);
+ for (int i = 0; i < selectItems.size(); i++ ) {
+ SelectItem item = selectItems.get(i);
+ if (item instanceof SelectItemGroup) {
+ SelectItem[] groupItems = ((SelectItemGroup) item).getSelectItems();
+ for (int j = 0; j < groupItems.length; j++) {
+ convertedItems.add(ConvertedSelectItem.get(context, pickList, groupItems[j], "group:" + j));
+ }
+ } else {
+ convertedItems.add(ConvertedSelectItem.get(context, pickList, item, Integer.toString(i)));
+ }
+ }
+
+ List<Object> valueItems = getValuesList(pickList);
+ for (ConvertedSelectItem item : convertedItems) {
+ for (Object selectedValue : valueItems) {
+ if (item.getValue().equals(selectedValue)) {
+ item.setSelected();
+ break;
+ }
+ }
+ }
+
+ return convertedItems;
+ }
+
protected ClassLoader getCurrentLoader(Object fallbackClass) {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Modified: branches/community/3.3.X/ui/pickList/src/main/templates/htmlPickList.jspx
===================================================================
--- branches/community/3.3.X/ui/pickList/src/main/templates/htmlPickList.jspx 2009-07-08 12:34:18 UTC (rev 14850)
+++ branches/community/3.3.X/ui/pickList/src/main/templates/htmlPickList.jspx 2009-07-08 12:41:15 UTC (rev 14851)
@@ -77,6 +77,8 @@
variables.setVariable("switchByDblClick", switchByDblClick);
variables.setVariable("baseClientId", component.getBaseClientId(context));
+
+ java.util.List<org.richfaces.renderkit.ConvertedSelectItem> convertedItems = getConvertedItems(context, component);
]]>
</jsp:scriptlet>
@@ -112,11 +114,9 @@
<div id="#{clientId}contentBox" class="rich-picklist-list-content" style="#{contentContainerStyle}">
<table id="#{clientId}internal_tab" class="rich-picklist-internal-tab" cellpadding="0" cellspacing="0">
<tbody id="#{clientId}tbody">
- <jsp:scriptlet>
- <![CDATA[
- encodeSourceRows(context, component, listStateFlags);
- ]]>
- </jsp:scriptlet>
+ <jsp:scriptlet><![CDATA[
+ encodeSourceRows(context, component, listStateFlags, convertedItems);
+ ]]></jsp:scriptlet>
</tbody>
</table>
</div>
@@ -138,7 +138,10 @@
<td>
<div class="rich-picklist-target-items #{component.listClass}">
<input autocomplete="off" type="hidden" value=":" style="display: none;" name="#{baseClientId}" />
- <f:call name="encodeHiddenField" />
+ <jsp:scriptlet><![CDATA[
+ encodeHiddenField(context, component, convertedItems);
+ ]]></jsp:scriptlet>
+
<input id="#{clientId}tlFocusKeeper" type="button" value="" style="width: 1px; position: absolute; left: -32767px;"/>
<table id="#{clientId}tlTable" cellpadding="0" cellspacing="0" class="rich-picklist-body">
@@ -169,7 +172,7 @@
<tbody id="#{clientId}tlTbody">
<jsp:scriptlet>
<![CDATA[
- encodeTargetRows(context, component, listStateFlags);
+ encodeTargetRows(context, component, listStateFlags, convertedItems);
]]>
</jsp:scriptlet>
</tbody>
15 years, 6 months
JBoss Rich Faces SVN: r14850 - in branches/community/3.3.X/ui/componentControl/src: main/java/org/richfaces/renderkit and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2009-07-08 08:34:18 -0400 (Wed, 08 Jul 2009)
New Revision: 14850
Modified:
branches/community/3.3.X/ui/componentControl/src/main/java/org/richfaces/component/UIComponentControl.java
branches/community/3.3.X/ui/componentControl/src/main/java/org/richfaces/renderkit/ComponentControlRendererBase.java
branches/community/3.3.X/ui/componentControl/src/main/resources/org/richfaces/renderkit/html/script/controlUtils.js
branches/community/3.3.X/ui/componentControl/src/main/templates/htmlComponentControl.jspx
branches/community/3.3.X/ui/componentControl/src/test/java/org/richfaces/component/ComponentControlTest.java
Log:
https://jira.jboss.org/jira/browse/RF-7474
Modified: branches/community/3.3.X/ui/componentControl/src/main/java/org/richfaces/component/UIComponentControl.java
===================================================================
--- branches/community/3.3.X/ui/componentControl/src/main/java/org/richfaces/component/UIComponentControl.java 2009-07-08 11:53:55 UTC (rev 14849)
+++ branches/community/3.3.X/ui/componentControl/src/main/java/org/richfaces/component/UIComponentControl.java 2009-07-08 12:34:18 UTC (rev 14850)
@@ -68,14 +68,31 @@
JSFunction invocation = new JSFunction("Richfaces.componentControl.performOperation");
invocation.addParameter(new JSReference("event"));
+ invocation.addParameter(getEvent());
invocation.addParameter(targetId);
invocation.addParameter(getOperation());
- invocation.addParameter(new JSReference("{" + getEncodedParametersMap() + "}"));
- invocation.addParameter(Boolean.valueOf(isDisableDefault()));
+ addOptions(invocation);
return invocation.toScript();
}
+ public void addOptions(JSFunction function) {
+ String params = getEncodedParametersMap();
+
+ if (params.length()!=0) {
+ function.addParameter(new JSReference("function(){return{"+params+"}}"));
+ }
+ String event = (String) getEvent();
+ boolean disableDefault = isDisableDefault();
+ boolean isOnContextMenu = ("contextmenu".equalsIgnoreCase(event) || "oncontextmenu".equalsIgnoreCase(event));
+ if ( isOnContextMenu ^ disableDefault ) {
+ if (params.length()==0) {
+ function.addParameter(new JSReference("{}"));
+ }
+ function.addParameter(disableDefault);
+ }
+ }
+
public String getEncodedParametersMap() {
StringBuilder result = new StringBuilder();
Modified: branches/community/3.3.X/ui/componentControl/src/main/java/org/richfaces/renderkit/ComponentControlRendererBase.java
===================================================================
--- branches/community/3.3.X/ui/componentControl/src/main/java/org/richfaces/renderkit/ComponentControlRendererBase.java 2009-07-08 11:53:55 UTC (rev 14849)
+++ branches/community/3.3.X/ui/componentControl/src/main/java/org/richfaces/renderkit/ComponentControlRendererBase.java 2009-07-08 12:34:18 UTC (rev 14850)
@@ -21,14 +21,19 @@
package org.richfaces.renderkit;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.renderkit.ComponentVariables;
-import org.ajax4jsf.renderkit.ComponentsVariableResolver;
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.javascript.JSReference;
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.resource.InternetResource;
@@ -89,81 +94,6 @@
}
/**
- * Prepare Java script according to the timing option of the component control
- * and write it to the ResponceWriter
- * @param context - FacesContext
- * @param component - component control
- * @throws IOException - is thrown in case of writing to ResponceWriter exception
- */
- protected void attachEventAccordingToTimingOption(FacesContext context,
- UIComponent component) throws IOException {
- if (!(component instanceof UIComponentControl)) {
- return;
- }
-
- UIComponentControl componentControl = (UIComponentControl) component;
- String attachTo = componentControl.getAttachTo();
- String attachTiming = componentControl.getAttachTiming();
- boolean isImmediate = attachTiming.equals(IMMEDIATE);
- boolean isOnLoad = attachTiming.equals(ON_LOAD);
- boolean isOnAvailable = attachTiming.equals(ON_AVAILABLE);
-
- if (!(isImmediate || isOnLoad || isOnAvailable || attachTo == null || attachTo.length() == 0)) {
- // unknown value of property "attachTiming"
- return;
- }
-
- ResponseWriter writer = context.getResponseWriter();
- ComponentVariables variables =
- ComponentsVariableResolver.getVariables(this, componentControl);
-
- writer.startElement("script", componentControl);
- getUtils().writeAttribute(writer, "type", "text/javascript");
- writer.writeText("//", null);
- writer.write("<![CDATA[");
-
- String attachEventBodyStart = "\n{\n Richfaces.componentControl.attachEvent('";
- StringBuilder attachEventBodyEnd = new StringBuilder();
- attachEventBodyEnd.append("', '");
- attachEventBodyEnd.append(convertToString(variables.getVariable("event")));
- attachEventBodyEnd.append("', '");
- attachEventBodyEnd.append(convertToString(variables.getVariable("forAttr")));
- attachEventBodyEnd.append("', '");
- attachEventBodyEnd.append(convertToString(variables.getVariable("operation")));
- attachEventBodyEnd.append("', function() { return {");
- attachEventBodyEnd.append(convertToString(variables.getVariable("params")));
- attachEventBodyEnd.append("}; }, ");
- attachEventBodyEnd.append(convertToString(componentControl.isDisableDefault()));
- attachEventBodyEnd.append(");\n }");
-
- String pattern = "\\s*,\\s*";
- // "attachTo" attribute may contain several ids splitted by ","
- String[] result = attachTo.split(pattern);
- for (int i = 0; i < result.length; i++) {
- if (isOnLoad) {
- writer.write("\n jQuery(document).ready(function()");
- } else if (isOnAvailable) {
- UIComponent target = RendererUtils.getInstance()
- .findComponentFor(context, component, result[i]);
- String clientId = (target != null) ? target.getClientId(context) : result[i];
- writer.write("\n Richfaces.onAvailable('" + clientId + "', function()");
- } else if (isImmediate) {
- }
-
- writer.write(attachEventBodyStart);
- writer.write(getUtils().escapeJavaScript(replaceClientIds(context, component, result[i])));
- writer.write(attachEventBodyEnd.toString());
-
- if (isOnLoad || isOnAvailable) {
- writer.write(");");
- }
- }
- writer.writeText("//", null);
- writer.write("]]>");
- writer.endElement("script");
- }
-
- /**
* Gets additional scripts.
*
* @return array of resources
@@ -181,4 +111,118 @@
private static String convertToString(Object obj ) {
return ( obj == null ? "" : obj.toString() );
}
-}
+
+ private static String convertToString(List array, String separator ) {
+ StringBuilder sb = new StringBuilder();
+ boolean close = false;
+ Iterator<Object> i = array.iterator();
+ while (i.hasNext())
+ {
+ Object item = i.next();
+ if (close) {
+ sb.append(separator);
+ } else {
+ close = true;
+ }
+ sb.append(item);
+ }
+ return sb.toString();
+ }
+
+ public void getScript(FacesContext context, UIComponent component) throws IOException {
+
+ UIComponentControl componentControl = (UIComponentControl) component;
+ ResponseWriter writer = context.getResponseWriter();
+
+ Map<String, Object> attributes = component.getAttributes();
+
+ JSFunctionDefinition function = null;
+ List<JSFunction> functionArray = new ArrayList<JSFunction>();
+
+ String name = convertToString(attributes.get("name"));
+ String attachTo = convertToString(attributes.get("attachTo"));
+ String forAttr = convertToString(attributes.get("for"));
+ forAttr = replaceClientIds(context, component, forAttr);
+ String operation = convertToString(attributes.get("operation"));
+ String attachTiming = componentControl.getAttachTiming();
+ checkValidity(componentControl.getClientId(context), name, attachTiming, forAttr, operation);
+ String event = convertToString(attributes.get("event"));
+
+ String performScript = null;
+
+ if (!"".equals(name.trim())) {
+ JSFunction subFunction = new JSFunction("Richfaces.componentControl.performOperation");
+ subFunction.addParameter(new JSReference("cevent"));
+ subFunction.addParameter(event);
+ subFunction.addParameter(forAttr);
+ subFunction.addParameter(operation);
+ componentControl.addOptions(subFunction);
+
+ function = new JSFunctionDefinition("cevent");
+ function.setName(name);
+ function.addToBody(subFunction);
+ performScript = function.toString();
+ }
+
+ if (attachTo != null && attachTo.trim().length() != 0 && !"#".equals(attachTo)) {
+
+ boolean isImmediate = attachTiming.equals(IMMEDIATE);
+ boolean isOnLoad = attachTiming.equals(ON_LOAD);
+ boolean isOnAvailable = attachTiming.equals(ON_AVAILABLE);
+
+ if (!(isImmediate || isOnLoad || isOnAvailable)) {
+ // unknown value of property "attachTiming"
+ return;
+ }
+
+ String pattern = "\\s*,\\s*";
+ // "attachTo" attribute may contain several ids splitted by ","
+ String[] result = attachTo.split(pattern);
+ for (int i = 0; i < result.length; i++) {
+ JSFunction mainFunction = null;
+ if (isOnLoad) {
+ mainFunction = new JSFunction("jQuery(document).ready");
+ } else if (isOnAvailable) {
+ UIComponent target = RendererUtils.getInstance().findComponentFor(context, component, result[i]);
+ String clientId = (target != null) ? target.getClientId(context) : result[i];
+ mainFunction = new JSFunction("Richfaces.onAvailable",clientId);
+ } else if (isImmediate) {
+ }
+
+ if (mainFunction!=null)
+ {
+ JSFunction subFunction = new JSFunction("Richfaces.componentControl.attachEvent");
+ subFunction.addParameter(replaceClientIds(context, component, result[i]));
+ subFunction.addParameter(event);
+ subFunction.addParameter(forAttr);
+ subFunction.addParameter(operation);
+ componentControl.addOptions(subFunction);
+
+ function = new JSFunctionDefinition("");
+ function.addToBody(subFunction);
+
+ mainFunction.addParameter(function);
+ functionArray.add(mainFunction);
+ }
+ }
+ }
+
+ if (!functionArray.isEmpty() || performScript!=null) {
+ writer.startElement("script", componentControl);
+ getUtils().writeAttribute(writer, "type", "text/javascript");
+ writer.writeText("//", null);
+ writer.write("<![CDATA[\n");
+ if (performScript!= null) {
+ writer.write(performScript);
+ writer.write(";");
+ }
+ if (!functionArray.isEmpty()) {
+ writer.write(convertToString(functionArray, ";"));
+ writer.write(";");
+ }
+ writer.writeText("\n//", null);
+ writer.write("]]>");
+ writer.endElement("script");
+ }
+ }
+}
\ No newline at end of file
Modified: branches/community/3.3.X/ui/componentControl/src/main/resources/org/richfaces/renderkit/html/script/controlUtils.js
===================================================================
--- branches/community/3.3.X/ui/componentControl/src/main/resources/org/richfaces/renderkit/html/script/controlUtils.js 2009-07-08 11:53:55 UTC (rev 14849)
+++ branches/community/3.3.X/ui/componentControl/src/main/resources/org/richfaces/renderkit/html/script/controlUtils.js 2009-07-08 12:34:18 UTC (rev 14850)
@@ -31,7 +31,7 @@
Richfaces.componentControl.attachEvent = function(attachTo, aevent, forAttr, operation, params, disableDefault) {
jQuery(attachTo).bind(Richfaces.effectEventOnOut(aevent),function(cevent) {
- Richfaces.componentControl.performOperation(cevent, forAttr, operation, params, disableDefault);
+ Richfaces.componentControl.performOperation(cevent, aevent, forAttr, operation, params, disableDefault);
}).each(function() {
Richfaces.componentControl.applyDecorations(this, forAttr, function(element) {
//TODO: handle component decoration
@@ -39,10 +39,19 @@
});
};
-Richfaces.componentControl.performOperation = function( cevent, forAttr, operation, params, disableDefault) {
+Richfaces.componentControl.checkDisableDefault = function (ename, disableDefault) {
+ if (disableDefault==undefined) {
+ var en=ename.toLowerCase();
+ return (en=="oncontextmenu" || en=="contextmenu" ? true : false);
+ } else {
+ return disableDefault;
+ }
+}
+
+Richfaces.componentControl.performOperation = function( cevent, aevent, forAttr, operation, params, disableDefault) {
// stop event before event isn't extended by prototype
- if (disableDefault) {
+ if (Richfaces.componentControl.checkDisableDefault(aevent, disableDefault)) {
var event = jQuery.event.fix(cevent);
event.stopPropagation();
event.preventDefault();
Modified: branches/community/3.3.X/ui/componentControl/src/main/templates/htmlComponentControl.jspx
===================================================================
--- branches/community/3.3.X/ui/componentControl/src/main/templates/htmlComponentControl.jspx 2009-07-08 11:53:55 UTC (rev 14849)
+++ branches/community/3.3.X/ui/componentControl/src/main/templates/htmlComponentControl.jspx 2009-07-08 12:34:18 UTC (rev 14850)
@@ -10,48 +10,13 @@
component="org.richfaces.component.UIComponentControl"
>
<h:scripts>/org/richfaces/renderkit/html/scripts/jquery/jquery.js,/org/richfaces/renderkit/html/script/controlUtils.js</h:scripts>
-
- <c:set var="event" value="#{component.attributes['event']}"/>
- <c:set var="forAttr" value="#{component.attributes['for']}"/>
- <c:set var="attachTiming" value="#{component.attributes['attachTiming']}"/>
- <c:set var="attachTo" value="#{component.attributes['attachTo']}"/>
- <c:set var="name" value="#{component.attributes['name']}"/>
- <c:set var="operation" value="#{component.attributes['operation']}"/>
- <c:set var="params" value="#{component.encodedParametersMap}"/>
-
-
- <f:clientid var="clientId"/>
- <jsp:scriptlet>
+
+<f:clientid var="clientId"/>
+
+<jsp:scriptlet>
<![CDATA[
- String event = (String) variables.getVariable("event");
- String forAttr = (String) variables.getVariable("forAttr");
- String attachTiming = (String) variables.getVariable("attachTiming");
- String attachTo = (String) variables.getVariable("attachTo");
- String name = (String) variables.getVariable("name");
- String operation = (String) variables.getVariable("operation");
-
- checkValidity(clientId, name, attachTiming, forAttr, operation);
- variables.setVariable("forAttr", getUtils().escapeJavaScript(
- replaceClientIds(context, component, forAttr)));
- variables.setVariable("attachTo", replaceClientIds(context, component, attachTo));
+ getScript(context, component);
]]>
</jsp:scriptlet>
-
-<jsp:scriptlet><![CDATA[ if (! "".equals(name.trim()) ) { ]]></jsp:scriptlet>
-<script type="text/javascript">
- //<![CDATA[
-function #{name}(cevent) {
- Richfaces.componentControl.performOperation(
- cevent, '#{forAttr}', '#{operation}', function() { return {#{params}}; }, #{component.disableDefault} );
-}
-//]]>
-</script>
-<jsp:scriptlet><![CDATA[ } ]]></jsp:scriptlet>
-
-<jsp:scriptlet><![CDATA[ if (attachTo != null && attachTo.trim().length() != 0 && !"#".equals(attachTo)) { ]]>
- attachEventAccordingToTimingOption(context, component);
-<![CDATA[ } ]]>
-</jsp:scriptlet>
-
</f:root>
Modified: branches/community/3.3.X/ui/componentControl/src/test/java/org/richfaces/component/ComponentControlTest.java
===================================================================
--- branches/community/3.3.X/ui/componentControl/src/test/java/org/richfaces/component/ComponentControlTest.java 2009-07-08 11:53:55 UTC (rev 14849)
+++ branches/community/3.3.X/ui/componentControl/src/test/java/org/richfaces/component/ComponentControlTest.java 2009-07-08 12:34:18 UTC (rev 14850)
@@ -158,11 +158,11 @@
assertEquals(6, params.length);
assertTrue(params[0].trim().endsWith("event"));
- assertEquals("'#button'", params[1].trim());
- assertEquals("'testOperation'", params[2].trim());
- assertTrue(params[3].trim().startsWith("{"));
- assertTrue(params[4].trim().endsWith("}"));
- assertTrue(params[5].trim().endsWith("false)"));
+ assertEquals("'onclick'", params[1].trim());
+ assertEquals("'#button'", params[2].trim());
+ assertEquals("'testOperation'", params[3].trim());
+ assertTrue(params[4].trim().startsWith("function(){return{"));
+ assertTrue(params[5].trim().endsWith("}})"));
}
public void testParametersMap() throws Exception {
15 years, 6 months
JBoss Rich Faces SVN: r14849 - branches/community/3.3.X/framework/impl/src/main/javascript/ajaxjsf.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-07-08 07:53:55 -0400 (Wed, 08 Jul 2009)
New Revision: 14849
Modified:
branches/community/3.3.X/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
Log:
Misspelled "Request" word in javascript files
https://jira.jboss.org/jira/browse/RF-7378
Modified: branches/community/3.3.X/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2009-07-08 09:23:06 UTC (rev 14848)
+++ branches/community/3.3.X/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2009-07-08 11:53:55 UTC (rev 14849)
@@ -72,7 +72,7 @@
return;
};
- LOG.debug("Reqest state : "+_this._request.readyState );
+ LOG.debug("Request state : "+_this._request.readyState );
if (_this._request.readyState == 4 ) {
if(_this._aborted){
//this will be true just once for request - no need to track state of status
@@ -82,7 +82,7 @@
return;
};
- LOG.debug("Reqest end with state 4");
+ LOG.debug("Request end with state 4");
if(_this._timeoutID){
window.clearTimeout(_this._timeoutID);
}
@@ -115,7 +115,7 @@
}
} else {
- _this._errorMessage = "Reqest error, status : "+requestStatus +" " + requestStatusText ;
+ _this._errorMessage = "Request error, status : "+requestStatus +" " + requestStatusText ;
LOG.error(_this._errorMessage);
if(typeof(_this._onerror) == "function"){
_this._onerror(_this,requestStatus,_this._errorMessage);
15 years, 6 months
JBoss Rich Faces SVN: r14848 - framework/trunk/version-matrix.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-08 05:23:06 -0400 (Wed, 08 Jul 2009)
New Revision: 14848
Modified:
framework/trunk/version-matrix/pom.xml
Log:
framework code being moved into new build system again...
Modified: framework/trunk/version-matrix/pom.xml
===================================================================
--- framework/trunk/version-matrix/pom.xml 2009-07-08 09:18:12 UTC (rev 14847)
+++ framework/trunk/version-matrix/pom.xml 2009-07-08 09:23:06 UTC (rev 14848)
@@ -255,7 +255,39 @@
</pluginManagement>
<plugins>
<plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-source</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <index>true</index>
+ <manifest>
+ <addDefaultSpecificationEntries>
+ true
+ </addDefaultSpecificationEntries>
+ <addDefaultImplementationEntries>
+ true
+ </addDefaultImplementationEntries>
+ </manifest>
+ <manifestEntries>
+ <mode>development</mode>
+ <Build-Number>${buildNumber}</Build-Number>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0-beta-1</version>
<executions>
15 years, 6 months
JBoss Rich Faces SVN: r14847 - branches/jsf2.0/framework.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-08 05:18:12 -0400 (Wed, 08 Jul 2009)
New Revision: 14847
Removed:
branches/jsf2.0/framework/test/
Log:
framework code being moved into new build system again...
15 years, 6 months
JBoss Rich Faces SVN: r14846 - framework/trunk.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-08 05:16:49 -0400 (Wed, 08 Jul 2009)
New Revision: 14846
Added:
framework/trunk/legacy-tests/
Log:
framework code being moved into new build system again...
Copied: framework/trunk/legacy-tests (from rev 14845, branches/jsf2.0/framework/test)
15 years, 6 months