protected T read(String design) {
   try {
     return (T) Design.read(new ByteArrayInputStream(design.getBytes("UTF-8")));
   } catch (UnsupportedEncodingException e) {
     throw new RuntimeException(e);
   }
 }
示例#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);
  }
示例#3
0
 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);
 }
示例#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);
 }
示例#8
0
 @Before
 public void setUp() throws Exception {
   ctx =
       Design.read(
           new FileInputStream("server/tests/src/com/vaadin/tests/design/testFile.html"), null);
 }
示例#9
0
  private ByteArrayOutputStream serializeDesign(DesignContext context) throws IOException {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    Design.write(context, out);

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