public static String getLabel(PropertyAccessor accessor, TextProvider textProvider) { String label; if (accessor.isAnnotationPresent(LabelI18N.class)) { String text = accessor.getAnnotation(LabelI18N.class).value(); logger.debug("LabelI18N annotation present with value: {}", text); label = textProvider.getText(text); } else if (accessor.isAnnotationPresent(Label.class)) { String text = accessor.getAnnotation(Label.class).value(); logger.debug("Label annotation present with value: {}", text); label = textProvider.getText(text); } else { label = Util.guessToWords(accessor.getName()); logger.debug("Setting label from property name: {}", label); } return label; }
public static String getLabel(PropertyAccessor accessor, TextProvider textProvider) { String label; if (accessor.isAnnotationPresent(LabelI18N.class)) { String text = accessor.getAnnotation(LabelI18N.class).value(); logger.debug("LabelI18N annotation present with value: {}", text); label = textProvider.getText(text); } else if (accessor.isAnnotationPresent(Label.class)) { String text = accessor.getAnnotation(Label.class).value(); logger.debug("Label annotation present with value: {}", text); label = textProvider.getText(text); } else { label = Util.guessToWords(accessor.getName()); logger.debug("Setting label from property name: {}", label); } return label; }
protected void setupPropertyEdits() { if(classAccessor == null) { return; } PropertyAccessor[] propertyAccessors = classAccessor.getProperties(); propertyEdits = new CrudPropertyEdit[propertyAccessors.length]; for (int i = 0; i < propertyAccessors.length; i++) { CrudPropertyEdit edit = new CrudPropertyEdit(); PropertyAccessor propertyAccessor = propertyAccessors[i]; edit.name = propertyAccessor.getName(); com.manydesigns.elements.annotations.Label labelAnn = propertyAccessor.getAnnotation(com.manydesigns.elements.annotations.Label.class); edit.label = labelAnn != null ? labelAnn.value() : null; Enabled enabledAnn = propertyAccessor.getAnnotation(Enabled.class); edit.enabled = enabledAnn != null && enabledAnn.value(); InSummary inSummaryAnn = propertyAccessor.getAnnotation(InSummary.class); edit.inSummary = inSummaryAnn != null && inSummaryAnn.value(); Insertable insertableAnn = propertyAccessor.getAnnotation(Insertable.class); edit.insertable = insertableAnn != null && insertableAnn.value(); Updatable updatableAnn = propertyAccessor.getAnnotation(Updatable.class); edit.updatable = updatableAnn != null && updatableAnn.value(); Searchable searchableAnn = propertyAccessor.getAnnotation(Searchable.class); edit.searchable = searchableAnn != null && searchableAnn.value(); propertyEdits[i] = edit; } }