You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/06/21 16:54:19 UTC

svn commit: r956612 - in /myfaces/tobago/trunk: tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/ tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/s...

Author: lofwyr
Date: Mon Jun 21 14:54:19 2010
New Revision: 956612

URL: http://svn.apache.org/viewvc?rev=956612&view=rev
Log:
TOBAGO-896: Input suggest: indicate that more entries are available

Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago.properties.xml
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago_de.properties.xml
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago_es.properties.xml
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/inputSuggest.js

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java?rev=956612&r1=956611&r2=956612&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java Mon Jun 21 14:54:19 2010
@@ -402,14 +402,11 @@ public class OverviewController {
 
   public List<String> getInputSuggestItems(UIInput component) {
     String prefix = (String) component.getSubmittedValue();
-    LOG.info("createing items for prefix :\"" + prefix + "\"");
+    LOG.info("Creating items for prefix: '" + prefix + "'");
     List<String> li = new ArrayList<String>();
-    li.add(prefix+1);
-    li.add(prefix+2);
-    li.add(prefix+3);
-    li.add(prefix+4);
-    li.add(prefix+5);
-    li.add(prefix+6);
+    for (int i = 1; i <= 6; i++) {
+      li.add(prefix + i);
+    }
     return li;
   }
 

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java?rev=956612&r1=956611&r2=956612&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java Mon Jun 21 14:54:19 2010
@@ -17,10 +17,9 @@ package org.apache.myfaces.tobago.render
  * limitations under the License.
  */
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.UIInput;
+import org.apache.myfaces.tobago.context.ResourceManagerUtils;
 import org.apache.myfaces.tobago.context.TobagoFacesContext;
 import org.apache.myfaces.tobago.internal.ajax.AjaxInternalUtils;
 import org.apache.myfaces.tobago.internal.component.AbstractUIPage;
@@ -37,6 +36,8 @@ import org.apache.myfaces.tobago.renderk
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -265,6 +266,13 @@ public class InRenderer extends InputRen
       writer.write(items.getNextFocusId());
       writer.write("\"");
     }
+
+    if (suggestItems.size() > items.getMaxSuggestedCount()) {
+      writer.write(", moreElements: \"");
+      writer.write(ResourceManagerUtils.getPropertyNotNull(context, "tobago", "tobago.in.inputSuggest.moreElements"));
+      writer.write("\"");
+    }
+
     writer.write("};");
     writer.endJavascript();
   }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago.properties.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago.properties.xml?rev=956612&r1=956611&r2=956612&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago.properties.xml (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago.properties.xml Mon Jun 21 14:54:19 2010
@@ -69,6 +69,9 @@
   <entry key="datePickerOk">OK</entry>
   <entry key="datePickerCancel">Cancel</entry>
 
+  <!-- in - input suggest -->
+  <entry key="tobago.in.inputSuggest.moreElements">There are more matching entries…</entry>
+
   <!-- messages -->
   <entry key="tobago.message.confirmation.title">Messages</entry>
   <entry key="tobago.message.confirmation.okay">OK</entry>
@@ -115,4 +118,4 @@
   <!-- The String contains all widths for char 32 to 127. Each pair of 2 chars is a hex value-->
   <entry key="tobago.font.widths">04040508080c09030505050804050404080808080808080808080404080808080e09090a0a09090b0a040709080c0a0b090b0a09090a090d0909090404040708050808070808040808030307030c0808080805070408070a070707050405080b</entry>
 
-</properties>
\ No newline at end of file
+</properties>

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago_de.properties.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago_de.properties.xml?rev=956612&r1=956611&r2=956612&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago_de.properties.xml (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago_de.properties.xml Mon Jun 21 14:54:19 2010
@@ -71,6 +71,9 @@
   <entry key="datePickerOk">OK</entry>
   <entry key="datePickerCancel">Abbrechen</entry>
 
+  <!-- in - input suggest -->
+  <entry key="tobago.in.inputSuggest.moreElements">Es gibt weitere passende Einträge…</entry>
+
   <!-- messages -->
   <entry key="tobago.message.confirmation.title">Meldungen</entry>
 
@@ -114,4 +117,4 @@
   <entry key="org.apache.myfaces.tobago.FileItemValidator.SIZE_LIMIT">Dateigröße Fehler</entry>
   <entry key="org.apache.myfaces.tobago.FileItemValidator.SIZE_LIMIT_detail">Die Größe der hochgeladenen Datei darf nicht größer als {1} Bytes sein.</entry>
 
-</properties>
\ No newline at end of file
+</properties>

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago_es.properties.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago_es.properties.xml?rev=956612&r1=956611&r2=956612&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago_es.properties.xml (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago_es.properties.xml Mon Jun 21 14:54:19 2010
@@ -69,6 +69,12 @@
   <entry key="datePickerOk">Enviar</entry>
   <entry key="datePickerCancel">Cancelar</entry>
 
+  <!-- in - input suggest -->
+  <entry key="tobago.in.inputSuggest.moreElements">Hay más entradas aparejadas…</entry>
+
+  <!-- messages -->
+  <entry key="tobago.message.confirmation.title">Aviso</entry>
+
   <!-- requiredvalidator -->
   <entry key="tobago.requiredvalidator.message.empty.summary">Campo requerido.</entry>
   <entry key="tobago.requiredvalidator.message.empty.detail">Campo es requerido.</entry>
@@ -106,4 +112,4 @@
   <entry key="org.apache.myfaces.tobago.FileItemValidator.SIZE_LIMIT">Error en el tamaño del archivo</entry>
   <entry key="org.apache.myfaces.tobago.FileItemValidator.SIZE_LIMIT_detail">El archivo subido excede el máximo tamaño de {0} bytes.</entry>
 
-</properties>
\ No newline at end of file
+</properties>

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/inputSuggest.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/inputSuggest.js?rev=956612&r1=956611&r2=956612&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/inputSuggest.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/inputSuggest.js Mon Jun 21 14:54:19 2010
@@ -166,11 +166,15 @@ Tobago.AutocompleterAjax.prototype.sugge
     ul.appendChild(li);
   }
 
+  jQuery(div).empty();
 
-  if (div.firstChild) {
-    div.removeChild(div.firstChild);
-  }
   div.appendChild(ul);
+
+  if (suggestObject.moreElements) {
+    var html = "<div title='" + suggestObject.moreElements + "'>…</div>";
+    jQuery(div).append(html);
+  }
+
   if (div.clientWidth < div.scrollWidth) {
     var runtimeStyle = Tobago.getRuntimeStyle(div);
     var leftBorder = runtimeStyle.borderLeftWidth.replace(/\D/g, "") - 0;