Package com.dooapp.fxform.model

Examples of com.dooapp.fxform.model.Element


*/
public class UtilTest {
    @Test
    public void testGetObjectPropertyGeneric() throws Exception {
        List<Element> fields = TestUtils.getTestFields();
        Element objectPropertyField = fields.get(4);
        Class clazz = ReflectionUtils.getObjectPropertyGeneric(null, ((ReadOnlyPropertyFieldElement) objectPropertyField).getField());
        Assert.assertEquals(TestEnum.class, clazz);
    }
View Full Code Here


    }

    @Test
    public void testElementFactory() throws NoSuchFieldException, FormException {
        PropertyElementFactory tested = new PropertyElementFactory();
        Element methodElement = tested.create(MethodTestBean.class.getDeclaredField("name"));
        Element fieldElement = tested.create(FieldTestBean.class.getDeclaredField("name"));
        Assert.assertEquals(PropertyMethodElement.class, methodElement.getClass());
        Assert.assertEquals(PropertyFieldElement.class, fieldElement.getClass());
    }
View Full Code Here

  public AbstractNameFilter(String[] names) {
    this.names = names;
  }

  protected Element extractFieldByName(List<Element> remaining, String name) throws FilterException {
    Element element = getFieldByName(remaining, name);
    remaining.remove(element);
    return element;
  }
View Full Code Here

        List<Element> list = new LinkedList<Element>();
        for (String name : getNames()) {
            if (name.startsWith("-")) {
                category = name;
            } else {
                Element element = extractFieldByName(remaining, name);
                element.setCategory(category);
                list.add(element);
            }
        }
        list.addAll(remaining);
        return list;
View Full Code Here

    public AbstractNameFilter(String[] names) {
        this.names = names;
    }

    protected Element extractFieldByName(List<Element> remaining, String name) throws FilterException {
        Element element = getFieldByName(remaining, name);
        remaining.remove(element);
        return element;
    }
View Full Code Here

        List<Element> list = new LinkedList<Element>();
        for (String name : getNames()) {
            if (name.startsWith("-")) {
                category = name;
            } else {
                Element element = extractFieldByName(remaining, name);
                element.setCategory(category);
                list.add(element);
            }
        }
        list.addAll(remaining);
        return list;
View Full Code Here

            return;
        controllers.clear();
        List<Field> fields = new ReflectionFieldProvider().getProperties(source.get());
        List<Element> elements = new LinkedList<Element>();
        for (Field field : fields) {
            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);
            }
        }
        for (FieldFilter filter : filters) {
            try {
                elements = filter.filter(elements);
            } catch (FilterException e) {
                throw new FormException("Something went wrong happened while applying " + filter + ":\n" + e.getMessage(), e);
            }
        }
        for (Element element : elements) {
            ElementController controller = null;
            if (PropertyFieldElement.class.isAssignableFrom(element.getClass())) {
                controller = new PropertyElementController(this, (PropertyElement) element);
            } else {
                controller = new ElementController(this, element);
            }
            if (controller != null) {
View Full Code Here

    public AbstractNameFilter(String[] names) {
        this.names = names;
    }

    protected Element extractFieldByName(List<Element> remaining, String name) throws FilterException {
        Element element = getFieldByName(remaining, name);
        remaining.remove(element);
        return element;
    }
View Full Code Here

TOP

Related Classes of com.dooapp.fxform.model.Element

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.