ClaraBuilder { public Component createFrom(InputStream xml) { Binder binder = new Binder(idPrefix); LayoutInflater inflater = createInflater(); Component result = inflater.inflate(xml, binder .getAlreadyAssignedFields(controller), componentProviders .toArray(new ComponentProvider[componentProviders.size()])); binder.bind(result, controller); return result; } ClaraBuilder(); ClaraBuilder withController(Object controller); Object getController(); ClaraBuilder withIdPrefix(String idPrefix); String getIdPrefix(); ClaraBuilder withAttributeFilter(AttributeFilter filter); ClaraBuilder withAttributeFilters(AttributeFilter... filters); ClaraBuilder withComponentProvider(ComponentProvider provider); ClaraBuilder withComponentProviders(ComponentProvider... providers); ClaraBuilder withComponentProviders(List<ComponentProvider> providers); List<AttributeFilter> getAttributeFilters(); ClaraBuilder withAttributeParser(AttributeParser parser); ClaraBuilder withAttributeParsers(AttributeParser... parsers); List<AttributeParser> getAttributeParsers(); Component createFrom(InputStream xml); Component createFrom(String xmlClassResourceFileName);  }
@Test public void inflaterListener_componentReuse() { VerticalLayout layout = (VerticalLayout) Clara.build().createFrom( "/org/vaadin/teemu/clara/component-reuse.xml"); assertEquals(2, layout.getComponentCount()); assertCustomComponentInflaterListener("custom1", (CustomComponentInflaterListener) layout.getComponent(0)); assertCustomComponentInflaterListener("custom2", (CustomComponentInflaterListener) layout.getComponent(1)); }
@Test public void create_noIdPrefix_prefixOnAllComponentsWithId() { VerticalLayout layout = (VerticalLayout) Clara.build().createFrom( getXml("hierarchy-with-ids.xml")); assertHierarchyWithIds("", layout); }