Search in sources :

Example 1 with SelectImpl

use of com.manydesigns.elements.annotations.impl.SelectImpl in project Portofino by ManyDesigns.

the class TablesAction method getApplicableAnnotations.

@NotNull
public MutableClassAccessor getApplicableAnnotations(Class type) {
    MutableClassAccessor classAccessor = new MutableClassAccessor();
    if (type == null) {
        return classAccessor;
    }
    if (Number.class.isAssignableFrom(type)) {
        classAccessor.addProperty(new MutablePropertyAccessor("fieldSize", Integer.class));
        classAccessor.addProperty(new MutablePropertyAccessor("minValue", BigDecimal.class));
        classAccessor.addProperty(new MutablePropertyAccessor("maxValue", BigDecimal.class));
        classAccessor.addProperty(new MutablePropertyAccessor("decimalFormat", String.class));
    } else if (String.class.equals(type)) {
        classAccessor.addProperty(new MutablePropertyAccessor("fieldSize", Integer.class));
        classAccessor.addProperty(new MutablePropertyAccessor("regexp", String.class));
        classAccessor.addProperty(new MutablePropertyAccessor("highlightLinks", Boolean.class));
        classAccessor.addProperty(new MutablePropertyAccessor("fileBlob", Boolean.class));
        SelectImpl select = new SelectImpl(DisplayMode.DROPDOWN, SearchDisplayMode.DROPDOWN, new String[] { EMAIL, PASSWORD, CAP, PARTITA_IVA, CODICE_FISCALE, PHONE, ENCRYPTED }, new String[] { "Email", "Password", "CAP/ZIP", "Partita IVA", "Codice Fiscale", "Phone", "Encrypted" }, true);
        classAccessor.addProperty(new MutablePropertyAccessor("stringFormat", String.class).configureAnnotation(select));
        select = new SelectImpl(DisplayMode.DROPDOWN, SearchDisplayMode.DROPDOWN, new String[] { MULTILINE, RICH_TEXT }, new String[] { "Multiline", "Rich text" }, true);
        classAccessor.addProperty(new MutablePropertyAccessor("typeOfContent", String.class).configureAnnotation(select));
    } else if (Date.class.isAssignableFrom(type)) {
        classAccessor.addProperty(new MutablePropertyAccessor("fieldSize", Integer.class));
        classAccessor.addProperty(new MutablePropertyAccessor("dateFormat", String.class));
    } else if (byte[].class.isAssignableFrom(type)) {
        classAccessor.addProperty(new MutablePropertyAccessor("databaseBlobContentTypeProperty", String.class));
        classAccessor.addProperty(new MutablePropertyAccessor("databaseBlobFileNameProperty", String.class));
        classAccessor.addProperty(new MutablePropertyAccessor("databaseBlobTimestampProperty", String.class));
    }
    return classAccessor;
}
Also used : BigInteger(java.math.BigInteger) SelectImpl(com.manydesigns.elements.annotations.impl.SelectImpl) MutablePropertyAccessor(com.manydesigns.elements.reflection.MutablePropertyAccessor) BigDecimal(java.math.BigDecimal) MutableClassAccessor(com.manydesigns.elements.reflection.MutableClassAccessor) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

SelectImpl (com.manydesigns.elements.annotations.impl.SelectImpl)1 MutableClassAccessor (com.manydesigns.elements.reflection.MutableClassAccessor)1 MutablePropertyAccessor (com.manydesigns.elements.reflection.MutablePropertyAccessor)1 BigDecimal (java.math.BigDecimal)1 BigInteger (java.math.BigInteger)1 NotNull (org.jetbrains.annotations.NotNull)1