You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Apache Wiki <wi...@apache.org> on 2008/08/28 21:21:56 UTC

[Tapestry Wiki] Update of "Tapestry5HowtoSelectWithObjects" by ArgoVilberg

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tapestry Wiki" for change notification.

The following page has been changed by ArgoVilberg:
http://wiki.apache.org/tapestry/Tapestry5HowtoSelectWithObjects

The comment on the change is:
OptionGroup add procedure.

------------------------------------------------------------------------------
              this.labelFieldAdapter = access.getAdapter(clazz).getPropertyAdapter(labelField);
      }
  
+     public void addOptionGroup(String label, boolean disabled, List<T> options) {
+         List<OptionModel> optionModels = new ArrayList<OptionModel>();
+         if (labelFieldAdapter == null) {
+             for (T obj : options) {
+                 optionModels.add(new OptionModelImpl(nvl(obj), obj));
+             }
+         } else {
+             for (T obj : options) {
+                 optionModels.add(new OptionModelImpl(nvl(labelFieldAdapter.get(obj)), obj));
+             }
+         }
+ 
+         if (optionGroups == null) {
+             optionGroups = new ArrayList<OptionGroupModel>();
+         }
+ 
+         optionGroups.add(new OptionGroupModelImpl(label, disabled, optionModels, new String[0]));
+     }
+ 
      public List<OptionGroupModel> getOptionGroups() {
          return null;
      }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org