protected T read(String design) {
   try {
     return (T) Design.read(new ByteArrayInputStream(design.getBytes("UTF-8")));
   } catch (UnsupportedEncodingException e) {
     throw new RuntimeException(e);
   }
 }
Exemple #2
0
  @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);
 }
Exemple #4
0
 @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());
 }
  protected String write(T object, boolean writeData) {
    try {
      ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

      DesignContext dc = new DesignContext();
      if (writeData) {
        dc.setShouldWriteDataDelegate(DeclarativeTestBaseBase.ALWAYS_WRITE_DATA);
      }
      dc.setRootComponent(object);
      Design.write(dc, outputStream);
      return outputStream.toString("UTF-8");
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
 public Design() {
   com.vaadin.ui.declarative.Design.read(this);
 }
 public MatchDesign() {
   Design.read(this);
 }
Exemple #8
0
 @Before
 public void setUp() throws Exception {
   ctx =
       Design.read(
           new FileInputStream("server/tests/src/com/vaadin/tests/design/testFile.html"), null);
 }
Exemple #9
0
  private ByteArrayOutputStream serializeDesign(DesignContext context) throws IOException {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    Design.write(context, out);

    return out;
  }
Exemple #10
0
 private DesignContext deSerializeDesign(ByteArrayOutputStream out) {
   ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
   return Design.read(in, null);
 }
 public SalesOverviewDesign() {
   Design.read(this);
 }