diff options
author | Artur Signell <artur@vaadin.com> | 2015-05-22 20:38:35 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-05-28 14:04:46 +0000 |
commit | 9f6cfbce67583dd5c5133d1de5c1fedc58916de0 (patch) | |
tree | 9f1db3f95039a0ee5f4d03f0742b2b4f6e27300d /server | |
parent | fdd6a9d9d00fbb0e94c96226744deab563b1cd63 (diff) | |
download | vaadin-framework-9f6cfbce67583dd5c5133d1de5c1fedc58916de0.tar.gz vaadin-framework-9f6cfbce67583dd5c5133d1de5c1fedc58916de0.zip |
Show declarative output for component selected in debug window (#17960)
Change-Id: I975eef2f06db4395925f76e40c044078028b0e66
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/ui/UI.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index 8dd600ddd0..b16d7e32d3 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -16,6 +16,8 @@ package com.vaadin.ui; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.net.URI; import java.util.ArrayList; import java.util.Collection; @@ -67,6 +69,7 @@ import com.vaadin.shared.ui.ui.UIConstants; import com.vaadin.shared.ui.ui.UIServerRpc; import com.vaadin.shared.ui.ui.UIState; import com.vaadin.ui.Component.Focusable; +import com.vaadin.ui.declarative.Design; import com.vaadin.util.ConnectorHelper; import com.vaadin.util.CurrentInstance; @@ -211,6 +214,32 @@ public abstract class UI extends AbstractSingleComponentContainer implements json.toString()); } + @Override + public void showServerDesign(Connector connector) { + if (!(connector instanceof Component)) { + getLogger().severe( + "Tried to output declarative design for " + connector + + ", which is not a component"); + return; + } + if (connector instanceof UI) { + // We want to see the content of the UI, so we can add it to + // another UI or component container + connector = ((UI) connector).getContent(); + } + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try { + Design.write((Component) connector, baos); + getLogger().info( + "Design for " + connector + + " requested from debug window:\n" + + baos.toString("UTF-8")); + } catch (IOException e) { + getLogger().log(Level.WARNING, + "Error producing design for " + connector, e); + } + + } }; /** |