public void setThumbnailUrl(String thumbnailUrl) {
   ListField photo = getListFieldWithType(THUMBNAIL_PHOTO_TYPE, getPhotos());
   if (photo != null) {
     photo.setValue(thumbnailUrl);
   } else {
     if (thumbnailUrl != null) {
       setPhotos(addListField(new ListFieldImpl(THUMBNAIL_PHOTO_TYPE, thumbnailUrl), getPhotos()));
     }
   }
 }
 @Override
 public void setDataSource(final DataSource datasource) {
   super.setDataSource(datasource);
   final Criterion levelcriterion =
       new Criterion(MillerTreeView.LEVEL, OperatorId.EQUALS, level);
   if (level != 0) {
     final Criterion parentcriterion =
         new Criterion(MillerTreeView.PARENT_ID, OperatorId.EQUALS, 0);
     levelcriterion.addCriteria(parentcriterion);
   }
   filterData(levelcriterion);
   final ArrayList<ListGridField> newfields = new ArrayList<ListGridField>();
   for (final ListField field : ListField.values()) {
     final ListGridField newfield = new ListGridField(field.toString());
     newfield.setTitle(Integer.toString(level));
     newfield.setAlign(Alignment.LEFT);
     hideField(field.toString());
     newfields.add(newfield);
   }
   setFields(newfields.toArray(new ListGridField[0]));
 }
 public String getThumbnailUrl() {
   ListField photo = getListFieldWithType(THUMBNAIL_PHOTO_TYPE, getPhotos());
   return photo == null ? null : photo.getValue();
 }
Exemple #4
0
 /**
  * Returns true if the specified field is optional.
  *
  * @param field to check
  * @return true if optional
  */
 public static boolean isOptionalField(@NotNull Field field) {
   ResourceField rf = field.getAnnotation(ResourceField.class);
   ListField lf = field.getAnnotation(ListField.class);
   PrimaryKey pk = field.getAnnotation(PrimaryKey.class);
   return (rf != null && rf.value()) || (lf != null && lf.optional()) || (pk != null);
 }