You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gm...@apache.org on 2006/06/20 16:54:35 UTC
svn commit: r415684 - in /myfaces/tomahawk/trunk/sandbox:
core/src/main/java/org/apache/myfaces/custom/ajax/api/
core/src/main/java/org/apache/myfaces/custom/suggestajax/
core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/
core/s...
Author: gmuellan
Date: Tue Jun 20 07:54:34 2006
New Revision: 415684
URL: http://svn.apache.org/viewvc?rev=415684&view=rev
Log:
applied patch for tomahawk-208, Thanks to Sharath Reddy
Modified:
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/api/AjaxComponent.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/api/AjaxDecodePhaseListener.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/SuggestAjax.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/SuggestAjaxRenderer.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/SuggestAjaxTag.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java
myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml
myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/default/table_suggest.css
myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/tableSuggest.js
myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/suggest_ajax_attributes.xml
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/inputSuggestAjax.jsp
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/tableSuggestAjax.jsp
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/api/AjaxComponent.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/api/AjaxComponent.java?rev=415684&r1=415683&r2=415684&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/api/AjaxComponent.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/api/AjaxComponent.java Tue Jun 20 07:54:34 2006
@@ -27,6 +27,5 @@
{
void encodeAjax(FacesContext context) throws IOException;
- void decodeAjax(FacesContext context);
-
+ void decodeAjax(FacesContext context);
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/api/AjaxDecodePhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/api/AjaxDecodePhaseListener.java?rev=415684&r1=415683&r2=415684&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/api/AjaxDecodePhaseListener.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ajax/api/AjaxDecodePhaseListener.java Tue Jun 20 07:54:34 2006
@@ -16,12 +16,17 @@
package org.apache.myfaces.custom.ajax.api;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.component.html.ext.UIComponentPerspective;
+import org.apache.myfaces.custom.ajax.util.AjaxRendererUtils;
+import org.apache.myfaces.custom.inputAjax.HtmlCommandButtonAjax;
+import org.apache.myfaces.custom.suggestajax.SuggestAjax;
+import org.apache.myfaces.shared_tomahawk.component.ExecuteOnCallback;
+import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlResponseWriterImpl;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.util.FormInfo;
+import org.apache.myfaces.shared_tomahawk.util._ComponentUtils;
import javax.faces.application.StateManager;
import javax.faces.component.UIComponent;
@@ -32,19 +37,12 @@
import javax.faces.event.PhaseListener;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.custom.ajax.util.AjaxRendererUtils;
-import org.apache.myfaces.custom.inputAjax.HtmlCommandButtonAjax;
-import org.apache.myfaces.custom.suggestajax.SuggestAjax;
-import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
-import org.apache.myfaces.shared_tomahawk.renderkit.html.util.FormInfo;
-import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlResponseWriterImpl;
-import org.apache.myfaces.shared_tomahawk.util._ComponentUtils;
-import org.apache.myfaces.shared_tomahawk.component.ExecuteOnCallback;
-import org.apache.myfaces.component.html.ext.UIComponentPerspective;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* This short circuits the life cycle and applies updates to affected components only
@@ -182,114 +180,102 @@
UIViewRoot viewRoot = context.getViewRoot();
Map requestMap = context.getExternalContext().getRequestParameterMap();
+ String charset = (String) requestMap.get("charset");
+
/* Handle character encoding as of section 2.5.2.2 of JSF 1.1:
- * At the beginning of the render-response phase, the ViewHandler must ensure
- * that the response Locale is set to that of the UIViewRoot, for exampe by
- * calling ServletResponse.setLocale() when running in the servlet environment.
+ * At the beginning of the render-response phase, the ViewHandler must ensure
+ * that the response Locale is set to that of the UIViewRoot, for exampe by
+ * calling ServletResponse.setLocale() when running in the servlet environment.
* Setting the response Locale may affect the response character encoding.
- *
- * Since there is no 'Render Response' phase for AJAX requests, we have to handle
- * this manually in order to ensure that the 'Content-type' string is sent
- * to the browser.
+ *
+ * Since there is no 'Render Response' phase for AJAX requests, we have to handle
+ * this manually.
*/
response.setLocale(viewRoot.getLocale());
-
- if (component instanceof SuggestAjax)
+
+ if (component instanceof SuggestAjax)
+ {
+ try
{
- try
- {
- if (context.getResponseWriter() == null)
- {
- response.setContentType("text/html");
- PrintWriter writer = response.getWriter();
- /* I've tried to set up the Response Writer similar to the way it is set up in
- * UIComponentTag.setupResponseWriter
- */
- context.setResponseWriter(new HtmlResponseWriterImpl(writer,
- null,
- request.getCharacterEncoding()));
- }
- ((AjaxComponent) component).encodeAjax(context);
- }
- catch (IOException e)
+ if (context.getResponseWriter() == null)
{
- log.error("Exception while rendering ajax-response", e);
+ response.setContentType(getContentType("text/html", charset));
+ PrintWriter writer = response.getWriter();
+ context.setResponseWriter(new HtmlResponseWriterImpl(writer,
+ null,
+ request.getCharacterEncoding()));
}
+
+ ((AjaxComponent) component).encodeAjax(context);
}
- else
+ catch (IOException e)
{
- try
- {
-
- //context.getResponseWriter();
- /*if (response == null)
- {
- ServletResponse servletResponse = (ServletResponse) context.getExternalContext().getResponse();
- Writer htmlResponseWriter = servletResponse.getWriter();
- response = new HtmlResponseWriterImpl(htmlResponseWriter, "text/html", "UTF-8");
- context.setResponseWriter(response);
- }*/
- //write wrapping output
- //response.setContentType("application/xml");
- //response.reset();
- //response.setCharacterEncoding("UTF-8");
- response.setContentType("text/xml");
-
- StringBuffer buff = new StringBuffer();
- buff.append("<?xml version=\"1.0\"?>\n");
- buff.append("<response>\n");
- PrintWriter out = response.getWriter();
- out.print(buff);
-
- // imario@apache.org: setup response writer, otherwise the component will fail with an NPE. I dont know why this worked before.
- context.setResponseWriter(new HtmlResponseWriterImpl(out,
- null,
- request.getCharacterEncoding()));
+ log.error("Exception while rendering ajax-response", e);
+ }
+ }
+ else
+ {
+ try
+ {
+ response.setContentType(getContentType("text/xml", charset));
- if (component instanceof HtmlCommandButtonAjax)
- {
- // special treatment for this one, it will try to update the entire form
- // 1. get surrounding form
- //String elname = (String) requestMap.get("elname");
- FormInfo fi = _ComponentUtils.findNestingForm(component, context);
- UIComponent form = fi.getForm();
- //System.out.println("FOUND FORM: " + form);
- if (form != null)
- {
- // special case, add responses from all components in form
- encodeChildren(form, context, requestMap);
- }
- }
- else if (component instanceof AjaxComponent)
+ StringBuffer buff = new StringBuffer();
+ buff.append("<?xml version=\"1.0\"?>\n");
+ buff.append("<response>\n");
+
+ PrintWriter out = response.getWriter();
+ out.print(buff);
+
+ // imario@apache.org: setup response writer, otherwise the component will fail with an NPE. I dont know why this worked before.
+ context.setResponseWriter(new HtmlResponseWriterImpl(out,
+ null,
+ request.getCharacterEncoding()));
+
+ if (component instanceof HtmlCommandButtonAjax)
+ {
+ // special treatment for this one, it will try to update the entire form
+ // 1. get surrounding form
+ //String elname = (String) requestMap.get("elname");
+ FormInfo fi = _ComponentUtils.findNestingForm(component, context);
+ UIComponent form = fi.getForm();
+ //System.out.println("FOUND FORM: " + form);
+ if (form != null)
{
- // let component render xml response
- // NOTE: probably don't need an encodeAjax in each component, but leaving it in until that's for sure
- ((AjaxComponent) component).encodeAjax(context);
- } else {
- // just get latest value
- AjaxRendererUtils.encodeAjax(context, component);
+ // special case, add responses from all components in form
+ encodeChildren(form, context, requestMap);
}
-
- // end response
- out.print("</response>");
- out.flush();
}
- catch (IOException e)
+ else if (component instanceof AjaxComponent)
{
- log.error("Exception while rendering ajax-response", e);
+ // let component render xml response
+ // NOTE: probably don't need an encodeAjax in each component, but leaving it in until that's for sure
+ ((AjaxComponent) component).encodeAjax(context);
+ } else {
+ // just get latest value
+ AjaxRendererUtils.encodeAjax(context, component);
}
+ // end response
+ out.print("</response>");
+ out.flush();
}
- /* }
- else
- {
- log.error("Found component is no AjaxComponent : " + RendererUtils.getPathToComponent(component));
- }*/
+ catch (IOException e)
+ {
+ log.error("Exception while rendering ajax-response", e);
+ }
+ }
}
+ private String getContentType(String contentType, String charset)
+ {
+ if (charset == null || charset.trim().length() == 0)
+ return contentType;
+ else
+ return contentType + ";charset=" + charset;
+ }
private void encodeChildren(UIComponent form, FacesContext context, Map requestMap)
throws IOException
- {
+ {
List formChildren = form.getChildren();
for (int i = 0; i < formChildren.size(); i++)
{
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/SuggestAjax.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/SuggestAjax.java?rev=415684&r1=415683&r2=415684&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/SuggestAjax.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/SuggestAjax.java Tue Jun 20 07:54:34 2006
@@ -40,7 +40,7 @@
private String _popupId;
private String _popupStyleClass;
private String _popupStyle;
-
+ private String _charset;
private String _layout;
private Integer _maxSuggestedItems;
@@ -54,7 +54,7 @@
public Object saveState(FacesContext context)
{
- Object[] values = new Object[7];
+ Object[] values = new Object[8];
values[0] = super.saveState(context);
values[1] = saveAttachedState(context, _suggestedItemsMethod);
values[2] = _popupId;
@@ -62,6 +62,7 @@
values[4] = _popupStyle;
values[5] = _layout;
values[6] = _maxSuggestedItems;
+ values[7] = _charset;
return values;
}
@@ -76,8 +77,9 @@
_popupStyle = (String) values[4];
_layout = (String) values[5];
_maxSuggestedItems = (Integer) values[6];
+ _charset = (String) values[7];
}
-
+
public void encodeAjax(FacesContext context)
throws IOException
{
@@ -171,6 +173,14 @@
public void setMaxSuggestedItems(Integer suggestedItems) {
_maxSuggestedItems = suggestedItems;
+ }
+
+ public String getCharset() {
+ return _charset;
+ }
+
+ public void setCharset(String charset) {
+ _charset = charset;
}
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/SuggestAjaxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/SuggestAjaxRenderer.java?rev=415684&r1=415683&r2=415684&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/SuggestAjaxRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/SuggestAjaxRenderer.java Tue Jun 20 07:54:34 2006
@@ -46,7 +46,7 @@
MethodBinding mb = suggestAjax.getSuggestedItemsMethod();
Integer maxSuggestedCount = suggestAjax.getMaxSuggestedItems();
- Collection suggesteds = null;
+ Collection suggesteds;
if (maxSuggestedCount != null
&& maxSuggestedCount.intValue() > 0)
@@ -85,5 +85,4 @@
{
super.decode(facesContext, component);
}
-
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/SuggestAjaxTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/SuggestAjaxTag.java?rev=415684&r1=415683&r2=415684&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/SuggestAjaxTag.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/SuggestAjaxTag.java Tue Jun 20 07:54:34 2006
@@ -42,7 +42,7 @@
private String _popupId;
private String _popupStyleClass;
private String _popupStyle;
-
+ private String _charset;
private String _layout;
public String getComponentType() {
@@ -63,6 +63,8 @@
_popupStyleClass = null;
_popupStyle = null;
_layout = null;
+ _charset = null;
+
}
protected void setProperties(UIComponent component) {
@@ -76,6 +78,7 @@
setStringProperty(component,"popupStyleClass",_popupStyleClass);
setStringProperty(component,"popupStyle",_popupStyle);
setStringProperty(component,"layout",_layout);
+ setStringProperty(component,"charset",_charset);
}
public static void setSuggestedItemsMethodProperty(FacesContext context,
@@ -133,6 +136,10 @@
public void setMaxSuggestedItems(String maxSuggestedItems) {
_maxSuggestedItems = (maxSuggestedItems);
+ }
+
+ public void setCharset(String charset) {
+ _charset = charset;
}
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java?rev=415684&r1=415683&r2=415684&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java Tue Jun 20 07:54:34 2006
@@ -27,7 +27,6 @@
import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
-import org.apache.myfaces.shared_tomahawk.renderkit.html.util.UnicodeEncoder;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -106,7 +105,10 @@
String clientId = component.getClientId(context);
String actionURL = getActionUrl(context);
- String ajaxUrl = context.getExternalContext().encodeActionURL(actionURL+"?affectedAjaxComponent=" + clientId + "&"+clientId+"=%{searchString}");
+ String charset = (inputSuggestAjax.getCharset() != null ? inputSuggestAjax.getCharset() : "");
+
+ String ajaxUrl = context.getExternalContext().encodeActionURL(actionURL+"?affectedAjaxComponent=" + clientId +
+ "&charset=" + charset + "&" + clientId + "=%{searchString}");
ResponseWriter out = context.getResponseWriter();
@@ -160,8 +162,8 @@
Object item = suggestedItem.next();
- buf.append("[\"").append(UnicodeEncoder.encode(item.toString())).append("\",\"")
- .append(UnicodeEncoder.encode(item.toString()).substring(0, 1).toUpperCase()).append("\"],");
+ buf.append("[\"").append(item.toString()).append("\",\"")
+ .append(item.toString().substring(0, 1).toUpperCase()).append("\"],");
}
buf.append("];");
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java?rev=415684&r1=415683&r2=415684&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java Tue Jun 20 07:54:34 2006
@@ -187,7 +187,8 @@
{
int betweenKeyUp = 0;
int startRequest = 0;
-
+ String charset = null;
+
if (tableSuggestAjax.getBetweenKeyUp()!=null)
betweenKeyUp = tableSuggestAjax.getBetweenKeyUp().intValue();
else
@@ -198,17 +199,22 @@
else
startRequest = DEFAULT_START_REQUEST;
+ if (tableSuggestAjax.getCharset() != null)
+ charset = tableSuggestAjax.getCharset();
+ else
+ charset = "";
+
StringBuffer buf = new StringBuffer();
String tableSuggestVar = "tableSuggest"+clientId.replace(':','_');
//doing ajax request and handling the response
- buf.append( "var "+tableSuggestVar+" = new org_apache_myfaces_TableSuggest(\""+ ajaxUrl + "\", "+ betweenKeyUp +", "+ startRequest +");\n"
-
- + "dojo.event.connect(dojo.byId(\"" + clientId + "\"), \"onkeyup\", function(evt) { "+ tableSuggestVar+".decideRequest(evt); });\n");
-
+ buf.append( "var " + tableSuggestVar + " = new org_apache_myfaces_TableSuggest(\""+ ajaxUrl + "\", " +
+ betweenKeyUp +", " + startRequest + ", \"" + charset + "\");\n" +
+ "dojo.event.connect(dojo.byId(\"" + clientId + "\"), \"onkeyup\", function(evt) { "+ tableSuggestVar+".decideRequest(evt); });\n");
+
//if setting the focus outside the input field, popup should not be displayed
buf.append("dojo.event.connect(document, \"onclick\", function(evt) { "+tableSuggestVar+".resetSettings(); });\n");
-
+
return buf;
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml?rev=415684&r1=415683&r2=415684&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml Tue Jun 20 07:54:34 2006
@@ -30,6 +30,11 @@
</component>
<component>
+ <component-type>org.apache.myfaces.TableSuggestAjax</component-type>
+ <component-class>org.apache.myfaces.custom.suggestajax.tablesuggestajax.TableSuggestAjax</component-class>
+ </component>
+
+ <component>
<component-type>org.apache.myfaces.AjaxChildComboBox</component-type>
<component-class>org.apache.myfaces.custom.ajaxchildcombobox.AjaxChildComboBox</component-class>
</component>
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/default/table_suggest.css
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/default/table_suggest.css?rev=415684&r1=415683&r2=415684&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/default/table_suggest.css (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/default/table_suggest.css Tue Jun 20 07:54:34 2006
@@ -8,6 +8,17 @@
table-layout:auto;
}
+.ajaxTableWidth{
+ font-family: Verdana, sans-serif;
+ font-size: 11px;
+ background-color: rgb(171, 202, 219);
+ color: rgb(0, 106, 164);
+ line-height: 16px;
+ border-collapse:collapse;
+ table-layout:auto;
+ width:260px;
+}
+
.ajaxTablePopup{
position:absolute;
z-index:10000;
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/tableSuggest.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/tableSuggest.js?rev=415684&r1=415683&r2=415684&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/tableSuggest.js (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/tableSuggest.js Tue Jun 20 07:54:34 2006
@@ -17,14 +17,15 @@
org_apache_myfaces_TableSuggest = function(ajaxUrl,
millisBetweenKeyUps,
- startChars)
+ startChars,
+ charset)
{
this.tablePagesCollection = new dojo.collections.ArrayList();
this.inputField = null;
this.popUp = null;
this.url = ajaxUrl;
-
+ this.charset = charset;
this.firstHighlightedElem = null;
this.actualHighlightedElem = null;
@@ -227,7 +228,7 @@
if(type == "load" && data)
{
dojo.debug("response successful");
- var tablePagesArray = dojo.html.createNodesFromText(data);
+ var tablePagesArray = dojo.html.createNodesFromText(data);
var collection = tableSuggest.tablePagesCollection;
var firstPage = null;
@@ -271,7 +272,8 @@
tableSuggest.requestLocker = false;
}
},
- mimetype: "text/plain"
+ mimetype: "text/plain",
+ content: { charset: this.charset }
});
}
};
@@ -451,4 +453,4 @@
dojo.debug("leaving decide function");
};
-}
\ No newline at end of file
+}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/suggest_ajax_attributes.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/suggest_ajax_attributes.xml?rev=415684&r1=415683&r2=415684&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/suggest_ajax_attributes.xml (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/suggest_ajax_attributes.xml Tue Jun 20 07:54:34 2006
@@ -54,3 +54,13 @@
<type>java.lang.String</type>
<description>Id for the pop up window</description>
</attribute>
+
+<attribute>
+ <name>charset</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ <type>java.lang.String</type>
+ <description>Force the charset of the Response</description>
+</attribute>
+
+
Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/inputSuggestAjax.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/inputSuggestAjax.jsp?rev=415684&r1=415683&r2=415684&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/inputSuggestAjax.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/inputSuggestAjax.jsp Tue Jun 20 07:54:34 2006
@@ -36,7 +36,8 @@
<h:panelGrid columns="5">
<h:outputText value="default suggest"/>
- <s:inputSuggestAjax suggestedItemsMethod="#{inputSuggestAjax.getItems}" value="#{inputSuggestAjax.suggestValue}"/>
+ <s:inputSuggestAjax suggestedItemsMethod="#{inputSuggestAjax.getItems}"
+ value="#{inputSuggestAjax.suggestValue}" charset="utf-8"/>
<h:outputText value="suggest with limited suggested items"/>
<s:inputSuggestAjax suggestedItemsMethod="#{inputSuggestAjax.getItems}" maxSuggestedItems="2" />
Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/tableSuggestAjax.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/tableSuggestAjax.jsp?rev=415684&r1=415683&r2=415684&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/tableSuggestAjax.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/tableSuggestAjax.jsp Tue Jun 20 07:54:34 2006
@@ -34,15 +34,16 @@
<f:verbatim><br/><br/><br/><br/></f:verbatim>
- <h:panelGrid columns="2">
+ <h:panelGrid >
<h:panelGrid columns="4">
- <f:verbatim> City Field TableSuggest <br/> (Paginator) <br/> Suggest starts with 2. char </f:verbatim>
+ <f:verbatim> City Field ppTableSuggest <br/> (Paginator) <br/> Suggest starts with 2. char </f:verbatim>
<s:tableSuggestAjax var="address" id="suggest" startRequest="2"
nextPageFieldClass="ajaxNextTablePageField"
value="#{inputSuggestAjax.suggestValue}" betweenKeyUp="300"
columnOutClass="tableSuggestOut" columnHoverClass="tableSuggestHover"
suggestedItemsMethod="#{inputSuggestAjax.getAddressList}"
- maxSuggestedItems="10" tableStyleClass="ajaxTable">
+ maxSuggestedItems="10" tableStyleClass="ajaxTable"
+ charset="utf-8">
<t:column>
<f:facet name="header">
<s:outputText value="city"/>
@@ -67,7 +68,7 @@
nextPageFieldClass="ajaxNextTablePageField" betweenKeyUp="300"
columnOutClass="tableSuggestOut" columnHoverClass="tableSuggestHover"
maxSuggestedItems="50" popupStyle="position:absolute; z-index:100000; overflow:auto; height:200px;"
- suggestedItemsMethod="#{inputSuggestAjax.getAddressList}">
+ suggestedItemsMethod="#{inputSuggestAjax.getAddressList}" charset="utf-8">
<t:column>
<s:outputText for="cityField2" label="#{address.city}"/>
</t:column>
@@ -79,6 +80,7 @@
</t:column>
</s:tableSuggestAjax>
</h:panelGrid>
+ <f:verbatim><br/><br/><br/><br/><br/></f:verbatim>
<h:panelGrid>
<h:commandButton/>
<h:outputText value="Street"/>