Ejemplo n.º 1
0
 public void setModel(BeanItemContainer<T> model) {
   AbstractSelect presentation = getPresentation();
   if (presentation != null) {
     presentation.setContainerDataSource(model);
   }
   this.model = model;
 }
Ejemplo n.º 2
0
 @SuppressWarnings("unchecked")
 public T[] getSelection() {
   AbstractSelect presentation = getPresentation();
   if (presentation != null) {
     Object value = presentation.getValue();
     if (value instanceof Collection<?>) {
       Collection<T> collection = (Collection<T>) value;
       selection = collection.toArray((T[]) Array.newInstance(beanType, collection.size()));
     } else {
       selection = (T[]) Array.newInstance(beanType, 1);
       selection[0] = (T) value;
     }
   }
   return selection;
 }
Ejemplo n.º 3
0
 @SafeVarargs
 public final void setSelection(T... selection) {
   AbstractSelect presentation = getPresentation();
   if (presentation != null) {
     switch (selection.length) {
       case 0:
         presentation.setValue(null);
         break;
       case 1:
         presentation.setValue(selection[0]);
         break;
       default:
         presentation.setValue(Arrays.asList(selection));
     }
   }
   this.selection = selection;
 }