List of usage examples for com.vaadin.ui.declarative Design write
private static void write(Document doc, OutputStream outputStream) throws IOException
From source file:org.lucidj.vaadin.VaadinSerializer.java
License:Apache License
@Override // Serializer public boolean serializeObject(SerializerInstance instance, Object object) { try {/*from ww w .jav a2 s .c o m*/ ByteArrayOutputStream baos = new ByteArrayOutputStream(); // TODO: BETTER WAY TO SET COMPONENT FACTORY Design.setComponentFactory(vcf); Design.write((Component) object, baos); instance.setValue(baos.toString("UTF-8")); instance.setObjectClass(Vaadin.class); return (true); } catch (Exception e) { log.error("Exception serializing object", e); return (false); } }
From source file:org.vaadin.artur.declarative.DeclarativeEditor.java
License:Apache License
protected void updateCode() { if (disableEvents) { return;//from ww w . ja v a2 s. co m } ByteArrayOutputStream o = new ByteArrayOutputStream(); try { Design.write(treeHolder.getComponent(0), o); disableEvents = true; editor.setValue(o.toString("UTF-8")); disableEvents = false; } catch (IOException e1) { e1.printStackTrace(); } }