myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject [myfaces-tobago] 09/19: matcher, tokenizer, tokenSeparators
Date Fri, 29 Nov 2019 15:55:16 GMT
This is an automated email from the ASF dual-hosted git repository.

weber pushed a commit to branch TOBAGO-1999_Select2
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit 1bfd1a1996b6921db247189c4236e7e6db4d8f9b
Author: Volker Weber <v.weber@inexso.de>
AuthorDate: Mon Aug 26 12:07:23 2019 +0200

    matcher, tokenizer, tokenSeparators
---
 .../component/AbstractUISelectManyBox.java         | 47 ++++++++++++++++++++++
 .../component/AbstractUISelectOneChoice.java       | 20 ++++++++-
 .../component/SelectManyBoxTagDeclaration.java     | 16 ++++++++
 .../internal/taglib/declaration/Select2.java       | 12 +++---
 .../tobago/renderkit/html/Select2Options.java      | 20 ++++++---
 5 files changed, 103 insertions(+), 12 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyBox.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyBox.java
index 51f928a..5963567 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyBox.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyBox.java
@@ -49,6 +49,21 @@ public abstract class AbstractUISelectManyBox extends AbstractUISelectMany
{
     getStateHelper().put(Select2Keys.allowCustom, allowCustom);
   }
 
+  public String getMatcher() {
+    String matcher = (String) getStateHelper().eval(Select2Keys.matcher);
+    if (matcher != null) {
+      return matcher;
+    }
+    return null;
+  }
+  public boolean isMatcherSet() {
+    return getStateHelper().eval(Select2Keys.matcher) != null;
+  }
+
+  public void setMatcher(String matcher) {
+    getStateHelper().put(Select2Keys.matcher, matcher);
+  }
+
   public int getMaximumInputLength() {
     Integer maximumInputLength = (Integer) getStateHelper().eval(Select2Keys.maximumInputLength);
     if (maximumInputLength != null) {
@@ -111,4 +126,36 @@ public abstract class AbstractUISelectManyBox extends AbstractUISelectMany
{
   }
 
 
+  public String getTokenizer() {
+    String tokenizer = (String) getStateHelper().eval(Select2Keys.tokenizer);
+    if (tokenizer != null) {
+      return tokenizer;
+    }
+    return null;
+  }
+
+  public boolean isTokenizerSet() {
+    return getStateHelper().eval(Select2Keys.tokenizer) != null;
+  }
+
+  public void setTokenizer(String tokenizer) {
+    getStateHelper().put(Select2Keys.tokenizer, tokenizer);
+  }
+
+  public String getTokenSeparators() {
+    String tokenSeparators = (String) getStateHelper().eval(Select2Keys.tokenSeparators);
+    if (tokenSeparators != null) {
+      return tokenSeparators;
+    }
+    return null;
+  }
+
+  public boolean isTokenSeparatorsSet() {
+    return getStateHelper().eval(Select2Keys.tokenSeparators) != null;
+  }
+
+  public void setTokenSeparators(String tokenSeparators) {
+    getStateHelper().put(Select2Keys.tokenSeparators, tokenSeparators);
+  }
+
 }
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneChoice.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneChoice.java
index d29ca83..1faeafc 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneChoice.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneChoice.java
@@ -30,7 +30,9 @@ public abstract class AbstractUISelectOneChoice extends AbstractUISelectOneBase
     maximumInputLength,
     minimumInputLength,
     maximumSelectionLength,
-    minimumResultsForSearch
+    minimumResultsForSearch,
+    tokenizer,
+    tokenSeparators
   }
 
 
@@ -68,6 +70,22 @@ public abstract class AbstractUISelectOneChoice extends AbstractUISelectOneBase
     getStateHelper().put(Select2Keys.allowCustom, allowCustom);
   }
 
