Package com.dooapp.fxform.model.impl

Examples of com.dooapp.fxform.model.impl.ReadOnlyPropertyFieldElement


            }
        }
        if (Property.class.isAssignableFrom(field.getType())) {
            element = new PropertyFieldElement(field);
        } else if (ReadOnlyProperty.class.isAssignableFrom(field.getType())) {
            element = new ReadOnlyPropertyFieldElement(field);
        }
        return element;
    }
View Full Code Here


    public Element create(Field field) throws FormException {
        Element element = null;
        if (Property.class.isAssignableFrom(field.getType())) {
            element = new PropertyFieldElement(field);
        } else if (ReadOnlyProperty.class.isAssignableFrom(field.getType())) {
            element = new ReadOnlyPropertyFieldElement(field);
        }
        return element;
    }
View Full Code Here

            }
        } else {
            if (Property.class.isAssignableFrom(field.getType())) {
                element = new PropertyFieldElement(field);
            } else if (ReadOnlyProperty.class.isAssignableFrom(field.getType())) {
                element = new ReadOnlyPropertyFieldElement(field);
            }
        }
        return element;
    }
View Full Code Here

    public static List<Element> getTestFields() {
        List<Field> fields = new ReflectionFieldProvider().getProperties(new TestBean());
        List<Element> elements = new LinkedList<Element>();
        for (Field field: fields) {
            try {
                elements.add(new ReadOnlyPropertyFieldElement(field));
            } catch (FormException e) {
                e.printStackTrace();
            }
        }
        return elements;
View Full Code Here

        ReflectionFieldProvider reflectionFieldProvider = new ReflectionFieldProvider();
        TestBean testBean = new TestBean();
        List<Field> fields = reflectionFieldProvider.getProperties(testBean);
        List<Element> elements = new LinkedList<Element>();
        for (Field field: fields) {
            elements.add(new ReadOnlyPropertyFieldElement(field));
        }
        Assert.assertEquals(5, fields.size());
        Assert.assertTrue(TestUtils.containsNamedField("stringProperty", elements));
        Assert.assertTrue(TestUtils.containsNamedField("booleanProperty", elements));
        Assert.assertTrue(TestUtils.containsNamedField("integerProperty", elements));
View Full Code Here

            }
        } else {
            if (Property.class.isAssignableFrom(field.getType())) {
                element = new PropertyFieldElement(field);
            } else if (ReadOnlyProperty.class.isAssignableFrom(field.getType())) {
                element = new ReadOnlyPropertyFieldElement(field);
            }
        }
        return element;
    }
View Full Code Here

            Element element = null;
            if (Property.class.isAssignableFrom(field.getType())) {
                element = new PropertyFieldElement(field);
                ((PropertyFieldElement) element).sourceProperty().bind(source);
            } else if (ReadOnlyPropertyFieldElement.class.isAssignableFrom(field.getType())) {
                element = new ReadOnlyPropertyFieldElement(field);
                ((ReadOnlyPropertyFieldElement) element).sourceProperty().bind(source);
            }
            if (element != null) {
                elements.add(element);
            }
View Full Code Here

     *
     * @param element
     * @return
     */
    public Callback<Void, FXFormNode> getFactory(Element element) {
        ReadOnlyPropertyFieldElement property = ((ReadOnlyPropertyFieldElement) element);
        // check field annotation
        if (property.getField().getAnnotation(FormFactory.class) != null) {
            // use factory provided by the annotation
            try {
                return property.getField().getAnnotation(FormFactory.class).value().newInstance();
            } catch (Exception e) {
               logger.log(Level.WARNING, "Unable to get new instance for " + property.getField().getAnnotation(FormFactory.class), e);
            }
        }
        // check FormFactory annotation
        if (ObjectProperty.class.isAssignableFrom(property.getField().getType())) {
            try {
                Class genericClass = property.getGenericType();
                if (genericClass.getAnnotation(FormFactory.class) != null) {
                    return ((FormFactory) genericClass.getAnnotation(FormFactory.class)).value().newInstance();
                }
            } catch (Exception e) {
                // ignore
View Full Code Here

            }
        }
        if (Property.class.isAssignableFrom(field.getType())) {
            element = new PropertyFieldElement(field);
        } else if (ReadOnlyProperty.class.isAssignableFrom(field.getType())) {
            element = new ReadOnlyPropertyFieldElement(field);
        }
        return element;
    }
View Full Code Here

TOP

Related Classes of com.dooapp.fxform.model.impl.ReadOnlyPropertyFieldElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.