protected T read(String design) { try { return (T) Design.read(new ByteArrayInputStream(design.getBytes("UTF-8"))); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
@Test(expected = DesignException.class) public void fieldsCannotBeBoundToAnInvalidTemplate() throws IOException { InvalidLayoutTemplate template = new InvalidLayoutTemplate(); InputStream htmlFile = new FileInputStream("server/tests/src/com/vaadin/tests/design/testFile.html"); Design.read(htmlFile, template); }
public TaskOptionLayout(Task task) { Design.read(this); Responsive.makeResponsive(this); scheduleStartDate.setResolution(Resolution.MINUTE); scheduleEndDate.setResolution(Resolution.MINUTE); setDefaultScheduler(task); binder.setItemDataSource(task); binder.bind(scheduleStartDate, "scheduleStartDate"); binder.bind(scheduleEndDate, "scheduleEndDate"); binder.setBuffered(true); }
@Test public void fieldsAreBoundToATemplate() throws IOException { LayoutTemplate template = new LayoutTemplate(); InputStream htmlFile = new FileInputStream("server/tests/src/com/vaadin/tests/design/testFile.html"); Design.read(htmlFile, template); assertNotNull(template.getFirstButton()); assertNotNull(template.getSecondButton()); assertNotNull(template.getYetanotherbutton()); assertNotNull(template.getClickme()); assertEquals("Native click me", template.getFirstButton().getCaption()); }
public Design() { com.vaadin.ui.declarative.Design.read(this); }
public MatchDesign() { Design.read(this); }
@Before public void setUp() throws Exception { ctx = Design.read( new FileInputStream("server/tests/src/com/vaadin/tests/design/testFile.html"), null); }
private DesignContext deSerializeDesign(ByteArrayOutputStream out) { ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); return Design.read(in, null); }
public SalesOverviewDesign() { Design.read(this); }