+  public String getMatcher() {
+    String matcher = (String) getStateHelper().eval(Select2Keys.matcher);
+    if (matcher != null) {
+      return matcher;
+    }
+    return null;
+  }
+
+  public boolean isMatcherSet() {
+    return getStateHelper().eval(Select2Keys.matcher) != null;
+  }
+
+  public void setMatcher(String matcher) {
+    getStateHelper().put(Select2Keys.matcher, matcher);
+  }
+
   public int getMaximumInputLength() {
     Integer maximumInputLength = (Integer) getStateHelper().eval(Select2Keys.maximumInputLength);
     if (maximumInputLength != null) {
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectManyBoxTagDeclaration.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectManyBoxTagDeclaration.java
index 9942487..21dc0c6 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectManyBoxTagDeclaration.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectManyBoxTagDeclaration.java
@@ -73,4 +73,20 @@ public interface SelectManyBoxTagDeclaration
   @TagAttribute
   @UIComponentTagAttribute(type = {"java.lang.Object[]", "java.util.List"})
   void setValue(String value);
+
+
+
+  /**
+   * Flag indicating that this select
+   */
+  @TagAttribute()
+  @UIComponentTagAttribute(type = "string", generate = false)
+  void setTokenizer(String tokenizer);
+
+  /**
+   * Flag indicating that this select
+   */
+  @TagAttribute()
+  @UIComponentTagAttribute(type = "string", generate = false)
+  void setTokenSeparators(String tokenSeparators);
 }
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/Select2.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/Select2.java
index adbc3bd..fc53679 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/Select2.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/Select2.java
@@ -19,12 +19,12 @@ public interface Select2 {
   @UIComponentTagAttribute(type = "boolean", defaultValue = "false", generate = false)
   void setAllowCustom(String allowed);
 
-//  /**
-//   * Flag indicating that this select
-//   */
-//  @TagAttribute()
-//  @UIComponentTagAttribute(type = "string", generate = false)
-//  void setMatcher(String allowed);
+  /**
+   * Flag indicating that this select
+   */
+  @TagAttribute()
+  @UIComponentTagAttribute(type = "string", generate = false)
+  void setMatcher(String matcher);
 
   /**
    * Flag indicating that this select
diff --git a/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Select2Options.java
b/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Select2Options.java
index f5b045e..ca3933d 100644
--- a/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Select2Options.java
+++ b/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Select2Options.java
@@ -27,8 +27,6 @@ import javax.faces.context.FacesContext;
 
 public class Select2Options {
 
-  private Boolean tags;
-  private String[] tokenSeparators;
   private Boolean allowClear;
   private Boolean dropdownAutoWidth;
   private String language;
@@ -40,6 +38,9 @@ public class Select2Options {
   private boolean minimumResultsForSearchSet;
   private String placeholder;
   private boolean renderSelect2;
+  private Boolean tags;
+  private String tokenizer;
+  private String[] tokenSeparators;
 
   public static Select2Options of(UISelectOneChoice select) {
     Select2Options options = new Select2Options();
@@ -63,6 +64,10 @@ public class Select2Options {
       options.setLanguage(facesContext.getViewRoot().getLocale().getLanguage());
     }
 
+    if (select.isMatcherSet()) {
+      options.setMatcher(select.getMatcher());
+    }
+
     if (select.isMaximumInputLengthSet()) {
       options.setMaximumInputLength(select.getMaximumInputLength());
     }
@@ -98,6 +103,10 @@ public class Select2Options {
       options.setLanguage(facesContext.getViewRoot().getLocale().getLanguage());
     }
 
+    if (select.isMatcherSet()) {
+      options.setMatcher(select.getMatcher());
+    }
+
     if (select.isMaximumInputLengthSet()) {
       options.setMaximumInputLength(select.getMaximumInputLength());
     }
@@ -115,15 +124,16 @@ public class Select2Options {
 
   public boolean hasAnyOption() {
     return renderSelect2
-        || tags != null
-        || tokenSeparators != null
         || allowClear != null
         || matcher != null
         || maximumInputLength != null
         || minimumInputLength != null
         || maximumSelectionLength != null
         || minimumResultsForSearchSet
-        || placeholder != null;
+        || placeholder != null
+        || tags != null
+        || tokenizer != null
+        || tokenSeparators != null;
   }
 
   public Boolean isTags() {


Mime
View raw message